org.jboss.system
Class InterceptorServiceMBeanSupport

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.system.InterceptorServiceMBeanSupport
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, InterceptorServiceMBean, Service, ServiceMBean
Direct Known Subclasses:
SubDeployerInterceptorSupport

public abstract class InterceptorServiceMBeanSupport
extends ServiceMBeanSupport
implements InterceptorServiceMBean

Helper class that can be used for writing MBean Services that dynamically hook-up an Interceptor to other (X)MBeans that have been configured as Interceptable. In a nutshell, call attach()/detach() from your createService()/destroyService() or startService()/stopService() pair methods to attach/detach an interceptor to the target mbean(s), then override invoke() to do something with the invocations. You may also provide your own Interceptor, in which case you should call attach(Interceptor).

Version:
$Revision: 1.3.2.5 $
Author:
Dimitris Andreadis

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
InterceptorServiceMBeanSupport()
          Constructs an InterceptorServiceMBeanSupport.
InterceptorServiceMBeanSupport(Class type)
          Constructs an InterceptorServiceMBeanSupport.
InterceptorServiceMBeanSupport(org.jboss.logging.Logger log)
          Constructs an InterceptorServiceMBeanSupport.
InterceptorServiceMBeanSupport(String category)
          Constructs an InterceptorServiceMBeanSupport.
 
Method Summary
protected  void attach()
          Add our interceptor to the target Interceptables.
protected  void attach(org.jboss.mx.interceptor.Interceptor interceptor)
          Add the provided interceptor to the target Interceptables.
protected  void detach()
          Remove the interceptor from the target Interceptables
 List getInterceptables()
           
protected  Object invoke(org.jboss.mx.server.Invocation invocation)
          Override
protected  Object invokeNext(org.jboss.mx.server.Invocation invocation)
          Use this to forward the call
 void setInterceptables(List interceptables)
          The ObjectNames of the MBeans implementing the operations in the org.jboss.mx.server.Interceptable interface
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, startService, stop, stopService
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Constructor Detail

InterceptorServiceMBeanSupport

public InterceptorServiceMBeanSupport()
Constructs an InterceptorServiceMBeanSupport.


InterceptorServiceMBeanSupport

public InterceptorServiceMBeanSupport(Class type)
Constructs an InterceptorServiceMBeanSupport. Pass-through to ServiceMBeanSupport.

Parameters:
type - The class type to determine Logger name from.

InterceptorServiceMBeanSupport

public InterceptorServiceMBeanSupport(String category)
Constructs an InterceptorServiceMBeanSupport. Pass-through to ServiceMBeanSupport.

Parameters:
category - The logger category name.

InterceptorServiceMBeanSupport

public InterceptorServiceMBeanSupport(org.jboss.logging.Logger log)
Constructs an InterceptorServiceMBeanSupport. Pass-through to ServiceMBeanSupport.

Parameters:
log - The logger to use.
Method Detail

setInterceptables

public void setInterceptables(List interceptables)
Description copied from interface: InterceptorServiceMBean
The ObjectNames of the MBeans implementing the operations in the org.jboss.mx.server.Interceptable interface

Specified by:
setInterceptables in interface InterceptorServiceMBean

getInterceptables

public List getInterceptables()
Specified by:
getInterceptables in interface InterceptorServiceMBean

attach

protected void attach()
               throws Exception
Add our interceptor to the target Interceptables. Override invoke(Invocation) to handle the calls.

Throws:
Exception - thrown on any interceptor registration error

attach

protected void attach(org.jboss.mx.interceptor.Interceptor interceptor)
               throws Exception
Add the provided interceptor to the target Interceptables.

Parameters:
interceptor - the interceptor to add
Throws:
Exception - thrown on any interceptor registration error

detach

protected void detach()
Remove the interceptor from the target Interceptables


invokeNext

protected Object invokeNext(org.jboss.mx.server.Invocation invocation)
                     throws Throwable
Use this to forward the call

Throws:
Throwable

invoke

protected Object invoke(org.jboss.mx.server.Invocation invocation)
                 throws Throwable
Override

Throws:
Throwable


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.