Package org.apache.ivy.osgi.core

Examples of org.apache.ivy.osgi.core.BundleInfo


        handler.startElement("", RepositoryHandler.REPOSITORY, RepositoryHandler.REPOSITORY, atts);
        int nbOk = 0;
        int nbRejected = 0;
        while (it.hasNext()) {
            ManifestAndLocation manifestAndLocation = (ManifestAndLocation) it.next();
            BundleInfo bundleInfo;
            try {
                bundleInfo = ManifestParser.parseManifest(manifestAndLocation.getManifest());
                bundleInfo.setUri(manifestAndLocation.getUri());
                nbOk++;
            } catch (ParseException e) {
                nbRejected++;
                IvyContext
                        .getContext()
View Full Code Here


            throws SAXException {
        handler.startDocument();
        AttributesImpl atts = new AttributesImpl();
        handler.startElement("", RepositoryHandler.REPOSITORY, RepositoryHandler.REPOSITORY, atts);
        while (it.hasNext()) {
            BundleInfo bundleInfo = (BundleInfo) it.next();
            saxBundleInfo(bundleInfo, handler);
        }
        handler.endElement("", RepositoryHandler.REPOSITORY, RepositoryHandler.REPOSITORY);
        handler.endDocument();
    }
View Full Code Here

    public void populate(Iterator/* <ManifestAndLocation> */it) {
        while (it.hasNext()) {
            ManifestAndLocation manifestAndLocation = (ManifestAndLocation) it.next();
            try {
                BundleInfo bundleInfo = ManifestParser.parseManifest(manifestAndLocation
                        .getManifest());
                bundleInfo.setUri(manifestAndLocation.getUri());
                addBundle(bundleInfo);
            } catch (ParseException e) {
                Message.error("Rejected " + manifestAndLocation.getUri() + ": " + e.getMessage());
            }
        }
View Full Code Here

import org.apache.ivy.osgi.util.VersionRange;

public class PluginAdapter {

    public static BundleInfo featureAsBundle(URI baseUri, EclipseFeature feature) {
        BundleInfo b = new BundleInfo(feature.getId(), feature.getVersion());

        if (feature.getUrl() == null) {
            b.setUri(baseUri.resolve("features/" + feature.getId() + '_' + feature.getVersion()
                    + ".jar"));
        } else {
            b.setUri(baseUri.resolve(feature.getUrl()));
        }

        b.setDescription(feature.getDescription());
        b.setLicense(feature.getLicense());

        Iterator itPlugins = feature.getPlugins().iterator();
        while (itPlugins.hasNext()) {
            EclipsePlugin plugin = (EclipsePlugin) itPlugins.next();
            BundleRequirement r = new BundleRequirement(BundleInfo.BUNDLE_TYPE, plugin.getId(),
                    new VersionRange(plugin.getVersion()), null);
            b.addRequirement(r);
        }

        Iterator itRequires = feature.getRequires().iterator();
        while (itRequires.hasNext()) {
            Require require = (Require) itRequires.next();
            String id;
            if (require.getPlugin() != null) {
                id = require.getPlugin();
            } else {
                id = require.getFeature();
            }
            VersionRange range;
            if (require.getMatch().equals("greaterOrEqual")) {
                range = new VersionRange(require.getVersion());
            } else {
                throw new IllegalStateException("unsupported match " + require.getMatch());
            }
            BundleRequirement r = new BundleRequirement(BundleInfo.BUNDLE_TYPE, id, range, null);
            b.addRequirement(r);
        }

        return b;
    }
View Full Code Here

        return b;
    }

    public static BundleInfo pluginAsBundle(URI baseUri, EclipsePlugin plugin) {
        BundleInfo b = new BundleInfo(plugin.getId(), plugin.getVersion());

        b.setUri(baseUri.resolve("plugins/" + plugin.getId() + '_' + plugin.getVersion() + ".jar"));

        return b;
    }
View Full Code Here

        public UnitsHandler() {
            super(UNITS);
            addChild(new UnitHandler(), new ChildElementHandler() {
                public void childHanlded(DelegetingHandler child) {
                    BundleInfo bundleInfo = ((UnitHandler) child).bundleInfo;
                    if (!bundleInfo.getCapabilities().isEmpty()) {
                        bundles.add(((UnitHandler) child).bundleInfo);
                    }
                }
            });
        }
View Full Code Here

        protected void handleAttributes(Attributes atts) throws SAXException {
            String id = atts.getValue(ID);
            String version = atts.getValue(VERSION);
            // Boolean singleton = Boolean.valueOf(atts.getValue(SINGLETON));
            try {
                bundleInfo = new BundleInfo(id, new Version(version));
            } catch (ParseException e) {
                throw new SAXException("Incorrect version on bundle '" + id + "': " + version
                        + " (" + e.getMessage() + ")");
            }
        }
View Full Code Here

    private void genericTestResolve(String jarName, String conf, ModuleRevisionId[] expectedMrids,
            ModuleRevisionId[] expected2Mrids) throws Exception {
        JarInputStream in = new JarInputStream(new FileInputStream("test/test-repo/bundlerepo/"
                + jarName));
        BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
        bundleInfo.setUri(new File("test/test-repo/bundlerepo/" + jarName).toURI());
        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
            OSGiManifestParser.getInstance(), null, bundleInfo, null);
        ResolveReport resolveReport = ivy.resolve(md,
            new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
        assertFalse("resolve failed " + resolveReport.getAllProblemMessages(),
View Full Code Here

    }

    private void genericTestFailingResolve(String jarName, String conf) throws Exception {
        JarInputStream in = new JarInputStream(new FileInputStream("test/test-repo/bundlerepo/"
                + jarName));
        BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
        bundleInfo.setUri(new File("test/test-repo/bundlerepo/" + jarName).toURI());
        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
            OSGiManifestParser.getInstance(), null, bundleInfo, null);
        ResolveReport resolveReport = ivy.resolve(md,
            new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
        assertTrue(resolveReport.hasError());
View Full Code Here

TOP

Related Classes of org.apache.ivy.osgi.core.BundleInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.