org.jboss.osgi.deployment.interceptor
Class AbstractLifecycleInterceptorService

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

public abstract class AbstractLifecycleInterceptorService
extends Object
implements LifecycleInterceptorService, org.osgi.framework.ServiceListener

A basic service that manages bundle lifecycle interceptors.

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

Constructor Summary
protected AbstractLifecycleInterceptorService(org.osgi.framework.BundleContext context)
           
 
Method Summary
protected  void addInterceptor(LifecycleInterceptor interceptor)
          Add a LifecycleInterceptor to the service.
protected  List<LifecycleInterceptor> getInterceptorChain()
           
protected abstract  InvocationContext getInvocationContext(org.osgi.framework.Bundle bundle)
          Get the InvocationContext for the given bundle.
 org.osgi.framework.BundleContext getSystemContext()
           
 void handleStateChange(int state, org.osgi.framework.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(org.osgi.framework.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(org.osgi.framework.BundleContext context)
Method Detail

getSystemContext

public org.osgi.framework.BundleContext getSystemContext()

serviceChanged

public void serviceChanged(org.osgi.framework.ServiceEvent event)
Specified by:
serviceChanged in interface org.osgi.framework.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,
                              org.osgi.framework.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(org.osgi.framework.Bundle bundle)
Get the InvocationContext for the given bundle.



Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.