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$
023: */package com.bostechcorp.cbesb.runtime.component.tcpip;
024:
025: /**
026: * @author LPS
027: *
028: */
029: public enum TcpIpPropertiesEnumeration {
030: RECORD_TYPE {
031: String getValue(TcpipEndpoint endpoint) {
032: return endpoint.getConfig().getRecordType();
033: }
034:
035: void setValue(TcpipEndpoint endpoint, Object value) {
036: if (isSetable())
037: endpoint.getConfig().setRecordType((String) value);
038: }
039:
040: boolean isSetable() {
041: return true;
042: }
043: },
044: CHARSET {
045: String getValue(TcpipEndpoint endpoint) {
046: return endpoint.getConfig().getCharset();
047: }
048:
049: void setValue(TcpipEndpoint endpoint, Object value) {
050: if (isSetable())
051: endpoint.getConfig().setCharset((String) value);
052: }
053:
054: boolean isSetable() {
055: return true;
056: }
057: },
058: PROTOCOL_HANDLER {
059: String getValue(TcpipEndpoint endpoint) {
060: return endpoint.getConfig().getProtocolHandler();
061: }
062:
063: void setValue(TcpipEndpoint endpoint, Object value) {
064: if (isSetable())
065: endpoint.getConfig().setProtocolHandler((String) value);
066: }
067:
068: boolean isSetable() {
069: return true;
070: }
071: },
072: CONNECTION_MODE {
073: String getValue(TcpipEndpoint endpoint) {
074: return String.valueOf(endpoint.getConfig()
075: .getConnectionMode());
076: }
077:
078: void setValue(TcpipEndpoint endpoint, Object value) {
079: if (isSetable())
080: endpoint.getConfig().setConnectionMode(
081: Short.parseShort((String) value));
082: }
083:
084: boolean isSetable() {
085: return true;
086: }
087: },
088: HOST {
089: String getValue(TcpipEndpoint endpoint) {
090: return endpoint.getConfig().getHost();
091: }
092:
093: void setValue(TcpipEndpoint endpoint, Object value) {
094: if (isSetable())
095: endpoint.getConfig().setHost((String) value);
096: }
097:
098: boolean isSetable() {
099: return true;
100: }
101: },
102: PORT {
103: String getValue(TcpipEndpoint endpoint) {
104: return String.valueOf(endpoint.getConfig().getPort());
105: }
106:
107: void setValue(TcpipEndpoint endpoint, Object value) {
108: if (isSetable())
109: endpoint.getConfig().setPort(
110: Integer.parseInt((String) value));
111: }
112:
113: boolean isSetable() {
114: return true;
115: }
116: },
117: LOCAL_BIND_HOST {
118: String getValue(TcpipEndpoint endpoint) {
119: return endpoint.getConfig().getLocalBindHost();
120: }
121:
122: void setValue(TcpipEndpoint endpoint, Object value) {
123: if (isSetable())
124: endpoint.getConfig().setLocalBindHost((String) value);
125: }
126:
127: boolean isSetable() {
128: return true;
129: }
130: },
131: USE_SSL {
132: String getValue(TcpipEndpoint endpoint) {
133: return String.valueOf(endpoint.getConfig().isUseSsl());
134: }
135:
136: void setValue(TcpipEndpoint endpoint, Object value) {
137: if (isSetable())
138: endpoint.getConfig().setUseSsl(
139: Boolean.parseBoolean((String) value));
140: }
141:
142: boolean isSetable() {
143: return true;
144: }
145: },
146: SSL_PROTOCOL {
147: String getValue(TcpipEndpoint endpoint) {
148: return endpoint.getConfig().getSslProtocol();
149: }
150:
151: void setValue(TcpipEndpoint endpoint, Object value) {
152: if (isSetable())
153: endpoint.getConfig().setSslProtocol((String) value);
154: }
155:
156: boolean isSetable() {
157: return true;
158: }
159: },
160: ALLOW_ANONYMOUS {
161: String getValue(TcpipEndpoint endpoint) {
162: return String.valueOf(endpoint.getConfig()
163: .isAllowAnonymous());
164: }
165:
166: void setValue(TcpipEndpoint endpoint, Object value) {
167: if (isSetable())
168: endpoint.getConfig().setAllowAnonymous(
169: Boolean.parseBoolean((String) value));
170: }
171:
172: boolean isSetable() {
173: return true;
174: }
175: },
176: USE_PRIVATE_KEY {
177: String getValue(TcpipEndpoint endpoint) {
178: return String.valueOf(endpoint.getConfig()
179: .isUsePrivateKey());
180: }
181:
182: void setValue(TcpipEndpoint endpoint, Object value) {
183: if (isSetable())
184: endpoint.getConfig().setUsePrivateKey(
185: Boolean.parseBoolean((String) value));
186: }
187:
188: boolean isSetable() {
189: return true;
190: }
191: },
192: KEY_STORE_FILE {
193: String getValue(TcpipEndpoint endpoint) {
194: return endpoint.getConfig().getKeyStoreFile();
195: }
196:
197: void setValue(TcpipEndpoint endpoint, Object value) {
198: if (isSetable())
199: endpoint.getConfig().setKeyStoreFile((String) value);
200: }
201:
202: boolean isSetable() {
203: return true;
204: }
205: },
206: KEY_STORE_PASSWORD {
207: String getValue(TcpipEndpoint endpoint) {
208: return endpoint.getConfig().getKeyStorePassword();
209: }
210:
211: void setValue(TcpipEndpoint endpoint, Object value) {
212: if (isSetable())
213: endpoint.getConfig()
214: .setKeyStorePassword((String) value);
215: }
216:
217: boolean isSetable() {
218: return true;
219: }
220: },
221: AUTHENTICATE_SERVER {
222: String getValue(TcpipEndpoint endpoint) {
223: return String.valueOf(endpoint.getConfig()
224: .isAuthenticateServer());
225: }
226:
227: void setValue(TcpipEndpoint endpoint, Object value) {
228: if (isSetable())
229: endpoint.getConfig().setAuthenticateServer(
230: Boolean.parseBoolean((String) value));
231: }
232:
233: boolean isSetable() {
234: return true;
235: }
236: },
237: USE_DEFAULT_TRUSTSTORE {
238: String getValue(TcpipEndpoint endpoint) {
239: return String.valueOf(endpoint.getConfig()
240: .isUseDefaultTrustStore());
241: }
242:
243: void setValue(TcpipEndpoint endpoint, Object value) {
244: if (isSetable())
245: endpoint.getConfig().setUseDefaultTrustStore(
246: Boolean.parseBoolean((String) value));
247: }
248:
249: boolean isSetable() {
250: return true;
251: }
252: },
253: TRUSTSTORE_FILE {
254: String getValue(TcpipEndpoint endpoint) {
255: return endpoint.getConfig().getTrustStoreFile();
256: }
257:
258: void setValue(TcpipEndpoint endpoint, Object value) {
259: if (isSetable())
260: endpoint.getConfig().setTrustStoreFile((String) value);
261: }
262:
263: boolean isSetable() {
264: return true;
265: }
266: },
267: LISTEN_PORT {
268: String getValue(TcpipEndpoint endpoint) {
269: return String.valueOf(endpoint.getConfig().getListenPort());
270: }
271:
272: void setValue(TcpipEndpoint endpoint, Object value) {
273: if (isSetable())
274: endpoint.getConfig().setListenPort(
275: Integer.parseInt((String) value));
276: }
277:
278: boolean isSetable() {
279: return true;
280: }
281: },
282: MAX_CLIENTS {
283: String getValue(TcpipEndpoint endpoint) {
284: return String.valueOf(endpoint.getConfig().getMaxClients());
285: }
286:
287: void setValue(TcpipEndpoint endpoint, Object value) {
288: if (isSetable())
289: endpoint.getConfig().setMaxClients(
290: Integer.parseInt((String) value));
291: }
292:
293: boolean isSetable() {
294: return true;
295: }
296: },
297: AUTHENTICATE_CLIENT {
298: String getValue(TcpipEndpoint endpoint) {
299: return String.valueOf(endpoint.getConfig()
300: .isAuthenticateClient());
301: }
302:
303: void setValue(TcpipEndpoint endpoint, Object value) {
304: if (isSetable())
305: endpoint.getConfig().setAuthenticateClient(
306: Boolean.parseBoolean((String) value));
307: }
308:
309: boolean isSetable() {
310: return true;
311: }
312: };
313: /**
314: *
315: * @param endpoint --
316: * endpoint in use
317: * @return - attribute value according to enumeration item
318: */
319: abstract String getValue(TcpipEndpoint endpoint);
320:
321: /**
322: *
323: * @param endpoint--
324: * endpoint in use
325: * @param value -
326: * sets attribute value according to enumeration item
327: */
328: abstract void setValue(TcpipEndpoint endpoint, Object value);
329:
330: /**
331: * tells either is possible or not to set the value false if the attribute
332: * is read only
333: *
334: * @return
335: */
336: abstract boolean isSetable();
337:
338: }
|