org.ops4j.pax.swissbox.tracker
Class ReplaceableService<T>

java.lang.Object
  extended by org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle
      extended by org.ops4j.pax.swissbox.tracker.ReplaceableService<T>
All Implemented Interfaces:
Lifecycle

public class ReplaceableService<T>
extends AbstractLifecycle


Constructor Summary
ReplaceableService(org.osgi.framework.BundleContext context, java.lang.Class<T> serviceClass)
          Creates a new replaceable service without a listener.
ReplaceableService(org.osgi.framework.BundleContext context, java.lang.Class<T> serviceClass, ReplaceableServiceListener<T> listener)
          Creates a new replaceable service.
 
Method Summary
 T getService()
          Returne the current service.
protected  void onStart()
          Creates a service collection and starts it.
protected  void onStop()
          Stops the service collection and releases resources.
 
Methods inherited from class org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle
isStarted, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplaceableService

public ReplaceableService(org.osgi.framework.BundleContext context,
                          java.lang.Class<T> serviceClass)
Creates a new replaceable service without a listener.

Parameters:
context - bundle context
serviceClass - class of the replaceable service

ReplaceableService

public ReplaceableService(org.osgi.framework.BundleContext context,
                          java.lang.Class<T> serviceClass,
                          ReplaceableServiceListener<T> listener)
Creates a new replaceable service.

Parameters:
context - bundle context
serviceClass - class of the replaceable service
listener - a listener
Method Detail

getService

public T getService()
Returne the current service.

Returns:
the current service.

onStart

protected void onStart()
Creates a service collection and starts it.

Specified by:
onStart in class AbstractLifecycle
See Also:
AbstractLifecycle.onStart()

onStop

protected void onStop()
Stops the service collection and releases resources.

Specified by:
onStop in class AbstractLifecycle
See Also:
AbstractLifecycle.onStop()


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.