Examples of EjbInterceptor


Examples of com.sun.enterprise.deployment.EjbInterceptor

            if( m.getAnnotation(PrePassivate.class) != null ) {
                prePassivateDescriptors.add(getLifecycleCallbackDescriptor(m));
            }
        }
       
        EjbInterceptor interceptor =
            ejbBundle.getInterceptorByClassName(interceptorClass.getName());
        if (interceptor == null) {
            interceptor = new EjbInterceptor();
            interceptor.setInterceptorClassName(interceptorClass.getName());
            // Add interceptor to the set of all interceptors in the ejb-jar
            ejbBundle.addInterceptor(interceptor);
        }
       
        if (aroundInvokeDescriptors.size() > 0) {
            interceptor.addAroundInvokeDescriptors(aroundInvokeDescriptors);
        }
       
        if (aroundTimeoutDescriptors.size() > 0) {
            interceptor.addAroundTimeoutDescriptors(aroundTimeoutDescriptors);
        }
       
        if (postActivateDescriptors.size() > 0) {
            interceptor.addCallbackDescriptors(CallbackType.POST_ACTIVATE,
                postActivateDescriptors);
        }
       
        if (prePassivateDescriptors.size() > 0) {
            interceptor.addCallbackDescriptors(CallbackType.PRE_PASSIVATE,
                prePassivateDescriptors);
        }

        // process resource related annotations
        EjbInterceptorContext ejbInterceptorContext =
View Full Code Here

Examples of com.sun.enterprise.deployment.EjbInterceptor

        // add the CDI impl-specific system-level interceptor that needs to be registered for ALL
        // EJB components.  At runtime, this sets up the appropriate request context for invocations that
        // do not originate via the web tier.  This interceptor must be registered *before*
        // any application-level interceptors in the chain, so add it in the framework interceptor
        // category within the ejb descriptor.
        EjbInterceptor systemLevelCDIInterceptor = createSystemLevelCDIInterceptor();
        ejbDesc.addFrameworkInterceptor(systemLevelCDIInterceptor);
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.EjbInterceptor

    }
   

    private EjbInterceptor createSystemLevelCDIInterceptor() {

        EjbInterceptor interceptor = new EjbInterceptor();

        Class<SessionBeanInterceptor> interceptorClass = SessionBeanInterceptor.class;

        String interceptorName = interceptorClass.getName();

        interceptor.setInterceptorClass(interceptorClass);

        // @@@ SessionBeanInterceptor.class no longer has @AroundInvoke annotation so
        // 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);
            }
        } catch(NoSuchMethodException nsme) {
            throw new RuntimeException("Cannot find weld EJB interceptor aroundInvoke method");
        }
View Full Code Here

Examples of com.sun.enterprise.deployment.EjbInterceptor

                if ( logger.isLoggable( Level.FINE ) ) {
                    logger.log(Level.FINE, "Adding interceptor: "
                        + next.getBeanClass().getName() + " for EJB:"
                        + glassfishEjbDesc.getEjbClassName());
                }
                EjbInterceptor ejbInt = makeEjbInterceptor(next, glassfishEjbDesc.getEjbBundleDescriptor());
                glassfishEjbDesc.addInterceptorClass(ejbInt);
            }
        }

        // Create ordered list of EjbInterceptor for each lifecycle interception type and append to
View Full Code Here

