org.osgi.util.tracker.ServiceTracker Java Examples

The following examples show how to use org.osgi.util.tracker.ServiceTracker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Activator.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 * @param context
 * @throws Exception
 */
public void start(BundleContext context) throws Exception {
	plugin = this;
	bundleContext = context;
	// tracker the open office converter service
	String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, OpenOffice2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_POSITIVE)).toString();
	positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter),
			new OpenOfficePositiveCustomizer());
	positiveTracker.open();

	String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xliff2OpenOffice.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_REVERSE)).toString();
	reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter),
			new OpenOfficeReverseCustomize());
	reverseTracker.open();
}
 
Example #2
Source File: FilterTracker.java    From packagedrone with Eclipse Public License 1.0 6 votes vote down vote up
public FilterTracker ( final BundleContext context )
{
    this.context = context;

    this.tracker = new ServiceTracker<> ( context, Filter.class, new ServiceTrackerCustomizer<Filter, TrackedFilter> () {

        @Override
        public TrackedFilter addingService ( final ServiceReference<Filter> reference )
        {
            return addFilter ( reference );
        }

        @Override
        public void modifiedService ( final ServiceReference<Filter> reference, final TrackedFilter service )
        {
        }

        @Override
        public void removedService ( final ServiceReference<Filter> reference, final TrackedFilter service )
        {
            service.dispose ();
            FilterTracker.this.filters = null; // reset cache
        }
    } );
}
 
Example #3
Source File: DirDeployerImpl.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public DirDeployerImpl()
  {
//    logTracker =
//      new ServiceTracker<LogService, LogService>(Activator.bc,
//                                                 LogService.class, null);
//    logTracker.open();

    caTracker =
      new ServiceTracker<ConfigurationAdmin, ConfigurationAdmin>(
                                                                 Activator.bc,
                                                                 ConfigurationAdmin.class,
                                                                 null);
    caTracker.open();

    // create and register the configuration class
    config = new Config();
  }
 
Example #4
Source File: Activator.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 * @param context
 * @throws Exception
 */
public void start(BundleContext context) throws Exception {
	plugin = this;
	bundleContext = context;
	// tracker the xml converter service
	String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_POSITIVE)).toString();
	positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer());
	positiveTracker.open();

	String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_REVERSE)).toString();
	reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize());
	reverseTracker.open();
}
 
Example #5
Source File: OsgiConfigurationServiceImpl.java    From publick-sling-blog with Apache License 2.0 6 votes vote down vote up
/**
 * Wait for an OSGi service to become active.
 *
 * @param serviceImpl The service implementation class
 * @param timeout The length of time to wait for the service
 */
private void waitForService(Class serviceImpl, long timeout) {
    Class serviceInterface = serviceImpl.getInterfaces()[0];
    BundleContext bundleContext = FrameworkUtil.getBundle(serviceInterface).getBundleContext();
    ServiceReference factoryRef = bundleContext.getServiceReference(serviceInterface.getName());

    ServiceTracker serviceTracker = new ServiceTracker(bundleContext, factoryRef, null);
    serviceTracker.open();

    try {
        serviceTracker.waitForService(timeout);
    } catch (InterruptedException e) {
        LOGGER.error("Could not get service", e);
    }

    serviceTracker.close();
}
 
Example #6
Source File: Activator.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 * @param context
 * @throws Exception
 */
public void start(BundleContext context) throws Exception {
	plugin = this;
	bundleContext = context;
	// tracker the xml converter service
	String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_POSITIVE)).toString();
	positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer());
	positiveTracker.open();

	String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_REVERSE)).toString();
	reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize());
	reverseTracker.open();

}
 
Example #7
Source File: CommandTty.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void start(BundleContext bc) throws Exception {
  this.bc = bc;

  log(LogService.LOG_INFO, "Starting");

  // Get config
  Dictionary<String,String> p = new Hashtable<String,String>();
  p.put(Constants.SERVICE_PID, getClass().getName());
  bc.registerService(ManagedService.class, this, p);

  inStream  = new SystemIn(bc);
  outStream = System.out;
  errStream = System.err;

  cmdProcTracker = new ServiceTracker(bc, CommandProcessor.class, this);
  cmdProcTracker.open();

  logTracker = new ServiceTracker(bc, LogService.class, null);
  logTracker.open();

}
 
