Package org.osgi.resource

Examples of org.osgi.resource.Capability


        for (Requirement req : resource.getRequirements(null))
        {
            List<Capability> cands = allCandidates.getCandidates(req);
            if (cands != null && !cands.isEmpty())
            {
                Capability cap = cands.get(0);
                if (!resource.equals(cap.getResource()))
                {
                    try
                    {
                        checkPackageSpaceConsistency(
                            session, cap.getResource(),
                            allCandidates, resourcePkgMap, resultCache);
                    }
                    catch (ResolutionException ex)
                    {
                        // If the lower level check didn't create any permutations,
View Full Code Here


        List<Capability> candidates = allCandidates.getCandidates(requirement);
        if (candidates == null || candidates.isEmpty())
        {
            return null;
        }
        Capability cand = candidates.get(0);
        return new WireImpl(
            getDeclaredResource(requirement.getResource()),
            getDeclaredRequirement(requirement),
            getDeclaredResource(cand.getResource()),
            getDeclaredCapability(cand));
    }
View Full Code Here

        List<Wire> packageWires = new ArrayList<Wire>();

        // Get the candidates for the current dynamic requirement.
        List<Capability> candCaps = allCandidates.getCandidates(dynReq);
        // Record the dynamic candidate.
        Capability dynCand = candCaps.get(0);

        if (!rc.getWirings().containsKey(dynCand.getResource()))
        {
            populateWireMap(rc, dynCand.getResource(), resourcePkgMap,
                wireMap, allCandidates);
        }

        packageWires.add(
            new WireImpl(
            resource,
            dynReq,
            getDeclaredResource(dynCand.getResource()),
            getDeclaredCapability(dynCand)));

        wireMap.put(resource, packageWires);

        return wireMap;
View Full Code Here

                {
                    sb.append("\n    provide: ");
                }
                if ((i + 1) < blame.m_reqs.size())
                {
                    Capability cap = getSatisfyingCapability(
                        rc,
                        allCandidates,
                        blame.m_reqs.get(i));
                    if (cap.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE))
                    {
                        sb.append(PackageNamespace.PACKAGE_NAMESPACE);
                        sb.append("=");
                        sb.append(cap.getAttributes()
                            .get(PackageNamespace.PACKAGE_NAMESPACE).toString());
                        Capability usedCap =
                            getSatisfyingCapability(
                            rc,
                            allCandidates,
                            blame.m_reqs.get(i + 1));
                        sb.append("; uses:=");
                        sb.append(usedCap.getAttributes()
                            .get(PackageNamespace.PACKAGE_NAMESPACE));
                    }
                    else
                    {
                        sb.append(cap);
                    }
                    sb.append("\n");
                }
                else
                {
                    Capability export = getSatisfyingCapability(
                        rc,
                        allCandidates,
                        blame.m_reqs.get(i));
                    sb.append(export.getNamespace());
                    sb.append("=");
                    sb.append(export.getAttributes().get(export.getNamespace()).toString());
                    if (export.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE)
                        && !export.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE)
                        .equals(blame.m_cap.getAttributes().get(
                        PackageNamespace.PACKAGE_NAMESPACE)))
                    {
                        sb.append("; uses:=");
                        sb.append(blame.m_cap.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
View Full Code Here

    }

    private static Capability getSatisfyingCapability(
        ResolveContext rc, Candidates allCandidates, Requirement req)
    {
        Capability cap = null;

        // If the requiring revision is not resolved, then check in the
        // candidate map for its matching candidate.
        List<Capability> cands = allCandidates.getCandidates(req);
        if (cands != null)
View Full Code Here

                CapReqBuilder builder = new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE);
                builder.addAttribute(PackageNamespace.PACKAGE_NAMESPACE, sysPkg.getName());
                String versionStr = sysPkg.getVersionString();
                Version version = versionStr != null ? new Version(versionStr) : Version.emptyVersion;
                builder.addAttribute(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE, version);
                Capability cap = builder.setResource(framework).buildCapability();
                capIndex.addCapability(cap);
            }

        // Add system capabilities extra
        if (sysCapsExtraParams != null) {
View Full Code Here

            }
        }
    }

    public void addFrameworkCapability(CapReqBuilder builder) {
        Capability cap = builder.setResource(framework).buildCapability();
        capIndex.addCapability(cap);
    }
View Full Code Here

                Parameters params = new Parameters(properties.getProperty("org.osgi.framework.system.packages", ""));
                for (String packageName : params.keySet()) {
                    CapReqBuilder builder = new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE);
                    builder.addAttribute(PackageNamespace.PACKAGE_NAMESPACE, packageName);
                    builder.addAttribute(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE, new Version(0, 0, 0));
                    Capability cap = builder.setResource(framework).buildCapability();
                    capIndex.addCapability(cap);
                }
            } catch (IOException e) {
                throw new IllegalStateException("Error loading JRE package properties", e);
            }
View Full Code Here

                CapReqBuilder builder = new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE);
                builder.addAttribute(PackageNamespace.PACKAGE_NAMESPACE, sysPkg.getName());
                String versionStr = sysPkg.getVersionString();
                Version version = versionStr != null ? new Version(versionStr) : Version.emptyVersion;
                builder.addAttribute(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE, version);
                Capability cap = builder.setResource(framework).buildCapability();
                capIndex.addCapability(cap);
            }

        // Add system capabilities extra
        if (sysCapsExtraParams != null) {
View Full Code Here

            }
        }
    }

    public void addFrameworkCapability(CapReqBuilder builder) {
        Capability cap = builder.setResource(framework).buildCapability();
        capIndex.addCapability(cap);
    }
View Full Code Here

TOP

Related Classes of org.osgi.resource.Capability

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.