Package org.apache.felix.sigil.common.repository

Examples of org.apache.felix.sigil.common.repository.IResolution


        Log.verbose("searching for " + bundle);

        try
        {
            IResolution resolution = resolveOrFail(bundle, false);
            ISigilBundle[] bundles = resolution.getBundles().toArray(new ISigilBundle[0]);
            if (bundles.length == 1)
            {
                return bundles[0];
            }
        }
View Full Code Here


                        ResolutionConfig config = new ResolutionConfig(
                            ResolutionConfig.INCLUDE_OPTIONAL
                                | ResolutionConfig.IGNORE_ERRORS);
                        try
                        {
                            IResolution r = manager.getBundleResolver().resolve(rb, config,
                                new ResolutionMonitorAdapter(monitor));
                            ISigilBundle bundle = r.getProvider(rb);
                            boolean found = false;
                            for (IPackageExport pe : bundle.getBundleInfo().getExports())
                            {
                                if (packages.contains(pe.getPackageName()))
                                {
View Full Code Here

        ResolutionConfig config = new ResolutionConfig(ResolutionConfig.INCLUDE_OPTIONAL
            | ResolutionConfig.IGNORE_ERRORS | ResolutionConfig.INDEXED_ONLY
            | ResolutionConfig.LOCAL_ONLY | ResolutionConfig.COMPILE_TIME);

        IResolution resolution;
        try
        {
            resolution = sigil.getRepositoryManager().getBundleResolver().resolve(
                sigil, config, new ResolutionMonitorAdapter(monitor));
        }
        catch (ResolutionException e)
        {
            throw SigilCore.newCoreException("Failed to resolve dependencies", e);
        }

        monitor.worked(1);

        Set<ISigilBundle> bundles = resolution.getBundles();
        for (ISigilBundle bundle : bundles)
        {
            if (!sigil.getSymbolicName().equals(bundle.getBundleInfo().getSymbolicName()))
            { // discard self reference...
                List<IModelElement> matched = resolution.getMatchedRequirements(bundle);
                for (IClasspathEntry cpe : buildClassPathEntry(sigil, bundle, bundles,
                    matched, monitor))
                {
                    entries.add(cpe);
                }
View Full Code Here

        ResolutionConfig config = new ResolutionConfig(ResolutionConfig.INCLUDE_OPTIONAL
            | ResolutionConfig.IGNORE_ERRORS);

        try
        {
            IResolution resolution = manager.getBundleResolver().resolve(this, config,
                new ResolutionMonitorAdapter(progress.newChild(20)));

            markProblems(resolution);

            // pull remote bundles from repositories to be added to classpath
            if (!resolution.isSynchronized())
            {
                resolution.synchronize(new ProgressAdapter(progress.newChild(80)));
            }
        }
        catch (ResolutionException e)
        {
            throw SigilCore.newCoreException("Failed to resolve dependencies", e);
View Full Code Here

                    try
                    {
                        IRepositoryManager manager = SigilProject.this.getRepositoryManager();
                        ResolutionConfig config = new ResolutionConfig(
                            ResolutionConfig.IGNORE_ERRORS);
                        IResolution res = manager.getBundleResolver().resolve(rb, config,
                            new ResolutionMonitorAdapter(monitor));
                        ISigilBundle b = res.getProvider(rb);
                        for (IPackageExport pe : b.getBundleInfo().getExports())
                        {
                            if (pe.getPackageName().equals(packageName))
                            {
                                found[0] = rb;
View Full Code Here

                // this can happen in IvyDE, but it retries and is OK next time.
                Log.warn("failed to find resolver - IvyContext not yet available.");
                return;
            }

            IResolution resolution = resolver.resolve(requirements, false);
            Log.verbose("resolution: " + resolution.getBundles());

            ModuleRevisionId masterMrid = md.getModuleRevisionId();
            DefaultDependencyDescriptor dd;
            ModuleRevisionId mrid;

            for (ISigilBundle bundle : resolution.getBundles())
            {
                IBundleModelElement info = bundle.getBundleInfo();
                String name = info.getSymbolicName();

                if ("system bundle".equals(name))
                {
                    // e.g. SystemProvider with framework=null
                    Log.verbose("Discarding system bundle");
                    continue;
                }

                ModuleDescriptor bmd = (ModuleDescriptor) bundle.getMeta().get(
                    ModuleDescriptor.class);
                if (bmd != null)
                {
                    ModuleRevisionId bmrid = bmd.getModuleRevisionId();
                    String org = bmrid.getOrganisation();
                    if (org == null)
                        org = masterMrid.getOrganisation();
                    String module = bmrid.getName();
                    String rev = "latest." + bmd.getStatus();

                    mrid = ModuleRevisionId.newInstance(org, module, rev);

                    dd = new SigilDependencyDescriptor(md, mrid, force, changing,
                        transitive);

                    Artifact artifact = (Artifact) bundle.getMeta().get(Artifact.class);
                    if (artifact != null)
                    {
                        dd.addDependencyArtifact(mrid.getName(),
                            new DefaultDependencyArtifactDescriptor(dd,
                                artifact.getName(), "jar", "jar", null, null));
                    }
                }
                else
                {
                    // XXX see FELIX-1395
                    // The following code has been commented out as it causes
                    // problems with require bundle dependencies
                    // VersionRange version = versions.get( name );
                    // String rev = version != null ? version.toString() : info.getVersion().toString();
                    String rev = info.getVersion().toString();
                    mrid = ModuleRevisionId.newInstance(SigilResolver.ORG_SIGIL, name,
                        rev);
                    dd = new SigilDependencyDescriptor(md, mrid, force, changing,
                        transitive);
                }

                int nDeps = 0;
                boolean foundDefault = false;

                // TODO: make dependency configurations configurable SIGIL-176
                for (String conf : md.getConfigurationsNames())
                {
                    if (conf.equals("default"))
                    {
                        foundDefault = true;
                    }
                    else if (md.getArtifacts(conf).length == 0)
                    {
                        dd.addDependencyConfiguration(conf, conf + "(default)");
                        nDeps++;
                    }
                }

                if (nDeps > 0)
                {
                    if (foundDefault)
                        dd.addDependencyConfiguration("default", "default");
                }
                else
                {
                    dd.addDependencyConfiguration("*", "*"); // all configurations
                }

                md.addDependency(dd);
            }

            boolean resolved = true;
            for (IModelElement child : requirements.children())
            {
                ISigilBundle provider = resolution.getProvider(child);
                if (provider == null)
                {
                    resolved = false;
                    // this is parse phase, so only log verbose message.
                    // error is produced during resolution phase.
View Full Code Here

            }
            try
            {
                ResolutionConfig config = new ResolutionConfig(
                    ResolutionConfig.IGNORE_ERRORS);
                IResolution resolution = resolver.resolve(element, config, null);
                if (resolution.getBundles().isEmpty())
                {
                    SigilCore.error("Failed to resolve bundle for " + base);
                }
                for (ISigilBundle b : resolution.getBundles())
                {
                    ISigilProjectModel p = b.getAncestor(ISigilProjectModel.class);
                    if (p != null)
                    {
                        uris.add(p.findBundleLocation().toFile().toURI());
View Full Code Here

TOP

Related Classes of org.apache.felix.sigil.common.repository.IResolution

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.