Package org.osgi.framework.wiring

Examples of org.osgi.framework.wiring.BundleWiring


        return urlPath;
    }

    private void loadImplementationsInBundle(final Test test, final String packageName) {
        //Do not remove the cast on the next line as removing it will cause a compile error on Java 7.
        @SuppressWarnings("RedundantCast")
        final BundleWiring wiring = (BundleWiring) FrameworkUtil.getBundle(
                ResolverUtil.class).adapt(BundleWiring.class);
        @SuppressWarnings("unchecked")
        final Collection<String> list = (Collection<String>) wiring.listResources(packageName, "*.class",
            BundleWiring.LISTRESOURCES_RECURSE);
        for (final String name : list) {
            addIfMatching(test, name);
        }
    }
View Full Code Here


        }
    }

    private void loadImplementationsInBundle(final Test test, final String packageName) {
        //Do not remove the cast on the next line as removing it will cause a compile error on Java 7.
        final BundleWiring wiring = (BundleWiring) FrameworkUtil.getBundle(
                ResolverUtil.class).adapt(BundleWiring.class);
        final Collection<String> list = wiring.listResources(packageName, "*.class",
            BundleWiring.LISTRESOURCES_RECURSE);
        for (final String name : list) {
            addIfMatching(test, name);
        }
    }
View Full Code Here

        }
    }

    private void loadImplementationsInBundle(final Test test, final String packageName) {
        //Do not remove the cast on the next line as removing it will cause a compile error on Java 7.
        final BundleWiring wiring = (BundleWiring) FrameworkUtil.getBundle(
                ResolverUtil.class).adapt(BundleWiring.class);
        final Collection<String> list = wiring.listResources(packageName, "*.class",
            BundleWiring.LISTRESOURCES_RECURSE);
        for (final String name : list) {
            addIfMatching(test, name);
        }
    }
View Full Code Here

            printResources(bundle);
        }
    }

    protected void printResources(Bundle bundle) {
        BundleWiring wiring = (BundleWiring) bundle.adapt(BundleWiring.class);
        if (wiring != null) {
            Collection<String> resources = null;
            if (displayAllFiles) {
                resources = wiring.listResources("/", null, BundleWiring.LISTRESOURCES_RECURSE);
            } else {
                resources = wiring.listResources("/", "*class", BundleWiring.LISTRESOURCES_RECURSE);
            }
            if (resources.size() > 0) {
                System.out.println("\n" + Util.getBundleName(bundle));
            }
            for (String resource : resources) {
View Full Code Here

    protected void findResource() {
        Bundle[] bundles = bundleContext.getBundles();
        String filter = "*" + className + "*";
        for (Bundle bundle : bundles) {
            BundleWiring wiring = (BundleWiring) bundle.adapt(BundleWiring.class);
            if (wiring != null) {
                Collection<String> resources = wiring.listResources("/", filter, BundleWiring.LISTRESOURCES_RECURSE);
                if (resources.size() > 0) {
                    System.out.println("\n" + Util.getBundleName(bundle));
                }
                for (String resource:resources) {
                    System.out.println(resource);
View Full Code Here

    final Configuration configuration = new Configuration();
    configuration.getProperties().put( AvailableSettings.JTA_PLATFORM, osgiJtaPlatform );
   
    // Allow bundles to put the config file somewhere other than the root level.
    final BundleWiring bundleWiring = (BundleWiring) requestingBundle.adapt( BundleWiring.class );
    final Collection<String> cfgResources = bundleWiring.listResources( "/", "hibernate.cfg.xml",
        BundleWiring.LISTRESOURCES_RECURSE );
    if (cfgResources.size() == 0) {
      configuration.configure();
    }
    else {
View Full Code Here

            throw new IllegalArgumentException("Not the system bundle: " + syscontext.getBundle());

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

        installListener = new SynchronousBundleListener() {
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

    final Configuration configuration = new Configuration();
    configuration.getProperties().put( AvailableSettings.JTA_PLATFORM, osgiJtaPlatform );
   
    // Allow bundles to put the config file somewhere other than the root level.
    final BundleWiring bundleWiring = (BundleWiring) requestingBundle.adapt( BundleWiring.class );
    final Collection<String> cfgResources = bundleWiring.listResources( "/", "hibernate.cfg.xml",
        BundleWiring.LISTRESOURCES_RECURSE );
    if (cfgResources.size() == 0) {
      configuration.configure();
    }
    else {
View Full Code Here

            throw new IllegalArgumentException("Not the system bundle: " + syscontext.getBundle());

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

        // Create the {@link URLStreamHandlerTracker}
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.