com.buglabs.application
Class AbstractServiceTracker

java.lang.Object
  extended by com.buglabs.application.AbstractServiceTracker
All Implemented Interfaces:
IServiceProvider, ServiceTrackerCustomizer

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

Service tracker for the BugApplication Bundle;


Constructor Summary
AbstractServiceTracker(org.osgi.framework.BundleContext context)
           
 
Method Summary
 java.lang.Object addingService(org.osgi.framework.ServiceReference reference)
          Used by OSGi to signal that a service was added.
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.
 org.osgi.framework.BundleContext getBundleContext()
           
 java.lang.Object getService(java.lang.Class clazz)
          Helper method to retrieve a service of type class.
 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(org.osgi.framework.ServiceReference reference, java.lang.Object service)
          A service tracked by the ServiceTracker object has been modified.
 void removedService(org.osgi.framework.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
 

Constructor Detail

AbstractServiceTracker

public AbstractServiceTracker(org.osgi.framework.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(org.osgi.framework.ServiceReference reference)
Used by OSGi to signal that a service was added.

Specified by:
addingService in interface ServiceTrackerCustomizer
Parameters:
reference - Reference to service being added to the ServiceTracker object.
Returns:
The service object to be tracked for the ServiceReference object or null if the ServiceReference object should not be tracked.

modifiedService

public void modifiedService(org.osgi.framework.ServiceReference reference,
                            java.lang.Object service)
Description copied from interface: ServiceTrackerCustomizer
A service tracked by the ServiceTracker object has been modified.

This method is called when a service being tracked by the ServiceTracker object has had it properties modified.

Specified by:
modifiedService in interface ServiceTrackerCustomizer
Parameters:
reference - Reference to service that has been modified.
service - The service object for the modified service.

removedService

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

Specified by:
removedService in interface ServiceTrackerCustomizer
Parameters:
reference - Reference to service that has been removed.
service - The service object for the removed service.

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

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 org.osgi.framework.BundleContext getBundleContext()

hasStarted

public boolean hasStarted()

stop

public void stop()