@Override protected void addCurrentInvocationContextFactory(ViewDescription view) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { configuration.addViewInterceptor(CurrentInvocationContextInterceptor.FACTORY, InterceptorOrder.View.INVOCATION_CONTEXT_INTERCEPTOR); } }); }
private void addConcurrencyManagementInterceptor(final ViewDescription view) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { final SingletonComponentDescription singletonComponentDescription = (SingletonComponentDescription) componentConfiguration.getComponentDescription(); // we don't care about BEAN managed concurrency, so just return if (singletonComponentDescription.getConcurrencyManagementType() == ConcurrencyManagementType.BEAN) { return; } configuration.addViewInterceptor(new ContainerManagedConcurrencyInterceptorFactory(configuration.getViewToComponentMethodMap()), InterceptorOrder.View.SINGLETON_CONTAINER_MANAGED_CONCURRENCY_INTERCEPTOR); } }); }
@Override protected void addCurrentInvocationContextFactory(ViewDescription view) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { configuration.addViewInterceptor(CurrentInvocationContextInterceptor.FACTORY, InterceptorOrder.View.INVOCATION_CONTEXT_INTERCEPTOR); } }); }
/** * Sets up the transaction management interceptor for all methods of the passed view. * * @param view The EJB bean view */ protected static void addTxManagementInterceptorForView(ViewDescription view) { // add a Tx configurator view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) componentConfiguration.getComponentDescription(); // Add CMT interceptor factory if (TransactionManagementType.CONTAINER.equals(ejbComponentDescription.getTransactionManagementType())) { configuration.addViewInterceptor(CMTTxInterceptor.FACTORY, InterceptorOrder.View.CMT_TRANSACTION_INTERCEPTOR); } } }); }
private void addToStringMethodInterceptor(final ViewDescription view) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { final Method TO_STRING_METHOD; try { TO_STRING_METHOD = Object.class.getMethod("toString"); } catch (NoSuchMethodException nsme) { throw new DeploymentUnitProcessingException(nsme); } List<Method> methods = configuration.getProxyFactory().getCachedMethods(); for (Method method : methods) { if (TO_STRING_METHOD.equals(method)) { configuration.addClientInterceptor(method, new ImmediateInterceptorFactory(new ToStringMethodInterceptor(EJBComponentDescription.this.getComponentName())), InterceptorOrder.Client.TO_STRING); return; } } } }); }
private void addRemoveMethodInterceptor(final ViewDescription view) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { final StatefulComponentDescription statefulComponentDescription = (StatefulComponentDescription) componentConfiguration.getComponentDescription(); final Collection<StatefulRemoveMethod> removeMethods = statefulComponentDescription.getRemoveMethods(); if (removeMethods.isEmpty()) { return; } for (final Method viewMethod : configuration.getProxyFactory().getCachedMethods()) { final MethodIdentifier viewMethodIdentifier = MethodIdentifier.getIdentifierForMethod(viewMethod); for (final StatefulRemoveMethod removeMethod : removeMethods) { if (removeMethod.methodIdentifier.equals(viewMethodIdentifier)) { //we do not want to add this if it is the Ejb(Local)Object.remove() method, as that is handed elsewhere final boolean object = EJBObject.class.isAssignableFrom(configuration.getViewClass()) || EJBLocalObject.class.isAssignableFrom(configuration.getViewClass()); if (!object || !viewMethodIdentifier.getName().equals("remove") || viewMethodIdentifier.getParameterTypes().length != 0) { configuration.addViewInterceptor(viewMethod, new ImmediateInterceptorFactory(new StatefulRemoveInterceptor(removeMethod.retainIfException)), InterceptorOrder.View.SESSION_REMOVE_INTERCEPTOR); } break; } } } } }); }
protected void setupSecurityInterceptors(final ViewDescription view) { // setup security interceptor for the component view.getConfigurators().add(new EJBSecurityViewConfigurator()); }
private void addViewSerializationInterceptor(final ViewDescription view) { view.setSerializable(true); view.setUseWriteReplace(true); view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { final DeploymentReflectionIndex index = context.getDeploymentUnit().getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX); ClassReflectionIndex classIndex = index.getClassIndex(WriteReplaceInterface.class); for (Method method : (Collection<Method>)classIndex.getMethods()) { configuration.addClientInterceptor(method, StatelessWriteReplaceInterceptor.factory(configuration.getViewServiceName().getCanonicalName()), InterceptorOrder.Client.WRITE_REPLACE); } } }); }
public void addNoInterfaceView() { noInterfaceViewPresent = true; final ViewDescription viewDescription = registerView(getEJBClassName(), MethodIntf.LOCAL); //set up interceptor for non-business methods viewDescription.getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { DeploymentReflectionIndex index = context.getDeploymentUnit().getAttachment(Attachments.REFLECTION_INDEX); for (final Method method : configuration.getProxyFactory().getCachedMethods()) { if (!Modifier.isPublic(method.getModifiers()) && isNotOverriden(method, componentConfiguration.getComponentClass(), index)) { configuration.addClientInterceptor(method, new ImmediateInterceptorFactory(new NotBusinessMethodInterceptor(method)), InterceptorOrder.Client.NOT_BUSINESS_METHOD_EXCEPTION); } } } }); }
private void addViewSerializationInterceptor(final ViewDescription view) { view.setSerializable(true); view.setUseWriteReplace(true); view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { final DeploymentReflectionIndex index = context.getDeploymentUnit().getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX); ClassReflectionIndex classIndex = index.getClassIndex(WriteReplaceInterface.class); for (Method method : classIndex.getMethods()) { configuration.addClientInterceptor(method, StatelessWriteReplaceInterceptor.factory(configuration.getViewServiceName().getCanonicalName()), InterceptorOrder.Client.WRITE_REPLACE); } } }); }
private void addViewSerializationInterceptor(final ViewDescription view) { view.setSerializable(true); view.setUseWriteReplace(true); view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { final DeploymentReflectionIndex index = context.getDeploymentUnit().getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX); ClassReflectionIndex classIndex = index.getClassIndex(WriteReplaceInterface.class); for (Method method : (Collection<Method>)classIndex.getMethods()) { configuration.addClientInterceptor(method, new StatefulWriteReplaceInterceptor.Factory(configuration.getViewServiceName().getCanonicalName()), InterceptorOrder.Client.WRITE_REPLACE); } } }); }
viewConfiguration = view.createViewConfiguration(viewClass, configuration, new ProxyFactory(proxyConfiguration)); for (final ViewConfigurator configurator : view.getConfigurators()) { configurator.configure(context, configuration, view, viewConfiguration);
viewDescription.getConfigurators().addFirst(new ViewConfigurator() { public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException {
@Override protected void addCurrentInvocationContextFactory(ViewDescription view) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { configuration.addViewInterceptor(CurrentInvocationContextInterceptor.FACTORY, InterceptorOrder.View.INVOCATION_CONTEXT_INTERCEPTOR); } }); }
@Override protected void addCurrentInvocationContextFactory(ViewDescription view) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { configuration.addViewInterceptor(CurrentInvocationContextInterceptor.FACTORY, InterceptorOrder.View.INVOCATION_CONTEXT_INTERCEPTOR); } }); }
@Override protected void addCurrentInvocationContextFactory(ViewDescription view) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { configuration.addViewInterceptor(CurrentInvocationContextInterceptor.FACTORY, InterceptorOrder.View.INVOCATION_CONTEXT_INTERCEPTOR); } }); }
private void registerWSPOJOInterceptors(WSComponentDescription componentDescription) { for (ViewDescription view : componentDescription.getViews()) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { for (final Method method : configuration.getProxyFactory().getCachedMethods()) { if (methodHasServiceRequestAnnotation(method)) { configuration.addViewInterceptor(method, XTSPOJOInterceptor.FACTORY, InterceptorOrder.View.XTS_INTERCEPTOR); } } } }); } }
private void addViewSerializationInterceptor(final ViewDescription view) { view.setSerializable(true); view.setUseWriteReplace(true); view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { final DeploymentReflectionIndex index = context.getDeploymentUnit().getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX); ClassReflectionIndex<WriteReplaceInterface> classIndex = index.getClassIndex(WriteReplaceInterface.class); for (Method method : classIndex.getMethods()) { configuration.addClientInterceptor(method, StatelessWriteReplaceInterceptor.factory(configuration.getViewServiceName().getCanonicalName()), InterceptorOrder.Client.WRITE_REPLACE); } } }); }
public void addNoInterfaceView() { noInterfaceViewPresent = true; final ViewDescription viewDescription = registerView(getEJBClassName(), MethodIntf.LOCAL); //set up interceptor for non-business methods viewDescription.getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { for (final Method method : configuration.getProxyFactory().getCachedMethods()) { if (!Modifier.isPublic(method.getModifiers())) { configuration.addViewInterceptor(method, new ImmediateInterceptorFactory(new NotBusinessMethodInterceptor(method)), InterceptorOrder.View.NOT_BUSINESS_METHOD_EXCEPTION); } } } }); }
static ServiceName registerView(final ComponentDescription componentDescription, final String componentClassName) { final ViewDescription pojoView = new ViewDescription(componentDescription, componentClassName); componentDescription.getViews().add(pojoView); pojoView.getConfigurators().add(new ViewConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { // add WS POJO component instance associating interceptor configuration.addViewInterceptor(WSComponentInstanceAssociationInterceptor.FACTORY, InterceptorOrder.View.ASSOCIATING_INTERCEPTOR); } }); return pojoView.getServiceName(); }