Examples of BundleInfo


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

        // not found in the regular bundle. Let's look up in the source ones
        Map<Version, BundleInfo> byVersion = sourceBundles.get(id);
        if (byVersion == null) {
            return;
        }
        BundleInfo source = byVersion.get(version);
        if (source == null) {
            return;
        }
        addArtifact(source, new BundleArtifact(true, uri, format));
    }
View Full Code Here

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

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

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

                        return;
                    }
                    if (child.manifest != null) {
                        // Eclipse may have serialized a little bit weirdly
                        String manifest = ManifestParser.formatLines(child.manifest.trim());
                        BundleInfo embeddedInfo;
                        try {
                            embeddedInfo = ManifestParser.parseManifest(manifest);
                        } catch (IOException e) {
                            if (logLevel >= Message.MSG_VERBOSE) {
                                Message.verbose(
                                    "The Manifest of the source bundle "
                                            + bundleInfo.getSymbolicName() + " could not be parsed",
                                    e);
                            }
                            return;
                        } catch (ParseException e) {
                            if (logLevel >= Message.MSG_VERBOSE) {
                                Message.verbose(
                                    "The Manifest of the source bundle "
                                            + bundleInfo.getSymbolicName() + " is ill formed", e);
                            }
                            return;
                        }
                        if (!embeddedInfo.isSource()) {
                            if (logLevel >= Message.MSG_VERBOSE) {
                                Message.verbose("The Manifest of the source bundle "
                                        + bundleInfo.getSymbolicName()
                                        + " is not declaring being a source.");
                            }
                            return;
                        }
                        String symbolicNameTarget = embeddedInfo.getSymbolicNameTarget();
                        if (symbolicNameTarget == null) {
                            if (logLevel >= Message.MSG_VERBOSE) {
                                Message.verbose("The Manifest of the source bundle "
                                        + bundleInfo.getSymbolicName()
                                        + " is not declaring a target symbolic name.");
                            }
                            return;
                        }
                        Version versionTarget = embeddedInfo.getVersionTarget();
                        if (versionTarget == null) {
                            if (logLevel >= Message.MSG_VERBOSE) {
                                Message.verbose("The Manifest of the source bundle "
                                        + bundleInfo.getSymbolicName()
                                        + " is not declaring a target version.");
View Full Code Here

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

        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

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

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());

        URI uri;
        if (feature.getUrl() == null) {
            uri = baseUri.resolve("features/" + feature.getId() + '_' + feature.getVersion()
                    + ".jar");
        } else {
            uri = baseUri.resolve(feature.getUrl());
        }
        b.addArtifact(new BundleArtifact(false, uri, null));

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

        for (EclipsePlugin plugin : feature.getPlugins()) {
            BundleRequirement r = new BundleRequirement(BundleInfo.BUNDLE_TYPE, plugin.getId(),
                    new VersionRange(plugin.getVersion()), null);
            b.addRequirement(r);
        }

        for (Require require : feature.getRequires()) {
            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

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

        return b;
    }

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

        URI uri = baseUri.resolve("plugins/" + plugin.getId() + '_' + plugin.getVersion() + ".jar");
        b.addArtifact(new BundleArtifact(false, uri, null));

        return b;
    }
View Full Code Here

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

    private IAccessRule[] getAccessRules(IPath artifact) {
        if (!osgiAvailable || !classpathSetup.isReadOSGiMetadata()) {
            return null;
        }
        BundleInfo bundleInfo;
        FileInputStream jar = null;
        try {
            jar = new FileInputStream(artifact.toFile());
            bundleInfo = ManifestParser.parseJarManifest(jar);
        } catch (IOException e) {
            IvyDEMessage.warn("OSGi metadata could not be extracted from " + artifact + ": "
                    + e.getMessage() + " (" + e.getClass().getName() + ")");
            return null;
        } catch (ParseException e) {
            IvyDEMessage.warn("OSGi metadata could not be extracted from " + artifact + ": "
                    + e.getMessage() + " (" + e.getClass().getName() + ")");
            return null;
        } finally {
            if (jar != null) {
                try {
                    jar.close();
                } catch (IOException e) {
                    // don't care
                }
            }
        }
        IAccessRule[] rules = new IAccessRule[bundleInfo.getExports().size() + 1];
        int i = 0;
        Iterator itExports = bundleInfo.getExports().iterator();
        while (itExports.hasNext()) {
            ExportPackage exportPackage = (ExportPackage) itExports.next();
            rules[i++] = JavaCore.newAccessRule(
                new Path(exportPackage.getName().replace('.', IPath.SEPARATOR) + "/*"),
                IAccessRule.K_ACCESSIBLE);
View Full Code Here

Examples of org.apache.karaf.bundle.core.BundleInfo

            Bundle[] bundles = bundleContext.getBundles();

            for (int i = 0; i < bundles.length; i++) {
                try {
                    Bundle bundle = bundles[i];
                    BundleInfo info = bundleService.getInfo(bundle);
                    String bundleStateString = info.getState().toString();
                    CompositeData data = new CompositeDataSupport(bundleType,
                            new String[]{"ID", "Name", "Version", "Start Level", "State"},
                            new Object[]{info.getBundleId(), info.getSymbolicName(), info.getVersion(), info.getStartLevel(), bundleStateString});
                    table.put(data);
                } catch (Exception e) {
                    LOG.error(e.getMessage(), e);
                }
            }
View Full Code Here

Examples of org.apache.karaf.bundle.core.BundleInfo

        super(true);
    }

    protected void doExecute(List<Bundle> bundles) throws Exception {
        for (Bundle bundle : bundles) {
            BundleInfo info = bundleService.getInfo(bundle);
            if (info.getState() == BundleState.Failure || info.getState() == BundleState.Waiting
                || info.getState() == BundleState.GracePeriod || info.getState() == BundleState.Installed) {
                String title = ShellUtil.getBundleName(bundle);
                System.out.println(title);
                System.out.println(ShellUtil.getUnderlineString(title));
                System.out.println("Status: " + info.getState().toString());
                System.out.println(this.bundleService.getDiag(bundle));
                System.out.println();
            }
        }
    }
View Full Code Here

Examples of org.apache.karaf.bundle.core.BundleInfo

        table.column("Version");
        table.column(getNameHeader());
       
        for (int i = 0; i < bundles.length; i++) {
            Bundle bundle = bundles[i];
            BundleInfo info = this.bundleService.getInfo(bundle);
            if (info.getStartLevel() >= bundleLevelThreshold) {
                String name = getNameToShow(info) + printFragments(info) + printHosts(info);
                String version = info.getVersion();
                table.addRow().addContent(info.getBundleId(), getStateString(info.getState()),
                        info.getStartLevel(), version, name);
            }
        }
        table.print(System.out, !noFormat);

        return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.