use of com.sun.enterprise.deployment.annotation.context.WebComponentsContext in project Payara by payara.
the class AbstractResourceHandler method processAnnotation.
/**
* Process a particular annotation which type is the same as the
* one returned by @see getAnnotationType(). All information
* pertinent to the annotation and its context is encapsulated
* in the passed AnnotationInfo instance.
*
* @param ainfo the annotation information
* @return
* @throws AnnotationProcessorException
*/
@Override
public HandlerProcessingResult processAnnotation(AnnotationInfo ainfo) throws AnnotationProcessorException {
AnnotatedElementHandler aeHandler = ainfo.getProcessingContext().getHandler();
if (aeHandler instanceof EjbBundleContext) {
EjbBundleContext ejbBundleContext = (EjbBundleContext) aeHandler;
aeHandler = ejbBundleContext.createContextForEjb();
if (aeHandler == null) {
aeHandler = ejbBundleContext.createContextForEjbInterceptor();
}
// If it's still null and we're in an ejb-jar, use the EjbBundleContext.
// This way we process dependencies on any classes (other than ejbs ,
// interceptors , and their super-classes) that have annotations in case
// we need the info for managed classes we wouldn't normally know about
// (e.g. 299 classes). In a .war, those are already processed during the
// .war annotation scanning.
EjbBundleDescriptor bundleDesc = ejbBundleContext.getDescriptor();
RootDeploymentDescriptor enclosingBundle = bundleDesc.getModuleDescriptor().getDescriptor();
boolean ejbJar = enclosingBundle instanceof EjbBundleDescriptor;
if ((aeHandler == null) && ejbJar) {
aeHandler = ejbBundleContext;
}
}
if (aeHandler == null) {
// not an ejb, interceptor in ejbBundle
return getInvalidAnnotatedElementHandlerResult(ainfo.getProcessingContext().getHandler(), ainfo);
}
ResourceContainerContext[] rcContexts = null;
if (aeHandler instanceof EjbsContext) {
EjbsContext ejbsContext = (EjbsContext) aeHandler;
rcContexts = (ResourceContainerContext[]) ejbsContext.getEjbContexts();
} else if (aeHandler instanceof WebComponentsContext) {
WebComponentsContext webCompsContext = (WebComponentsContext) aeHandler;
rcContexts = (ResourceContainerContext[]) webCompsContext.getWebComponentContexts();
} else if (aeHandler instanceof ResourceContainerContext) {
rcContexts = new ResourceContainerContext[] { (ResourceContainerContext) aeHandler };
} else {
return getInvalidAnnotatedElementHandlerResult(aeHandler, ainfo);
}
return processAnnotation(ainfo, rcContexts);
}
use of com.sun.enterprise.deployment.annotation.context.WebComponentsContext in project Payara by payara.
the class AbstractWebHandler method processAnnotation.
/**
* Process a particular annotation which type is the same as the
* one returned by @see getAnnotationType(). All information
* pertinent to the annotation and its context is encapsulated
* in the passed AnnotationInfo instance.
* This is a method in interface AnnotationHandler.
*
* @param ainfo the annotation information
*/
@Override
public HandlerProcessingResult processAnnotation(AnnotationInfo ainfo) throws AnnotationProcessorException {
AnnotatedElementHandler aeHandler = ainfo.getProcessingContext().getHandler();
if (aeHandler instanceof WebBundleContext) {
WebBundleContext webBundleContext = (WebBundleContext) aeHandler;
AnnotatedElementHandler aeh = webBundleContext.createContextForWeb();
if (aeh != null) {
aeHandler = aeh;
}
}
// no inheritance
HandlerProcessingResult procResult = null;
if (aeHandler instanceof WebComponentContext) {
procResult = processAnnotation(ainfo, new WebComponentContext[] { (WebComponentContext) aeHandler });
} else if (aeHandler instanceof WebComponentsContext) {
WebComponentsContext webCompsContext = (WebComponentsContext) aeHandler;
procResult = processAnnotation(ainfo, webCompsContext.getWebComponentContexts());
} else if (aeHandler instanceof WebBundleContext) {
WebBundleContext webBundleContext = (WebBundleContext) aeHandler;
procResult = processAnnotation(ainfo, webBundleContext);
} else {
return getInvalidAnnotatedElementHandlerResult(aeHandler, ainfo);
}
return procResult;
}
Aggregations