KickJava   Java API By Example, From Geeks To Geeks.

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


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

4 package org.jfox.jms.server;
5
6 import javax.jms.Topic JavaDoc;
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 /**
15  * @author <a HREF="mailto:yy.young@gmail.com">Young Yang</a>
16  */

17
18 public class JMSTopicS extends AbstractService implements ActiveComponent {
19
20     private Topic JavaDoc topic;
21     private String JavaDoc topicJndiName;
22     private String JavaDoc topicName;
23
24     public JMSTopicS() {
25
26     }
27
28     protected void doInit() throws Exception JavaDoc {
29
30     }
31
32     protected void doDestroy() throws Exception JavaDoc {
33
34     }
35
36     protected void doStart() throws Exception JavaDoc {
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 JavaDoc {
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 JavaDoc topicJndiName) {
52         this.topicJndiName = topicJndiName;
53     }
54
55     public void setTopicName(String JavaDoc topicName) {
56         this.topicName = topicName;
57         topic = new JMSTopic(topicName);
58     }
59
60     public String JavaDoc getTopicName() {
61         return topicName;
62     }
63
64     public String JavaDoc getTopicJndiName() {
65         return topicJndiName;
66     }
67
68
69     public static void main(String JavaDoc[] args) {
70
71     }
72 }
73
74
Popular Tags