use of org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl in project Payara by payara.
the class ApplicationExceptionHandler method processAnnotation.
public HandlerProcessingResult processAnnotation(AnnotationInfo ainfo) throws AnnotationProcessorException {
AnnotatedElement ae = ainfo.getAnnotatedElement();
Annotation annotation = ainfo.getAnnotation();
AnnotatedElementHandler aeHandler = ainfo.getProcessingContext().getHandler();
if (aeHandler instanceof EjbBundleContext) {
EjbBundleContext ejbBundleContext = (EjbBundleContext) aeHandler;
EjbBundleDescriptorImpl ejbBundle = (EjbBundleDescriptorImpl) ejbBundleContext.getDescriptor();
ApplicationException appExcAnn = (ApplicationException) annotation;
EjbApplicationExceptionInfo appExcInfo = new EjbApplicationExceptionInfo();
Class annotatedClass = (Class) ae;
appExcInfo.setExceptionClassName(annotatedClass.getName());
appExcInfo.setRollback(appExcAnn.rollback());
appExcInfo.setInherited(appExcAnn.inherited());
// in ejb-jar.xml
if (!ejbBundle.getApplicationExceptions().containsKey(annotatedClass.getName())) {
ejbBundle.addApplicationException(appExcInfo);
}
}
return getDefaultProcessedResult();
}
use of org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl in project Payara by payara.
the class ExcludeClassInterceptorsHandler 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.setExcludeClassInterceptors(true);
// Annotation can be defined at a method level or constructor level.
MethodDescriptor md = null;
if (ElementType.METHOD.equals(ainfo.getElementType())) {
Method m = (Method) ainfo.getAnnotatedElement();
md = new MethodDescriptor(m, MethodDescriptor.EJB_BEAN);
} 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);
md = new MethodDescriptor(cl.getSimpleName(), null, parameterClassNames, MethodDescriptor.EJB_BEAN);
}
// else throw Exception?
binding.setBusinessMethod(md);
ejbBundle.prependInterceptorBinding(binding);
}
return getDefaultProcessedResult();
}
use of org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl in project Payara by payara.
the class EjbBundleTracerVisitor method accept.
@Override
public void accept(BundleDescriptor descriptor) {
if (descriptor instanceof EjbBundleDescriptorImpl) {
EjbBundleDescriptorImpl ejbBundle = (EjbBundleDescriptorImpl) descriptor;
accept(ejbBundle);
for (EjbDescriptor anEjb : ejbBundle.getEjbs()) {
anEjb.visit(getSubDescriptorVisitor(anEjb));
}
if (ejbBundle.hasRelationships()) {
for (RelationshipDescriptor rd : ejbBundle.getRelationships()) {
accept(rd);
}
}
for (WebService ws : ejbBundle.getWebServices().getWebServices()) {
accept(ws);
}
}
super.accept(descriptor);
}
use of org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl in project Payara by payara.
the class EjbBundleValidator method accept.
@Override
public void accept(BundleDescriptor descriptor) {
this.bundleDescriptor = descriptor;
this.application = descriptor.getApplication();
if (descriptor instanceof EjbBundleDescriptorImpl) {
EjbBundleDescriptorImpl ejbBundle = (EjbBundleDescriptorImpl) descriptor;
accept(ejbBundle);
for (EjbDescriptor anEjb : ejbBundle.getEjbs()) {
anEjb.visit(getSubDescriptorVisitor(anEjb));
}
if (ejbBundle.hasRelationships()) {
for (Iterator itr = ejbBundle.getRelationships().iterator(); itr.hasNext(); ) {
RelationshipDescriptor rd = (RelationshipDescriptor) itr.next();
accept(rd);
}
}
for (WebService aWebService : ejbBundle.getWebServices().getWebServices()) {
accept(aWebService);
}
// inject field.
for (InjectionCapable injectable : ejbBundle.getInjectableResources(ejbBundle)) {
accept(injectable);
}
super.accept(descriptor);
} else {
super.accept(descriptor);
}
}
use of org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl in project Payara by payara.
the class EjbNode method addDescriptor.
@Override
public void addDescriptor(Object newDescriptor) {
if (newDescriptor instanceof EjbReference) {
if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
DOLUtils.getDefaultLogger().fine("Adding ejb ref " + newDescriptor);
}
getEjbDescriptor().addEjbReferenceDescriptor((EjbReference) newDescriptor);
} else if (newDescriptor instanceof RunAsIdentityDescriptor) {
if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
DOLUtils.getDefaultLogger().fine("Adding security-identity" + newDescriptor);
}
getEjbDescriptor().setUsesCallerIdentity(false);
getEjbDescriptor().setRunAsIdentity((RunAsIdentityDescriptor) newDescriptor);
} else if (newDescriptor instanceof MessageDestinationReferenceDescriptor) {
MessageDestinationReferenceDescriptor msgDestRef = (MessageDestinationReferenceDescriptor) newDescriptor;
EjbBundleDescriptorImpl ejbBundle = (EjbBundleDescriptorImpl) getParentNode().getDescriptor();
// EjbBundle might not be set yet on EjbDescriptor, so set it
// explicitly here.
msgDestRef.setReferringBundleDescriptor(ejbBundle);
getEjbDescriptor().addMessageDestinationReferenceDescriptor(msgDestRef);
} else {
super.addDescriptor(newDescriptor);
}
}
Aggregations