KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > jms > server > JMSConnectionFactoryS


1 /*
2  * Copyright (c) 2004 Your Corporation. All Rights Reserved.
3  */

4 package org.jfox.jms.server;
5
6 import javax.naming.Context JavaDoc;
7
8 import org.jfox.ioc.common.AbstractService;
9 import org.jfox.ioc.ext.ActiveComponent;
10 import org.jfox.jndi.InitialContextHelper;
11
12 /**
13  * @author <a HREF="mailto:yy.young@gmail.com">Young Yang</a>
14  */

15
16 public class JMSConnectionFactoryS extends AbstractService implements ActiveComponent {
17
18     private String JavaDoc jndiName = "jms/defaultcf";
19
20     public JMSConnectionFactoryS(String JavaDoc jndiName) {
21         this.jndiName = jndiName;
22     }
23
24     protected void doStart() throws Exception JavaDoc {
25         this.getClass().getClassLoader().loadClass("org.jfox.jndi.InitialContextHelper");
26         Context JavaDoc 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 JavaDoc {
33         logger.info("unbind ConnectionFactory " + jndiName);
34         Context JavaDoc ctx = InitialContextHelper.getInitialContext();
35         ctx.unbind(jndiName);
36     }
37
38     protected void doInit() throws Exception JavaDoc {
39     }
40
41     protected void doDestroy() throws Exception JavaDoc {
42     }
43
44     public void run() {
45     }
46
47
48     public static void main(String JavaDoc[] args) {
49
50     }
51 }
52
53
Popular Tags