1 package org.jboss.ejb3.test.service; 2 3 import javax.annotation.Resource; 4 import javax.jms.Topic ; 5 import javax.jms.TopicConnectionFactory ; 6 7 import org.jboss.annotation.ejb.Management; 8 import org.jboss.annotation.ejb.Service; 9 import org.jboss.logging.Logger; 10 11 17 @Service(objectName = "jboss.ejb3.bugs:service=TestResourceInjectionService") 18 @Management(TestResourceInjectionServiceIF.class) 19 public class TestResourceInjectionService implements TestResourceInjectionServiceIF { 20 21 private static Logger log = Logger.getLogger(TestResourceInjectionService.class); 22 23 public boolean testedSuccessful = false; 24 25 @Resource(mappedName = "topic/testTopic") 26 private Topic testTopic; 27 28 @Resource(mappedName = "ConnectionFactory") 29 private TopicConnectionFactory topicConnectionFactory; 30 31 public boolean getTestedSuccessful() { 32 return testedSuccessful; 33 } 34 35 public boolean getTestedSuccessfulNow() { 36 boolean success = true; 37 if(testTopic == null) 38 { 39 log.warn("Dependent resource injection 'testTopic' failed"); 40 success = false; 41 } 42 43 if(topicConnectionFactory == null) 44 { 45 log.warn("Dependent resource injection 'topicConnectionFactory' failed"); 46 success = false; 47 } 48 return success; 49 } 50 51 53 public void create() throws Exception { 54 log.info("TestResourceInjectionService.create()"); 55 } 57 58 public void start() throws Exception { 59 log.info("TestResourceInjectionService.start()"); 60 testedSuccessful = true; 61 if(testTopic == null) 62 { 63 log.warn("Dependent resource injection 'testTopic' failed"); 64 testedSuccessful = false; 65 } 66 67 if(topicConnectionFactory == null) 68 { 69 log.warn("Dependent resource injection 'topicConnectionFactory' failed"); 70 testedSuccessful = false; 71 } 72 } 73 74 public void stop() { 75 log.info("TestResourceInjectionService.stop()"); 76 } 77 78 public void destroy() { 79 log.info("TestResourceInjectionService.destroy()"); 80 } 81 82 } 83 | Popular Tags |