use of org.jboss.as.ee.component.ComponentInstance in project wildfly by wildfly.
the class XTSPOJOInterceptor method processInvocation.
@Override
public Object processInvocation(InterceptorContext context) throws Exception {
ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
Object serviceInstance = componentInstance.getInstance();
Method serviceMethod = context.getMethod();
Class serviceClass = serviceInstance.getClass();
Object result;
ProtocolHandler protocolHandler = HandlerFactory.getInstance(new ServiceInvocationMeta(serviceInstance, serviceClass, serviceMethod));
try {
protocolHandler.preInvocation();
result = context.proceed();
protocolHandler.notifySuccess();
} catch (Exception e) {
protocolHandler.notifyFailure();
throw e;
}
return result;
}
use of org.jboss.as.ee.component.ComponentInstance in project wildfly by wildfly.
the class WeldInterceptorInjectionInterceptor method processInvocation.
@Override
public Object processInvocation(final InterceptorContext context) throws Exception {
WeldInjectionContext injectionContext = context.getPrivateData(WeldInjectionContext.class);
final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
//now inject the interceptors
for (final Class<?> interceptorClass : interceptorClasses) {
final ManagedReference instance = (ManagedReference) componentInstance.getInstanceData(interceptorClass);
if (instance != null) {
injectionContext.injectInterceptor(instance.getInstance());
}
}
return context.proceed();
}
use of org.jboss.as.ee.component.ComponentInstance in project wildfly by wildfly.
the class ComponentDispatcherInterceptor method processInvocation.
public Object processInvocation(final InterceptorContext context) throws Exception {
ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
if (componentInstance == null) {
throw EeLogger.ROOT_LOGGER.noComponentInstance();
}
Method oldMethod = context.getMethod();
try {
context.setMethod(componentMethod);
context.setTarget(componentInstance.getInstance());
return componentInstance.getInterceptor(componentMethod).processInvocation(context);
} finally {
context.setMethod(oldMethod);
context.setTarget(null);
}
}
Aggregations