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.file;
024:
025: /**
026: * @author LPS
027: *
028: */
029: public enum FilePropertiesEnumeration {
030: SOURCE_DIRECTORY {
031: String getValue(FileEndpoint endpoint) {
032: return endpoint.getSourceDir();
033: }
034:
035: void setValue(FileEndpoint endpoint, Object value) {
036: if (isSetable())
037: endpoint.setSourceDir((String) value);
038: }
039:
040: boolean isSetable() {
041: return true;
042: }
043: },
044:
045: STAGE_DIRECTORY {
046: String getValue(FileEndpoint endpoint) {
047: return endpoint.getStageDir();
048: }
049:
050: void setValue(FileEndpoint endpoint, Object value) {
051: if (isSetable())
052: endpoint.setStageDir((String) value);
053: }
054:
055: boolean isSetable() {
056: return true;
057: }
058: },
059:
060: ARCHIVE_DIRECTORY {
061: String getValue(FileEndpoint endpoint) {
062: return endpoint.getArchiveDir();
063: }
064:
065: void setValue(FileEndpoint endpoint, Object value) {
066: if (isSetable())
067: endpoint.setArchiveDir((String) value);
068: }
069:
070: boolean isSetable() {
071: return true;
072: }
073: },
074: HOLD_DIRECTORY {
075: String getValue(FileEndpoint endpoint) {
076: return endpoint.getHoldDir();
077: }
078:
079: void setValue(FileEndpoint endpoint, Object value) {
080: if (isSetable())
081: endpoint.setHoldDir((String) value);
082: }
083:
084: boolean isSetable() {
085: return true;
086: }
087: },
088: SCAN_INTERVAL {
089: String getValue(FileEndpoint endpoint) {
090: return Long.toString(endpoint.getScanInterval());
091: }
092:
093: void setValue(FileEndpoint endpoint, Object value) {
094: if (isSetable())
095: endpoint.setScanInterval((String) value);
096: }
097:
098: boolean isSetable() {
099: return true;
100: }
101: },
102: HOLD {
103: String getValue(FileEndpoint endpoint) {
104: return Boolean.toString(endpoint.isHold());
105: }
106:
107: void setValue(FileEndpoint endpoint, Object value) {
108: if (isSetable())
109: endpoint.setHold((String) value);
110: }
111:
112: boolean isSetable() {
113: return true;
114: }
115: },
116: FILE_PATTERN {
117: String getValue(FileEndpoint endpoint) {
118: return endpoint.getFilePattern();
119: }
120:
121: void setValue(FileEndpoint endpoint, Object value) {
122: if (isSetable())
123: endpoint.setFilePattern((String) value);
124: }
125:
126: boolean isSetable() {
127: return true;
128: }
129: },
130: MATCH_MODE {
131: String getValue(FileEndpoint endpoint) {
132: return endpoint.getMatchMode();
133: }
134:
135: void setValue(FileEndpoint endpoint, Object value) {
136: if (isSetable())
137: endpoint.setMatchMode((String) value);
138: }
139:
140: boolean isSetable() {
141: return true;
142: }
143: },
144: TWO_PASS {
145: String getValue(FileEndpoint endpoint) {
146: return Boolean.toString(endpoint.isTwoPass());
147: }
148:
149: void setValue(FileEndpoint endpoint, Object value) {
150: if (isSetable())
151: endpoint.setTwoPass((String) value);
152: }
153:
154: boolean isSetable() {
155: return true;
156: }
157: },
158: TWO_PASS_INTERVAL {
159: String getValue(FileEndpoint endpoint) {
160: return Long.toString(endpoint.getTwoPassInterval());
161: }
162:
163: void setValue(FileEndpoint endpoint, Object value) {
164: if (isSetable())
165: endpoint.setTwoPassInterval((String) value);
166: }
167:
168: boolean isSetable() {
169: return true;
170: }
171: },
172: FILE_COMPLETE_ACTION {
173: String getValue(FileEndpoint endpoint) {
174: return endpoint.getFileCompleteAction();
175: }
176:
177: void setValue(FileEndpoint endpoint, Object value) {
178: if (isSetable())
179: endpoint.setFileCompleteAction((String) value);
180: }
181:
182: boolean isSetable() {
183: return true;
184: }
185: },
186: RECORDS_PER_MESSAGE {
187: String getValue(FileEndpoint endpoint) {
188: return Integer.toString(endpoint.getRecordsPerMessage());
189: }
190:
191: void setValue(FileEndpoint endpoint, Object value) {
192: if (isSetable())
193: endpoint.setRecordsPerMessage((String) value);
194: }
195:
196: boolean isSetable() {
197: return true;
198: }
199: },
200: READ_STYLE {
201: String getValue(FileEndpoint endpoint) {
202: return endpoint.getReadStyle();
203: }
204:
205: void setValue(FileEndpoint endpoint, Object value) {
206: if (isSetable())
207: endpoint.setReadStyle((String) value);
208: }
209:
210: boolean isSetable() {
211: return true;
212: }
213: },
214: RECORD_TYPE {
215: String getValue(FileEndpoint endpoint) {
216: return endpoint.getRecordType();
217: }
218:
219: void setValue(FileEndpoint endpoint, Object value) {
220: if (isSetable())
221: endpoint.setRecordType((String) value);
222: }
223:
224: boolean isSetable() {
225: return true;
226: }
227: },
228: CHARSET {
229: String getValue(FileEndpoint endpoint) {
230: return endpoint.getCharset();
231: }
232:
233: void setValue(FileEndpoint endpoint, Object value) {
234: if (isSetable())
235: endpoint.setCharset((String) value);
236: }
237:
238: boolean isSetable() {
239: return true;
240: }
241: },
242: ARCHIVE_FILE_PATTERN {
243: String getValue(FileEndpoint endpoint) {
244: return endpoint.getArchiveFilePattern();
245: }
246:
247: void setValue(FileEndpoint endpoint, Object value) {
248: if (isSetable())
249: endpoint.setArchiveFilePattern((String) value);
250: }
251:
252: boolean isSetable() {
253: return true;
254: }
255: },
256: REPLY_DIR {
257: String getValue(FileEndpoint endpoint) {
258: return endpoint.getReplyDir();
259: }
260:
261: void setValue(FileEndpoint endpoint, Object value) {
262: if (isSetable())
263: endpoint.setReplyDir((String) value);
264: }
265:
266: boolean isSetable() {
267: return true;
268: }
269: },
270: REPLY_CHARSET {
271: String getValue(FileEndpoint endpoint) {
272: return endpoint.getReplyCharset();
273: }
274:
275: void setValue(FileEndpoint endpoint, Object value) {
276: if (isSetable())
277: endpoint.setReplyCharset((String) value);
278: }
279:
280: boolean isSetable() {
281: return true;
282: }
283: },
284: REPLY_WRITE_STYLE {
285: String getValue(FileEndpoint endpoint) {
286: return endpoint.getReplyWriteStyle();
287: }
288:
289: void setValue(FileEndpoint endpoint, Object value) {
290: if (isSetable())
291: endpoint.setReplyWriteStyle((String) value);
292: }
293:
294: boolean isSetable() {
295: return true;
296: }
297: },
298: REPLY_FILE_PATTERN {
299: String getValue(FileEndpoint endpoint) {
300: return endpoint.getReplyFilePattern();
301: }
302:
303: void setValue(FileEndpoint endpoint, Object value) {
304: if (isSetable())
305: endpoint.setReplyFilePattern((String) value);
306: }
307:
308: boolean isSetable() {
309: return true;
310: }
311: },
312: DESTINATION_DIRECTORY {
313: String getValue(FileEndpoint endpoint) {
314: return endpoint.getDestDir();
315: }
316:
317: void setValue(FileEndpoint endpoint, Object value) {
318: if (isSetable())
319: endpoint.setDestDir((String) value);
320: }
321:
322: boolean isSetable() {
323: return true;
324: }
325: },
326: WRITE_STYLE {
327: String getValue(FileEndpoint endpoint) {
328: return endpoint.getWriteStyle();
329: }
330:
331: void setValue(FileEndpoint endpoint, Object value) {
332: if (isSetable())
333: endpoint.setWriteStyle((String) value);
334: }
335:
336: boolean isSetable() {
337: return true;
338: }
339: };
340:
341: /**
342: *
343: * @param endpoint -- endpoint in use
344: * @return - attribute value according to enumeration item
345: */
346: abstract String getValue(FileEndpoint endpoint);
347:
348: /**
349: *
350: * @param endpoint-- endpoint in use
351: * @param value - sets attribute value according to enumeration item
352: */
353: abstract void setValue(FileEndpoint endpoint, Object value);
354:
355: /**
356: * tells either is possible or not to set the value
357: * false if the attribute is read only
358: * @return
359: */
360: abstract boolean isSetable();
361: };
|