com.buglabs.application
Class AbstractServiceTracker

java.lang.Object
  extended by com.buglabs.application.AbstractServiceTracker
All Implemented Interfaces:
IServiceProvider
Direct Known Subclasses:
SewingServiceTracker, TestSuiteServiceTracker, TestSuiteServiceTracker, TestSuiteServiceTracker

public abstract class AbstractServiceTracker
extends java.lang.Object
implements IServiceProvider

Service tracker for the BugApplication Bundle;


Field Summary
protected  BundleContext context
           
protected  java.util.List services
           
 
Constructor Summary
AbstractServiceTracker(BundleContext context)
           
 
Method Summary
 java.lang.Object addingService(ServiceReference reference)
          Used by OSGi to signal that a service was added.
protected  void addServiceFilters(java.lang.String serviceName, java.lang.String[][] properties)
          Helps set up the serviceProperties map created to make generated code simpler
protected  boolean canStart()
          Determines if the application can be started.
abstract  void doStart()
          Invoked when all services have been registered.
abstract  void doStop()
          Invoked when a service is unregistered.
 BundleContext getBundleContext()
           
 java.lang.Object getService(java.lang.Class clazz)
          Helper method to retrieve a service of type class.
 java.util.SortedMap getServicePropertiesMap()
          returns the map of services and properties that represent the service dependencies for this tracker the map, in pseudo-generic code, is: Map>
 java.util.List getServices()
          Used to retrieve a list of qualified service names.
 boolean hasStarted()
           
 void initServices()
          Implementations should add services of interest
 void modifiedService(ServiceReference reference, java.lang.Object service)
           
 void removedService(ServiceReference reference, java.lang.Object service)
          Used by OSGi to signal that a service was removed.
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected BundleContext context

services

protected java.util.List services
Constructor Detail

AbstractServiceTracker

public AbstractServiceTracker(BundleContext context)
Method Detail

doStart

public abstract void doStart()
Invoked when all services have been registered.


doStop

public abstract void doStop()
Invoked when a service is unregistered.


initServices

public void initServices()
Implementations should add services of interest


addingService

public java.lang.Object addingService(ServiceReference reference)
Used by OSGi to signal that a service was added.


modifiedService

public void modifiedService(ServiceReference reference,
                            java.lang.Object service)

removedService

public void removedService(ServiceReference reference,
                           java.lang.Object service)
Used by OSGi to signal that a service was removed.


canStart

protected boolean canStart()
Determines if the application can be started.


getService

public java.lang.Object getService(java.lang.Class clazz)
Helper method to retrieve a service of type class.

Specified by:
getService in interface IServiceProvider
Returns:
A reference to the instance of the available service.

addServiceFilters

protected final void addServiceFilters(java.lang.String serviceName,
                                       java.lang.String[][] properties)
Helps set up the serviceProperties map created to make generated code simpler

Parameters:
serviceName -
properties -

getServicePropertiesMap

public final java.util.SortedMap getServicePropertiesMap()
returns the map of services and properties that represent the service dependencies for this tracker the map, in pseudo-generic code, is: Map>

Returns:

getServices

public java.util.List getServices()
Used to retrieve a list of qualified service names. If you want your application to depend on another service, simply add the fully qualified name of the service to this list.

Returns:
a list of Strings containing the fully qualified name of each service.

getBundleContext

public BundleContext getBundleContext()

hasStarted

public boolean hasStarted()

stop

public void stop()