View Javadoc

1   /*
2    * Copyright (C) The Apache Software Foundation. All rights reserved.
3    *
4    * This software is published under the terms of the Apache Software License
5    * version 1.1, a copy of which has been included with this distribution in
6    * the LICENSE file.
7    * 
8    * $Id: Subscription.java 155459 2005-02-26 13:24:44Z dirkv $
9    */
10  package org.apache.commons.messagelet.model;
11  
12  import javax.jms.MessageListener;
13  
14  import org.apache.commons.messagelet.ConsumerThread;
15  
16  /** <p><code>SubscriptionList</code> a bean used by the digester to 
17    * create a list of JMS subscriptions.</p>
18    *
19    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
20    * @version $Revision: 155459 $
21    */
22  public class Subscription {
23  
24      /** Holds value of property connection. */
25      private String connection;
26      
27      /** Holds value of property subject. */
28      private String subject;
29      
30      /** Holds value of property selector. */
31      private String selector;
32      
33      /** Holds value of property messageListener. */
34      private MessageListener messageListener;
35      
36      /** Holds value of property servlet. */
37      private String servlet;
38  
39      /** should a ConsumerThread be used to consume these messages */
40      private ConsumerThread consumerThread;    
41      
42      public Subscription() {
43      }        
44          
45      /** Getter for property connection.
46       * @return Value of property connection.
47       */
48      public String getConnection() {
49          return connection;
50      }
51      
52      /** Setter for property connection.
53       * @param connection New value of property connection.
54       */
55      public void setConnection(String connection) {
56          this.connection = connection;
57      }
58      
59      /** Getter for property subject.
60       * @return Value of property subject.
61       */
62      public String getSubject() {
63          return subject;
64      }
65      
66      /** Setter for property subject.
67       * @param subject New value of property subject.
68       */
69      public void setSubject(String subject) {
70          this.subject = subject;
71      }
72      
73      /** Getter for property selector.
74       * @return Value of property selector.
75       */
76      public String getSelector() {
77          return selector;
78      }
79      
80      /** Setter for property selector.
81       * @param selector New value of property selector.
82       */
83      public void setSelector(String selector) {
84          this.selector = selector;
85      }
86      
87      /** Getter for property messageListener.
88       * @return Value of property messageListener.
89       */
90      public MessageListener getMessageListener() {
91          return messageListener;
92      }
93      
94      /** Setter for property messageListener.
95       * @param messageListener New value of property messageListener.
96       */
97      public void setMessageListener(MessageListener messageListener) {
98          this.messageListener = messageListener;
99      }
100     
101     
102     /** Getter for property servlet.
103      * @return Value of property servlet.
104      */
105     public String getServlet() {
106         return servlet;
107     }
108     
109     /** Setter for property servlet.
110      * @param servlet New value of property servlet.
111      */
112     public void setServlet(String servlet) {
113         this.servlet = servlet;
114     }
115     
116     
117     /**
118      * Returns the consumerThread.
119      * @return ConsumerThread
120      */
121     public ConsumerThread getConsumerThread() {
122         return consumerThread;
123     }
124 
125     /**
126      * Sets the consumerThread.
127      * @param consumerThread The consumerThread to set
128      */
129     public void setConsumerThread(ConsumerThread consumerThread) {
130         this.consumerThread = consumerThread;
131     }
132     
133     /** Outputs a debugging string */
134     public String toString() {
135         StringBuffer buffer = new StringBuffer( super.toString() );
136         buffer.append( "[ connection: " );
137         buffer.append( connection );
138         buffer.append( " subject: " );
139         buffer.append( subject );
140         if ( selector != null ) {
141             buffer.append( " selector: " );
142             buffer.append( selector );
143         }
144         if ( servlet != null ) {
145             buffer.append( " servlet: " );
146             buffer.append( servlet );
147         }
148         else {
149             buffer.append( " messageListener: " );
150             buffer.append( messageListener );
151         }
152         return buffer.toString();
153     }   
154 
155 }