Package org.osgi.framework.resource

Examples of org.osgi.framework.resource.Wiring


        if (fragmentCands != null)
        {
            for (Capability fragCand : fragmentCands)
            {
                // Only necessary for resolved fragments.
                Wiring wiring = env.getWirings().get(fragCand.getResource());
                if (wiring != null)
                {
                    // Fragments only have host wire, so each wire represents
                    // an attached host.
                    for (Wire wire : wiring.getRequiredResourceWires(null))
                    {
                        // If the capability is a package, then make sure the
                        // host actually provides it in its resolved capabilities,
                        // since it may be a substitutable export.
                        if (!fragCand.getNamespace().equals(ResourceConstants.WIRING_PACKAGE_NAMESPACE)
View Full Code Here


        // Create parallel arrays for requirement and proposed candidate
        // capability or actual capability if revision is resolved or not.
        List<Requirement> reqs = new ArrayList();
        List<Capability> caps = new ArrayList();
        boolean isDynamicImporting = false;
        Wiring wiring = env.getWirings().get(resource);
        if (wiring != null)
        {
            // Use wires to get actual requirements and satisfying capabilities.
            for (Wire wire : wiring.getRequiredResourceWires(null))
            {
                // Wrap the requirement as a hosted requirement if it comes
                // from a fragment, since we will need to know the host. We
                // also need to wrap if the requirement is a dynamic import,
                // since that requirement will be shared with any other
                // matching dynamic imports.
                Requirement r = wire.getRequirement();
                if (!r.getResource().equals(wire.getRequirer())
                    || ((r.getDirectives()
                            .get(ResourceConstants.REQUIREMENT_RESOLUTION_DIRECTIVE) != null)
// TODO: RFC-112 - Need dynamic constant.
                        && r.getDirectives()
                            .get(ResourceConstants.REQUIREMENT_RESOLUTION_DIRECTIVE).equals("dynamic")))
                {
                    r = new HostedRequirement(wire.getRequirer(), r);
                }
                // Wrap the capability as a hosted capability if it comes
                // from a fragment, since we will need to know the host.
                Capability c = wire.getCapability();
                if (!c.getResource().equals(wire.getProvider()))
                {
                    c = new HostedCapability(wire.getProvider(), c);
                }
                reqs.add(r);
                caps.add(c);
            }

            // Since the revision is resolved, it could be dynamically importing,
            // so check to see if there are candidates for any of its dynamic
            // imports.
            for (Requirement req
                : Util.getDynamicRequirements(wiring.getResourceRequirements(null)))
            {
                // Get the candidates for the current requirement.
                SortedSet<Capability> candCaps = allCandidates.getCandidates(req);
                // Optional requirements may not have any candidates.
                if (candCaps == null)
View Full Code Here

                    revisionPkgMap);
            }

            // If the candidate requires any other bundles with reexport visibility,
            // then we also need to merge their packages too.
            Wiring candWiring = env.getWirings().get(candCap.getResource());
            if (candWiring != null)
            {
                for (Wire bw : candWiring.getRequiredResourceWires(null))
                {
                    if (bw.getRequirement().getNamespace()
                        .equals(ResourceConstants.WIRING_BUNDLE_NAMESPACE))
                    {
                        String value = bw.getRequirement()
View Full Code Here

            return;
        }
        packages = new Packages(revision);

        // Get all exported packages.
        Wiring wiring = env.getWirings().get(revision);
        List<Capability> caps = (wiring != null)
            ? wiring.getResourceCapabilities(null)
            : revision.getCapabilities(null);
        Map<String, Capability> exports =
            new HashMap<String, Capability>(caps.size());
        for (Capability cap : caps)
        {
View Full Code Here

            String pkgName = cap.getAttributes()
                .get(ResourceConstants.WIRING_PACKAGE_NAMESPACE).toString();

            // Since a revision can export the same package more than once, get
            // all package capabilities for the specified package name.
            Wiring wiring = env.getWirings().get(cap.getResource());
            List<Capability> caps = (wiring != null)
                ? wiring.getResourceCapabilities(null)
                : cap.getResource().getCapabilities(null);
            for (int capIdx = 0; capIdx < caps.size(); capIdx++)
            {
                if (caps.get(capIdx).getNamespace()
                        .equals(ResourceConstants.WIRING_PACKAGE_NAMESPACE)
View Full Code Here

    }

    private void dumpRevisionPkgs(
        Environment env, Resource resource, Packages packages)
    {
        Wiring wiring = env.getWirings().get(resource);
        m_logger.log(Logger.LOG_TRACE, resource
            + " (" + ((wiring != null) ? "RESOLVED)" : "UNRESOLVED)"));
        m_logger.log(Logger.LOG_TRACE, "  EXPORTED");
        for (Entry<String, Blame> entry : packages.m_exportedPkgs.entrySet())
        {
View Full Code Here

    }

    public static Capability getSatisfyingCapability(
        Environment env, Resource br, Requirement req)
    {
        Wiring wiring = env.getWirings().get(br);
        List<Capability> caps = (wiring != null)
            ? wiring.getResourceCapabilities(null)
            : br.getCapabilities(null);
        if (caps != null)
        {
            for (Capability cap : caps)
            {
View Full Code Here

TOP

Related Classes of org.osgi.framework.resource.Wiring

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.