1 25 package org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.simpleentry; 26 27 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.ON_MESSAGE; 28 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.ANNOTATION_INJECTION_FIELD; 29 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.ANNOTATION_INJECTION_METHOD; 30 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.ANNOTATION_RESOURCES_DECLARATION; 31 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.ANNOTATION_RESOURCE_DECLARATION; 32 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.OVERRIDE_INJECTION_FIELD; 33 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.OVERRIDE_INJECTION_METHOD; 34 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.XML_INJECTION_FIELD; 35 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.XML_INJECTION_METHOD; 36 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.XML_RESOURCE_DECLARATION; 37 import static org.objectweb.easybeans.tests.common.helper.ContextHelper.checkSimpleEntry; 38 39 import javax.annotation.Resource; 40 import javax.annotation.Resources; 41 import javax.ejb.ActivationConfigProperty ; 42 import javax.ejb.MessageDriven ; 43 import javax.ejb.MessageDrivenContext ; 44 import javax.jms.Message ; 45 import javax.jms.MessageListener ; 46 47 import org.objectweb.easybeans.log.JLog; 48 import org.objectweb.easybeans.log.JLogFactory; 49 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.BaseInsertOperation; 50 import org.objectweb.easybeans.tests.common.jms.JMSManager; 51 52 63 @MessageDriven (messageListenerInterface = MessageListener .class, activationConfig = { 64 @ActivationConfigProperty (propertyName = "destinationType", propertyValue = "javax.jms.Queue"), 65 @ActivationConfigProperty (propertyName = "destination", propertyValue = JMSManager.DEFAULT_QUEUE), 66 @ActivationConfigProperty (propertyName = "messageSelector", propertyValue = "TYPE = 'org.objectweb.easybeans.tests." 67 + "common.ejbs.mdb.containermanaged.simpleentry.MDBSimpleEntryEnv'")}) 68 @Resources({@Resource(name = "simple/strDeclaration00", type = java.lang.String .class)}) 69 @Resource(name = "simple/strDeclaration01", type = java.lang.String .class) 70 public class MDBSimpleEntryEnv extends BaseInsertOperation { 71 72 75 public static final String MESSAGE_TYPE = "org.objectweb.easybeans.tests.common.ejbs.mdb." 76 + "containermanaged.simpleentry.MDBSimpleEntryEnv"; 77 78 81 private static JLog logger = JLogFactory.getLog(MDBSimpleEntryEnv.class); 82 83 86 private String strMethodInjection; 87 88 91 @Resource(name = "simple/strFieldInjection") 92 private String strFieldInjection; 93 94 97 private String strXMLFieldInjection; 98 99 102 private String strXMLMethodInjection; 103 104 108 @Resource(name = "simple/strOverrideField") 109 private String strOverrideFieldInjection; 110 111 115 private String strOverrideMethodInjection; 116 117 121 @SuppressWarnings ("unused") 122 @Resource(name = "simple/strMethodInjection") 123 private void setMethodInjection(final String value) { 124 strMethodInjection = value; 125 } 126 127 131 @SuppressWarnings ("unused") 132 private void setXMLMethodInjection(final String value) { 133 strXMLMethodInjection = value; 134 } 135 136 140 @SuppressWarnings ("unused") 141 @Resource(name ="simple/strOverrideMethod") 142 private void setOverrideMethodInjection(final String value) { 143 strOverrideMethodInjection = value; 144 } 145 146 149 @Resource 150 private MessageDrivenContext ctx; 151 152 156 public void onMessage(final Message message) { 157 158 try { 160 checkSimpleEntry(ctx, "simple/strDeclaration00", "strDeclaration00"); 161 super.log(MDBSimpleEntryEnv.class, ON_MESSAGE, MDBSimpleEntryEnv.class, ANNOTATION_RESOURCES_DECLARATION); 162 logger.debug("{0} is working properly.", ANNOTATION_RESOURCES_DECLARATION.toString()); 163 } catch (Exception e) { 164 logger.debug("Error checking {0}: {1}", ANNOTATION_RESOURCES_DECLARATION.toString(), e.getMessage()); 165 } 166 try { 167 checkSimpleEntry(ctx, "simple/strDeclaration01", "strDeclaration01"); 168 super.log(MDBSimpleEntryEnv.class, ON_MESSAGE, MDBSimpleEntryEnv.class, ANNOTATION_RESOURCE_DECLARATION); 169 logger.debug("{0} is working properly.", ANNOTATION_RESOURCE_DECLARATION.toString()); 170 } catch (Exception e) { 171 logger.debug("Error checking {0}: {1}", ANNOTATION_RESOURCE_DECLARATION.toString(), e.getMessage()); 172 } 173 174 175 try { 177 checkSimpleEntry(ctx, "simple/strXMLDeclaration", "strXMLDeclaration00"); 178 super.log(MDBSimpleEntryEnv.class, ON_MESSAGE, MDBSimpleEntryEnv.class, XML_RESOURCE_DECLARATION); 179 logger.debug("{0} is working properly.", XML_RESOURCE_DECLARATION.toString()); 180 } catch (Exception e) { 181 logger.debug("Error checking {0}: {1}", XML_RESOURCE_DECLARATION.toString(), e.getMessage()); 182 } 183 184 try { 186 187 checkSimpleEntry(ctx, "simple/strFieldInjection", strFieldInjection, "strFieldInjection00"); 188 super.log(MDBSimpleEntryEnv.class, ON_MESSAGE, MDBSimpleEntryEnv.class, ANNOTATION_INJECTION_FIELD); 189 logger.debug("{0} is working properly.", ANNOTATION_INJECTION_FIELD.toString()); 190 } catch (Exception e) { 191 logger.debug("Error checking {0}: {1}", ANNOTATION_INJECTION_FIELD.toString(), e.getMessage()); 192 } 193 194 195 try { 197 checkSimpleEntry(ctx, "simple/strMethodInjection", strMethodInjection, "strMethodInjection00"); 198 super.log(MDBSimpleEntryEnv.class, ON_MESSAGE, MDBSimpleEntryEnv.class, ANNOTATION_INJECTION_METHOD); 199 logger.debug("{0} is working properly.", ANNOTATION_INJECTION_METHOD.toString()); 200 } catch (Exception e) { 201 logger.debug("Error checking {0}: {1}", ANNOTATION_INJECTION_METHOD.toString(), e.getMessage()); 202 } 203 204 try { 206 checkSimpleEntry(ctx, "simple/strXMLFieldInjection", strXMLFieldInjection, "strXMLFieldInjection00"); 207 super.log(MDBSimpleEntryEnv.class, ON_MESSAGE, MDBSimpleEntryEnv.class, XML_INJECTION_FIELD); 208 logger.debug("{0} is working properly.", XML_INJECTION_FIELD.toString()); 209 } catch (Exception e) { 210 logger.debug("Error checking {0}: {1}", XML_INJECTION_FIELD.toString(), e.getMessage()); 211 } 212 213 try { 215 checkSimpleEntry(ctx, "simple/strXMLMethodInjection", strXMLMethodInjection, "strXMLMethodInjection00"); 216 super.log(MDBSimpleEntryEnv.class, ON_MESSAGE, MDBSimpleEntryEnv.class, XML_INJECTION_METHOD); 217 logger.debug("{0} is working properly.", XML_INJECTION_METHOD.toString()); 218 } catch (Exception e) { 219 logger.debug("Error checking {0}: {1}", XML_INJECTION_METHOD.toString(), e.getMessage()); 220 } 221 222 try { 224 checkSimpleEntry(ctx, "simple/strOverrideFieldInjection", strOverrideFieldInjection, "strOverrideFieldInjection00"); 226 super.log(MDBSimpleEntryEnv.class, ON_MESSAGE, MDBSimpleEntryEnv.class, OVERRIDE_INJECTION_FIELD); 227 logger.debug("{0} is working properly.", OVERRIDE_INJECTION_FIELD.toString()); 228 } catch (Exception e) { 229 logger.debug("Error checking {0}: {1}", OVERRIDE_INJECTION_FIELD.toString(), e.getMessage()); 230 } 231 232 try { 234 checkSimpleEntry(ctx, "simple/strOverrideMethodInjection", 236 strOverrideMethodInjection, "strOverrideMethodInjection00"); 237 super.log(MDBSimpleEntryEnv.class, ON_MESSAGE, MDBSimpleEntryEnv.class, OVERRIDE_INJECTION_METHOD); 238 logger.debug("{0} is working properly.", OVERRIDE_INJECTION_METHOD.toString()); 239 } catch (Exception e) { 240 logger.debug("Error checking {0}: {1}", OVERRIDE_INJECTION_METHOD.toString(), e.getMessage()); 241 } 242 243 } 244 245 } 246 | Popular Tags |