Package org.apache.ivy.osgi.core

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


    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.addArtifact(new BundleArtifact(false, new File("test/test-repo/bundlerepo/"
                + jarName).toURI(), null));
        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
            OSGiManifestParser.getInstance(), null, bundleInfo, profileProvider);
        ResolveReport resolveReport = ivy.resolve(md,
            new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
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.addArtifact(new BundleArtifact(false, new File("test/test-repo/bundlerepo/"
                + jarName).toURI(), null));
        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
            OSGiManifestParser.getInstance(), null, bundleInfo, profileProvider);
        ResolveReport resolveReport = ivy.resolve(md,
            new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
View Full Code Here

    public void testWriteWithSource() throws Exception {
        List<BundleInfo> bundles = new ArrayList<BundleInfo>();

        BundleInfo bundle = new BundleInfo(BUNDLE_1, BUNDLE_VERSION);
        bundle.addArtifact(new BundleArtifact(false, new URI("file:///test.jar"), null));
        bundle.addArtifact(new BundleArtifact(true, new URI("file:///test-sources.jar"), null));
        bundles.add(bundle);

        bundle = new BundleInfo(BUNDLE_2, BUNDLE_VERSION);
        bundle.addArtifact(new BundleArtifact(false, new URI("file:///test2.jar"), null));
        bundles.add(bundle);

        new File("build/test-files").mkdirs();
        File obrFile = new File("build/test-files/obr-sources.xml");
        FileOutputStream out = new FileOutputStream(obrFile);
View Full Code Here

        for (ManifestAndLocation manifestAndLocation : manifestAndLocations) {
            BundleInfo bundleInfo;
            try {
                bundleInfo = ManifestParser.parseManifest(manifestAndLocation.getManifest());
                bundleInfo
                        .addArtifact(new BundleArtifact(false, manifestAndLocation.getUri(), null));
                if (manifestAndLocation.getSourceURI() != null) {
                    bundleInfo.addArtifact(new BundleArtifact(true, manifestAndLocation
                            .getSourceURI(), null));
                }
                nbOk++;
            } catch (ParseException e) {
                nbRejected++;
View Full Code Here

                            "A source uri is suspect, it is not ending with .jar, it is probably"
                                    + " a pointer to a download page. Ignoring it.");
                        return;
                    }
                    try {
                        bundleInfo.addArtifact(new BundleArtifact(true, new URI(uri), null));
                    } catch (URISyntaxException e) {
                        log(Message.MSG_WARN, "Incorrect uri " + uri + ". The source of "
                                + bundleInfo.getSymbolicName() + " is then ignored.");
                        return;
                    }
View Full Code Here

            bundleInfo = new BundleInfo(symbolicname, version);
            bundleInfo.setPresentationName(atts.getValue(PRESENTATION_NAME));
            String uri = atts.getValue(URI);
            if (uri != null) {
                try {
                    bundleInfo.addArtifact(new BundleArtifact(false, new URI(uri), null));
                } catch (URISyntaxException e) {
                    log(Message.MSG_ERR, "Incorrect uri " + uri + ". The resource " + symbolicname
                            + " is then ignored.");
                    skip();
                    return;
View Full Code Here

            // we only support OSGi bundle, no Eclipse feature or anything else
            return;
        }
        ModuleDescriptorWrapper module = findModule(id, version);
        if (module != null) {
            addArtifact(module.getBundleInfo(), new BundleArtifact(false, uri, format));
            return;
        }

        // 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

        addArtifact(source, new BundleArtifact(true, uri, format));
    }

    private void addArtifact(BundleInfo bundle, BundleArtifact artifact) {
        // find an existing artifact that might be a duplicate
        BundleArtifact same = null;
        for (BundleArtifact a : bundle.getArtifacts()) {
            if (a.isSource() == artifact.isSource()) {
                same = a;
                break;
            }
        }

        BundleArtifact best = artifact;

        if (same != null) {
            // we have two artifacts for the same bundle, let's choose a "packed" one
            if (artifact.getFormat() == null || same.getFormat() != null) {
                // the new one cannot be better
View Full Code Here

            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

            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()) {
View Full Code Here

TOP

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

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.