Package org.osgi.framework

Examples of org.osgi.framework.ServiceFactory


        // Check that the proxy registration was done on the original provider bundle's context
        EasyMock.verify(providerBC);

        // Test that the actual proxy invokes the original service...
        ServiceFactory proxyServiceSF = (ServiceFactory) serviceMap.get(proxySR);
        Object proxyService = proxyServiceSF.getService(clientBundle, null);
        assertNotSame("The proxy should not be the same object as the original service", testService, proxyService);

        return proxyService;
    }
View Full Code Here


        // configure and start listening for configuration
        updateConfiguration(null);

        // register managed service as a service factory
        this.configurationListener = bundleContext.registerService( "org.osgi.service.cm.ManagedService", //$NON-NLS-1$
            new ServiceFactory()
            {
                public Object getService( Bundle bundle, ServiceRegistration registration )
                {
                    /*
                     * Explicitly load the class through the class loader to dynamically
View Full Code Here

   *
   * @param service2 The service to register.
   */
  private void registerService(Runnable service2)
  {
    ServiceFactory factory = Skeleton.newMock(ServiceFactory.class);
    Skeleton skel = Skeleton.getSkeleton(factory);
   
    skel.setReturnValue(new MethodCall(ServiceFactory.class, "getService", Bundle.class, ServiceRegistration.class), service2);
   
    Hashtable<String, String> props = new Hashtable<String, String>();
View Full Code Here

    // sort the names in alphabetical order (eases debugging)
    Arrays.sort(names);

    log.info("Publishing service under classes [" + ObjectUtils.nullSafeToString(names) + "]");

    ServiceFactory serviceFactory = new PublishingServiceFactory(classes);

    if (isBeanBundleScoped())
      serviceFactory = new OsgiBundleScope.BundleScopeServiceFactory(serviceFactory);

    return bundleContext.registerService(names, serviceFactory, serviceProperties);
View Full Code Here

            {
                service = reference.getService();
            }
            else if (service instanceof ServiceFactory)
            {
                ServiceFactory factory = (ServiceFactory) service;
                service = factory.getService(bundleController, entry.getRegistration());
                reference.setService(service);
            }
            return service;
        }
    }
View Full Code Here

            if (reference.getCount() == 0)
            {
                Object service = reference.getService();
                if (service != null)
                {
                    ServiceFactory factory = (ServiceFactory) entry.getService();
                    factory.ungetService(bundleController, entry.getRegistration(), service);
                }
                entry.getUsingBundles().remove(bundleController);
            }

            return true;
View Full Code Here

            {
                BundleServiceReference bsr = bundles.get(bundle);
                Object service = bsr.getService();
                if (service != null)
                {
                    ServiceFactory factory = (ServiceFactory) entry.getService();
                    factory.ungetService(bundle, entry.getRegistration(), service);
                }
            }
        }
        finally
        {
View Full Code Here

    {
        LogWrapper.setContext(context);

        mgr = new CoordinationMgr();

        final ServiceFactory factory = new CoordinatorFactory(mgr);
        final Hashtable<String, String> props = new Hashtable<String, String>();
        props.put(Constants.SERVICE_DESCRIPTION, "Coordinator Service Implementation");
        props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
        coordinatorService = context.registerService(Coordinator.class.getName(), factory, props);
    }
View Full Code Here

        ));
        return securityConfig;
    }

    private void registerSecurityProvider() {
        ServiceFactory sf = new ServiceFactory() {
            @Override
            public Object getService(Bundle bundle, ServiceRegistration serviceRegistration) {
                return securityProvider;
            }
View Full Code Here

   *
   * @param service2 The service to register.
   */
  private void registerService(Runnable service2)
  {
    ServiceFactory factory = Skeleton.newMock(ServiceFactory.class);
    Skeleton skel = Skeleton.getSkeleton(factory);
   
    skel.setReturnValue(new MethodCall(ServiceFactory.class, "getService", Bundle.class, ServiceRegistration.class), service2);
   
    Hashtable<String, String> props = new Hashtable<String, String>();
View Full Code Here

TOP

Related Classes of org.osgi.framework.ServiceFactory

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.