Package org.osgi.util.tracker

Examples of org.osgi.util.tracker.ServiceTracker.open()


     * @return
     */
    protected <T> T getService(String serviceName)
    {
        ServiceTracker tracker = new ServiceTracker(m_context, serviceName, null);
        tracker.open();
        T result;
        try
        {
            result = (T) tracker.getService();
        }
View Full Code Here


     * @throws Exception
     */
    protected <T> T awaitService(String serviceName) throws Exception
    {
        ServiceTracker tracker = new ServiceTracker(m_context, serviceName, null);
        tracker.open();
        T result;
        try
        {
            result = (T) tracker.waitForService(DEFAULT_TIMEOUT);
        }
View Full Code Here

     * @throws Exception
     */
    protected <T> T getService(String serviceName) throws Exception
    {
        ServiceTracker tracker = new ServiceTracker(m_context, serviceName, null);
        tracker.open();
        T result;
        try
        {
            result = (T) tracker.getService();
        }
View Full Code Here

        m_gate.set(0);
    }

    protected <T> T awaitService(String serviceName) throws Exception {
        ServiceTracker tracker = new ServiceTracker(m_context, serviceName, null);
        tracker.open();
        T result;
        try {
            result = (T) tracker.waitForService(DEFAULT_TIMEOUT);
        }
        finally {
View Full Code Here

          filter = getContext().createFilter(FILTER_PREFIX + protocol + FILTER_POSTFIX);
        } catch (InvalidSyntaxException e) {
          return null;
        }
        tracker = new ServiceTracker(getContext(), filter, null);
        tracker.open();
        // cache it in the registry
        urlTrackers.put(protocol, tracker);
      }
      return (URLConverter) tracker.getService();
    }
View Full Code Here

                        }
                    }
                    return result;
                }
            };
            tracker.open();
            // sleep for a bit
            Thread.sleep(2000);
           
            installDswIfNeeded();
View Full Code Here

            public void removedService(ServiceReference reference, Object service) {
                httpServiceReferences.remove(reference);
                super.removedService(reference, service);
            }                       
        };
        st.open();
    }

    public Object createProxy(ServiceReference serviceReference,
            BundleContext dswContext, BundleContext callingContext,
            Class<?> iClass, ServiceEndpointDescription sd) {
View Full Code Here

                        }
                    }
                    return svc;
                }           
            };
            st.open();
                               
            ServiceReference ref = waitService(String.class.getName(), "(testResult=test2)");
            String trace = (String) ref.getProperty("result");
            Assert.assertFalse("Stack trace must not contain client packages. " +
                "Invocation should go through the protocol stack. " +
View Full Code Here

      
       
        // get services
       
        ServiceTracker trackerA = new ServiceTracker(bundleContext, InterfaceA.class.getName(), null);
        trackerA.open();
        InterfaceA managedServiceA = (InterfaceA) trackerA.getService();
        assertNotNull(managedServiceA);
       
        Filter filter = bundleContext.createFilter("(" + Constants.SERVICE_PID + "=jmx.test.B.factory)");
        ServiceTracker trackerMSF = new ServiceTracker(bundleContext, filter, null);
View Full Code Here

        InterfaceA managedServiceA = (InterfaceA) trackerA.getService();
        assertNotNull(managedServiceA);
       
        Filter filter = bundleContext.createFilter("(" + Constants.SERVICE_PID + "=jmx.test.B.factory)");
        ServiceTracker trackerMSF = new ServiceTracker(bundleContext, filter, null);
        trackerMSF.open();
        MSF managedFactory = (MSF) trackerMSF.getService();
        assertNotNull(managedFactory);
       
        ServiceTracker tracker = new ServiceTracker(bundleContext, ConfigurationAdmin.class.getName(), null);
        tracker.open();
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.