Package org.osgi.framework.wiring

Examples of org.osgi.framework.wiring.BundleWiring


        Module module = getModule(bundle.getBundleId());
        if (module != null)
            return module;

        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        ClassLoader classLoader = wiring != null ? wiring.getClassLoader() : null;
        if (classLoader == null)
            return null;

        Resource resource = ThreadResourceAssociation.getResource();
        Dictionary<String, String> headers = bundle.getHeaders();
View Full Code Here


            }
        }
    }

    private void loadImplementationsInBundle(Test test, String packageName) {
        BundleWiring wiring = (BundleWiring)FrameworkUtil.getBundle(ResolverUtil.class).adapt(BundleWiring.class);
        Collection<String> list = wiring.listResources(packageName, "*.class", BundleWiring.LISTRESOURCES_RECURSE);
        for (String name : list) {
            addIfMatching(test, name);
        }
    }
View Full Code Here

            if (fragmentCands != null)
            {
                for (BundleCapability fragCand : fragmentCands)
                {
                    // Only necessary for resolved fragments.
                    BundleWiring wiring = fragCand.getRevision().getWiring();
                    if (wiring != null)
                    {
                        // Fragments only have host wire, so each wire represents
                        // an attached host.
                        for (BundleWire wire : wiring.getRequiredWires(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(BundleRevision.PACKAGE_NAMESPACE)
View Full Code Here

        // Install system module
        Bundle sysbundle = context.getBundle(0);
        try {
            Resource resource = new DefaultResourceBuilder().addIdentityCapability(getSystemIdentity()).getResource();
            BundleWiring wiring = sysbundle.adapt(BundleWiring.class);
            installModule(wiring.getClassLoader(), resource, sysbundle.getHeaders(), null);
        } catch (ModuleException ex) {
            throw new IllegalStateException("Cannot install system module", ex);
        }

        // Create the {@link URLStreamHandlerTracker}
View Full Code Here

        Module module = getModule(bundle.getBundleId());
        if (module != null)
            return module;

        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        ClassLoader classLoader = wiring != null ? wiring.getClassLoader() : null;
        if (classLoader == null)
            return null;

        Resource resource = ThreadResourceAssociation.getResource();
        Dictionary<String, String> headers = bundle.getHeaders();
View Full Code Here

        // Install system module
        Bundle sysbundle = context.getBundle(0);
        try {
            Resource resource = new DefaultResourceBuilder().addIdentityCapability(getSystemIdentity()).getResource();
            BundleWiring wiring = sysbundle.adapt(BundleWiring.class);
            installModule(wiring.getClassLoader(), resource, sysbundle.getHeaders(), null);
        } catch (ModuleException ex) {
            throw new IllegalStateException("Cannot install system module", ex);
        }

        // Create the {@link URLStreamHandlerTracker}
View Full Code Here

        Module module = getModule(bundle.getBundleId());
        if (module != null)
            return module;

        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        ClassLoader classLoader = wiring != null ? wiring.getClassLoader() : null;
        if (classLoader == null)
            return null;

        Resource resource = ThreadResourceAssociation.getResource();
        Dictionary<String, String> headers = bundle.getHeaders();
View Full Code Here

            LOG.warn("Bundle dependency loop detected: {}", stack.subList(stack.indexOf(bundle), stack.size()));
            return;
        }
        stack.add(bundle);
       
        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        List<BundleWire> wires;
        wires = wiring.getRequiredWires(BundleRevision.PACKAGE_NAMESPACE);
        for (BundleWire wire : wires) {
            Bundle wiredBundle = wire.getProviderWiring().getBundle();
            // examine wires to other application bundles only
            if (wiredBundle != bundle && applicationBundles.contains(wiredBundle)) {
                sortDependentBundles(wiredBundle, sortedBundles, stack);
            }
        }
        wires = wiring.getRequiredWires(BundleRevision.BUNDLE_NAMESPACE);
        for (BundleWire wire : wires) {
            Bundle wiredBundle = wire.getProviderWiring().getBundle();
            // examine wires to other application bundles only
            if (wiredBundle != bundle && applicationBundles.contains(wiredBundle)) {
                sortDependentBundles(wiredBundle, sortedBundles, stack);
View Full Code Here

            throw e;
        }
    }

    public static void loadBundleAsModule(Bundle bundle) {
        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        String symbolicName = bundle.getSymbolicName();
        Version version = bundle.getVersion();
        String versionString = new StringBuilder("")
                                    .append(version.getMajor())
                                    .append('.')
                                    .append(version.getMinor())
                                    .append('.')
                                    .append(version.getMicro())
                                    .toString();
                                   
       
        ClassLoader  bundleClassLoader = null;
        try {
            bundleClassLoader = wiring.getClassLoader();
        } catch(ClassCastException e) {
            // to solve a problem in Kepler with system bundles throwing a CCE
        }
        BundleArtifactResult artifactResult = new BundleArtifactResult(wiring);
        if (Metamodel.loadModule(symbolicName, versionString,
View Full Code Here

public class BundleInformation {

    public static void showSWTBotDependencies() {
        log("commencing showSWTBotDependencies");
        Bundle bundle = FrameworkUtil.getBundle(SWTBot.class);
        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        List<BundleWire> requiredWires = wiring.getRequiredWires(null);
        for (BundleWire requiredWire : requiredWires) {
            log("requiredWire: " + requiredWire);
        }
        log("completed showSWTBotDependencies");
    }
View Full Code Here

TOP

Related Classes of org.osgi.framework.wiring.BundleWiring

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.