KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > deployment > xml > MessageDriven


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  *
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or 1any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  *
22  * Initial developer: JOnAS team
23  * --------------------------------------------------------------------------
24  * $Id: MessageDriven.java,v 1.11 2004/06/24 16:35:37 benoitf Exp $
25  * --------------------------------------------------------------------------
26  */

27 package org.objectweb.jonas_ejb.deployment.xml;
28
29 /**
30  * This class defines the implementation of the element message-driven
31  *
32  * @author JOnAS team
33  */

34
35 public class MessageDriven extends CommonEjb {
36
37     /**
38      * message-selector (EJB2.0 only)
39      */

40     private String JavaDoc messageSelector = null;
41
42     /**
43      * acknowledge-mode (EJB2.0 only)
44      */

45     private String JavaDoc acknowledgeMode = null;
46
47     /**
48      * message-driven-destination (EJB2.0 only)
49      */

50     private MessageDrivenDestination messageDrivenDestination = null;
51
52     /**
53      * message-destination-type (EJB2.1 only)
54      */

55     private String JavaDoc messageDestinationType = null;
56
57     /**
58      * message-destination-link (EJB2.1 only)
59      */

60     private String JavaDoc messageDestinationLink = null;
61
62     /**
63      * activation-config (EJB2.1 only)
64      */

65     private ActivationConfig activationConfig = null;
66
67     /**
68      * Constructor
69      */

70     public MessageDriven() {
71         super();
72
73         // specifies the messaging type interface of the message driven bean
74
// if not specified it is assumed to be javax.jms.MessageListener
75
setMessagingType("javax.jms.MessageListener");
76     }
77
78     /**
79      * Gets the message-selector (EJB2.0 only)
80      * @return the message-selector
81      */

82     public String JavaDoc getMessageSelector() {
83         return messageSelector;
84     }
85
86     /**
87      * Set the message-selector (EJB2.0 only)
88      * @param messageSelector messageSelector
89      */

90     public void setMessageSelector(String JavaDoc messageSelector) {
91         this.messageSelector = messageSelector;
92     }
93
94     /**
95      * Gets the acknowledge-mode (EJB2.0 only)
96      * @return the acknowledge-mode
97      */

98     public String JavaDoc getAcknowledgeMode() {
99         return acknowledgeMode;
100     }
101
102     /**
103      * Set the acknowledge-mode (EJB2.0 only)
104      * @param acknowledgeMode acknowledgeMode
105      */

106     public void setAcknowledgeMode(String JavaDoc acknowledgeMode) {
107         this.acknowledgeMode = acknowledgeMode;
108     }
109
110     /**
111      * Gets the message-driven-destination (EJB2.0 only)
112      * @return the message-driven-destination
113      */

114     public MessageDrivenDestination getMessageDrivenDestination() {
115         return messageDrivenDestination;
116     }
117
118     /**
119      * Set the message-driven-destination (EJB2.0 only)
120      * @param messageDrivenDestination messageDrivenDestination
121      */

122     public void setMessageDrivenDestination(MessageDrivenDestination messageDrivenDestination) {
123         this.messageDrivenDestination = messageDrivenDestination;
124     }
125
126     /**
127      * Gets the message-destination-type (EJB2.1 only)
128      * @return the message-destination-type
129      */

130     public String JavaDoc getMessageDestinationType() {
131         return messageDestinationType;
132     }
133
134     /**
135      * Set the message-destination-type (EJB2.1 only)
136      * @param messageDestinationType message-destination-type
137      */

138     public void setMessageDestinationType(String JavaDoc messageDestinationType) {
139         this.messageDestinationType = messageDestinationType;
140     }
141
142
143     /**
144      * Gets the message-destination-link (EJB2.1 only)
145      * @return the message-destination-link
146      */

147     public String JavaDoc getMessageDestinationLink() {
148         return messageDestinationLink;
149     }
150
151     /**
152      * Set the message-destination-link (EJB2.1 only)
153      * @param messageDestinationLink message-destination-link
154      */

155     public void setMessageDestinationLink(String JavaDoc messageDestinationLink) {
156         this.messageDestinationLink = messageDestinationLink;
157     }
158
159     /**
160      * Gets the activation-config (EJB2.1 only)
161      * @return the activation-config
162      */

163     public ActivationConfig getActivationConfig() {
164         return activationConfig;
165     }
166
167     /**
168      * Set the activation-config (EJB2.1 only)
169      * @param activationConfig activation-config
170      */

171     public void setActivationConfig(ActivationConfig activationConfig) {
172         this.activationConfig = activationConfig;
173     }
174
175
176     /**
177      * Represents this element by it's XML description.
178      * @param indent use this indent for prexifing XML representation.
179      * @return the XML description of this object.
180      */

181     public String JavaDoc toXML(int indent) {
182         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
183         sb.append(indent(indent));
184         sb.append("<message-driven>\n");
185
186         indent += 2;
187
188          // description
189
sb.append(xmlElement(getDescription(), "description", indent));
190         // display-name
191
sb.append(xmlElement(getDisplayName(), "display-name", indent));
192         // small-icon
193
sb.append(xmlElement(getIcon().getSmallIcon(), "small-icon", indent));
194         // large-icon
195
sb.append(xmlElement(getIcon().getLargeIcon(), "large-icon", indent));
196         // ejb-name
197
sb.append(xmlElement(getEjbName(), "ejb-name", indent));
198         // ejb-class
199
sb.append(xmlElement(getEjbClass(), "ejb-class", indent));
200         // messaging-type
201
sb.append(xmlElement(getMessagingType(), "messaging-type", indent));
202         // transaction-type
203
sb.append(xmlElement(getTransactionType(), "transaction-type", indent));
204
205         /* the old EJB2.0
206         // message-selector
207         sb.append(xmlElement(messageSelector, "message-selector", indent));
208         // acknowledge-mode
209         sb.append(xmlElement(acknowledgeMode, "acknowledge-mode", indent));
210         // message-driven-destination
211         if(messageDrivenDestination != null) {
212             sb.append(messageDrivenDestination.toXML(indent));
213         }
214         */

215
216         // message-destination-type (EJB2.1 only)
217
sb.append(xmlElement(messageDestinationType, "message-destination-type", indent));
218         // message-destination-link (EJB2.1 only)
219
sb.append(xmlElement(messageDestinationLink, "message-destination-link", indent));
220         // activation-config (EJB2.1 only)
221
if (activationConfig != null) {
222             sb.append(activationConfig.toXML(indent));
223         }
224
225         // env-entry
226
sb.append(getEnvEntryList().toXML(indent));
227         // ejb-ref
228
sb.append(getEjbRefList().toXML(indent));
229         // ejb-local-ref
230
sb.append(getEjbLocalRefList().toXML(indent));
231         // resource-ref
232
sb.append(getResourceRefList().toXML(indent));
233         // resource-env-ref
234
sb.append(getResourceEnvRefList().toXML(indent));
235         // service-ref
236
sb.append(getServiceRefList().toXML(indent));
237         // message-destination-ref
238
sb.append(getMessageDestinationRefList().toXML(indent));
239         // security-identity
240
if (getSecurityIdentity() != null) {
241             sb.append(getSecurityIdentity().toXML(indent));
242         }
243         indent -= 2;
244         sb.append(indent(indent));
245         sb.append("</message-driven>\n");
246
247         return sb.toString();
248     }
249 }
250
Popular Tags