Package org.osgi.framework

Examples of org.osgi.framework.Bundle.loadClass()


                        } catch (Throwable t) {
                            // Check if the bundle can see the class
                            try {
                                PassThroughMetadata ptm = (PassThroughMetadata) componentDefinitionRegistry.getComponentDefinition("blueprintBundle");
                                Bundle b = (Bundle) ptm.getObject();
                                if (b.loadClass(DataFormatResolver.class.getName()) != DataFormatResolver.class) {
                                    throw new UnsupportedOperationException();
                                }
                                svc.setInterface(DataFormatResolver.class.getName());
                            } catch (Throwable t2) {
                                throw new UnsupportedOperationException();
View Full Code Here


        for (ExtendedBeanMetadata metadata : blueprintContainer.getMetadata(ExtendedBeanMetadata.class)) {
            try {
                Class cl = metadata.getRuntimeClass();
                if (cl == null && metadata.getClassName() != null) {
                    Bundle bundle = (Bundle) blueprintContainer.getComponentInstance("blueprintBundle");
                    cl = bundle.loadClass(metadata.getClassName());
                }
                if (cl == null || type.isAssignableFrom(cl)) {
                    Object o = blueprintContainer.getComponentInstance(metadata.getId());
                    objects.put(metadata.getId(), type.cast(o));
                }
View Full Code Here

        for (MutableReferenceMetadata metadata : blueprintContainer.getMetadata(MutableReferenceMetadata.class)) {
            try {
                Class cl = metadata.getRuntimeInterface();
                if (cl == null && metadata.getInterface() != null) {
                    Bundle bundle = (Bundle) blueprintContainer.getComponentInstance("blueprintBundle");
                    cl = bundle.loadClass(metadata.getInterface());
                }
                if (cl == null || type.isAssignableFrom(cl)) {
                    Object o = blueprintContainer.getComponentInstance(metadata.getId());
                    objects.put(metadata.getId(), type.cast(o));
                }
View Full Code Here

                                                "Bundle org.apache.tuscany.sca.implementation.node.runtime is not installed");
            }

            // Use Java reflection to create the node as only the runtime class
            // loader knows the runtime classes required by the node
            Class<?> bootstrapClass = bundle.loadClass(NODE_IMPLEMENTATION_LAUNCHER_BOOTSTRAP);

            Object bootstrap;
            if (configurationURI != null) {

                // Construct the node with a configuration URI
View Full Code Here

            if (servletContainerInitializerClassNamesMap != null) {
                for (Map.Entry<String, Set<String>> entry : servletContainerInitializerClassNamesMap.entrySet()) {
                    String servletContainerInitializerClassName = entry.getKey();
                    Set<String> classNames = entry.getValue();
                    try {
                        ServletContainerInitializer servletContainerInitializer = (ServletContainerInitializer) bundle.loadClass(servletContainerInitializerClassName).newInstance();
                        if (classNames == null || classNames.size() == 0) {
                            addServletContainerInitializer(servletContainerInitializer, null);
                        } else {
                            Set<Class<?>> classSet = new HashSet<Class<?>>();
                            for (String cls : classNames) {
View Full Code Here

                            addServletContainerInitializer(servletContainerInitializer, null);
                        } else {
                            Set<Class<?>> classSet = new HashSet<Class<?>>();
                            for (String cls : classNames) {
                                try {
                                    classSet.add(bundle.loadClass(cls));
                                } catch (ClassNotFoundException e) {
                                    getLogger().warn("Fail to load class " + cls + " interested by ServletContainerInitializer " + servletContainerInitializerClassName, e);
                                }
                            }
                            addServletContainerInitializer(servletContainerInitializer, classSet);
View Full Code Here

            List<String> webModuleListenerClassNames = (List<String>) tomcatWebAppContext.getDeploymentAttribute(WebApplicationConstants.WEB_MODULE_LISTENERS);
            if (webModuleListenerClassNames != null && webModuleListenerClassNames.size() > 0) {
                webModuleListeners = new ArrayList(webModuleListenerClassNames.size());
                for (String webModuleListenerClassName : webModuleListenerClassNames) {
                    try {
                        Class<?> cls = bundle.loadClass(webModuleListenerClassName);
                        Object webModuleListener = cls.newInstance();
                        webModuleListeners.add((WebModuleListener) webModuleListener);
                    } catch (ClassNotFoundException e) {
                        logger.warn("Unable to load the listener class" + webModuleListenerClassName, e);
                    } catch (InstantiationException e) {
View Full Code Here

//            Map credentialsNameMap = (Map) serviceRefCredentialsNameMap.get(name);
        String serviceInterfaceName = serviceRef.getServiceInterface();
        assureInterface(serviceInterfaceName, "javax.xml.rpc.Service", "[Web]Service", bundle);
        Class serviceInterface;
        try {
            serviceInterface = bundle.loadClass(serviceInterfaceName);
        } catch (ClassNotFoundException e) {
            throw new DeploymentException("Could not load service interface class: " + serviceInterfaceName, e);
        }
        URI wsdlURI = null;
        if (serviceRef.getWsdlFile() != null) {
View Full Code Here

            String portComponentLink = portComponentRef.getPortComponentLink();
            String serviceEndpointInterfaceType = portComponentRef.getServiceEndpointInterface();
            assureInterface(serviceEndpointInterfaceType, "java.rmi.Remote", "ServiceEndpoint", bundle);
            Class serviceEndpointClass;
            try {
                serviceEndpointClass = bundle.loadClass(serviceEndpointInterfaceType);
            } catch (ClassNotFoundException e) {
                throw new DeploymentException("could not load service endpoint class " + serviceEndpointInterfaceType, e);
            }
            portComponentRefMap.put(serviceEndpointClass, portComponentLink);
        }
View Full Code Here

        // Get the main class from the module
        String mainClass = appClientModule.getMainClassName();
        Class<?> mainClas;
        try {
            mainClas = bundle.loadClass(mainClass);
        }
        catch (ClassNotFoundException e) {
            throw new DeploymentException("AppClientModuleBuilder: Could not load main class: " + mainClass, e);
        }
        while (mainClas != null && mainClas != Object.class) {
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.