类 AbstractSlsbInvokerInterceptor
- java.lang.Object
- org.springframework.jndi.JndiAccessor
- org.springframework.jndi.JndiLocatorSupport
- org.springframework.jndi.JndiObjectLocator
- org.springframework.ejb.access.AbstractSlsbInvokerInterceptor
- 所有已实现的接口:
Advice
,Interceptor
,MethodInterceptor
,InitializingBean
public abstract class AbstractSlsbInvokerInterceptor extends JndiObjectLocator implements MethodInterceptor
Base class for AOP interceptors invoking local or remote Stateless Session Beans. Designed for EJB 2.x, but works for EJB 3 Session Beans as well.Such an interceptor must be the last interceptor in the advice chain. In this case, there is no direct target object: The call is handled in a special way, getting executed on an EJB instance retrieved via an EJB home.
- 作者:
- Rod Johnson, Juergen Hoeller
字段概要
从类继承的字段 org.springframework.jndi.JndiLocatorSupport
CONTAINER_PREFIX
从类继承的字段 org.springframework.jndi.JndiAccessor
logger
构造器概要
构造器 构造器 说明 AbstractSlsbInvokerInterceptor()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Fetches EJB home on startup, if necessary.protected Object
create()
Invokes thecreate()
method on the cached EJB home object.protected Method
getCreateMethod(Object home)
Determine the create method of the given EJB home object.protected Object
getHome()
Return the EJB home object to use.Object
invoke(MethodInvocation invocation)
Prepares the thread context if necessar, and delegates toinvokeInContext(org.aopalliance.intercept.MethodInvocation)
.protected abstract Object
invokeInContext(MethodInvocation invocation)
Perform the given invocation on the current EJB home, within the thread context being prepared accordingly.protected boolean
isHomeRefreshable()
Return whether the cached EJB home object is potentially subject to on-demand refreshing.protected void
refreshHome()
Refresh the cached home object, if applicable.void
setCacheHome(boolean cacheHome)
Set whether to cache the EJB home object once it has been located.void
setExposeAccessContext(boolean exposeAccessContext)
Set whether to expose the JNDI environment context for all access to the target EJB, i.e. for all method invocations on the exposed object reference.void
setLookupHomeOnStartup(boolean lookupHomeOnStartup)
Set whether to look up the EJB home object on startup.从类继承的方法 org.springframework.jndi.JndiObjectLocator
getExpectedType, getJndiName, lookup, setExpectedType, setJndiName
从类继承的方法 org.springframework.jndi.JndiLocatorSupport
convertJndiName, isResourceRef, lookup, lookup, setResourceRef
从类继承的方法 org.springframework.jndi.JndiAccessor
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
构造器详细资料
AbstractSlsbInvokerInterceptor
public AbstractSlsbInvokerInterceptor()
方法详细资料
setLookupHomeOnStartup
public void setLookupHomeOnStartup(boolean lookupHomeOnStartup)
Set whether to look up the EJB home object on startup. Default is "true".Can be turned off to allow for late start of the EJB server. In this case, the EJB home object will be fetched on first access.
setCacheHome
public void setCacheHome(boolean cacheHome)
Set whether to cache the EJB home object once it has been located. Default is "true".Can be turned off to allow for hot restart of the EJB server. In this case, the EJB home object will be fetched for each invocation.
setExposeAccessContext
public void setExposeAccessContext(boolean exposeAccessContext)
Set whether to expose the JNDI environment context for all access to the target EJB, i.e. for all method invocations on the exposed object reference.Default is "false", i.e. to only expose the JNDI context for object lookup. Switch this flag to "true" in order to expose the JNDI environment (including the authorization context) for each EJB invocation, as needed by WebLogic for EJBs with authorization requirements.
afterPropertiesSet
public void afterPropertiesSet() throws NamingException
Fetches EJB home on startup, if necessary.
refreshHome
protected void refreshHome() throws NamingException
Refresh the cached home object, if applicable. Also caches the create method on the home object.- 抛出:
NamingException
- if thrown by the JNDI lookup- 另请参阅:
JndiObjectLocator.lookup()
,getCreateMethod(java.lang.Object)
getCreateMethod
protected Method getCreateMethod(Object home) throws EjbAccessException
Determine the create method of the given EJB home object.- 参数:
home
- the EJB home object- 返回:
- the create method
- 抛出:
EjbAccessException
- if the method couldn't be retrieved
getHome
protected Object getHome() throws NamingException
Return the EJB home object to use. Called for each invocation.Default implementation returns the home created on initialization, if any; else, it invokes lookup to get a new proxy for each invocation.
Can be overridden in subclasses, for example to cache a home object for a given amount of time before recreating it, or to test the home object whether it is still alive.
- 返回:
- the EJB home object to use for an invocation
- 抛出:
NamingException
- if proxy creation failed- 另请参阅:
JndiObjectLocator.lookup()
,getCreateMethod(java.lang.Object)
isHomeRefreshable
protected boolean isHomeRefreshable()
Return whether the cached EJB home object is potentially subject to on-demand refreshing. Default is "false".
invoke
public Object invoke(MethodInvocation invocation) throws Throwable
Prepares the thread context if necessar, and delegates toinvokeInContext(org.aopalliance.intercept.MethodInvocation)
.- 指定者:
invoke
在接口中MethodInterceptor
- 参数:
invocation
- the method invocation joinpoint- 返回:
- the result of the call to
Joinpoint.proceed()
; might be intercepted by the interceptor - 抛出:
Throwable
- if the interceptors or the target object throws an exception
invokeInContext
protected abstract Object invokeInContext(MethodInvocation invocation) throws Throwable
Perform the given invocation on the current EJB home, within the thread context being prepared accordingly. Template method to be implemented by subclasses.- 参数:
invocation
- the AOP method invocation- 返回:
- the invocation result, if any
- 抛出:
Throwable
- in case of invocation failure
create
protected Object create() throws NamingException, InvocationTargetException
Invokes thecreate()
method on the cached EJB home object.- 返回:
- a new EJBObject or EJBLocalObject
- 抛出:
NamingException
- if thrown by JNDIInvocationTargetException
- if thrown by the create method