Examples of BundleReference


Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

        Object bundle = null;
        String bundleName = ((BundleReference)unresolved).getBundleName();
        String bundleVersion = ((BundleReference)unresolved).getBundleVersion();
       
        bundle = osgiRuntime.findBundle(bundleName, bundleVersion);
        BundleReference bundleReference;
       
        if (bundle == null)
            bundleReference = bundleProcessor.installNestedBundle(contribution, bundleName, bundleVersion);
        else {
            bundleReference = new BundleReference(bundle,
                    ((BundleReference)unresolved).getBundleName(),
                    bundleVersion,
                    getBundleFileName(bundle)
                    );
        }
View Full Code Here

Examples of org.osgi.framework.BundleReference

        // If the class comes from bundle class loader, then return
        // associated bundle if it is from this framework instance.
        if (clazz.getClassLoader() instanceof BundleReference)
        {
            // Only return the bundle if it is from this framework.
            BundleReference br = (BundleReference) clazz.getClassLoader();
            return ((br.getBundle() instanceof BundleImpl)
                && (((BundleImpl) br.getBundle()).getFramework() == this))
                    ? br.getBundle() : null;
        }
        // Otherwise check if the class conceptually comes from the
        // system bundle. Ignore implicit boot delegation.
        if (!clazz.getName().startsWith("java."))
        {
View Full Code Here

Examples of org.osgi.framework.BundleReference

        ServiceReference sref = context.getServiceReference(Echo.class.getName());
        return (Echo) context.getService(sref);
    }

    private BundleContext getBundleContextFromClass(Class<?> clazz) {
        BundleReference bref = (BundleReference) clazz.getClassLoader();
        Bundle bundle = bref.getBundle();
        if (bundle.getState() != Bundle.ACTIVE) {
            try {
                bundle.start();
            } catch (BundleException ex) {
                log.errorf(ex, "Cannot start bundle: %s", bundle);
View Full Code Here

Examples of org.osgi.framework.BundleReference

    private void installManagedBundles() {
        try {

            // Obtaining BundleContext from ServletContext class which is loaded
            // by bundle class loader
            BundleReference ref = (BundleReference) servletContext.getClass()
                    .getClassLoader();
            bctx = ref.getBundle().getBundleContext();

            // installing managed bundles
            installBundles();

        } catch (Exception ex) {
View Full Code Here

Examples of org.osgi.framework.BundleReference

            });           
           
            if (loader == null) return false;
           
            if (loader instanceof BundleReference) {
                BundleReference ref = (BundleReference) loader;
                return ref.getBundle().equals(container.getBundleContext().getBundle());               
            }
           
            return false;
        }
View Full Code Here

Examples of org.osgi.framework.BundleReference

        // If the class comes from bundle class loader, then return
        // associated bundle if it is from this framework instance.
        if (clazz.getClassLoader() instanceof BundleReference)
        {
            // Only return the bundle if it is from this framework.
            BundleReference br = (BundleReference) clazz.getClassLoader();
            return ((br.getBundle() instanceof BundleImpl)
                && (((BundleImpl) br.getBundle()).getFramework() == this))
                    ? br.getBundle() : null;
        }
        // Otherwise check if the class conceptually comes from the
        // system bundle. Ignore implicit boot delegation.
        if (!clazz.getName().startsWith("java."))
        {
View Full Code Here

Examples of org.osgi.framework.BundleReference

            ClassLoader loader = declaringClass.get().getClassLoader();
           
            if (loader == null) return false;
           
            if (loader instanceof BundleReference) {
                BundleReference ref = (BundleReference) loader;
                return ref.getBundle().equals(container.getBundleContext().getBundle());               
            }
           
            return false;
        }
View Full Code Here

Examples of org.osgi.framework.BundleReference

        // [ARQ-459] Allow TestRunner to TestEnricher communication
        Bundle bundle = BundleAssociation.getBundle();
        if (bundle == null) {
            ClassLoader classLoader = testCase.getClass().getClassLoader();
            if (classLoader instanceof BundleReference) {
                BundleReference bref = (BundleReference) classLoader;
                bundle = bref.getBundle();
            }
        }
        return bundle;
    }
View Full Code Here

Examples of org.osgi.framework.BundleReference

            ClassLoader loader = declaringClass.get().getClassLoader();
           
            if (loader == null) return false;
           
            if (loader instanceof BundleReference) {
                BundleReference ref = (BundleReference) loader;
                return ref.getBundle().equals(container.getBundleContext().getBundle());               
            }
           
            return false;
        }
View Full Code Here

Examples of org.osgi.framework.BundleReference

            ClassLoader loader = declaringClass.get().getClassLoader();
           
            if (loader == null) return false;
           
            if (loader instanceof BundleReference) {
                BundleReference ref = (BundleReference) loader;
                return ref.getBundle().equals(container.getBundleContext().getBundle());               
            }
           
            return false;
        }
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.