configuration.getInterceptorContextKeys().add(contextKey);
/** * Construct a new instance. * * @param componentConfiguration the component configuration */ public StatefulSessionComponentCreateService(final ComponentConfiguration componentConfiguration, final ApplicationExceptions ejbJarConfiguration, Supplier<CacheFactory<SessionID, StatefulSessionComponentInstance>> cacheFactory) { super(componentConfiguration, ejbJarConfiguration); final StatefulComponentDescription componentDescription = (StatefulComponentDescription) componentConfiguration.getComponentDescription(); final ClassLoader classLoader = componentConfiguration.getModuleClassLoader(); final InterceptorFactory tcclInterceptorFactory = new ImmediateInterceptorFactory(new ContextClassLoaderInterceptor(classLoader)); final InterceptorFactory namespaceContextInterceptorFactory = componentConfiguration.getNamespaceContextInterceptorFactory(); this.afterBeginMethod = componentDescription.getAfterBegin(); this.afterBegin = (this.afterBeginMethod != null) ? Interceptors.getChainedInterceptorFactory(tcclInterceptorFactory, namespaceContextInterceptorFactory, CurrentInvocationContextInterceptor.FACTORY, invokeMethodOnTarget(this.afterBeginMethod)) : null; this.afterCompletionMethod = componentDescription.getAfterCompletion(); this.afterCompletion = (this.afterCompletionMethod != null) ? Interceptors.getChainedInterceptorFactory(tcclInterceptorFactory, namespaceContextInterceptorFactory, CurrentInvocationContextInterceptor.FACTORY, invokeMethodOnTarget(this.afterCompletionMethod)) : null; this.beforeCompletionMethod = componentDescription.getBeforeCompletion(); this.beforeCompletion = (this.beforeCompletionMethod != null) ? Interceptors.getChainedInterceptorFactory(tcclInterceptorFactory, namespaceContextInterceptorFactory, CurrentInvocationContextInterceptor.FACTORY, invokeMethodOnTarget(this.beforeCompletionMethod)) : null; this.prePassivate = Interceptors.getChainedInterceptorFactory(componentConfiguration.getPrePassivateInterceptors()); this.postActivate = Interceptors.getChainedInterceptorFactory(componentConfiguration.getPostActivateInterceptors()); //the interceptor chain for EJB e.x remove methods this.ejb2XRemoveMethod = Interceptors.getChainedInterceptorFactory(StatefulSessionSynchronizationInterceptor.factory(componentDescription.getTransactionManagementType()), new ImmediateInterceptorFactory(new StatefulRemoveInterceptor(false)), Interceptors.getTerminalInterceptorFactory()); this.serializableInterceptorContextKeys = componentConfiguration.getInterceptorContextKeys(); this.passivationCapable = componentDescription.isPassivationApplicable(); this.cacheFactory = cacheFactory; }
@Override public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) throws DeploymentUnitProcessingException { for (Method method : configuration.getDefinedComponentMethods()) { if (methodHasServiceRequestAnnotation(method)) { configuration.addComponentInterceptor(method, XTSEJBInterceptor.FACTORY, InterceptorOrder.Component.XTS_INTERCEPTOR); configuration.getInterceptorContextKeys().add(XTSEJBInterceptor.CONTEXT_KEY); } } } });
@Override public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) throws DeploymentUnitProcessingException { configuration.addPostConstructInterceptor(SFSBPreCreateInterceptor.FACTORY, InterceptorOrder.ComponentPostConstruct.JPA_SFSB_PRE_CREATE); configuration.addPostConstructInterceptor(SFSBCreateInterceptor.FACTORY, InterceptorOrder.ComponentPostConstruct.JPA_SFSB_CREATE); configuration.addPreDestroyInterceptor(SFSBDestroyInterceptor.FACTORY, InterceptorOrder.ComponentPreDestroy.JPA_SFSB_DESTROY); configuration.addComponentInterceptor(SFSBInvocationInterceptor.FACTORY, InterceptorOrder.Component.JPA_SFSB_INTERCEPTOR, false); //we need to serialized the entity manager state configuration.getInterceptorContextKeys().add(SFSBInvocationInterceptor.CONTEXT_KEY); } });
@Override public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) throws DeploymentUnitProcessingException { configuration.addPostConstructInterceptor(SFSBPreCreateInterceptor.FACTORY, InterceptorOrder.ComponentPostConstruct.JPA_SFSB_PRE_CREATE); configuration.addPostConstructInterceptor(SFSBCreateInterceptor.FACTORY, InterceptorOrder.ComponentPostConstruct.JPA_SFSB_CREATE); configuration.addPreDestroyInterceptor(SFSBDestroyInterceptor.FACTORY, InterceptorOrder.ComponentPreDestroy.JPA_SFSB_DESTROY); configuration.addComponentInterceptor(SFSBInvocationInterceptor.FACTORY, InterceptorOrder.Component.JPA_SFSB_INTERCEPTOR, false); //we need to serialized the entity manager state configuration.getInterceptorContextKeys().add(SFSBInvocationInterceptor.CONTEXT_KEY); } });
@Override public boolean integrate(ServiceName beanManagerServiceName, ComponentConfiguration configuration, ComponentDescription description, ServiceBuilder<?> weldComponentServiceBuilder, Supplier<ServiceName> bindingServiceNameSupplier, DefaultInterceptorIntegrationAction integrationAction, ComponentInterceptorSupport interceptorSupport) { if (description instanceof EJBComponentDescription) { ServiceName bindingServiceName = bindingServiceNameSupplier.get(); integrationAction.perform(bindingServiceName); if (description.isPassivationApplicable()) { configuration.addPrePassivateInterceptor( factory(InterceptionType.PRE_PASSIVATE, weldComponentServiceBuilder, bindingServiceName, interceptorSupport), InterceptorOrder.ComponentPassivation.CDI_INTERCEPTORS); configuration.addPostActivateInterceptor( factory(InterceptionType.POST_ACTIVATE, weldComponentServiceBuilder, bindingServiceName, interceptorSupport), InterceptorOrder.ComponentPassivation.CDI_INTERCEPTORS); } if (description instanceof StatefulComponentDescription) { // add a context key for weld interceptor replication configuration.getInterceptorContextKeys().add(SerializedCdiInterceptorsKey.class); } return true; } else if (description instanceof ManagedBeanComponentDescription) { integrationAction.perform(bindingServiceNameSupplier.get()); return true; } return false; }
@Override public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException { final Class<?> componentClass = configuration.getComponentClass(); final DeploymentUnit deploymentUnit = context.getDeploymentUnit(); final ModuleClassLoader classLoader = deploymentUnit.getAttachment(Attachments.MODULE).getClassLoader(); //get the interceptors so they can be injected as well final Set<Class<?>> interceptorClasses = new HashSet<Class<?>>(); for (InterceptorDescription interceptorDescription : description.getAllInterceptors()) { try { final ClassIndex index = classIndex.classIndex(interceptorDescription.getInterceptorClassName()); interceptorClasses.add(index.getModuleClass()); } catch (ClassNotFoundException e) { throw WeldMessages.MESSAGES.couldNotLoadInterceptorClass(interceptorDescription.getInterceptorClassName(), e); } } addWeldIntegration(context.getServiceTarget(), configuration, description, componentClass, beanName, weldBootstrapService, weldStartService, interceptorClasses, classLoader, description.getBeanDeploymentArchiveId()); configuration.addPostConstructInterceptor(new WeldInjectionInterceptor.Factory(configuration, interceptorClasses), InterceptorOrder.ComponentPostConstruct.WELD_INJECTION); //add a context key for weld interceptor replication if (description instanceof StatefulComponentDescription) { configuration.getInterceptorContextKeys().add(SerializedCdiInterceptorsKey.class); } } });
configuration.getInterceptorContextKeys().add(contextKey);
configuration.getInterceptorContextKeys().add(contextKey);
configuration.getInterceptorContextKeys().add(contextKey);
this.serializableInterceptorContextKeys = componentConfiguration.getInterceptorContextKeys();