Search in sources :

Example 1 with ShutDownInterceptorFactory

use of org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory in project wildfly by wildfly.

the class EJBComponentDescription method setupViewInterceptors.

protected void setupViewInterceptors(final EJBViewDescription view) {
    // add a logging interceptor (to take care of EJB3 spec, section 14.3 logging requirements)
    view.getConfigurators().add(new ViewConfigurator() {

        @Override
        public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration viewConfiguration) throws DeploymentUnitProcessingException {
            viewConfiguration.addViewInterceptor(LoggingInterceptor.FACTORY, InterceptorOrder.View.EJB_EXCEPTION_LOGGING_INTERCEPTOR);
            final ClassLoader classLoader = componentConfiguration.getModuleClassLoader();
            viewConfiguration.addViewInterceptor(AccessCheckingInterceptor.getFactory(), InterceptorOrder.View.CHECKING_INTERCEPTOR);
            viewConfiguration.addViewInterceptor(new ImmediateInterceptorFactory(new ContextClassLoaderInterceptor(classLoader)), InterceptorOrder.View.TCCL_INTERCEPTOR);
            //If this is the EJB 2.x local or home view add the exception transformer interceptor
            if (view.getMethodIntf() == MethodIntf.LOCAL && EJBLocalObject.class.isAssignableFrom(viewConfiguration.getViewClass())) {
                viewConfiguration.addViewInterceptor(EjbExceptionTransformingInterceptorFactories.LOCAL_INSTANCE, InterceptorOrder.View.REMOTE_EXCEPTION_TRANSFORMER);
            } else if (view.getMethodIntf() == MethodIntf.LOCAL_HOME) {
                viewConfiguration.addViewInterceptor(EjbExceptionTransformingInterceptorFactories.LOCAL_INSTANCE, InterceptorOrder.View.REMOTE_EXCEPTION_TRANSFORMER);
            }
            final List<SetupAction> ejbSetupActions = context.getDeploymentUnit().getAttachmentList(Attachments.OTHER_EE_SETUP_ACTIONS);
            if (!ejbSetupActions.isEmpty()) {
                viewConfiguration.addViewInterceptor(AdditionalSetupInterceptor.factory(ejbSetupActions), InterceptorOrder.View.EE_SETUP);
            }
            viewConfiguration.addViewInterceptor(WaitTimeInterceptor.FACTORY, InterceptorOrder.View.EJB_WAIT_TIME_INTERCEPTOR);
            viewConfiguration.addViewInterceptor(shutDownInterceptorFactory, InterceptorOrder.View.SHUTDOWN_INTERCEPTOR);
        }
    });
    this.addCurrentInvocationContextFactory(view);
    this.setupSecurityInterceptors(view);
    this.setupRemoteViewInterceptors(view);
    view.getConfigurators().addFirst(new NamespaceViewConfigurator());
}
Also used : NamespaceViewConfigurator(org.jboss.as.ee.component.NamespaceViewConfigurator) EJBRemoteTransactionsViewConfigurator(org.jboss.as.ejb3.remote.EJBRemoteTransactionsViewConfigurator) EJBSecurityViewConfigurator(org.jboss.as.ejb3.security.EJBSecurityViewConfigurator) ViewConfigurator(org.jboss.as.ee.component.ViewConfigurator) ComponentConfiguration(org.jboss.as.ee.component.ComponentConfiguration) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) ViewConfiguration(org.jboss.as.ee.component.ViewConfiguration) ViewDescription(org.jboss.as.ee.component.ViewDescription) ImmediateInterceptorFactory(org.jboss.invocation.ImmediateInterceptorFactory) ContextClassLoaderInterceptor(org.jboss.invocation.ContextClassLoaderInterceptor) NamespaceViewConfigurator(org.jboss.as.ee.component.NamespaceViewConfigurator) ArrayList(java.util.ArrayList) List(java.util.List) DeploymentPhaseContext(org.jboss.as.server.deployment.DeploymentPhaseContext)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 ComponentConfiguration (org.jboss.as.ee.component.ComponentConfiguration)1 NamespaceViewConfigurator (org.jboss.as.ee.component.NamespaceViewConfigurator)1 ViewConfiguration (org.jboss.as.ee.component.ViewConfiguration)1 ViewConfigurator (org.jboss.as.ee.component.ViewConfigurator)1 ViewDescription (org.jboss.as.ee.component.ViewDescription)1 EJBRemoteTransactionsViewConfigurator (org.jboss.as.ejb3.remote.EJBRemoteTransactionsViewConfigurator)1 EJBSecurityViewConfigurator (org.jboss.as.ejb3.security.EJBSecurityViewConfigurator)1 DeploymentPhaseContext (org.jboss.as.server.deployment.DeploymentPhaseContext)1 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)1 ContextClassLoaderInterceptor (org.jboss.invocation.ContextClassLoaderInterceptor)1 ImmediateInterceptorFactory (org.jboss.invocation.ImmediateInterceptorFactory)1