Package org.osgi.util.tracker

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


        trackerMSF.open();
        MSF managedFactory = (MSF) trackerMSF.getService();
        assertNotNull(managedFactory);
       
        ServiceTracker tracker = new ServiceTracker(bundleContext, ConfigurationAdmin.class.getName(), null);
        tracker.open();
        ConfigurationAdmin configAdmin = (ConfigurationAdmin) tracker.getService();
        assertNotNull(configAdmin);
       
        // ManagedService operations
       
View Full Code Here


    }


    private static ServiceTracker getServiceManager(final BundleContext context) throws InterruptedException {
        final ServiceTracker serviceManagerTracker = new ServiceTracker(context, SERVICE_MANAGER_NAME, null);
        serviceManagerTracker.open();
        serviceManagerTracker.waitForService(TRACKER_TIMEOUT);
        return serviceManagerTracker;
    }

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

        ProvisioningServiceMBean mbean = getMBean(ProvisioningServiceMBean.OBJECTNAME, ProvisioningServiceMBean.class);
        assertNotNull(mbean);
       
        ServiceTracker tracker = new ServiceTracker(bundleContext, ProvisioningService.class.getName(), null);
        tracker.open();
        ProvisioningService ps = (ProvisioningService) tracker.getService();
        assertNotNull(ps);
       
        Dictionary<String, Object> info;
       
View Full Code Here

            } else {
                flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
            }
            Filter osgiFilter = FrameworkUtil.createFilter(flt);
            tracker = new ServiceTracker(bundleContext, osgiFilter, null);
            tracker.open(true);
            // Note that the tracker is not closed to keep the reference
            // This is buggy, as the service reference may change i think
            Object svc = type.cast(tracker.waitForService(timeout));
            if (svc == null) {
                Dictionary dic = bundleContext.getBundle().getHeaders();
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

        trackerMSF.open();
        MSF managedFactory = (MSF) trackerMSF.getService();
        assertNotNull(managedFactory);
       
        ServiceTracker tracker = new ServiceTracker(bundleContext, ConfigurationAdmin.class.getName(), null);
        tracker.open();
        ConfigurationAdmin configAdmin = (ConfigurationAdmin) tracker.getService();
        assertNotNull(configAdmin);
       
        // ManagedService operations
       
View Full Code Here

        ProvisioningServiceMBean mbean = getMBean(ProvisioningServiceMBean.OBJECTNAME, ProvisioningServiceMBean.class);
        assertNotNull(mbean);
       
        ServiceTracker tracker = new ServiceTracker(bundleContext, ProvisioningService.class.getName(), null);
        tracker.open();
        ProvisioningService ps = (ProvisioningService) tracker.getService();
        assertNotNull(ps);
       
        Dictionary<String, Object> info;
       
View Full Code Here

    protected void waitForServices(Bundle b, String sclass) {
    try {
      BundleContext bc = b.getBundleContext();
        String bsn = b.getSymbolicName();
      ServiceTracker st = new ServiceTracker(bc, sclass, null);
        st.open();
        Object bac = st.waitForService(DEFAULT_TIMEOUT);
      /* Uncomment for debug */
      /*
      if(bac == null) {
        System.out.println("SERVICE NOTFOUND " + bsn);
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.