View Javadoc

1   /**
2    * Copyright 2005-2006 the original author or authors.
3    *
4    * Licensed under the Gnu General Pubic License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with
6    * the License. You may obtain a copy of the License at
7    *
8    *      http://www.opensource.org/licenses/gpl-license.php
9    *
10   * This program 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.
13   * See the Gnu General Public License for more details.
14   */
15  package org.figure8.join.services.remoting.beans;
16  
17  import java.io.Serializable;
18  import java.util.List;
19  import java.util.ArrayList;
20  /**
21   * This is a thin bean used for remotely representing a <code>JMSConsumerBeanInfo</code>
22   * domain object. This remote bean if lighter than domain one.
23   * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
24   * @version $Revision: 1.1 $
25   */
26  public class RemoteJMSConsumerBeanInfo implements Serializable{
27  
28     // Attributes ---------------------------------------------------------------
29  
30     /** The name corresponding to the consumer. */
31     private String name;
32     /** The message selector expression to apply on consumer. */
33     private String selector;
34     /** The reference of destination this consumer get messages from. */
35     private String destination;
36     /** The Java class used for instanciating a JMS consumer */
37     private String consumerBeanClass;
38     /** Whether the wrapped consumer is active or not (it may have been temporarily disabled) */
39     private boolean active = true;
40     /** Whether the wrapped consumer bean is thread safe or not. Default is true. */
41     private boolean threadSafe = true;
42  
43     /** The parameters this consumer may have. */
44     private List parameters = new ArrayList();
45  
46  
47     // Constructors -------------------------------------------------------------
48  
49     /**
50      * Creates a new instance of RemoteJMSConsumerBeanInfo using mandatory fields
51      * @param name Name corresponding to the consumer
52      * @param selector Message selector expression
53      * @param destination Reference of listened destination
54      * @param consumerBeanClass Java class used for instanciating a JMS consumer
55      * @param active Whether the wrapped consumer is active
56      * @param threadSafe Whether the wrapped consumer is thread safe
57      */
58     public RemoteJMSConsumerBeanInfo(String name, String selector, String destination, String consumerBeanClass, boolean active, boolean threadSafe){
59        this.name = name;
60        this.selector = selector;
61        this.destination = destination;
62        this.consumerBeanClass = consumerBeanClass;
63        this.active = active;
64        this.threadSafe = threadSafe;
65     }
66  
67  
68     // Public -------------------------------------------------------------------
69  
70     /** @return The name of this consumer */
71     public String getName(){
72        return name;
73     }
74     /** @param name The name of this consumer */
75     public void setName(String name){
76        this.name = name;
77     }
78  
79     /** @return The selector expression for filtering messages */
80     public String getSelector(){
81        return selector;
82     }
83     /** @param selector The selector expression for filtering messages */
84     public void setSelector(String selector){
85        this.selector = selector;
86     }
87  
88     /** @return The reference of the JMS destination this consumer should listen */
89     public String getDestination(){
90        return destination;
91     }
92     /** @param destination The name of the JMS destination this consumer shoud listen */
93     public void setDestination(String destination){
94        this.destination = destination;
95     }
96  
97     /** @return The FQN of the Java class of denoted JMSConsumerBean instance */
98     public String getConsumerBeanClass(){
99        return consumerBeanClass;
100    }
101    /**
102     * Give the FQN of Java class used for instanciating a JMSConsumerBean
103     * @param consumerBeanClass The FQN of the Java class of wrapped JMSConsumerBean instance
104     */
105    public void setConsumerBeanClass(String consumerBeanClass){
106       this.consumerBeanClass = consumerBeanClass;
107    }
108 
109    /** @return Whether the denoted <code>JMSConsumerBean</code> is active or not */
110    public boolean isActive(){
111       return active;
112    }
113    /** @param active Flag telling whether wrapped JMSConsumerBean is active or not */
114    public void setActive(boolean active){
115       this.active = active;
116    }
117 
118    /** @return Whether the denoted <code>JMSConsumerBean</code> is thread safe or not */
119    public boolean isThreadSafe(){
120       return threadSafe;
121    }
122    /** @param threadSafe Flag telling whether denoted JMSConsumerBean is thread safe or not */
123    public void setThreadSafe(boolean threadSafe){
124       this.threadSafe = threadSafe;
125    }
126 
127    /** @return The configuration parameters this consumer may have */
128    public List getConsumerParameterInfos(){
129       return parameters;
130    }
131    /** @param param A configuration parameter for this consumer implementation */
132    public void addConsumerParameterInfo(RemoteParameter param){
133       parameters.add(param);
134    }
135 }