1 4 package org.jfox.jms.server; 5 6 import javax.jms.Topic ; 7 8 import org.jfox.ioc.common.AbstractService; 9 import org.jfox.ioc.ext.ActiveComponent; 10 import org.jfox.jms.JMSTopic; 11 import org.jfox.jms.connector.JMSDestinations; 12 import org.jfox.jndi.InitialContextHelper; 13 14 17 18 public class JMSTopicS extends AbstractService implements ActiveComponent { 19 20 private Topic topic; 21 private String topicJndiName; 22 private String topicName; 23 24 public JMSTopicS() { 25 26 } 27 28 protected void doInit() throws Exception { 29 30 } 31 32 protected void doDestroy() throws Exception { 33 34 } 35 36 protected void doStart() throws Exception { 37 logger.debug("bind topic: " + topicJndiName); 38 InitialContextHelper.getInitialContext().rebind(topicJndiName, topic); 39 JMSDestinations.getInstance().registerDestination(topic); 40 } 41 42 protected void doStop() throws Exception { 43 logger.debug("unbind topic: " + topicJndiName); 44 InitialContextHelper.getInitialContext().unbind(topicJndiName); 45 JMSDestinations.getInstance().unregisterDestination(topic); 46 } 47 48 public void run() { 49 } 50 51 public void setTopicJndiName(String topicJndiName) { 52 this.topicJndiName = topicJndiName; 53 } 54 55 public void setTopicName(String topicName) { 56 this.topicName = topicName; 57 topic = new JMSTopic(topicName); 58 } 59 60 public String getTopicName() { 61 return topicName; 62 } 63 64 public String getTopicJndiName() { 65 return topicJndiName; 66 } 67 68 69 public static void main(String [] args) { 70 71 } 72 } 73 74 | Popular Tags |