use of org.jboss.as.webservices.injection.WSComponent in project wildfly by wildfly.
the class WSComponentInstanceAssociationInterceptor method processInvocation.
@Override
public Object processInvocation(final InterceptorContext interceptorContext) throws Exception {
final WSComponent wsComponent = (WSComponent) interceptorContext.getPrivateData(Component.class);
BasicComponentInstance pojoComponentInstance = null;
if (interceptorContext.getPrivateData(ManagedReference.class) != null) {
ManagedReference reference = interceptorContext.getPrivateData(ManagedReference.class);
pojoComponentInstance = (BasicComponentInstance) wsComponent.createInstance(reference.getInstance());
} else {
pojoComponentInstance = wsComponent.getComponentInstance();
}
interceptorContext.putPrivateData(ComponentInstance.class, pojoComponentInstance);
return interceptorContext.proceed();
}
use of org.jboss.as.webservices.injection.WSComponent in project wildfly by wildfly.
the class AbstractInvocationHandler method invokeInternal.
public void invokeInternal(final Endpoint endpoint, final Invocation wsInvocation) throws Exception {
// prepare for invocation
onBeforeInvocation(wsInvocation);
// prepare invocation data
final ComponentView componentView = getComponentView();
Component component = componentView.getComponent();
// in case of @FactoryType annotation we don't need to go into EE interceptors
final boolean forceTargetBean = (wsInvocation.getInvocationContext().getProperty("forceTargetBean") != null);
if (forceTargetBean) {
this.reference = new ManagedReference() {
public void release() {
}
public Object getInstance() {
return wsInvocation.getInvocationContext().getTargetBean();
}
};
if (component instanceof WSComponent) {
((WSComponent) component).setReference(reference);
}
}
final Method method = getComponentViewMethod(wsInvocation.getJavaMethod(), componentView.getViewMethods());
final InterceptorContext context = new InterceptorContext();
prepareForInvocation(context, wsInvocation);
context.setMethod(method);
context.setParameters(wsInvocation.getArgs());
context.putPrivateData(Component.class, component);
context.putPrivateData(ComponentView.class, componentView);
// pull in any XTS transaction
LocalTransactionContext.getCurrent().importProviderTransaction();
context.setTransaction(ContextTransactionManager.getInstance().getTransaction());
if (forceTargetBean) {
context.putPrivateData(ManagedReference.class, reference);
}
// invoke method
final Object retObj = componentView.invoke(context);
// set return value
wsInvocation.setReturnValue(retObj);
}
Aggregations