use of com.sun.enterprise.deployment.annotation.context.EjbContext in project Payara by payara.
the class AsynchronousHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
for (EjbContext ejbContext : ejbContexts) {
EjbDescriptor ejbDesc = (EjbDescriptor) ejbContext.getDescriptor();
if (ElementType.TYPE.equals(ainfo.getElementType())) {
ejbContext.addPostProcessInfo(ainfo, this);
} else {
Method annMethod = (Method) ainfo.getAnnotatedElement();
setAsynchronous(annMethod, ejbDesc);
}
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.EjbContext in project Payara by payara.
the class ConcurrencyManagementHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
ConcurrencyManagement cmAn = (ConcurrencyManagement) ainfo.getAnnotation();
ConcurrencyManagementType cmType = cmAn.value();
for (EjbContext ejbContext : ejbContexts) {
EjbDescriptor ejbDesc = ejbContext.getDescriptor();
if (ejbDesc instanceof EjbSessionDescriptor) {
EjbSessionDescriptor.ConcurrencyManagementType descCMType;
switch(cmType) {
case CONTAINER:
descCMType = EjbSessionDescriptor.ConcurrencyManagementType.Container;
break;
case BEAN:
descCMType = EjbSessionDescriptor.ConcurrencyManagementType.Bean;
break;
default:
throw new AnnotationProcessorException("Unsupported concurrency management " + "type = " + cmType);
}
EjbSessionDescriptor sDesc = (EjbSessionDescriptor) ejbDesc;
// Set value on descriptor unless it has been set by .xml
sDesc.setConcurrencyManagementTypeIfNotSet(descCMType);
}
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.EjbContext 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();
}
use of com.sun.enterprise.deployment.annotation.context.EjbContext in project Payara by payara.
the class PostActivateHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
for (EjbContext next : ejbContexts) {
EjbSessionDescriptor ejbSessionDescriptor = (EjbSessionDescriptor) next.getDescriptor();
ejbSessionDescriptor.addPostActivateDescriptor(getPostActivateDescriptor(ainfo));
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.EjbContext in project Payara by payara.
the class RemoveHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
Remove remove = (Remove) ainfo.getAnnotation();
for (EjbContext next : ejbContexts) {
EjbSessionDescriptor sessionDescriptor = (EjbSessionDescriptor) next.getDescriptor();
Method m = (Method) ainfo.getAnnotatedElement();
MethodDescriptor removeMethod = new MethodDescriptor(m, MethodDescriptor.EJB_BEAN);
EjbRemovalInfo removalInfo = sessionDescriptor.getRemovalInfo(removeMethod);
if (removalInfo == null) {
// if this element is not defined in xml
// use all information from annotation
removalInfo = new EjbRemovalInfo();
removalInfo.setRemoveMethod(removeMethod);
removalInfo.setRetainIfException(remove.retainIfException());
sessionDescriptor.addRemoveMethod(removalInfo);
} else {
// is not defined in xml
if (!removalInfo.isRetainIfExceptionSet()) {
removalInfo.setRetainIfException(remove.retainIfException());
}
}
}
return getDefaultProcessedResult();
}
Aggregations