use of com.sun.enterprise.deployment.LifecycleCallbackDescriptor in project Payara by payara.
the class PreDestroyHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, ResourceContainerContext[] rcContexts) throws AnnotationProcessorException {
Method annMethod = (Method) ainfo.getAnnotatedElement();
validateAnnotatedLifecycleMethod(annMethod);
String pdMethodName = annMethod.getName();
String pdClassName = annMethod.getDeclaringClass().getName();
for (ResourceContainerContext rcContext : rcContexts) {
LifecycleCallbackDescriptor preDestroyDesc = new LifecycleCallbackDescriptor();
preDestroyDesc.setLifecycleCallbackClass(pdClassName);
preDestroyDesc.setLifecycleCallbackMethod(pdMethodName);
preDestroyDesc.setMetadataSource(MetadataSource.ANNOTATION);
// override by xml is handled in addPreDestroyDescriptor
rcContext.addPreDestroyDescriptor(preDestroyDesc);
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.LifecycleCallbackDescriptor 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.LifecycleCallbackDescriptor in project Payara by payara.
the class WebBundleDescriptorImpl method addPreDestroyDescriptor.
@Override
public void addPreDestroyDescriptor(LifecycleCallbackDescriptor preDestroyDesc) {
String className = preDestroyDesc.getLifecycleCallbackClass();
boolean found = false;
for (LifecycleCallbackDescriptor next : getPreDestroyDescriptors()) {
if (next.getLifecycleCallbackClass().equals(className)) {
found = true;
break;
}
}
if (!found) {
getPreDestroyDescriptors().add(preDestroyDesc);
}
}
use of com.sun.enterprise.deployment.LifecycleCallbackDescriptor in project Payara by payara.
the class WebBundleDescriptorImpl method addPostConstructDescriptor.
@Override
public void addPostConstructDescriptor(LifecycleCallbackDescriptor postConstructDesc) {
String className = postConstructDesc.getLifecycleCallbackClass();
boolean found = false;
for (LifecycleCallbackDescriptor next : getPostConstructDescriptors()) {
if (next.getLifecycleCallbackClass().equals(className)) {
found = true;
break;
}
}
if (!found) {
getPostConstructDescriptors().add(postConstructDesc);
}
}
use of com.sun.enterprise.deployment.LifecycleCallbackDescriptor in project Payara by payara.
the class InterceptorsHandler method getLifecycleCallbackDescriptor.
private LifecycleCallbackDescriptor getLifecycleCallbackDescriptor(Method m) {
LifecycleCallbackDescriptor lccDesc = new LifecycleCallbackDescriptor();
lccDesc.setLifecycleCallbackClass(m.getDeclaringClass().getName());
lccDesc.setLifecycleCallbackMethod(m.getName());
return lccDesc;
}
Aggregations