use of org.glassfish.ejb.deployment.descriptor.InterceptorBindingDescriptor in project Payara by payara.
the class InterceptorBindingTranslator method processMethod.
private void processMethod(MethodDescriptor businessMethod, List<InterceptorBindingDescriptor> bindings) {
LinkedList<String> tempDefaultInterceptorChain = new LinkedList<String>();
LinkedList<String> tempClassInterceptorChain = new LinkedList<String>();
LinkedList<String> tempMethodInterceptorChain = new LinkedList<String>();
if (hasTotalClassLevelOrdering) {
tempClassInterceptorChain.addAll(totalClassLevelOrdering);
} else {
tempDefaultInterceptorChain.addAll(defaultInterceptorChain);
tempClassInterceptorChain.addAll(classInterceptorChain);
}
for (InterceptorBindingDescriptor nextBinding : bindings) {
if (nextBinding.getExcludeDefaultInterceptors()) {
if (hasTotalClassLevelOrdering) {
tempClassInterceptorChain.removeAll(defaultInterceptorChain);
} else {
tempDefaultInterceptorChain.clear();
}
}
if (nextBinding.getExcludeClassInterceptors()) {
if (hasTotalClassLevelOrdering) {
tempClassInterceptorChain.removeAll(classInterceptorChain);
} else {
tempClassInterceptorChain.clear();
}
}
if (nextBinding.getIsTotalOrdering()) {
tempDefaultInterceptorChain.clear();
tempClassInterceptorChain.clear();
tempMethodInterceptorChain.clear();
}
tempMethodInterceptorChain.addAll(nextBinding.getInterceptorClasses());
}
LinkedList<String> methodInterceptors = new LinkedList<String>();
methodInterceptors.addAll(tempDefaultInterceptorChain);
methodInterceptors.addAll(tempClassInterceptorChain);
methodInterceptors.addAll(tempMethodInterceptorChain);
methodInterceptorsMap.put(businessMethod, methodInterceptors);
}
use of org.glassfish.ejb.deployment.descriptor.InterceptorBindingDescriptor in project Payara by payara.
the class ExcludeDefaultInterceptorsHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
EjbBundleDescriptorImpl ejbBundle = ((EjbDescriptor) ejbContexts[0].getDescriptor()).getEjbBundleDescriptor();
for (EjbContext next : ejbContexts) {
EjbDescriptor ejbDescriptor = (EjbDescriptor) next.getDescriptor();
// Create binding information.
InterceptorBindingDescriptor binding = new InterceptorBindingDescriptor();
binding.setEjbName(ejbDescriptor.getName());
binding.setExcludeDefaultInterceptors(true);
if (ElementType.METHOD.equals(ainfo.getElementType())) {
Method m = (Method) ainfo.getAnnotatedElement();
MethodDescriptor md = new MethodDescriptor(m, MethodDescriptor.EJB_BEAN);
binding.setBusinessMethod(md);
} else if (ElementType.CONSTRUCTOR.equals(ainfo.getElementType())) {
Constructor c = (Constructor) ainfo.getAnnotatedElement();
Class cl = c.getDeclaringClass();
Class[] ctorParamTypes = c.getParameterTypes();
String[] parameterClassNames = (new MethodDescriptor()).getParameterClassNamesFor(null, ctorParamTypes);
MethodDescriptor md = new MethodDescriptor(cl.getSimpleName(), null, parameterClassNames, MethodDescriptor.EJB_BEAN);
binding.setBusinessMethod(md);
}
ejbBundle.prependInterceptorBinding(binding);
}
return getDefaultProcessedResult();
}
Aggregations