1 25 package org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.interceptororder; 26 27 import static org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleBean.EMBEDDED_INTERCEPTOR; 28 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.AROUND_INVOKE; 29 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.UNDEFINED; 30 import static org.objectweb.easybeans.tests.common.helper.InterceptorHelper.addValue; 31 32 import java.util.ArrayList ; 33 import java.util.List ; 34 35 import javax.ejb.ActivationConfigProperty ; 36 import javax.ejb.MessageDriven ; 37 import javax.interceptor.AroundInvoke; 38 import javax.interceptor.Interceptors; 39 import javax.interceptor.InvocationContext; 40 import javax.jms.Message ; 41 import javax.jms.MessageListener ; 42 43 import org.objectweb.easybeans.log.JLog; 44 import org.objectweb.easybeans.log.JLogFactory; 45 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.BaseInsertCallbackEvent; 46 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.CallbackChecker; 47 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder01Interceptor; 48 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder02Interceptor; 49 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder06Interceptor; 50 import org.objectweb.easybeans.tests.common.jms.JMSManager; 51 52 57 @MessageDriven (messageListenerInterface = MessageListener .class, activationConfig = { 58 @ActivationConfigProperty (propertyName = "destinationType", propertyValue = "javax.jms.Queue"), 59 @ActivationConfigProperty (propertyName = "destination", propertyValue = JMSManager.DEFAULT_QUEUE), 60 @ActivationConfigProperty (propertyName = "messageSelector", propertyValue = 61 "TYPE = 'org.objectweb.easybeans.tests.common.ejbs." 62 + "mdb.containermanaged.interceptororder.MDBInvocationOrder00'")}) 63 @Interceptors({PrintOrder01Interceptor.class}) 64 public class MDBInvocationOrder00 extends BaseInsertCallbackEvent { 65 66 69 private static JLog logger = JLogFactory.getLog(MDBInvocationOrder00.class); 70 71 74 public static final String MESSAGE_TYPE = "org.objectweb.easybeans.tests.common." 75 + "ejbs.mdb.containermanaged.interceptororder.MDBInvocationOrder00"; 76 77 85 @SuppressWarnings ("unused") 86 @AroundInvoke 87 private Object addOrder(final InvocationContext invocationContext) throws Exception { 88 logger.debug("Interceptor invoked."); 89 return addValue(invocationContext, EMBEDDED_INTERCEPTOR, MDBInvocationOrder00.class.toString()); 90 } 91 92 97 @SuppressWarnings ("unchecked") 98 @Interceptors({PrintOrder02Interceptor.class, PrintOrder06Interceptor.class}) 99 public void onMessage(final Message message) { 100 CallbackChecker checker = new CallbackChecker(); 101 102 List <String > lstResult = new ArrayList <String >(); 103 lstResult.add(PrintOrder01Interceptor.class.toString()); 104 lstResult.add(PrintOrder02Interceptor.class.toString()); 105 lstResult.add(PrintOrder06Interceptor.class.toString()); 106 lstResult.add(MDBInvocationOrder00.class.toString()); 107 108 try { 110 checker.check(MDBInvocationOrder00.class.toString(), UNDEFINED, lstResult); 111 super.log(MDBInvocationOrder00.class.toString(), AROUND_INVOKE, MDBInvocationOrder00.class.toString()); 112 } catch (Exception e) { 113 logger.error("Error verifying interceptors order. Exception: ", e); 114 } 115 116 } 117 } 118 | Popular Tags |