Package org.apache.ivy.osgi.core

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


    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

    private static final String BUNDLE_2 = "org.apache.ivy.test2";

    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

        AttributesImpl atts = new AttributesImpl();
        handler.startElement("", RepositoryHandler.REPOSITORY, RepositoryHandler.REPOSITORY, atts);
        int nbOk = 0;
        int nbRejected = 0;
        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

                        + symbolicname + " is then ignored.");
                skip();
                return;
            }

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

            throw new BuildException("the manifest file '" + manifest + "' was not found", e);
        } catch (IOException e) {
            throw new BuildException("the manifest file '" + manifest + "' could not be read", e);
        }

        BundleInfo bundleInfo;
        try {
            bundleInfo = ManifestParser.parseManifest(m);
        } catch (ParseException e) {
            throw new BuildException("Incorrect manifest file '" + manifest + "'", e);
        }
View Full Code Here

        File manifest = new File(f, "META-INF/MANIFEST.MF");
        if (!manifest.exists()) {
            path.createPathElement().setLocation(f);
            return;
        }
        BundleInfo bundleInfo = ManifestParser.parseManifest(manifest);
        List/* <String> */cp = bundleInfo.getClasspath();
        if (cp == null) {
            path.createPathElement().setLocation(f);
            return;
        }
        for (int i = 0; i < cp.size(); i++) {
View Full Code Here

                    .getSymbolicNameTarget());
            if (byTargetVersion == null) {
                byTargetVersion = new HashMap<Version, BundleInfo>();
                sourceTargetBundles.put(bundleInfo.getSymbolicNameTarget(), byTargetVersion);
            }
            BundleInfo old = byTargetVersion.put(bundleInfo.getVersionTarget(), bundleInfo);
            if (old != null && !old.equals(bundleInfo)) {
                if (getLogLevel() <= Message.MSG_VERBOSE) {
                    Message.verbose("Duplicate source for the bundle "
                            + bundleInfo.getSymbolicNameTarget() + "@"
                            + bundleInfo.getVersionTarget() + " : " + bundleInfo + " is replacing "
                            + old);
View Full Code Here

                String symbolicName = mdw.getBundleInfo().getSymbolicName();
                Map<Version, BundleInfo> byVersion = sourceTargetBundles.get(symbolicName);
                if (byVersion == null) {
                    continue;
                }
                BundleInfo source = byVersion.get(mdw.getBundleInfo().getVersion());
                if (source == null) {
                    continue;
                }
                for (BundleArtifact artifact : source.getArtifacts()) {
                    mdw.getBundleInfo().addArtifact(artifact);
                }
            }
        }
        sourceTargetBundles = null;
View Full Code Here

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

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.