Search in sources :

Example 16 with EjbInterceptor

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

the class EjbBundleDescriptorImpl method addInterceptor.

public void addInterceptor(EjbInterceptor interceptor) {
    EjbInterceptor ic = getInterceptorByClassName(interceptor.getInterceptorClassName());
    if (ic == null) {
        interceptor.setEjbBundleDescriptor(this);
        interceptors.put(interceptor.getInterceptorClassName(), interceptor);
    }
}
Also used : EjbInterceptor(com.sun.enterprise.deployment.EjbInterceptor)

Example 17 with EjbInterceptor

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

the class AppSpecificConnectorClassLoaderUtil method processDescriptorForRAReferences.

private void processDescriptorForRAReferences(Application app, Descriptor descriptor, String moduleName) {
    if (descriptor instanceof JndiNameEnvironment) {
        processDescriptorForRAReferences(app, moduleName, (JndiNameEnvironment) descriptor);
    }
    // ejb descriptors
    if (descriptor instanceof EjbBundleDescriptor) {
        EjbBundleDescriptor ejbDesc = (EjbBundleDescriptor) descriptor;
        Set<? extends EjbDescriptor> ejbDescriptors = ejbDesc.getEjbs();
        for (EjbDescriptor ejbDescriptor : ejbDescriptors) {
            processDescriptorForRAReferences(app, moduleName, ejbDescriptor);
            if (ejbDescriptor instanceof EjbMessageBeanDescriptor) {
                EjbMessageBeanDescriptor messageBeanDesc = (EjbMessageBeanDescriptor) ejbDescriptor;
                String raMid = messageBeanDesc.getResourceAdapterMid();
                // there seem to be applications that do not specify ra-mid
                if (raMid != null) {
                    app.addResourceAdapter(raMid);
                }
            }
        }
        // ejb interceptors
        Set<EjbInterceptor> ejbInterceptors = ejbDesc.getInterceptors();
        for (EjbInterceptor ejbInterceptor : ejbInterceptors) {
            processDescriptorForRAReferences(app, moduleName, ejbInterceptor);
        }
    }
    if (descriptor instanceof BundleDescriptor) {
        // managed bean descriptors
        Set<ManagedBeanDescriptor> managedBeanDescriptors = ((BundleDescriptor) descriptor).getManagedBeans();
        for (ManagedBeanDescriptor mbd : managedBeanDescriptors) {
            processDescriptorForRAReferences(app, moduleName, mbd);
        }
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) JndiNameEnvironment(com.sun.enterprise.deployment.JndiNameEnvironment) EjbMessageBeanDescriptor(com.sun.enterprise.deployment.EjbMessageBeanDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) EjbInterceptor(com.sun.enterprise.deployment.EjbInterceptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 18 with EjbInterceptor

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

the class EjbDescriptorImpl method createSystemLevelCDIInterceptor.

/*  enabled for debugging 
    public int hashCode() {
        return getEjbName().hashCode();
    }

    public boolean equals(Object o) {

        boolean equal = false;

        if( (o != null) && (o instanceof EjbDescriptorImpl) ) {

            equal = getEjbName().equals( ((EjbDescriptorImpl)o).getEjbName() );

        }

        return equal;

    }
    */
// JJS: 4/2/13 Removing superinterfaces to track down cdi tck failures.
// http://java.net/jira/browse/GLASSFISH-19970
// private void addIfLocal(Class<?>[] interfaces, Set<String> names) {
// for(Class<?> next : interfaces) {
// if( next.getAnnotation(Local.class) != null ) {
// names.add(next.getName());
// }
// addIfLocal(next.getInterfaces(), names);
// }
// }
// 
// private void addIfRemote(Class<?>[] interfaces, Set<String> names) {
// for(Class<?> next : interfaces) {
// if( next.getAnnotation(Remote.class) != null ) {
// names.add(next.getName());
// }
// addIfRemote(next.getInterfaces(), names);
// }
// }
private EjbInterceptor createSystemLevelCDIInterceptor() {
    EjbInterceptor interceptor = new EjbInterceptor();
    Class<SessionBeanInterceptor> interceptorClass = SessionBeanInterceptor.class;
    String interceptorName = interceptorClass.getName();
    interceptor.setInterceptorClass(interceptorClass);
    // we have to look for method explicitly.
    try {
        Method aroundInvokeMethod = interceptorClass.getMethod("aroundInvoke", InvocationContext.class);
        if (aroundInvokeMethod != null) {
            LifecycleCallbackDescriptor aroundInvokeDesc = new LifecycleCallbackDescriptor();
            aroundInvokeDesc.setLifecycleCallbackClass(interceptorName);
            aroundInvokeDesc.setLifecycleCallbackMethod(aroundInvokeMethod.getName());
            interceptor.addAroundInvokeDescriptor(aroundInvokeDesc);
            // TODO BUG -- Existing SessionBeanInterceptor does not define an @AroundTimeout method.
            // Until that's fixed, work around it by adding the method marked @AroundInvoke as an
            // @AroundTimeout.
            LifecycleCallbackDescriptor aroundTimeoutDesc = new LifecycleCallbackDescriptor();
            aroundTimeoutDesc.setLifecycleCallbackClass(interceptorName);
            aroundTimeoutDesc.setLifecycleCallbackMethod(aroundInvokeMethod.getName());
            interceptor.addAroundTimeoutDescriptor(aroundTimeoutDesc);
            // SessionBeanInterceptor does not define an @PostConstruct method so use the aroundInvoke method
            LifecycleCallbackDescriptor postConstructDesc = new LifecycleCallbackDescriptor();
            postConstructDesc.setLifecycleCallbackClass(interceptorName);
            postConstructDesc.setLifecycleCallbackMethod(aroundInvokeMethod.getName());
            interceptor.addPostConstructDescriptor(postConstructDesc);
        }
    } catch (NoSuchMethodException nsme) {
        throw new RuntimeException("Cannot find weld EJB interceptor aroundInvoke method");
    }
    return interceptor;
}
Also used : LifecycleCallbackDescriptor(com.sun.enterprise.deployment.LifecycleCallbackDescriptor) EjbInterceptor(com.sun.enterprise.deployment.EjbInterceptor) Method(java.lang.reflect.Method) SessionBeanInterceptor(org.jboss.weld.module.ejb.SessionBeanInterceptor)

Example 19 with EjbInterceptor

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

the class EjbServicesImpl method makeEjbInterceptor.

private EjbInterceptor makeEjbInterceptor(Interceptor<?> interceptor, EjbBundleDescriptor bundle) {
    EjbInterceptor ejbInt = new EjbInterceptor();
    ejbInt.setBundleDescriptor(bundle);
    ejbInt.setInterceptorClass(interceptor.getBeanClass());
    ejbInt.setInterceptorClassName(interceptor.getBeanClass().getName());
    ejbInt.setCDIInterceptor(true);
    ejbInt.setInterceptor(interceptor);
    return ejbInt;
}
Also used : EjbInterceptor(com.sun.enterprise.deployment.EjbInterceptor)

Example 20 with EjbInterceptor

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

the class EjbInterceptorNode method getDescriptor.

@Override
public EjbInterceptor getDescriptor() {
    if (descriptor == null) {
        descriptor = new EjbInterceptor();
        descriptor.setEjbBundleDescriptor((EjbBundleDescriptor) getParentNode().getDescriptor());
    }
    return descriptor;
}
Also used : EjbInterceptor(com.sun.enterprise.deployment.EjbInterceptor)

Aggregations

EjbInterceptor (com.sun.enterprise.deployment.EjbInterceptor)34 LifecycleCallbackDescriptor (com.sun.enterprise.deployment.LifecycleCallbackDescriptor)9 LinkedList (java.util.LinkedList)6 Method (java.lang.reflect.Method)5 HashSet (java.util.HashSet)5 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)3 InterceptorDescriptor (com.sun.enterprise.deployment.InterceptorDescriptor)3 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)3 Result (com.sun.enterprise.tools.verifier.Result)3 ComponentNameConstructor (com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)3 ArrayList (java.util.ArrayList)3 EjbSessionDescriptor (org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)3 Descriptor (org.glassfish.deployment.common.Descriptor)2 Node (org.w3c.dom.Node)2 JCDIService (com.sun.enterprise.container.common.spi.JCDIService)1 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)1 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)1 EjbMessageBeanDescriptor (com.sun.enterprise.deployment.EjbMessageBeanDescriptor)1 EntityManagerFactoryReferenceDescriptor (com.sun.enterprise.deployment.EntityManagerFactoryReferenceDescriptor)1 EntityManagerReferenceDescriptor (com.sun.enterprise.deployment.EntityManagerReferenceDescriptor)1