001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id: JMSEndpoint.java 1206 2006-09-23 03:51:32Z elu $
023: */
024: package com.bostechcorp.cbesb.runtime.component.jms;
025:
026: //import org.apache.servicemix.common.ExchangeProcessor;
027: import java.util.ArrayList;
028: import java.util.List;
029:
030: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.*;
031:
032: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.IComponentProcessor;
033: import com.bostechcorp.cbesb.runtime.component.jms.processors.ConsumerProcessor;
034: import com.bostechcorp.cbesb.runtime.component.jms.processors.ProviderProcessor;
035:
036: public class JMSEndpoint extends LifeCycleEndpoint {
037:
038: //jndi information
039: protected String jndiInitialContextFactory;
040: protected String jndiProviderUrl;
041: protected String jndiConnectionFactoryName;
042:
043: // Jms informations
044: protected String destinationStyle;
045: protected String targetDestinationName;
046: protected String replyDestinationName;
047: protected String awaitTimeout;
048: protected String replyTimeout;
049: protected String recordsPerMessage;
050: protected String readStyle;
051: protected String recordType;
052: protected String writeStyle;
053: protected String charset;
054:
055: // JMS 1.2 propertyes
056: protected boolean transactional;
057: protected boolean retry;
058: protected int maxRetryCount;
059: protected int retryInterval;
060:
061: protected boolean enableQuery;
062: protected String queryExpression;
063:
064: protected String dLQ;
065: protected boolean savaMetadata;
066:
067: public String getCharset() {
068: return charset;
069: }
070:
071: public void setCharset(String charset) {
072: this .charset = charset;
073: }
074:
075: public String getDestinationStyle() {
076: return destinationStyle;
077: }
078:
079: public void setDestinationStyle(String destinationStyle) {
080: this .destinationStyle = destinationStyle;
081: }
082:
083: public String getJndiConnectionFactoryName() {
084: return jndiConnectionFactoryName;
085: }
086:
087: public void setJndiConnectionFactoryName(
088: String jndiConnectionFactoryName) {
089: this .jndiConnectionFactoryName = jndiConnectionFactoryName;
090: }
091:
092: public String getJndiInitialContextFactory() {
093: return jndiInitialContextFactory;
094: }
095:
096: public void setJndiInitialContextFactory(
097: String jndiInitialContextFactory) {
098: this .jndiInitialContextFactory = jndiInitialContextFactory;
099: }
100:
101: public String getJndiProviderUrl() {
102: return jndiProviderUrl;
103: }
104:
105: public void setJndiProviderUrl(String jndiProviderUrl) {
106: this .jndiProviderUrl = jndiProviderUrl;
107: }
108:
109: public String getReadStyle() {
110: return readStyle;
111: }
112:
113: public void setReadStyle(String readStyle) {
114: this .readStyle = readStyle;
115: }
116:
117: public String getRecordsPerMessage() {
118: return recordsPerMessage;
119: }
120:
121: public void setRecordsPerMessage(String recordsPerMessage) {
122: this .recordsPerMessage = recordsPerMessage;
123: }
124:
125: public String getRecordType() {
126: return recordType;
127: }
128:
129: public void setRecordType(String recordType) {
130: this .recordType = recordType;
131: }
132:
133: public String getReplyDestinationName() {
134: return replyDestinationName;
135: }
136:
137: public void setReplyDestinationName(String replyDestinationName) {
138: this .replyDestinationName = replyDestinationName;
139: }
140:
141: public String getReplyTimeout() {
142: return replyTimeout;
143: }
144:
145: public void setReplyTimeout(String replyTimeout) {
146: this .replyTimeout = replyTimeout;
147: }
148:
149: public String getTargetDestinationName() {
150: return targetDestinationName;
151: }
152:
153: public void setTargetDestinationName(String targetDestinationName) {
154: this .targetDestinationName = targetDestinationName;
155: }
156:
157: public String getWriteStyle() {
158: return writeStyle;
159: }
160:
161: public void setWriteStyle(String writeStyle) {
162: this .writeStyle = writeStyle;
163: }
164:
165: public String getAwaitTimeout() {
166: return awaitTimeout;
167: }
168:
169: public void setAwaitTimeout(String awaitTimeout) {
170: this .awaitTimeout = awaitTimeout;
171: }
172:
173: /**
174: * @return the maxRetryCount
175: */
176: public int getMaxRetryCount() {
177: return maxRetryCount;
178: }
179:
180: /**
181: * @param maxRetryCount the maxRetryCount to set
182: */
183: public void setMaxRetryCount(int maxRetryCount) {
184: this .maxRetryCount = maxRetryCount;
185: }
186:
187: /**
188: * @return the retry
189: */
190: public boolean isRetry() {
191: return retry;
192: }
193:
194: /**
195: * @param retry the retry to set
196: */
197: public void setRetry(boolean retry) {
198: this .retry = retry;
199: }
200:
201: /**
202: * @return the retryInterval
203: */
204: public int getRetryInterval() {
205: return retryInterval;
206: }
207:
208: /**
209: * @param retryInterval the retryInterval to set
210: */
211: public void setRetryInterval(int retryInterval) {
212: this .retryInterval = retryInterval;
213: }
214:
215: /**
216: * @return the selectrorExpression
217: */
218: public String getQueryExpression() {
219: return queryExpression;
220: }
221:
222: /**
223: * @param selectrorExpression the selectrorExpression to set
224: */
225: public void setQueryExpression(String selectrorExpression) {
226: this .queryExpression = selectrorExpression;
227: }
228:
229: /**
230: * @return the transactional
231: */
232: public boolean isTransactional() {
233: return transactional;
234: }
235:
236: /**
237: * @param transactional the transactional to set
238: */
239: public void setTransactional(boolean transactional) {
240: this .transactional = transactional;
241: }
242:
243: /**
244: * @return the useSelector
245: */
246: public boolean isEnableQuery() {
247: return enableQuery;
248: }
249:
250: /**
251: * @param useSelector the useSelector to set
252: */
253: public void setEnableQuery(boolean useSelector) {
254: this .enableQuery = useSelector;
255: }
256:
257: public String getDLQ() {
258: return dLQ;
259: }
260:
261: public void setDLQ(String dlq) {
262: dLQ = dlq;
263: }
264:
265: public boolean isSavaMetadata() {
266: return savaMetadata;
267: }
268:
269: public void setSavaMetadata(boolean savaMetadata) {
270: this .savaMetadata = savaMetadata;
271: }
272:
273: protected IComponentProcessor createProviderProcessor() {
274: return new ProviderProcessor(this );
275: }
276:
277: protected IComponentProcessor createConsumerProcessor() {
278: return new ConsumerProcessor(this );
279: }
280:
281: /**********************************************************************************
282: * These attributes and methods customize the LifeCycleEndpoint for this component
283: ***********************************************************************************/
284:
285: /*
286: * The display parameters are general information for the admin console to display.
287: */
288: public String[] getDisplayParameterTitles() {
289: return new String[] {
290: JmsPropertiesEnumeration.JNDI_INITIAL_CONTEXT_FACTORY
291: .name(),
292: JmsPropertiesEnumeration.JNDI_PROVIDER_URL.name(),
293: JmsPropertiesEnumeration.DESTINATION_STYLE.name(),
294: JmsPropertiesEnumeration.TARGET_DESTINATION_NAME.name(),
295: JmsPropertiesEnumeration.REPLY_DESTINATION_NAME.name() };
296: }
297:
298: /*
299: * The values returned here correspond to the titles above.
300: */
301: public String[] getDisplayParameters() {
302: return new String[] {
303: JmsPropertiesEnumeration.JNDI_INITIAL_CONTEXT_FACTORY
304: .getValue(this ),
305: JmsPropertiesEnumeration.JNDI_PROVIDER_URL
306: .getValue(this ),
307: JmsPropertiesEnumeration.DESTINATION_STYLE
308: .getValue(this ),
309: JmsPropertiesEnumeration.TARGET_DESTINATION_NAME
310: .getValue(this ),
311: JmsPropertiesEnumeration.REPLY_DESTINATION_NAME
312: .getValue(this ) };
313: }
314:
315: /*
316: * This returns a list of properties that can be read.
317: */
318: public String[] getGetableProperties() {
319: JmsPropertiesEnumeration[] fps = JmsPropertiesEnumeration
320: .values();
321: List<String> result = new ArrayList<String>();
322: for (int i = 0; i < fps.length; i++) {
323: result.add(fps[i].name());
324: }
325: String[] sr = new String[result.size()];
326: return result.toArray(sr);
327: }
328:
329: /*
330: * This gets one property from the list above.
331: */
332: public String getProperty(int index) {
333: return JmsPropertiesEnumeration.values()[index].getValue(this );
334: }
335:
336: /*
337: * This gets one property from the list above.
338: */
339: public String getProperty(String property) {
340: return JmsPropertiesEnumeration.valueOf(property)
341: .getValue(this );
342: }
343:
344: /*
345: * This returns a list of properties that can be set.
346: */
347: public String[] getSetableProperties() {
348: JmsPropertiesEnumeration[] fps = JmsPropertiesEnumeration
349: .values();
350: List<String> result = new ArrayList<String>();
351: for (int i = 0; i < fps.length; i++) {
352: if (fps[i].isSetable())
353: result.add(fps[i].name());
354: }
355: String[] sr = new String[result.size()];
356: return result.toArray(sr);
357: }
358:
359: /*
360: * This sets one property from the list above.
361: */
362: public void setProperty(int index, String value) {
363: JmsPropertiesEnumeration.values()[index].setValue(this , value);
364: }
365:
366: /*
367: * This sets one property from the list above.
368: */
369: public void setProperty(String property, String value) {
370: JmsPropertiesEnumeration.valueOf(property)
371: .setValue(this , value);
372: }
373:
374: /**************************************************
375: * Done with LifeCycleEndpoint methods
376: ***************************************************/
377: }
|