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: SequencingEndpoint.java 1694 2006-10-11 19:20:34Z mpreston $
023: */
024:
025: package com.bostechcorp.cbesb.runtime.component.cbr;
026:
027: import java.util.ArrayList;
028: import java.util.List;
029:
030: import javax.jbi.messaging.MessageExchange;
031:
032: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.IComponentProcessor;
033: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.LifeCycleEndpoint;
034: import com.bostechcorp.cbesb.runtime.component.cbr.processors.CBRProviderProcessor;
035:
036: public class CBREndpoint extends LifeCycleEndpoint {
037:
038: protected String routingRules;
039:
040: protected String type;
041:
042: protected String offset;
043: protected String length;
044:
045: protected String delimiter;
046: protected String index;
047:
048: protected String expression;
049:
050: protected String scriptEngine;
051: protected String scriptClass;
052: protected String scriptMethod;
053:
054: public String getRoutingRules() {
055: return routingRules;
056: }
057:
058: public void setRoutingRules(String routingRules) {
059: this .routingRules = routingRules;
060: }
061:
062: public String getType() {
063: return type;
064: }
065:
066: public void setType(String type) {
067: this .type = type;
068: }
069:
070: public String getLength() {
071: return length;
072: }
073:
074: public void setLength(String length) {
075: this .length = length;
076: }
077:
078: public String getOffset() {
079: return offset;
080: }
081:
082: public void setOffset(String offset) {
083: this .offset = offset;
084: }
085:
086: public String getDelimiter() {
087: return delimiter;
088: }
089:
090: public void setDelimiter(String delimiter) {
091: this .delimiter = delimiter;
092: }
093:
094: public String getIndex() {
095: return index;
096: }
097:
098: public void setIndex(String index) {
099: this .index = index;
100: }
101:
102: public String getExpression() {
103: return expression;
104: }
105:
106: public void setExpression(String expression) {
107: this .expression = expression;
108: }
109:
110: public String getScriptClass() {
111: return scriptClass;
112: }
113:
114: public void setScriptClass(String scriptClass) {
115: this .scriptClass = scriptClass;
116: }
117:
118: public String getScriptEngine() {
119: return scriptEngine;
120: }
121:
122: public void setScriptEngine(String scriptEngine) {
123: this .scriptEngine = scriptEngine;
124: }
125:
126: public String getScriptMethod() {
127: return scriptMethod;
128: }
129:
130: public void setScriptMethod(String scriptMethod) {
131: this .scriptMethod = scriptMethod;
132: }
133:
134: /*
135: * (non-Javadoc)
136: *
137: * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.BaseEndpoint#createConsumerProcessor()
138: */
139: @Override
140: protected IComponentProcessor createConsumerProcessor() {
141: return null;
142: }
143:
144: /*
145: * (non-Javadoc)
146: *
147: * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.BaseEndpoint#createProviderProcessor()
148: */
149: @Override
150: protected IComponentProcessor createProviderProcessor() {
151: CBRProviderProcessor provider = new CBRProviderProcessor(this );
152: provider.setMessageExchangeFactory(exchangeFactory);
153: provider.setChannel(channel);
154:
155: return provider;
156:
157: }
158:
159: public void processAsConsumer(MessageExchange exchange)
160: throws Exception {
161: Exception e = new Exception(
162: "CBR component doesn't support Consumer role ");
163: exchange.setError(e);
164: channel.send(exchange);
165: throw e;
166: }
167:
168: /**********************************************************************************
169: * These attributes and methods customize the LifeCycleEndpoint for this component
170: ***********************************************************************************/
171: /*
172: * The display parameters are general information for the admin console to display.
173: */
174: public String[] getDisplayParameterTitles() {
175: return new String[] {};
176: }
177:
178: /*
179: * The values returned here correspond to the titles above.
180: */
181: public String[] getDisplayParameters() {
182: return new String[] {};
183: }
184:
185: /*
186: * This returns a list of properties that can be read.
187: */
188: public String[] getGetableProperties() {
189: CbrPropertiesEnumeration[] fps = CbrPropertiesEnumeration
190: .values();
191: List<String> result = new ArrayList<String>();
192: for (int i = 0; i < fps.length; i++) {
193: result.add(fps[i].name());
194: }
195: String[] sr = new String[result.size()];
196: return result.toArray(sr);
197: }
198:
199: /*
200: * This gets one property from the list above.
201: */
202: public String getProperty(int index) {
203: return CbrPropertiesEnumeration.values()[index].getValue(this );
204: }
205:
206: /*
207: * This gets one property from the list above.
208: */
209: public String getProperty(String property) {
210: return CbrPropertiesEnumeration.valueOf(property)
211: .getValue(this );
212: }
213:
214: /*
215: * This returns a list of properties that can be set.
216: */
217: public String[] getSetableProperties() {
218: CbrPropertiesEnumeration[] fps = CbrPropertiesEnumeration
219: .values();
220: List<String> result = new ArrayList<String>();
221: for (int i = 0; i < fps.length; i++) {
222: if (fps[i].isSetable())
223: result.add(fps[i].name());
224: }
225: String[] sr = new String[result.size()];
226: return result.toArray(sr);
227: }
228:
229: /*
230: * This sets one property from the list above.
231: */
232: public void setProperty(int index, String value) {
233: CbrPropertiesEnumeration.values()[index].setValue(this , value);
234: }
235:
236: /*
237: * This sets one property from the list above.
238: */
239: public void setProperty(String property, String value) {
240: CbrPropertiesEnumeration.valueOf(property)
241: .setValue(this , value);
242: }
243:
244: /**************************************************
245: * Done with LifeCycleEndpoint methods
246: ***************************************************/
247: }
|