Package org.osgi.util.tracker

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


          {
            TestListener tl = (TestListener) service;
            tr.removeListener(tl);
          }
        };
      testListenerTracker.open();

      long start = System.currentTimeMillis();
      suite.run(tr);
      long stop  = System.currentTimeMillis();
View Full Code Here


            optional = true;
        }
        // Else, find the resolver
        String filter = "(&(" + Constants.OBJECTCLASS + "=" + Resolver.class.getName() + ")(name=" + resolver + "))";
        ServiceTracker tracker = new ServiceTracker(bundleContext, FrameworkUtil.createFilter(filter), null);
        tracker.open();
        try {
            if (optional) {
                Resolver r = (Resolver) tracker.getService();
                if (r != null) {
                    return r.resolve(feature);
View Full Code Here

    }

    public void setup() throws Exception {
        final ServiceTracker st = new ServiceTracker(bundleContext, SlingRepository.class.getName(), null);
        st.open(true);
        try {
            this.repository = (SlingRepository) st.waitForService(10000);
        } catch (InterruptedException e) {
        }
       
View Full Code Here

{

    public void start( final BundleContext ctx ) throws Exception
    {
        ServiceTracker tracker = new ServiceTracker( ctx, JUnitService.class.getName(), null );
        tracker.open();

        Hashtable<String, Object> props = new Hashtable<String, Object>();
        props.put( CommandProcessor.COMMAND_SCOPE, "sigil" );
        props.put( CommandProcessor.COMMAND_FUNCTION, new String[]
            { "runTests", "listTests" } );
View Full Code Here

    protected void setUp()
    {
        for (Class<?> c : getReferences())
        {
            ServiceTracker t = createBindTracker(c);
            t.open();
            trackers.add(t);
        }
    }

    @Override
View Full Code Here

    {
        ServiceTracker serviceTracker = ( ServiceTracker ) services.get( serviceName );
        if ( serviceTracker == null )
        {
            serviceTracker = new ServiceTracker( getBundleContext(), serviceName, null );
            serviceTracker.open();

            services.put( serviceName, serviceTracker );
        }

        return serviceTracker.getService();
View Full Code Here

    private static final String PLATFORM_TRANSACTION_MANAGER_CLASS = "org.springframework.transaction.PlatformTransactionManager";

    public void test() throws Exception {
        ServiceTracker tracker = new ServiceTracker(bundleContext, TransactionManager.class.getName(), null);
        tracker.open();

        tracker.waitForService(5000L);
        ServiceReference ref = tracker.getServiceReference();
        assertNotNull(ref);
        String[] objClass = (String[]) ref.getProperty(Constants.OBJECTCLASS);
View Full Code Here

                }
                super.removedService(reference, service);
            }
        };

        t.open();
        return t;
    }
}
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

    protected org.osgi.service.cm.Configuration configureHttpService(Dictionary<?, ?> props) throws Exception
    {
        final String pid = "org.apache.felix.http";
        ServiceTracker tracker = new ServiceTracker(m_context, ConfigurationAdmin.class.getName(), null);
        tracker.open();

        ServiceRegistration reg = null;
        org.osgi.service.cm.Configuration config = null;

        try
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.