Examples of ServiceFactory


Examples of org.osgi.framework.ServiceFactory

    public void open(boolean trackAllServices)
    {
        Dictionary<String, Object> props = new Hashtable<String, Object>();
        props.put(Constants.SERVICE_PID, SslFilter.PID);

        this.configReceiver = super.context.registerService(ManagedService.class.getName(), new ServiceFactory()
        {
            public Object getService(Bundle bundle, ServiceRegistration registration)
            {
                return new ManagedService()
                {
View Full Code Here

Examples of org.osgi.framework.ServiceFactory

    {
        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

Examples of org.osgi.framework.ServiceFactory

        controlContext.replay();

        ServiceRegistry sr = new ServiceRegistry(new Logger(), null);
        MockControl sfControl = MockControl.createNiceControl(ServiceFactory.class);
        sfControl.replay();
        ServiceFactory sf = (ServiceFactory) sfControl.getMock();

        assertEquals("Precondition failed", 0, sr.getHooks(EventHook.class).size());
        assertEquals("Precondition failed", 0, sr.getHooks(FindHook.class).size());
        assertEquals("Precondition failed", 0, sr.getHooks(ListenerHook.class).size());
        ServiceRegistration reg = sr.registerService(c, new String [] {EventHook.class.getName()}, sf, new Hashtable());
View Full Code Here

Examples of org.osgi.framework.ServiceFactory

        controlContext.replay();

        ServiceRegistry sr = new ServiceRegistry(new Logger(), null);
        MockControl sfControl = MockControl.createNiceControl(ServiceFactory.class);
        sfControl.replay();
        ServiceFactory sf = (ServiceFactory) sfControl.getMock();

        assertEquals("Precondition failed", 0, sr.getHooks(EventHook.class).size());
        assertEquals("Precondition failed", 0, sr.getHooks(FindHook.class).size());
        assertEquals("Precondition failed", 0, sr.getHooks(ListenerHook.class).size());
        ServiceRegistration reg = sr.registerService(c, new String [] {FindHook.class.getName()}, sf, new Hashtable());
View Full Code Here

Examples of org.osgi.framework.ServiceFactory

        controlContext.replay();

        ServiceRegistry sr = new ServiceRegistry(new Logger(), null);
        MockControl sfControl = MockControl.createNiceControl(ServiceFactory.class);
        sfControl.replay();
        ServiceFactory sf = (ServiceFactory) sfControl.getMock();

        assertEquals("Precondition failed", 0, sr.getHooks(EventHook.class).size());
        assertEquals("Precondition failed", 0, sr.getHooks(FindHook.class).size());
        assertEquals("Precondition failed", 0, sr.getHooks(ListenerHook.class).size());
        ServiceRegistration reg = sr.registerService(c, new String [] {ListenerHook.class.getName()}, sf, new Hashtable());
View Full Code Here

Examples of org.osgi.framework.ServiceFactory

                }
      }}).start();
    }

    protected ServiceRegistration register(final Object service, final int delay) {
        return bundleContext.registerService(service.getClass().getName(), new ServiceFactory() {
            public Object getService(Bundle bundle, ServiceRegistration registration)
            {
                delay(delay);
                return service;
            }
View Full Code Here

Examples of org.osgi.framework.ServiceFactory

   *
   * @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

Examples of org.osgi.framework.ServiceFactory

        mainCompInst = main.getComponentInstance();
        TestCase.assertNotNull(mainCompInst);
    }

    protected ServiceRegistration register(final Object service, final int delay) {
        return bundleContext.registerService(service.getClass().getName(), new ServiceFactory() {
            public Object getService(Bundle bundle, ServiceRegistration registration)
            {
                delay(delay);
                return service;
            }
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.