org.objectweb.easybeans.naming.interceptors
Class TomcatENCInterceptor

java.lang.Object
  extended by org.objectweb.easybeans.naming.interceptors.TomcatENCInterceptor
All Implemented Interfaces:
EasyBeansInterceptor, NamingInterceptor

public class TomcatENCInterceptor
extends java.lang.Object
implements NamingInterceptor

Interceptor used when EasyBeans is integrated in Tomcat. As the java: namespace is managed by Tomcat, EasyBeans needs to call Tomcat objects in order to set java: context.

Author:
Florent Benoit

Field Summary
private static java.lang.reflect.Method bindContextMethod
          Method used to bind the component context for the current thread on the Tomcat naming.
private static java.lang.reflect.Method bindThreadMethod
          Method used to bind the name associated to a component context for the current thread on the Tomcat naming.
private static java.lang.reflect.Method getThreadNameMethod
          Method used to get the context's name associated to the current thread on the Tomcat naming.
protected static java.lang.String TOMCAT_NAMING_CLASS
          Tomcat's class for naming.
private static java.lang.reflect.Method unbindContextMethod
          Method used to unbind the component context for the current thread on the Tomcat naming.
private static java.lang.reflect.Method unbindThreadMethod
          Method used to unbind the name associated to a context for the current thread on the Tomcat naming.
 
Constructor Summary
TomcatENCInterceptor()
          Default constructor.
 
Method Summary
 void initContext(java.lang.String id, javax.naming.Context context)
          Init the context for the given name.
 java.lang.Object intercept(EasyBeansInvocationContext invocationContext)
          Sets JOnAS ENC context.
 void removeContext(java.lang.String id)
          Remove the context associated to a given id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOMCAT_NAMING_CLASS

protected static final java.lang.String TOMCAT_NAMING_CLASS
Tomcat's class for naming.

See Also:
Constant Field Values

bindThreadMethod

private static java.lang.reflect.Method bindThreadMethod
Method used to bind the name associated to a component context for the current thread on the Tomcat naming.


getThreadNameMethod

private static java.lang.reflect.Method getThreadNameMethod
Method used to get the context's name associated to the current thread on the Tomcat naming.


unbindThreadMethod

private static java.lang.reflect.Method unbindThreadMethod
Method used to unbind the name associated to a context for the current thread on the Tomcat naming.


bindContextMethod

private static java.lang.reflect.Method bindContextMethod
Method used to bind the component context for the current thread on the Tomcat naming.


unbindContextMethod

private static java.lang.reflect.Method unbindContextMethod
Method used to unbind the component context for the current thread on the Tomcat naming.

Constructor Detail

TomcatENCInterceptor

public TomcatENCInterceptor()
Default constructor. Gets a reference on the tomcat's naming methods

Method Detail

intercept

public java.lang.Object intercept(EasyBeansInvocationContext invocationContext)
                           throws java.lang.Exception
Sets JOnAS ENC context.

Specified by:
intercept in interface EasyBeansInterceptor
Parameters:
invocationContext - context with useful attributes on the current invocation.
Returns:
result of the next invocation (to chain interceptors).
Throws:
java.lang.Exception - needs for signature of interceptor.

initContext

public void initContext(java.lang.String id,
                        javax.naming.Context context)
Init the context for the given name.

Specified by:
initContext in interface NamingInterceptor
Parameters:
id - the id.
context - the context associated to a factory's id.

removeContext

public void removeContext(java.lang.String id)
Remove the context associated to a given id.

Specified by:
removeContext in interface NamingInterceptor
Parameters:
id - the id.