Search in sources :

Example 11 with LifecycleCallbackDescriptor

use of com.sun.enterprise.deployment.LifecycleCallbackDescriptor in project Payara by payara.

the class EjbDescriptor method addAroundInvokeDescriptor.

public void addAroundInvokeDescriptor(LifecycleCallbackDescriptor aroundInvokeDesc) {
    String className = aroundInvokeDesc.getLifecycleCallbackClass();
    boolean found = false;
    for (LifecycleCallbackDescriptor next : getAroundInvokeDescriptors()) {
        if (next.getLifecycleCallbackClass().equals(className)) {
            found = true;
            break;
        }
    }
    if (!found) {
        getAroundInvokeDescriptors().add(aroundInvokeDesc);
    }
}
Also used : LifecycleCallbackDescriptor(com.sun.enterprise.deployment.LifecycleCallbackDescriptor)

Example 12 with LifecycleCallbackDescriptor

use of com.sun.enterprise.deployment.LifecycleCallbackDescriptor in project Payara by payara.

the class EjbDescriptor method applyDefaultClassToLifecycleMethods.

/**
 * Since ejb-class is optional, in some cases the lifecycle-class
 * for AroundInvoke, PostConstruct, etc. methods on the bean-class
 * is not known at processing time and must be applied lazily.  As such,
 * this method should only be called if the ejb-class has been set
 * on this EjbDescriptor.
 */
public void applyDefaultClassToLifecycleMethods() {
    Set<LifecycleCallbackDescriptor> lifecycleMethods = getLifecycleCallbackDescriptors();
    lifecycleMethods.addAll(getAroundInvokeDescriptors());
    lifecycleMethods.addAll(getAroundTimeoutDescriptors());
    for (LifecycleCallbackDescriptor next : lifecycleMethods) {
        if (next.getLifecycleCallbackClass() == null) {
            next.setLifecycleCallbackClass(getEjbClassName());
        }
    }
}
Also used : LifecycleCallbackDescriptor(com.sun.enterprise.deployment.LifecycleCallbackDescriptor)

Example 13 with LifecycleCallbackDescriptor

use of com.sun.enterprise.deployment.LifecycleCallbackDescriptor in project Payara by payara.

the class EjbSessionDescriptor method addPostActivateDescriptor.

public void addPostActivateDescriptor(LifecycleCallbackDescriptor postActivateDesc) {
    String className = postActivateDesc.getLifecycleCallbackClass();
    boolean found = false;
    for (LifecycleCallbackDescriptor next : getPostActivateDescriptors()) {
        if (next.getLifecycleCallbackClass().equals(className)) {
            found = true;
            break;
        }
    }
    if (!found) {
        getPostActivateDescriptors().add(postActivateDesc);
    }
}
Also used : LifecycleCallbackDescriptor(com.sun.enterprise.deployment.LifecycleCallbackDescriptor)

Example 14 with LifecycleCallbackDescriptor

use of com.sun.enterprise.deployment.LifecycleCallbackDescriptor in project Payara by payara.

the class AroundInvokeNode method getDescriptor.

@Override
public LifecycleCallbackDescriptor getDescriptor() {
    if (descriptor == null) {
        descriptor = new LifecycleCallbackDescriptor();
        Descriptor parentDesc = (Descriptor) getParentNode().getDescriptor();
        if (parentDesc instanceof EjbDescriptor) {
            EjbDescriptor ejbDesc = (EjbDescriptor) parentDesc;
            descriptor.setDefaultLifecycleCallbackClass(ejbDesc.getEjbClassName());
        } else if (parentDesc instanceof EjbInterceptor) {
            EjbInterceptor ejbInterceptor = (EjbInterceptor) parentDesc;
            descriptor.setDefaultLifecycleCallbackClass(ejbInterceptor.getInterceptorClassName());
        }
    }
    return descriptor;
}
Also used : LifecycleCallbackDescriptor(com.sun.enterprise.deployment.LifecycleCallbackDescriptor) LifecycleCallbackDescriptor(com.sun.enterprise.deployment.LifecycleCallbackDescriptor) Descriptor(org.glassfish.deployment.common.Descriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) EjbInterceptor(com.sun.enterprise.deployment.EjbInterceptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 15 with LifecycleCallbackDescriptor

use of com.sun.enterprise.deployment.LifecycleCallbackDescriptor in project Payara by payara.

the class AroundConstructHandler method getAroundConstructDescriptor.

private LifecycleCallbackDescriptor getAroundConstructDescriptor(AnnotationInfo ainfo) {
    Method annotatedMethod = (Method) ainfo.getAnnotatedElement();
    LifecycleCallbackDescriptor aroundConstruct = new LifecycleCallbackDescriptor();
    aroundConstruct.setLifecycleCallbackClass(annotatedMethod.getDeclaringClass().getName());
    aroundConstruct.setLifecycleCallbackMethod(annotatedMethod.getName());
    return aroundConstruct;
}
Also used : LifecycleCallbackDescriptor(com.sun.enterprise.deployment.LifecycleCallbackDescriptor) Method(java.lang.reflect.Method)

Aggregations

LifecycleCallbackDescriptor (com.sun.enterprise.deployment.LifecycleCallbackDescriptor)38 Method (java.lang.reflect.Method)15 EjbInterceptor (com.sun.enterprise.deployment.EjbInterceptor)9 ArrayList (java.util.ArrayList)4 EJBException (javax.ejb.EJBException)4 InterceptorDescriptor (com.sun.enterprise.deployment.InterceptorDescriptor)3 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)3 EjbSessionDescriptor (org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)3 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)2 ResourceContainerContext (com.sun.enterprise.deployment.annotation.context.ResourceContainerContext)2 Result (com.sun.enterprise.tools.verifier.Result)2 ComponentNameConstructor (com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)2 HashSet (java.util.HashSet)2 Descriptor (org.glassfish.deployment.common.Descriptor)2 EjbDescriptor (org.glassfish.ejb.deployment.descriptor.EjbDescriptor)2 EjbContext (com.sun.enterprise.deployment.annotation.context.EjbContext)1 EjbInterceptorContext (com.sun.enterprise.deployment.annotation.context.EjbInterceptorContext)1 Collection (java.util.Collection)1 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1