001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: *
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or 1any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: * Initial developer: JOnAS team
023: * --------------------------------------------------------------------------
024: * $Id: MessageDriven.java 5000 2004-06-24 16:35:37Z benoitf $
025: * --------------------------------------------------------------------------
026: */package org.objectweb.jonas_ejb.deployment.xml;
027:
028: /**
029: * This class defines the implementation of the element message-driven
030: *
031: * @author JOnAS team
032: */
033:
034: public class MessageDriven extends CommonEjb {
035:
036: /**
037: * message-selector (EJB2.0 only)
038: */
039: private String messageSelector = null;
040:
041: /**
042: * acknowledge-mode (EJB2.0 only)
043: */
044: private String acknowledgeMode = null;
045:
046: /**
047: * message-driven-destination (EJB2.0 only)
048: */
049: private MessageDrivenDestination messageDrivenDestination = null;
050:
051: /**
052: * message-destination-type (EJB2.1 only)
053: */
054: private String messageDestinationType = null;
055:
056: /**
057: * message-destination-link (EJB2.1 only)
058: */
059: private String messageDestinationLink = null;
060:
061: /**
062: * activation-config (EJB2.1 only)
063: */
064: private ActivationConfig activationConfig = null;
065:
066: /**
067: * Constructor
068: */
069: public MessageDriven() {
070: super ();
071:
072: // specifies the messaging type interface of the message driven bean
073: // if not specified it is assumed to be javax.jms.MessageListener
074: setMessagingType("javax.jms.MessageListener");
075: }
076:
077: /**
078: * Gets the message-selector (EJB2.0 only)
079: * @return the message-selector
080: */
081: public String getMessageSelector() {
082: return messageSelector;
083: }
084:
085: /**
086: * Set the message-selector (EJB2.0 only)
087: * @param messageSelector messageSelector
088: */
089: public void setMessageSelector(String messageSelector) {
090: this .messageSelector = messageSelector;
091: }
092:
093: /**
094: * Gets the acknowledge-mode (EJB2.0 only)
095: * @return the acknowledge-mode
096: */
097: public String getAcknowledgeMode() {
098: return acknowledgeMode;
099: }
100:
101: /**
102: * Set the acknowledge-mode (EJB2.0 only)
103: * @param acknowledgeMode acknowledgeMode
104: */
105: public void setAcknowledgeMode(String acknowledgeMode) {
106: this .acknowledgeMode = acknowledgeMode;
107: }
108:
109: /**
110: * Gets the message-driven-destination (EJB2.0 only)
111: * @return the message-driven-destination
112: */
113: public MessageDrivenDestination getMessageDrivenDestination() {
114: return messageDrivenDestination;
115: }
116:
117: /**
118: * Set the message-driven-destination (EJB2.0 only)
119: * @param messageDrivenDestination messageDrivenDestination
120: */
121: public void setMessageDrivenDestination(
122: 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 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 messageDestinationType) {
139: this .messageDestinationType = messageDestinationType;
140: }
141:
142: /**
143: * Gets the message-destination-link (EJB2.1 only)
144: * @return the message-destination-link
145: */
146: public String getMessageDestinationLink() {
147: return messageDestinationLink;
148: }
149:
150: /**
151: * Set the message-destination-link (EJB2.1 only)
152: * @param messageDestinationLink message-destination-link
153: */
154: public void setMessageDestinationLink(String messageDestinationLink) {
155: this .messageDestinationLink = messageDestinationLink;
156: }
157:
158: /**
159: * Gets the activation-config (EJB2.1 only)
160: * @return the activation-config
161: */
162: public ActivationConfig getActivationConfig() {
163: return activationConfig;
164: }
165:
166: /**
167: * Set the activation-config (EJB2.1 only)
168: * @param activationConfig activation-config
169: */
170: public void setActivationConfig(ActivationConfig activationConfig) {
171: this .activationConfig = activationConfig;
172: }
173:
174: /**
175: * Represents this element by it's XML description.
176: * @param indent use this indent for prexifing XML representation.
177: * @return the XML description of this object.
178: */
179: public String toXML(int indent) {
180: StringBuffer sb = new StringBuffer();
181: sb.append(indent(indent));
182: sb.append("<message-driven>\n");
183:
184: indent += 2;
185:
186: // description
187: sb.append(xmlElement(getDescription(), "description", indent));
188: // display-name
189: sb.append(xmlElement(getDisplayName(), "display-name", indent));
190: // small-icon
191: sb.append(xmlElement(getIcon().getSmallIcon(), "small-icon",
192: indent));
193: // large-icon
194: sb.append(xmlElement(getIcon().getLargeIcon(), "large-icon",
195: 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",
202: indent));
203: // transaction-type
204: sb.append(xmlElement(getTransactionType(), "transaction-type",
205: indent));
206:
207: /* the old EJB2.0
208: // message-selector
209: sb.append(xmlElement(messageSelector, "message-selector", indent));
210: // acknowledge-mode
211: sb.append(xmlElement(acknowledgeMode, "acknowledge-mode", indent));
212: // message-driven-destination
213: if(messageDrivenDestination != null) {
214: sb.append(messageDrivenDestination.toXML(indent));
215: }
216: */
217:
218: // message-destination-type (EJB2.1 only)
219: sb.append(xmlElement(messageDestinationType,
220: "message-destination-type", indent));
221: // message-destination-link (EJB2.1 only)
222: sb.append(xmlElement(messageDestinationLink,
223: "message-destination-link", indent));
224: // activation-config (EJB2.1 only)
225: if (activationConfig != null) {
226: sb.append(activationConfig.toXML(indent));
227: }
228:
229: // env-entry
230: sb.append(getEnvEntryList().toXML(indent));
231: // ejb-ref
232: sb.append(getEjbRefList().toXML(indent));
233: // ejb-local-ref
234: sb.append(getEjbLocalRefList().toXML(indent));
235: // resource-ref
236: sb.append(getResourceRefList().toXML(indent));
237: // resource-env-ref
238: sb.append(getResourceEnvRefList().toXML(indent));
239: // service-ref
240: sb.append(getServiceRefList().toXML(indent));
241: // message-destination-ref
242: sb.append(getMessageDestinationRefList().toXML(indent));
243: // security-identity
244: if (getSecurityIdentity() != null) {
245: sb.append(getSecurityIdentity().toXML(indent));
246: }
247: indent -= 2;
248: sb.append(indent(indent));
249: sb.append("</message-driven>\n");
250:
251: return sb.toString();
252: }
253: }
|