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