Package org.osgi.framework

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


    String widgetClassname=config.getAttribute("widgetClass");
    IContributor contrib = config.getContributor();
    String pluginID = contrib.getName();
    Bundle bundle = Platform.getBundle(pluginID);
    try {
      beanClass=bundle.loadClass(widgetClassname);
    } catch (Exception e) {
      WidgetPlugin.getLogger().error(e);
    }
    this.widget = createWidget();
    this.hotspotPoint = new Point(widget.getWidth() / 2, widget.getHeight() / 2);
View Full Code Here


    try {
      String widgetClassname = config.getAttribute("widgetClass"); //$NON-NLS-1$
      IContributor contributor = config.getContributor();
      String pluginId = contributor.getName();
      Bundle bundle = Platform.getBundle(pluginId);
      return bundle.loadClass(widgetClassname);
    } catch (Exception e) {
      VisualSwingPlugin.getLogger().error(e);
      return null;
    }
  }
View Full Code Here

            throw new IllegalStateException("Found MODULE attachment for Bundle deployment: " + depUnit);

        Class<?> testClass;
        if (osgidep != null) {
            Bundle bundle = osgidep.getAttachment(Bundle.class);
            testClass = bundle.loadClass(className);
            BundleAssociation.setBundle(bundle);
        } else {
            testClass = module.getClassLoader().loadClass(className);
        }
View Full Code Here

            if (packageName.equals("sun.beans.infos") && className.endsWith("BeanInfo")) {
                throw cnfe;
            }
            return findClass(className, packageName, cnfe);
        } else {
            return bundle.loadClass(className);
        }
    }
       
    private Class<?> findClass(String className, String packageName, ClassNotFoundException cnfe) throws ClassNotFoundException {
        Iterator<Bundle> iterator = bundles.iterator();
View Full Code Here

            if (hasDynamicImports && hasWildcardDynamicImport(delegate)) {
                // skip any bundles with Dynamic-ImportPackage: * to avoid unnecessary wires
                continue;
            }
            try {
                return delegate.loadClass(className);
            } catch (ClassNotFoundException e) {
                // ignore
            }
        }
        throw cnfe;
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

            System.out.println("Started "+b.getSymbolicName() + " [" + getState(b) + "]");
            // Get the Platform.getExtensionRegistry()
            if ("org.eclipse.core.runtime".equals(b.getSymbolicName())) {
                // The Platform class loaded by the bundle is different that the one
                // on the classpath
                Class<?> cls = b.loadClass("org.eclipse.core.runtime.Platform");
                Method m = cls.getMethod("getExtensionRegistry");
                Object reg = m.invoke(cls);
                System.out.println(reg);
            }
        }
View Full Code Here

        // The mock bundle that consumes the service
        Bundle clientBundle = EasyMock.createNiceMock(Bundle.class);
        EasyMock.expect(clientBundle.getBundleId()).andReturn(2999L).anyTimes();
        EasyMock.expect(clientBundle.getBundleContext()).andReturn(clientBC).anyTimes();
        EasyMock.expect(clientBundle.loadClass(EasyMock.isA(String.class))).andAnswer(new IAnswer() {
            @Override
            public Class answer() throws Throwable {
                return objClsMap.get(EasyMock.getCurrentArguments()[0]);
            }
        }).anyTimes();
View Full Code Here

                        } 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(ComponentResolver.class.getName()) != ComponentResolver.class) {
                                    throw new UnsupportedOperationException();
                                }
                                svc.setInterface(ComponentResolver.class.getName());
                            } catch (Throwable t2) {
                                throw new UnsupportedOperationException();
View Full Code Here

                        } 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(LanguageResolver.class.getName()) != LanguageResolver.class) {
                                    throw new UnsupportedOperationException();
                                }
                                svc.setInterface(LanguageResolver.class.getName());
                            } catch (Throwable t2) {
                                throw new UnsupportedOperationException();
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.