private void initDefaultInterceptors()
{
if (synchronize)
{
addInterceptor( new Interceptor( new SynchronizationInterceptor(), this ) );
}
if (
( getType().isEjb() && businessInterfaceHasAnnotation(Asynchronous.class) ) ||
( getType()==JAVA_BEAN && beanClassHasAnnotation(Asynchronous.class) )
)
{
addInterceptor( new Interceptor( new AsynchronousInterceptor(), this ) );
}
if ( getType()==STATEFUL_SESSION_BEAN )
{
addInterceptor( new Interceptor( new RemoveInterceptor(), this ) );
}
if ( getType()==STATEFUL_SESSION_BEAN || getType()==STATELESS_SESSION_BEAN )
{
if (Reflections.isClassAvailable("org.hibernate.Session"))
{
addInterceptor( new Interceptor ( new HibernateSessionProxyInterceptor(), this ) );
}
addInterceptor( new Interceptor ( new EntityManagerProxyInterceptor(), this ) );
}
if ( getType()!=ENTITY_BEAN )
{
addInterceptor( new Interceptor( new MethodContextInterceptor(), this ) );
}
if ( beanClassHasAnnotation(RaiseEvent.class) )
{
addInterceptor( new Interceptor( new EventInterceptor(), this ) );
}
if ( beanClassHasAnnotation(Conversational.class) )
{
addInterceptor( new Interceptor( new ConversationalInterceptor(), this ) );
}
if ( Contexts.isApplicationContextActive() ) //ugh, for unit tests
{
if ( Init.instance().isJbpmInstalled() )
{
addInterceptor( new Interceptor( new BusinessProcessInterceptor(), this ) );
}
}
if ( !conversationManagementMethods.isEmpty() )
{
addInterceptor( new Interceptor( new ConversationInterceptor(), this ) );
}
if ( needsInjection() || needsOutjection() )
{
addInterceptor( new Interceptor( new BijectionInterceptor(), this ) );
}
addInterceptor( new Interceptor( new RollbackInterceptor(), this ) );
if ( getType()==JAVA_BEAN && beanClassHasAnnotation(Transactional.class))
{
addInterceptor( new Interceptor( new TransactionInterceptor(), this ) );
}
if ( getScope()==CONVERSATION )
{
addInterceptor( new Interceptor( new ManagedEntityIdentityInterceptor(), this ) );
}
if ( beanClassHasAnnotation(Restrict.class) )
{
if (beanClassHasAnnotation("javax.jws.WebService"))
{
addInterceptor( new Interceptor( new WSSecurityInterceptor(), this ) );
}
else
{
addInterceptor( new Interceptor( new SecurityInterceptor(), this ) );
}
}
}