use of com.sun.enterprise.deployment.EjbInterceptor in project Payara by payara.
the class EjbBundleDescriptorImpl method addInterceptor.
public void addInterceptor(EjbInterceptor interceptor) {
EjbInterceptor ic = getInterceptorByClassName(interceptor.getInterceptorClassName());
if (ic == null) {
interceptor.setEjbBundleDescriptor(this);
interceptors.put(interceptor.getInterceptorClassName(), interceptor);
}
}
use of com.sun.enterprise.deployment.EjbInterceptor in project Payara by payara.
the class AppSpecificConnectorClassLoaderUtil method processDescriptorForRAReferences.
private void processDescriptorForRAReferences(Application app, Descriptor descriptor, String moduleName) {
if (descriptor instanceof JndiNameEnvironment) {
processDescriptorForRAReferences(app, moduleName, (JndiNameEnvironment) descriptor);
}
// ejb descriptors
if (descriptor instanceof EjbBundleDescriptor) {
EjbBundleDescriptor ejbDesc = (EjbBundleDescriptor) descriptor;
Set<? extends EjbDescriptor> ejbDescriptors = ejbDesc.getEjbs();
for (EjbDescriptor ejbDescriptor : ejbDescriptors) {
processDescriptorForRAReferences(app, moduleName, ejbDescriptor);
if (ejbDescriptor instanceof EjbMessageBeanDescriptor) {
EjbMessageBeanDescriptor messageBeanDesc = (EjbMessageBeanDescriptor) ejbDescriptor;
String raMid = messageBeanDesc.getResourceAdapterMid();
// there seem to be applications that do not specify ra-mid
if (raMid != null) {
app.addResourceAdapter(raMid);
}
}
}
// ejb interceptors
Set<EjbInterceptor> ejbInterceptors = ejbDesc.getInterceptors();
for (EjbInterceptor ejbInterceptor : ejbInterceptors) {
processDescriptorForRAReferences(app, moduleName, ejbInterceptor);
}
}
if (descriptor instanceof BundleDescriptor) {
// managed bean descriptors
Set<ManagedBeanDescriptor> managedBeanDescriptors = ((BundleDescriptor) descriptor).getManagedBeans();
for (ManagedBeanDescriptor mbd : managedBeanDescriptors) {
processDescriptorForRAReferences(app, moduleName, mbd);
}
}
}
use of com.sun.enterprise.deployment.EjbInterceptor in project Payara by payara.
the class EjbDescriptorImpl method createSystemLevelCDIInterceptor.
/* enabled for debugging
public int hashCode() {
return getEjbName().hashCode();
}
public boolean equals(Object o) {
boolean equal = false;
if( (o != null) && (o instanceof EjbDescriptorImpl) ) {
equal = getEjbName().equals( ((EjbDescriptorImpl)o).getEjbName() );
}
return equal;
}
*/
// JJS: 4/2/13 Removing superinterfaces to track down cdi tck failures.
// http://java.net/jira/browse/GLASSFISH-19970
// private void addIfLocal(Class<?>[] interfaces, Set<String> names) {
// for(Class<?> next : interfaces) {
// if( next.getAnnotation(Local.class) != null ) {
// names.add(next.getName());
// }
// addIfLocal(next.getInterfaces(), names);
// }
// }
//
// private void addIfRemote(Class<?>[] interfaces, Set<String> names) {
// for(Class<?> next : interfaces) {
// if( next.getAnnotation(Remote.class) != null ) {
// names.add(next.getName());
// }
// addIfRemote(next.getInterfaces(), names);
// }
// }
private EjbInterceptor createSystemLevelCDIInterceptor() {
EjbInterceptor interceptor = new EjbInterceptor();
Class<SessionBeanInterceptor> interceptorClass = SessionBeanInterceptor.class;
String interceptorName = interceptorClass.getName();
interceptor.setInterceptorClass(interceptorClass);
// we have to look for method explicitly.
try {
Method aroundInvokeMethod = interceptorClass.getMethod("aroundInvoke", InvocationContext.class);
if (aroundInvokeMethod != null) {
LifecycleCallbackDescriptor aroundInvokeDesc = new LifecycleCallbackDescriptor();
aroundInvokeDesc.setLifecycleCallbackClass(interceptorName);
aroundInvokeDesc.setLifecycleCallbackMethod(aroundInvokeMethod.getName());
interceptor.addAroundInvokeDescriptor(aroundInvokeDesc);
// TODO BUG -- Existing SessionBeanInterceptor does not define an @AroundTimeout method.
// Until that's fixed, work around it by adding the method marked @AroundInvoke as an
// @AroundTimeout.
LifecycleCallbackDescriptor aroundTimeoutDesc = new LifecycleCallbackDescriptor();
aroundTimeoutDesc.setLifecycleCallbackClass(interceptorName);
aroundTimeoutDesc.setLifecycleCallbackMethod(aroundInvokeMethod.getName());
interceptor.addAroundTimeoutDescriptor(aroundTimeoutDesc);
// SessionBeanInterceptor does not define an @PostConstruct method so use the aroundInvoke method
LifecycleCallbackDescriptor postConstructDesc = new LifecycleCallbackDescriptor();
postConstructDesc.setLifecycleCallbackClass(interceptorName);
postConstructDesc.setLifecycleCallbackMethod(aroundInvokeMethod.getName());
interceptor.addPostConstructDescriptor(postConstructDesc);
}
} catch (NoSuchMethodException nsme) {
throw new RuntimeException("Cannot find weld EJB interceptor aroundInvoke method");
}
return interceptor;
}
use of com.sun.enterprise.deployment.EjbInterceptor in project Payara by payara.
the class EjbServicesImpl method makeEjbInterceptor.
private EjbInterceptor makeEjbInterceptor(Interceptor<?> interceptor, EjbBundleDescriptor bundle) {
EjbInterceptor ejbInt = new EjbInterceptor();
ejbInt.setBundleDescriptor(bundle);
ejbInt.setInterceptorClass(interceptor.getBeanClass());
ejbInt.setInterceptorClassName(interceptor.getBeanClass().getName());
ejbInt.setCDIInterceptor(true);
ejbInt.setInterceptor(interceptor);
return ejbInt;
}
use of com.sun.enterprise.deployment.EjbInterceptor in project Payara by payara.
the class EjbInterceptorNode method getDescriptor.
@Override
public EjbInterceptor getDescriptor() {
if (descriptor == null) {
descriptor = new EjbInterceptor();
descriptor.setEjbBundleDescriptor((EjbBundleDescriptor) getParentNode().getDescriptor());
}
return descriptor;
}
Aggregations