Examples of BundleCapability


Examples of org.osgi.framework.wiring.BundleCapability

        wireMap.put(revision, (List<ResolverWire>) Collections.EMPTY_LIST);

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

        BundleRequirement dynReq = null;
        BundleCapability dynCand = null;
        for (BundleRequirement req
            : Util.getDynamicRequirements(revision.getWiring().getRequirements(null)))
        {
            // Get the candidates for the current dynamic requirement.
            List<BundleCapability> candCaps = allCandidates.getCandidates(req);
            // Optional requirements may not have any candidates.
            if ((candCaps == null) || candCaps.isEmpty())
            {
                continue;
            }

            // Record the dynamic requirement.
            dynReq = req;
            dynCand = candCaps.get(0);

            // Can only dynamically import one at a time, so break
            // out of the loop after the first.
            break;
        }

        if (dynReq != null)
        {
            if (dynCand.getRevision().getWiring() == null)
            {
                populateWireMap(dynCand.getRevision(), revisionPkgMap, wireMap,
                    allCandidates);
            }

            packageWires.add(
                new ResolverWireImpl(
                    revision,
                    dynReq,
                    getDeclaringBundleRevision(dynCand.getRevision()),
                    getDeclaredCapability(dynCand)));
        }

        wireMap.put(revision, packageWires);
View Full Code Here

Examples of org.osgi.framework.wiring.BundleCapability

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

Examples of org.osgi.framework.wiring.BundleCapability

    }

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

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

Examples of org.osgi.framework.wiring.BundleCapability

                caps = m_dependentsMap.get(revision);
            if (caps != null)
            {
                for (Entry<BundleCapability, Set<BundleWire>> entry : caps.entrySet())
                {
                    BundleCapability cap = entry.getKey();
                    if ((cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE)
                        && cap.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE)
                            .equals(pkgName))
                        || cap.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE))
                    {
                        for (BundleWire dependentWire : entry.getValue())
                        {
                            result.add(dependentWire.getRequirer().getBundle());
                        }
View Full Code Here

Examples of org.osgi.framework.wiring.BundleCapability

        if (System.getSecurityManager() != null)
        {
            for (Iterator<BundleCapability> iter = capList.iterator();iter.hasNext();)
            {
                BundleCapability cap = iter.next();
                if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
                {
                    if (!((BundleProtectionDomain) ((BundleRevisionImpl) cap.getRevision()).getProtectionDomain()).impliesDirect(
                        new PackagePermission((String) cap.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE), PackagePermission.EXPORTONLY)))
                    {
                        iter.remove();
                    }
                }
                else if (!cap.getNamespace().equals(BundleRevision.HOST_NAMESPACE) && !cap.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE) &&
                    !cap.getNamespace().equals("osgi.ee"))
                {
                    if (!((BundleProtectionDomain) ((BundleRevisionImpl) cap.getRevision()).getProtectionDomain()).impliesDirect(
                        new CapabilityPermission(cap.getNamespace(), CapabilityPermission.PROVIDE)))
                    {
                        iter.remove();
                    }
                }
            }
View Full Code Here

Examples of org.osgi.framework.wiring.BundleCapability

            }
            else
            {
                for (Iterator<BundleCapability> it = caps.iterator(); it.hasNext(); )
                {
                    BundleCapability cap = it.next();
                    Object lhs = cap.getAttributes().get(sf.getName());
                    if (lhs != null)
                    {
                        if (compare(lhs, sf.getValue(), sf.getOperation()))
                        {
                            matches.add(cap);
View Full Code Here

Examples of org.osgi.framework.wiring.BundleCapability

    private static Set<BundleCapability> matchMandatory(
        Set<BundleCapability> caps, SimpleFilter sf)
    {
        for (Iterator<BundleCapability> it = caps.iterator(); it.hasNext(); )
        {
            BundleCapability cap = it.next();
            if (!matchMandatory(cap, sf))
            {
                it.remove();
            }
        }
View Full Code Here

Examples of org.osgi.framework.wiring.BundleCapability

    configMap.put(FelixConstants.FRAMEWORK_PROCESSOR, "x86_64");
    configMap.put(FelixConstants.FRAMEWORK_OS_NAME, "windows8");
    configMap.put(FelixConstants.FRAMEWORK_OS_VERSION, "6.3");
    ExtensionManager extensionManager = new ExtensionManager(logger,
        configMap, null);
    BundleCapability nativeBundleCapability = extensionManager
        .buildNativeCapabilites();
    assertEquals(
        "Native Language should be same as framework Language",
        "en",
        nativeBundleCapability.getAttributes().get(
            NativeNamespace.CAPABILITY_LANGUAGE_ATTRIBUTE));
    assertEquals(
        "Native Processor should be same as framework Processor",
        "x86_64",
        nativeBundleCapability.getAttributes().get(
            NativeNamespace.CAPABILITY_PROCESSOR_ATTRIBUTE));
    assertEquals(
        "Native OS Name should be the same as the framework os name",
        "windows8",
        nativeBundleCapability.getAttributes().get(
            NativeNamespace.CAPABILITY_OSNAME_ATTRIBUTE));
    assertEquals(
        "Native OS Version should be the same as the framework OS Version",
        new Version("6.3"),
        nativeBundleCapability.getAttributes().get(
            NativeNamespace.CAPABILITY_OSVERSION_ATTRIBUTE));
  }
View Full Code Here

Examples of org.osgi.framework.wiring.BundleCapability

            dynIdx++)
        {
            for (Iterator<BundleCapability> itCand = candidates.iterator();
                (dynReq == null) && itCand.hasNext(); )
            {
                BundleCapability cap = itCand.next();
                if (CapabilitySet.matches(
                    cap,
                    ((BundleRequirementImpl) dynamics.get(dynIdx)).getFilter()))
                {
                    dynReq = (BundleRequirementImpl) dynamics.get(dynIdx);
                }
            }
        }

        // If we found a matching dynamic requirement, then filter out
        // any candidates that do not match it.
        if (dynReq != null)
        {
            for (Iterator<BundleCapability> itCand = candidates.iterator();
                itCand.hasNext(); )
            {
                BundleCapability cap = itCand.next();
                if (!CapabilitySet.matches(
                    cap, dynReq.getFilter()))
                {
                    itCand.remove();
                }
View Full Code Here

Examples of org.osgi.framework.wiring.BundleCapability

        // Create groups according to how the resolver hooks filtered the
        // collisions.
        List<List<BundleRevision>> groups = new ArrayList<List<BundleRevision>>();
        while (!allCollisions.isEmpty())
        {
            BundleCapability target = allCollisions.entrySet().iterator().next().getKey();
            groups.add(groupSingletons(allCollisions, target, new ArrayList<BundleRevision>()));
        }

        // Now select the singletons available for this resolve operation.
        for (List<BundleRevision> group : groups)
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.