Example #8
Source File: ScriptMonitor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public ScriptMonitor ( final String id, final String factoryId, final Executor executor, final BundleContext context, final Interner<String> stringInterner, final EventProcessor eventProcessor, final ObjectPoolTracker<DataSource> dataSourcePoolTracker, final ObjectPoolTracker<MasterItem> masterItemPoolTracker, final ServiceTracker<ConfigurationAdministrator, ConfigurationAdministrator> caTracker )
{
    super ( id, factoryId, executor, context, stringInterner, eventProcessor );
    this.executor = executor;

    this.prefix = stringInterner.intern ( factoryId + ". " + id ); //$NON-NLS-1$

    this.classLoader = getClass ().getClassLoader ();

    this.monitorStateInjector = new MonitorStateInjector ( stringInterner );
    this.monitorStateInjector.setPrefix ( this.prefix );

    this.handler = new InjectMasterHandler ( id, masterItemPoolTracker, 0, caTracker, this.prefix, factoryId );
    this.listener = new MultiDataSourceListener ( dataSourcePoolTracker ) {

        @Override
        protected void handleChange ( final Map<String, DataSourceHandler> sources )
        {
            ScriptMonitor.this.handleChange ( sources );
        }
    };
}
 
Example #9
Source File: Activator.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 * @param context
 * @throws Exception
 */
public void start(BundleContext context) throws Exception {
	plugin = this;
	bundleContext = context;
	// tracker the xml converter service
	String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_POSITIVE)).toString();
	positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer());
	positiveTracker.open();

	String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_REVERSE)).toString();
	reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize());
	reverseTracker.open();
}
 
Example #10
Source File: Activator.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 * @param context
 * @throws Exception
 */
public void start(BundleContext context) throws Exception {
	plugin = this;
	bundleContext = context;
	// tracker the xml converter service
	String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_POSITIVE)).toString();
	positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer());
	positiveTracker.open();

	String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_REVERSE)).toString();
	reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize());
	reverseTracker.open();
}
 
Example #11
Source File: Activator.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void start(BundleContext _bc)
{
  Activator.bc = _bc;
  Activator.log = new LogRef(bc);

  mtsTracker =
    new ServiceTracker<MetaTypeService, MetaTypeService>(
                                                         bc,
                                                         MetaTypeService.class,
                                                         null);
  mtsTracker.open();

  // bundle displayers
  disp = new CMDisplayer(bc);
  disp.open();
  disp.register();
}
 
Example #12
Source File: CommandProvidersService.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void open() {
  try {
    Filter filter =  Activator.bc
      .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();
}
 
Example #13
Source File: Activator.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 * @param context
 * @throws Exception
 */
public void start(BundleContext context) throws Exception {
	plugin = this;
	bundleContext = context;
	// tracker the xml converter service
	String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_POSITIVE)).toString();
	positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer());
	positiveTracker.open();

	String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()),
			new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION,
					Converter.DIRECTION_REVERSE)).toString();
	reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize());
	reverseTracker.open();
}
 
Example #14
Source File: MethodWalker.java    From peer-os with Apache License 2.0 5 votes vote down vote up
public MethodWalker( final Logger logger )
{
    BundleContext ctx = FrameworkUtil.getBundle( this.getClass() ).getBundleContext();
    serviceTracker = new ServiceTracker<>( ctx, RelationManager.class, null );
    serviceTracker.open();
    this.logger = logger;
}
 
Example #15
Source File: ExtensionList.java    From concierge with Eclipse Public License 1.0 5 votes vote down vote up
public ExtensionList(
		ServiceTracker<RestApiExtension, Class<? extends ServerResource>> tracker) {
	final ServiceReference<RestApiExtension>[] refs = tracker
			.getServiceReferences();
	if (refs != null) {
		for (final ServiceReference<RestApiExtension> ref : refs) {
			add(new ExtensionPojo(
					(String) ref.getProperty(RestApiExtension.NAME),
					(String) ref.getProperty(RestApiExtension.URI_PATH)));
		}
	}
}
 
Example #16
Source File: WebExtenderProcessor.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
public WebExtenderProcessor ( final BundleContext context )
{
    this.context = context;

    this.tracker = new ServiceTracker<> ( context, WebExtender.class, this.customizer );
    this.tracker.open ();
}
 
Example #17
Source File: KarafTestSupport.java    From mobi with GNU Affero General Public License v3.0 5 votes vote down vote up
protected void waitForService(String filter, long timeout) throws InvalidSyntaxException, InterruptedException {
    ServiceTracker st = new ServiceTracker(bundleContext, bundleContext.createFilter(filter), null);
    try {
        st.open();
        st.waitForService(timeout);
    } finally {
        st.close();
    }
}
 
