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 7714 2007-06-04 07:56:32Z sji $
023: */
024:
025: package com.bostechcorp.cbesb.runtime.component.sequencing;
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.sequencing.processors.SequencingProviderProcessor;
035:
036: public class SequencingEndpoint extends LifeCycleEndpoint {
037:
038: protected String ServiceList;
039:
040: public String getServiceList() {
041: return ServiceList;
042: }
043:
044: public void setServiceList(String serviceList) {
045: ServiceList = serviceList;
046: }
047:
048: /* (non-Javadoc)
049: * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.BaseEndpoint#createConsumerProcessor()
050: */
051: @Override
052: protected IComponentProcessor createConsumerProcessor() {
053: return null;
054: }
055:
056: /* (non-Javadoc)
057: * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.BaseEndpoint#createProviderProcessor()
058: */
059: @Override
060: protected IComponentProcessor createProviderProcessor() {
061: SequencingProviderProcessor provider = new SequencingProviderProcessor(
062: this );
063: provider.setMessageExchangeFactory(exchangeFactory);
064: provider.setChannel(channel);
065:
066: return provider;
067:
068: }
069:
070: public void processAsConsumer(MessageExchange exchange)
071: throws Exception {
072: Exception e = new Exception(
073: "Sequencing component doesn't support Consumer role ");
074: exchange.setError(e);
075: channel.send(exchange);
076: throw e;
077: }
078:
079: /**********************************************************************************
080: * These attributes and methods customize the LifeCycleEndpoint for this component
081: ***********************************************************************************/
082:
083: /*
084: * The display parameters are general information for the admin console to display.
085: */
086: public String[] getDisplayParameterTitles() {
087: return null;
088: }
089:
090: /*
091: * The values returned here correspond to the titles above.
092: */
093: public String[] getDisplayParameters() {
094: return null;
095: }
096:
097: /*
098: * This returns a list of properties that can be read.
099: */
100: public String[] getGetableProperties() {
101: SequencingPropertiesEnumeration[] fps = SequencingPropertiesEnumeration
102: .values();
103: List<String> result = new ArrayList<String>();
104: for (int i = 0; i < fps.length; i++) {
105: result.add(fps[i].name());
106: }
107: String[] sr = new String[result.size()];
108: return result.toArray(sr);
109: }
110:
111: /*
112: * This gets one property from the list above.
113: */
114: public String getProperty(int index) {
115: return SequencingPropertiesEnumeration.values()[index]
116: .getValue(this );
117: }
118:
119: /*
120: * This gets one property from the list above.
121: */
122: public String getProperty(String property) {
123: return SequencingPropertiesEnumeration.valueOf(property)
124: .getValue(this );
125: }
126:
127: /*
128: * This returns a list of properties that can be set.
129: */
130: public String[] getSetableProperties() {
131: SequencingPropertiesEnumeration[] fps = SequencingPropertiesEnumeration
132: .values();
133: List<String> result = new ArrayList<String>();
134: for (int i = 0; i < fps.length; i++) {
135: if (fps[i].isSetable())
136: result.add(fps[i].name());
137: }
138: String[] sr = new String[result.size()];
139: return result.toArray(sr);
140: }
141:
142: /*
143: * This sets one property from the list above.
144: */
145: public void setProperty(int index, String value) {
146: SequencingPropertiesEnumeration.values()[index].setValue(this ,
147: value);
148: }
149:
150: /*
151: * This sets one property from the list above.
152: */
153: public void setProperty(String property, String value) {
154: SequencingPropertiesEnumeration.valueOf(property).setValue(
155: this , value);
156: }
157:
158: /**************************************************
159: * Done with LifeCycleEndpoint methods
160: ***************************************************/
161:
162: }
|