Examples of com.sun.enterprise.deployment.EjbInterceptor

            return ejbInterceptorList;
        }

        for(Interceptor<?> next : lifecycleList ) {

            EjbInterceptor ejbInt = makeEjbInterceptor(next, ejbDesc.getEjbBundleDescriptor());
            LifecycleCallbackDescriptor lifecycleDesc = new LifecycleCallbackDescriptor();

            lifecycleDesc.setLifecycleCallbackClass(next.getBeanClass().getName());
            lifecycleDesc.setLifecycleCallbackMethod(getInterceptorMethod(next.getBeanClass(),
                    getInterceptorAnnotationType(interceptionType)));

            switch(interceptionType) {
                case POST_CONSTRUCT :
                    ejbInt.addPostConstructDescriptor(lifecycleDesc);
                    break;
                case PRE_DESTROY :
                    ejbInt.addPreDestroyDescriptor(lifecycleDesc);
                    break;
                case PRE_PASSIVATE :
                    ejbInt.addPrePassivateDescriptor(lifecycleDesc);
                    break;
                case POST_ACTIVATE :
                    ejbInt.addPostActivateDescriptor(lifecycleDesc);
                    break;
                case AROUND_INVOKE :
                    ejbInt.addAroundInvokeDescriptor(lifecycleDesc);
                    break;
                case AROUND_TIMEOUT :
                    ejbInt.addAroundTimeoutDescriptor(lifecycleDesc);
                    break;
                default :
                      throw new IllegalArgumentException("Invalid lifecycle interception type " +
                        interceptionType);
            }
View Full Code Here

Examples of com.sun.enterprise.deployment.EjbInterceptor

    }

    private EjbInterceptor makeEjbInterceptor(Interceptor<?> interceptor, EjbBundleDescriptor bundle) {

        EjbInterceptor ejbInt = new EjbInterceptor();
        ejbInt.setBundleDescriptor(bundle);
        ejbInt.setInterceptorClassName(interceptor.getBeanClass().getName());
        ejbInt.setCDIInterceptor(true);

        return ejbInt;
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.EjbInterceptor

                if ( logger.isLoggable( Level.FINE ) ) {
                    logger.log(Level.FINE,
                               CDILoggerInfo.ADDING_INTERCEPTOR_FOR_EJB,
                               new Object [] {next.getBeanClass().getName(), glassfishEjbDesc.getEjbClassName()});
                }
                EjbInterceptor ejbInt = makeEjbInterceptor(next, glassfishEjbDesc.getEjbBundleDescriptor());
                glassfishEjbDesc.addInterceptorClass(ejbInt);
            }
        }

        // Create ordered list of EjbInterceptor for each lifecycle interception type and append to
View Full Code Here

Examples of com.sun.enterprise.deployment.EjbInterceptor

        if( lifecycleList == null ) {
            return ejbInterceptorList;
        }

        for(Interceptor<?> next : lifecycleList ) {
            EjbInterceptor ejbInt = makeEjbInterceptor(next, ejbDesc.getEjbBundleDescriptor());
            Class interceptorClass = next.getBeanClass();
            while ( interceptorClass != null && ! interceptorClass.equals( Object.class ) ) {
                LifecycleCallbackDescriptor lifecycleDesc = new LifecycleCallbackDescriptor();

                lifecycleDesc.setLifecycleCallbackClass( interceptorClass.getName());
                lifecycleDesc.setLifecycleCallbackMethod( getInterceptorMethod( interceptorClass,
                                                                                getInterceptorAnnotationType(interceptionType)));
                switch(interceptionType) {
                    case POST_CONSTRUCT :
                        ejbInt.addPostConstructDescriptor(lifecycleDesc);
                        break;
                    case PRE_DESTROY :
                        ejbInt.addPreDestroyDescriptor(lifecycleDesc);
                        break;
                    case PRE_PASSIVATE :
                        ejbInt.addPrePassivateDescriptor(lifecycleDesc);
                        break;
                    case POST_ACTIVATE :
                        ejbInt.addPostActivateDescriptor(lifecycleDesc);
                        break;
                    case AROUND_INVOKE :
                        ejbInt.addAroundInvokeDescriptor(lifecycleDesc);
                        break;
                    case AROUND_TIMEOUT :
                        ejbInt.addAroundTimeoutDescriptor(lifecycleDesc);
                        break;
                    default :
                        throw new IllegalArgumentException("Invalid lifecycle interception type " +
                                                           interceptionType);
                }
View Full Code Here

Examples of com.sun.enterprise.deployment.EjbInterceptor

    }

    private EjbInterceptor makeEjbInterceptor(Interceptor<?> interceptor, EjbBundleDescriptor bundle) {

        EjbInterceptor ejbInt = new EjbInterceptor();
        ejbInt.setBundleDescriptor(bundle);
        ejbInt.setInterceptorClassName(interceptor.getBeanClass().getName());
        ejbInt.setCDIInterceptor(true);

        return ejbInt;
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.EjbInterceptor

            // add the CDI impl-specific system-level interceptor that needs to be registered for ALL
            // EJB components.  At runtime, this sets up the appropriate request context for invocations that
            // do not originate via the web tier.  This interceptor must be registered *before*
            // any application-level interceptors in the chain, so add it in the framework interceptor
            // category within the ejb descriptor.
            EjbInterceptor systemLevelCDIInterceptor = createSystemLevelCDIInterceptor();
            ejbDesc.addFrameworkInterceptor(systemLevelCDIInterceptor);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.