Package org.osgi.framework

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


        }
       
        if(b == null) {
            throw new IllegalArgumentException("No Bundle found that supplies test class " + testName);
        }
        return b.loadClass(testName);
    }

    /** @inheritDoc */
    public long lastModified() {
        return lastModified;
View Full Code Here


        try {
            clazz = super.findClass(name);
        } catch (ClassNotFoundException cnfe) {
            final Bundle bundle = this.findBundleForPackage(getPackageFromClassName(name));
            if ( bundle != null ) {
                clazz = bundle.loadClass(name);
                this.factory.addUsedBundle(bundle);
            }
        }
        if ( clazz == null ) {
            throw new ClassNotFoundException("Class not found " + name);
View Full Code Here

        } catch (final ClassNotFoundException cnfe) {
            final String pckName = getPackageFromClassName(name);
            final Bundle bundle = this.findBundleForPackage(pckName);
            if ( bundle != null ) {
                try {
                    clazz = bundle.loadClass(name);
                    this.factory.addUsedBundle(bundle);
                } catch (final ClassNotFoundException inner) {
                    negativeClassCache.add(name);
                    this.factory.addUnresolvedPackage(pckName);
                    throw inner;
View Full Code Here

                if (m_shape == null)
                {
                    // Get the bundle.
                    Bundle bundle = m_context.getBundle(m_bundleId);
                    // Load the class and instantiate it.
                    Class<?> clazz = bundle.loadClass(m_className);
                    m_shape = (SimpleShape) clazz.newInstance();
                }
                // Draw the shape.
                m_shape.draw(g2, p);
                // If everything was successful, then simply return.
View Full Code Here

            throw new IllegalStateException("bundle shut down while trying to load implementation object class");
        }
        Class<?> implementationObjectClass;
        try
        {
            implementationObjectClass = bundle.loadClass(
                    getComponentMetadata().getImplementationClassName() );
        }
        catch ( ClassNotFoundException e )
        {
            log( LogService.LOG_ERROR, "Could not load implementation object class {0}",
View Full Code Here

            return null;
        }
        try
        {
            // 112.4.4 The class is retrieved with the loadClass method of the component's bundle
            implementationObjectClass = (Class<S>) bundle.loadClass(
                    getComponentMetadata().getImplementationClassName() )  ;

            // 112.4.4 The class must be public and have a public constructor without arguments so component instances
            // may be created by the SCR with the newInstance method on Class
            implementationObject = implementationObjectClass.newInstance();
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(DataFormatResolver.class.getName()) != DataFormatResolver.class) {
                        throw new UnsupportedOperationException();
                    }
                    svc.setInterface(DataFormatResolver.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

            } 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

        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_VERSION,
                          "1.0.0");
        bundle.getHeaders();
        EasyMock.expectLastCall().andReturn(bundleHeaders).times(2);
        final String serviceClass = TestService.class.getName();
        bundle.loadClass(serviceClass);
        EasyMock.expectLastCall().andReturn(TestService.class).times(2);
        final BundleContext requestingContext =
            control.createMock(BundleContext.class);
       
        BundleTestContext dswContext = new BundleTestContext(bundle);
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.