Example #18
Source File: EventHandlerTracker.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public EventHandlerTracker(BundleContext bc)
{
  this.bc = bc;
  tracker = new ServiceTracker<EventHandler, TrackedEventHandler>(
                                                                  bc,
                                                                  EventHandler.class,
                                                                  this);
}
 
Example #19
Source File: ImportController.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
public void start ()
{
    final BundleContext context = FrameworkUtil.getBundle ( ImportController.class ).getBundleContext ();

    this.tracker = new ServiceTracker<> ( context, Importer.class, this.customizer );
    this.tracker.open ();

    this.impManager = new ImportManager ( context, this.jobManager );
}
 
Example #20
Source File: CppcheclipsePlugin.java    From cppcheclipse with Apache License 2.0 5 votes vote down vote up
public synchronized void start(BundleContext context) throws Exception {
	super.start(context);
	plugin = this;
	// don't create new threads in here, otherwise class-loading can be delayed by 5 seconds (if the class is not local)
	// see EclipseLazyStarter.postFindLocalClass(String, Class, ClasspathManager) line: 111	
	profile = null;
	
	binaryPathChangeListeners = new CopyOnWriteArrayList<IPropertyChangeListener>();
	
	tracker = new ServiceTracker(context, IHttpClientService.class.getName(), null);
	tracker.open();
}
 
Example #21
Source File: YumServlet.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init () throws ServletException
{
    super.init ();

    final BundleContext context = FrameworkUtil.getBundle ( getClass () ).getBundleContext ();
    this.sitePrefixTracker = new ServiceTracker<> ( context, SitePrefixService.class, null );
    this.sitePrefixTracker.open ();
}
 
Example #22
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void start ( final BundleContext context ) throws Exception
{
    this.context = context;

    this.injector = new EventInjectorQueue ( context );

    this.httpServiceTracker = new ServiceTracker<HttpService, HttpService> ( context, HttpService.class, createHttpServiceTrackerCustomizer () );
    this.httpServiceTracker.open ();
}
 
Example #23
Source File: Activator.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
private ServiceTracker<IPreferencesService, IPreferencesService> getPrefTracker() {
	if (prefTracker != null)
		return prefTracker;
	// lazy init if the bundle has been started
	if (bundleContext == null)
		return null;
	prefTracker = new ServiceTracker<IPreferencesService, IPreferencesService>(bundleContext, IPreferencesService.class, null);
	prefTracker.open();
	return prefTracker;
}
 
Example #24
Source File: EventHandlerFactoryTracker.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public EventHandlerFactoryTracker ( final BundleContext context, final Listener listener )
{
    this.context = context;
    this.listener = listener;
    this.tracker = new ServiceTracker<EventHandlerFactory, EventHandlerFactory> ( context, EventHandlerFactory.class, this.customizer );
    this.tracker.open ();
}
 
Example #25
Source File: AbstractCommandProvider.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * This constructor is responsible for creation and opening a tracker for {@link Parser} services.
 *
 * @param context is the {@link BundleContext}, used for creating a tracker for {@link Parser} services.
 */
@SuppressWarnings("unchecked")
public AbstractCommandProvider(BundleContext context) {
    this.bundleContext = context;
    parserTracker = new ServiceTracker(context, Parser.class.getName(), this);
    parserTracker.open();
}
 
Example #26
Source File: OsgiLogManager.java    From vespa with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void install(final BundleContext osgiContext) {
    if (tracker != null) {
        throw new IllegalStateException("OsgiLogManager already installed.");
    }
    tracker = new ServiceTracker<>(osgiContext, LogService.class, new ServiceTrackerCustomizer<LogService,LogService>() {

        @Override
        public LogService addingService(ServiceReference<LogService> reference) {
            LogService service = osgiContext.getService(reference);
            services.add(service);
            return service;
        }

        @Override
        public void modifiedService(ServiceReference<LogService> reference, LogService service) {

        }

        @Override
        public void removedService(ServiceReference<LogService> reference, LogService service) {
            services.remove(service);
        }
    });
    tracker.open();
    synchronized (globalLock) {
        Logger root = Logger.getLogger("");
        if (configureLogLevel) {
            root.setLevel(Level.ALL);
        }
        for (Handler handler : root.getHandlers()) {
            root.removeHandler(handler);
        }
        root.addHandler(new OsgiLogHandler(this));
    }
}
 
