KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > connector > OutboundSubscriber


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2004 - Bull SA
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): Frederic Maistre (Bull SA)
21  * Contributor(s): Nicolas Tachker (Bull SA)
22  */

23 package org.objectweb.joram.client.connector;
24
25 import javax.jms.JMSException JavaDoc;
26 import javax.jms.MessageConsumer JavaDoc;
27 import javax.jms.Topic JavaDoc;
28
29 import org.objectweb.util.monolog.api.BasicLevel;
30
31 /**
32  * An <code>OutboundSubscriber</code> instance wraps a JMS PubSub consumer
33  * for a component involved in outbound messaging.
34  */

35 public class OutboundSubscriber extends OutboundConsumer
36                               implements javax.jms.TopicSubscriber JavaDoc
37 {
38   /** Topic instance to consume messages from. */
39   private Topic JavaDoc topic;
40   /** NoLocal parameter. */
41   private boolean noLocal;
42
43
44   /**
45    * Constructs an <code>OutboundSubscriber</code> instance.
46    */

47   OutboundSubscriber(Topic JavaDoc topic,
48                      boolean noLocal,
49                      MessageConsumer JavaDoc consumer,
50                      OutboundSession session) {
51     super(consumer, session);
52     this.topic = topic;
53     this.noLocal = noLocal;
54
55     if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
56       AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG,
57                                     "OutboundSubscriber(" + topic +
58                                     ", " + noLocal +
59                                     ", " + consumer +
60                                     ", " + session + ")");
61   }
62
63
64   /** Returns the consumer's topic. */
65   public Topic JavaDoc getTopic() throws JMSException JavaDoc {
66     if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
67       AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, this + " getTopic()");
68     
69     checkValidity();
70     return topic;
71   }
72
73   /** Returns the noLocal parameter. */
74   public boolean getNoLocal() throws JMSException JavaDoc {
75    if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
76       AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, this + " getNoLocal()");
77
78     checkValidity();
79     return noLocal;
80   }
81 }
82
Popular Tags