1 4 package org.jfox.jms.server; 5 6 import javax.naming.Context ; 7 8 import org.jfox.ioc.common.AbstractService; 9 import org.jfox.ioc.ext.ActiveComponent; 10 import org.jfox.jndi.InitialContextHelper; 11 12 15 16 public class JMSConnectionFactoryS extends AbstractService implements ActiveComponent { 17 18 private String jndiName = "jms/defaultcf"; 19 20 public JMSConnectionFactoryS(String jndiName) { 21 this.jndiName = jndiName; 22 } 23 24 protected void doStart() throws Exception { 25 this.getClass().getClassLoader().loadClass("org.jfox.jndi.InitialContextHelper"); 26 Context ctx = InitialContextHelper.getInitialContext(); 27 logger.info("bind ConnectionFactory " + jndiName); 28 ctx.bind(jndiName, new org.jfox.jms.JMSConnectionFactory()); 29 30 } 31 32 protected void doStop() throws Exception { 33 logger.info("unbind ConnectionFactory " + jndiName); 34 Context ctx = InitialContextHelper.getInitialContext(); 35 ctx.unbind(jndiName); 36 } 37 38 protected void doInit() throws Exception { 39 } 40 41 protected void doDestroy() throws Exception { 42 } 43 44 public void run() { 45 } 46 47 48 public static void main(String [] args) { 49 50 } 51 } 52 53 | Popular Tags |