001    /*
002     * Copyright (C) The Apache Software Foundation. All rights reserved.
003     *
004     * This software is published under the terms of the Apache Software License
005     * version 1.1, a copy of which has been included with this distribution in
006     * the LICENSE file.
007     * 
008     * $Id: Subscription.java 155459 2005-02-26 13:24:44Z dirkv $
009     */
010    package org.apache.commons.messagelet.model;
011    
012    import javax.jms.MessageListener;
013    
014    import org.apache.commons.messagelet.ConsumerThread;
015    
016    /** <p><code>SubscriptionList</code> a bean used by the digester to 
017      * create a list of JMS subscriptions.</p>
018      *
019      * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
020      * @version $Revision: 155459 $
021      */
022    public class Subscription {
023    
024        /** Holds value of property connection. */
025        private String connection;
026        
027        /** Holds value of property subject. */
028        private String subject;
029        
030        /** Holds value of property selector. */
031        private String selector;
032        
033        /** Holds value of property messageListener. */
034        private MessageListener messageListener;
035        
036        /** Holds value of property servlet. */
037        private String servlet;
038    
039        /** should a ConsumerThread be used to consume these messages */
040        private ConsumerThread consumerThread;    
041        
042        public Subscription() {
043        }        
044            
045        /** Getter for property connection.
046         * @return Value of property connection.
047         */
048        public String getConnection() {
049            return connection;
050        }
051        
052        /** Setter for property connection.
053         * @param connection New value of property connection.
054         */
055        public void setConnection(String connection) {
056            this.connection = connection;
057        }
058        
059        /** Getter for property subject.
060         * @return Value of property subject.
061         */
062        public String getSubject() {
063            return subject;
064        }
065        
066        /** Setter for property subject.
067         * @param subject New value of property subject.
068         */
069        public void setSubject(String subject) {
070            this.subject = subject;
071        }
072        
073        /** Getter for property selector.
074         * @return Value of property selector.
075         */
076        public String getSelector() {
077            return selector;
078        }
079        
080        /** Setter for property selector.
081         * @param selector New value of property selector.
082         */
083        public void setSelector(String selector) {
084            this.selector = selector;
085        }
086        
087        /** Getter for property messageListener.
088         * @return Value of property messageListener.
089         */
090        public MessageListener getMessageListener() {
091            return messageListener;
092        }
093        
094        /** Setter for property messageListener.
095         * @param messageListener New value of property messageListener.
096         */
097        public void setMessageListener(MessageListener messageListener) {
098            this.messageListener = messageListener;
099        }
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    }