Examples of ServiceTracker


Examples of org.osgi.util.tracker.ServiceTracker

        .createFilter("(&" +
                      "(" + CommandProcessor.COMMAND_SCOPE + "=*)" +
                      "(" + CommandProcessor.COMMAND_FUNCTION + "=*)" +
                      ")");
     
      cpTracker = new ServiceTracker(Activator.bc,
                                     filter,
                                     null);
      cpTracker.open();
    } catch (Exception e) {
      throw new RuntimeException("Failed to init command provider tracker " + e);
    }
    convTracker = new ServiceTracker(Activator.bc,
                                     Converter.class.getName(),
                                     null);
    convTracker.open();
  }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

  Test6(BundleContext bc) {
    this.bc = bc;
  }
 
  public void prepare() {
    tracker = new ServiceTracker(bc, Control.class.getName(), null);
    tracker.open();
  }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

            }

        } else // secure case, can not create socket by myself, need to get
                // service
        {
            securityTracker = new ServiceTracker(this.bc,
                    "javax.net.ssl.SSLServerSocketFactory", this);
            securityTracker.open();
        }
    }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

        if (!httpConfig.isSecure()) {
            uninit();

        } else {
            ServiceTracker tempTr = this.securityTracker;
            this.securityTracker = null;
            if (tempTr != null) {
                try {
                    tempTr.close();

                } catch (Exception excpt) {
                }
            }
        }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

  static BundleContext bc;
  ServiceTracker cmdTracker;
  public void start(BundleContext bc) throws Exception {
    this.bc = bc;   
   
    cmdTracker = new ServiceTracker(bc,
                                    CommandGroup.class.getName(),
                                    cmdTrackerCustomizer);   

    cmdTracker.open();
  }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

            resolver = resolver.substring(1, resolver.length() - 1);
            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);
                } else {
                    LOGGER.debug("Optional resolver '" + resolver + "' not found, using the default resolver");
                    return feature.getBundles();
                }
            } else {
                Resolver r = (Resolver) tracker.waitForService(resolverTimeout);
                if (r == null) {
                    throw new Exception("Unable to find required resolver '" + resolver + "'");
                }
                return r.resolve(feature);
            }
        } finally {
            tracker.close();
        }
    }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

    private Map<String, ServiceRegistration> registrationMap = Maps.newConcurrentMap();

    public void start(final BundleContext context) throws Exception {
        registerChefServiceFactory(context);
        //We use the system bundle context to avoid issues with InvalidBundleContext.
        chefServiceTracker = new ServiceTracker(context.getBundle(0).getBundleContext(), ChefService.class.getName(), null) {
            @Override
            public Object addingService(ServiceReference reference) {
                Object obj =  super.addingService(reference);
                if (ChefService.class.isAssignableFrom(obj.getClass())) {
                    String serviceId =  String.valueOf(reference.getProperty(Constants.SERVICE_ID));
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

     *             the code
     */
    public InventoryPrinterManagerImpl(final BundleContext btx) throws InvalidSyntaxException
    {
        this.bundleContext = btx;
        this.cfgPrinterTracker = new ServiceTracker(this.bundleContext, InventoryPrinter.SERVICE, this);
        this.cfgPrinterTracker.open();

        final Dictionary props = new Hashtable();
        props.put(ConsoleConstants.PLUGIN_LABEL, ConsoleConstants.NAME);
        props.put(ConsoleConstants.PLUGIN_TITLE, ConsoleConstants.TITLE);
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

    /**
     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
     */
    public void start(final BundleContext context) throws Exception
    {
        this.logServiceTracker = new ServiceTracker(context, "org.osgi.service.log.LogService", null)
        {
            public Object addingService(ServiceReference reference)
            {
                Activator.logService = super.addingService(reference);
                return Activator.logService;
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

        context.registerService(Workspace.class.getName(), new WorkspaceServiceFactory(), props);
    }

    private void registerWorkspaceURLHandler(BundleContext context) {
        workspaceTracker = new ServiceTracker(context, IWorkspace.class.getName(), null);
        workspaceTracker.open();

        Dictionary<String,Object> props = new Hashtable<String,Object>();
        props.put(URLConstants.URL_HANDLER_PROTOCOL, new String[] {
            WorkspaceURLStreamHandlerService.PROTOCOL
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.