org.jboss.osgi.deployment.interceptor
Class AbstractLifecycleInterceptorService

java.lang.Object
  extended by org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService
All Implemented Interfaces:
EventListener, LifecycleInterceptorService, ServiceListener

public abstract class AbstractLifecycleInterceptorService
extends Object
implements LifecycleInterceptorService, ServiceListener

A basic service that manages bundle lifecycle interceptors.

Since:
15-Oct-2009
Author:
thomas.diesler@jboss.com

Constructor Summary
protected AbstractLifecycleInterceptorService(BundleContext context)
           
 
Method Summary
protected  void addInterceptor(LifecycleInterceptor interceptor)
          Add a LifecycleInterceptor to the service.
protected  List<LifecycleInterceptor> getInterceptorChain()
           
protected abstract  InvocationContext getInvocationContext(Bundle bundle)
          Get the InvocationContext for the given bundle.
 BundleContext getSystemContext()
           
 void handleStateChange(int state, Bundle bundle)
          Invoke the registered set of interceptors for the given bundle state change.
protected  void removeInterceptor(LifecycleInterceptor interceptor)
          Remove an LifecycleInterceptor to the service.
 void serviceChanged(ServiceEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLifecycleInterceptorService

protected AbstractLifecycleInterceptorService(BundleContext context)
Method Detail

getSystemContext

public BundleContext getSystemContext()

serviceChanged

public void serviceChanged(ServiceEvent event)
Specified by:
serviceChanged in interface ServiceListener

addInterceptor

protected void addInterceptor(LifecycleInterceptor interceptor)
Add a LifecycleInterceptor to the service. The interceptor is added according to its input requirements and relative order.

Parameters:
interceptor - The interceptor

removeInterceptor

protected void removeInterceptor(LifecycleInterceptor interceptor)
Remove an LifecycleInterceptor to the service.

Parameters:
interceptor - The interceptor

getInterceptorChain

protected List<LifecycleInterceptor> getInterceptorChain()

handleStateChange

public void handleStateChange(int state,
                              Bundle bundle)
Invoke the registered set of interceptors for the given bundle state change.

Specified by:
handleStateChange in interface LifecycleInterceptorService
Parameters:
state - The future state of the bundle
bundle - The bundle that changes state
Throws:
LifecycleInterceptorException - if the invocation of an interceptor fails

getInvocationContext

protected abstract InvocationContext getInvocationContext(Bundle bundle)
Get the InvocationContext for the given bundle.



Copyright © 2010. All Rights Reserved.