use of org.jboss.as.ee.component.ViewConfigurator in project wildfly by wildfly.
the class StatefulComponentDescription method setupViewInterceptors.
@Override
protected void setupViewInterceptors(EJBViewDescription view) {
// let super do its job
super.setupViewInterceptors(view);
// add the @Remove method interceptor
this.addRemoveMethodInterceptor(view);
// setup the instance associating interceptors
this.addStatefulInstanceAssociatingInterceptor(view);
this.addViewSerializationInterceptor(view);
if (view.getMethodIntf() == MethodIntf.REMOTE) {
view.getConfigurators().add(new ViewConfigurator() {
@Override
public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException {
final String earApplicationName = componentConfiguration.getComponentDescription().getModuleDescription().getEarApplicationName();
configuration.setViewInstanceFactory(new StatefulRemoteViewInstanceFactory(earApplicationName, componentConfiguration.getModuleName(), componentConfiguration.getComponentDescription().getModuleDescription().getDistinctName(), componentConfiguration.getComponentName()));
}
});
}
}
use of org.jboss.as.ee.component.ViewConfigurator in project wildfly by wildfly.
the class AbstractIntegrationProcessorJAXWS method registerView.
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 {
configuration.addViewInterceptor(AccessCheckingInterceptor.getFactory(), InterceptorOrder.View.CHECKING_INTERCEPTOR);
// add WS POJO component instance associating interceptor
configuration.addViewInterceptor(WSComponentInstanceAssociationInterceptor.FACTORY, InterceptorOrder.View.ASSOCIATING_INTERCEPTOR);
}
});
return pojoView.getServiceName();
}
use of org.jboss.as.ee.component.ViewConfigurator in project wildfly by wildfly.
the class MessageDrivenComponentDescription method setupViewInterceptors.
@Override
protected void setupViewInterceptors(EJBViewDescription view) {
// let the super do its job
super.setupViewInterceptors(view);
view.getConfigurators().add(new ViewConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException {
//add the invocation type to the start of the chain
//TODO: is there a cleaner way to do this?
configuration.addViewInterceptor(new ImmediateInterceptorFactory(new Interceptor() {
@Override
public Object processInvocation(final InterceptorContext context) throws Exception {
context.putPrivateData(InvocationType.class, InvocationType.MESSAGE_DELIVERY);
return context.proceed();
}
}), InterceptorOrder.View.INVOCATION_TYPE);
// add the instance associating interceptor at the start of the interceptor chain
configuration.addViewInterceptor(MessageDrivenComponentInstanceAssociatingFactory.instance(), InterceptorOrder.View.ASSOCIATING_INTERCEPTOR);
final MessageDrivenComponentDescription mdb = (MessageDrivenComponentDescription) componentConfiguration.getComponentDescription();
if (mdb.getTransactionManagementType() == TransactionManagementType.CONTAINER) {
configuration.addViewInterceptor(CMTTxInterceptor.FACTORY, InterceptorOrder.View.CMT_TRANSACTION_INTERCEPTOR);
}
}
});
}
use of org.jboss.as.ee.component.ViewConfigurator in project wildfly by wildfly.
the class SessionBeanComponentDescription method addNoInterfaceView.
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);
}
}
}
});
}
use of org.jboss.as.ee.component.ViewConfigurator in project wildfly by wildfly.
the class StatelessComponentDescription method setupViewInterceptors.
@Override
protected void setupViewInterceptors(EJBViewDescription view) {
// let super do its job first
super.setupViewInterceptors(view);
addViewSerializationInterceptor(view);
// add the instance associating interceptor at the start of the interceptor chain
view.getConfigurators().addFirst(new ViewConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException {
//add equals/hashCode interceptor
for (Method method : configuration.getProxyFactory().getCachedMethods()) {
if ((method.getName().equals("hashCode") && method.getParameterTypes().length == 0) || method.getName().equals("equals") && method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == Object.class) {
configuration.addClientInterceptor(method, ComponentTypeIdentityInterceptorFactory.INSTANCE, InterceptorOrder.Client.EJB_EQUALS_HASHCODE);
}
}
// add the stateless component instance associating interceptor
configuration.addViewInterceptor(StatelessComponentInstanceAssociatingFactory.instance(), InterceptorOrder.View.ASSOCIATING_INTERCEPTOR);
}
});
if (view instanceof EJBViewDescription) {
EJBViewDescription ejbViewDescription = (EJBViewDescription) view;
if (ejbViewDescription.getMethodIntf() == MethodIntf.REMOTE) {
view.getConfigurators().add(new ViewConfigurator() {
@Override
public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException {
final String earApplicationName = componentConfiguration.getComponentDescription().getModuleDescription().getEarApplicationName();
configuration.setViewInstanceFactory(new StatelessRemoteViewInstanceFactory(earApplicationName, componentConfiguration.getModuleName(), componentConfiguration.getComponentDescription().getModuleDescription().getDistinctName(), componentConfiguration.getComponentName()));
}
});
}
}
}
Aggregations