Example #27
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void start ( final BundleContext bundleContext ) throws Exception
{
    Activator.context = bundleContext;

    this.stringInterner = InternerHelper.makeInterner ( "org.eclipse.scada.ae.monitor.datasource.common.stringInternerType", "strong" );

    this.executor = new ExportedExecutorService ( bundleContext.getBundle ().getSymbolicName (), 1, 1, 1, TimeUnit.MINUTES );

    this.eventProcessor = new EventProcessor ( context );
    this.eventProcessor.open ();

    this.dataSourcePoolTracker = new ObjectPoolTracker<DataSource> ( context, DataSource.class );
    this.dataSourcePoolTracker.open ();

    this.masterItemPoolTracker = new ObjectPoolTracker<MasterItem> ( context, MasterItem.class );
    this.masterItemPoolTracker.open ();

    this.configAdminTracker = new ServiceTracker<ConfigurationAdministrator, ConfigurationAdministrator> ( context, ConfigurationAdministrator.class, null );
    this.configAdminTracker.open ();

    this.monitorServicePool = new ObjectPoolImpl<MonitorService> ();
    this.monitorServicePoolHandler = ObjectPoolHelper.registerObjectPool ( context, this.monitorServicePool, MonitorService.class );

    this.factory = new ScriptMonitorFactory ( bundleContext, this.executor, this.stringInterner, this.eventProcessor, this.dataSourcePoolTracker, this.masterItemPoolTracker, this.configAdminTracker, this.monitorServicePool );

    final Hashtable<String, Object> properties = new Hashtable<String, Object> ();
    properties.put ( ConfigurationAdministrator.FACTORY_ID, ScriptMonitorFactory.FACTORY_ID );
    properties.put ( Constants.SERVICE_DESCRIPTION, "Script monitor" );
    context.registerService ( new String[] { ConfigurationFactory.class.getName () }, this.factory, properties );
}
 
Example #28
Source File: Activator.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void start(BundleContext bc) {
  this.bc = bc;

  logTracker = new ServiceTracker(bc, LogService.class.getName(), null);
  logTracker.open();

  // Create serial port reader
  serial = new SerialPortDevice(this, true);
  String device = bc.getProperty("org.knopflerfish.example.rxtx_echo.device");
  if (device == null) {
    device = "S0";
  }
  serial.open(device);
}
 
Example #29
Source File: ResolverHooks.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
synchronized void open() {
  if (fwCtx.debug.hooks) {
    fwCtx.debug.println("Begin Tracking Resolver Hooks");
  }
  
  resolverHookTracker = new ServiceTracker<ResolverHookFactory, TrackedResolverHookFactory>(
      (BundleContext) fwCtx.systemBundle.bundleContext, ResolverHookFactory.class,
      new ServiceTrackerCustomizer<ResolverHookFactory, TrackedResolverHookFactory>() {
        public TrackedResolverHookFactory addingService(
            ServiceReference<ResolverHookFactory> reference) {
          return new TrackedResolverHookFactory(
              (ResolverHookFactory) fwCtx.systemBundle.bundleContext
                  .getService(reference), reference.getBundle());
        }

        public void modifiedService(ServiceReference<ResolverHookFactory> reference,
            TrackedResolverHookFactory service) {

        }

        public void removedService(ServiceReference<ResolverHookFactory> reference,
            TrackedResolverHookFactory service) {
          service.resetResolverHook();
        }
      });

  resolverHookTracker.open();
}
 
Example #30
Source File: TestHelper.java    From aries-jax-rs-whiteboard with Apache License 2.0 5 votes vote down vote up
@Before
public void before() {
    _clientBuilderTracker = new ServiceTracker<>(
        bundleContext, ClientBuilder.class, null);

    _clientBuilderTracker.open();

    _configurationAdminTracker = new ServiceTracker<>(
        bundleContext, ConfigurationAdmin.class, null);

    _configurationAdminTracker.open();

    _sseEventSourceFactoryTracker = new ServiceTracker<>(
        bundleContext, SseEventSourceFactory.class, null);

    _sseEventSourceFactoryTracker.open();

    _runtimeTracker = new ServiceTracker<>(
        bundleContext, JaxrsServiceRuntime.class, null);

    _runtimeTracker.open();

    try {
        _runtime = _runtimeTracker.waitForService(15000L);
    }
    catch (InterruptedException e) {
        throw new RuntimeException(e);
    }

    _runtimeServiceReference = _runtimeTracker.getServiceReference();
}