Search in sources :

Example 6 with HandlerProcessingResult

use of org.glassfish.apf.HandlerProcessingResult in project Payara by payara.

the class EntityManagerFactoryReferencesHandler method processAnnotation.

protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, ResourceContainerContext[] rcContexts) throws AnnotationProcessorException {
    PersistenceUnits annotation = (PersistenceUnits) ainfo.getAnnotation();
    PersistenceUnit[] emfRefAnnotations = annotation.value();
    List<HandlerProcessingResult> results = new ArrayList<>();
    for (PersistenceUnit emfRef : emfRefAnnotations) {
        results.add(processEmfRef(ainfo, rcContexts, emfRef));
    }
    return getOverallProcessingResult(results);
}
Also used : PersistenceUnit(javax.persistence.PersistenceUnit) HandlerProcessingResult(org.glassfish.apf.HandlerProcessingResult) ArrayList(java.util.ArrayList) PersistenceUnits(javax.persistence.PersistenceUnits)

Example 7 with HandlerProcessingResult

use of org.glassfish.apf.HandlerProcessingResult in project Payara by payara.

the class EntityManagerReferencesHandler method processAnnotation.

@Override
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, ResourceContainerContext[] rcContexts) throws AnnotationProcessorException {
    PersistenceContexts annotation = (PersistenceContexts) ainfo.getAnnotation();
    PersistenceContext[] emRefAnnotations = annotation.value();
    List<HandlerProcessingResult> results = new ArrayList<>();
    for (PersistenceContext emRef : emRefAnnotations) {
        results.add(processEmRef(ainfo, rcContexts, emRef));
    }
    return getOverallProcessingResult(results);
}
Also used : PersistenceContexts(javax.persistence.PersistenceContexts) HandlerProcessingResult(org.glassfish.apf.HandlerProcessingResult) ArrayList(java.util.ArrayList) PersistenceContext(javax.persistence.PersistenceContext)

Example 8 with HandlerProcessingResult

use of org.glassfish.apf.HandlerProcessingResult in project Payara by payara.

the class ResourcesHandler method processAnnotation.

/**
 * This entry point is used both for a single @EJB and iteratively
 * from a compound @EJBs processor.
 */
@Override
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, ResourceContainerContext[] rcContexts) throws AnnotationProcessorException {
    Resources resourcesAn = (Resources) ainfo.getAnnotation();
    Resource[] resourceAns = resourcesAn.value();
    List<HandlerProcessingResult> results = new ArrayList<>();
    for (Resource res : resourceAns) {
        results.add(processResource(ainfo, rcContexts, res));
    }
    return getOverallProcessingResult(results);
}
Also used : HandlerProcessingResult(org.glassfish.apf.HandlerProcessingResult) Resource(javax.annotation.Resource) ArrayList(java.util.ArrayList) Resources(javax.annotation.Resources)

Example 9 with HandlerProcessingResult

use of org.glassfish.apf.HandlerProcessingResult 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;
}
Also used : WebBundleContext(com.sun.enterprise.deployment.annotation.context.WebBundleContext) WebComponentsContext(com.sun.enterprise.deployment.annotation.context.WebComponentsContext) WebComponentContext(com.sun.enterprise.deployment.annotation.context.WebComponentContext) HandlerProcessingResult(org.glassfish.apf.HandlerProcessingResult) AnnotatedElementHandler(org.glassfish.apf.AnnotatedElementHandler)

Example 10 with HandlerProcessingResult

use of org.glassfish.apf.HandlerProcessingResult in project Payara by payara.

the class WebServiceRefsHandler method processAnnotation.

public HandlerProcessingResult processAnnotation(AnnotationInfo ainfo) throws AnnotationProcessorException {
    WebServiceRefs wsRefsAnnotation = (WebServiceRefs) ainfo.getAnnotation();
    WebServiceRef[] wsRefAnnotations = wsRefsAnnotation.value();
    List<HandlerProcessingResult> results = new ArrayList<HandlerProcessingResult>();
    for (WebServiceRef wsRef : wsRefAnnotations) {
        results.add(processAWsRef(ainfo, wsRef));
    }
    HandlerProcessingResult finalResult = null;
    for (HandlerProcessingResult result : results) {
        if (finalResult == null || (result.getOverallResult().compareTo(finalResult.getOverallResult()) > 0)) {
            finalResult = result;
        }
    }
    return finalResult;
}
Also used : HandlerProcessingResult(org.glassfish.apf.HandlerProcessingResult) ArrayList(java.util.ArrayList) WebServiceRefs(javax.xml.ws.WebServiceRefs) WebServiceRef(javax.xml.ws.WebServiceRef)

Aggregations

HandlerProcessingResult (org.glassfish.apf.HandlerProcessingResult)13 ArrayList (java.util.ArrayList)6 AnnotatedElementHandler (org.glassfish.apf.AnnotatedElementHandler)5 Annotation (java.lang.annotation.Annotation)3 EjbBundleContext (com.sun.enterprise.deployment.annotation.context.EjbBundleContext)2 EjbContext (com.sun.enterprise.deployment.annotation.context.EjbContext)2 EjbsContext (com.sun.enterprise.deployment.annotation.context.EjbsContext)2 AnnotatedElement (java.lang.reflect.AnnotatedElement)2 EnvironmentProperty (com.sun.enterprise.deployment.EnvironmentProperty)1 NameValuePairDescriptor (com.sun.enterprise.deployment.NameValuePairDescriptor)1 ComponentContext (com.sun.enterprise.deployment.annotation.context.ComponentContext)1 EjbInterceptorContext (com.sun.enterprise.deployment.annotation.context.EjbInterceptorContext)1 WebBundleContext (com.sun.enterprise.deployment.annotation.context.WebBundleContext)1 WebComponentContext (com.sun.enterprise.deployment.annotation.context.WebComponentContext)1 WebComponentsContext (com.sun.enterprise.deployment.annotation.context.WebComponentsContext)1 ApplicationState (fish.payara.nucleus.hotdeploy.ApplicationState)1 Resource (javax.annotation.Resource)1 Resources (javax.annotation.Resources)1 ActivationConfigProperty (javax.ejb.ActivationConfigProperty)1 EJB (javax.ejb.EJB)1