KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

17
18 public class JMSQueueS extends AbstractService implements ActiveComponent {
19
20     private String JavaDoc queueName;
21     private String JavaDoc queueJndiName;
22     private Queue JavaDoc queue;
23
24     public JMSQueueS() {
25     }
26
27     protected void doInit() throws Exception JavaDoc {
28     }
29
30     protected void doDestroy() throws Exception JavaDoc {
31
32     }
33
34     protected void doStart() throws Exception JavaDoc {
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 JavaDoc {
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 JavaDoc queueName) {
50         this.queueName = queueName;
51         queue = new JMSQueue(queueName);
52     }
53
54     public void setQueueJndiName(String JavaDoc queueJndiName) {
55         this.queueJndiName = queueJndiName;
56     }
57
58     public String JavaDoc getQueueName() {
59         return queueName;
60     }
61
62     public String JavaDoc getQueueJndiName() {
63         return queueJndiName;
64     }
65
66     public static void main(String JavaDoc[] args) {
67
68     }
69 }
70
71
Popular Tags