0001: /*
0002: * ChainBuilder ESB
0003: * Visual Enterprise Integration
0004: *
0005: * Copyright (C) 2006 Bostech Corporation
0006: *
0007: * This program is free software; you can redistribute it and/or modify
0008: * it under the terms of the GNU General Public License as published by
0009: * the Free Software Foundation; either version 2 of the License, or
0010: * (at your option) any later version.
0011: *
0012: * This program is distributed in the hope that it will be useful,
0013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0015: * General Public License for more details.
0016: *
0017: * You should have received a copy of the GNU General Public License
0018: * along with this program; if not, write to the Free Software
0019: * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
0020: * USA
0021: *
0022: *
0023: * $Id: FtpEndpoint.java 9747 2007-10-26 11:05:12Z lzheng $
0024: */
0025: package com.bostechcorp.cbesb.runtime.component.ftp;
0026:
0027: import java.util.ArrayList;
0028: import java.util.List;
0029:
0030: import org.apache.commons.logging.Log;
0031: import org.apache.commons.logging.LogFactory;
0032:
0033: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.CbEmbeddedSchedulerConsumerProcessor;
0034: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.IComponentProcessor;
0035: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.ScheduledEndpointProcessor;
0036: import com.bostechcorp.cbesb.runtime.component.file.FilePropertiesEnumeration;
0037: import com.bostechcorp.cbesb.runtime.component.ftp.processors.FtpConsumerHandler;
0038: import com.bostechcorp.cbesb.runtime.component.ftp.processors.FtpProviderProcessor;
0039:
0040: public class FtpEndpoint extends ScheduledEndpointProcessor {
0041:
0042: protected final transient Log logger = LogFactory
0043: .getLog(getClass());
0044:
0045: /*
0046: * Type of message exchange to initiate.
0047: */
0048: // defaultMep;
0049: /**
0050: * Hostname or IP address of FTP server.
0051: */
0052: private String ftpHost;
0053:
0054: /**
0055: * User name to login to FTP server.
0056: */
0057: private String ftpUser;
0058:
0059: /**
0060: * Password to login to FTP server.
0061: */
0062: private String ftpPassword;
0063:
0064: /**
0065: * Specify the XML based command file described in advanced mode.
0066: */
0067: private String cmdFile;
0068:
0069: /**
0070: * Value should be "active" or "passive"
0071: */
0072: private String ftpConnectMode = "passive";
0073:
0074: /**
0075: * Value should be "ascii" or "binary"
0076: */
0077: private String ftpTransferMode = "binary";
0078:
0079: /**
0080: * Directory on FTP server where files are to be retrieved.
0081: */
0082: private String sourceDir;
0083:
0084: /**
0085: * Directory where files are downloaded to.
0086: */
0087: private String transferDir;
0088:
0089: /**
0090: * Staging directory where files are moved for processing.
0091: */
0092: private String stageDir;
0093:
0094: /**
0095: * Archive location to place files when done processing.
0096: */
0097: private String archiveDir;
0098:
0099: /**
0100: * Hold location to place files when an error occurs during processing.
0101: */
0102: private String holdDir;
0103:
0104: /**
0105: * Value in milliseconds that determines how often the source URL is scanned
0106: * for new data files.
0107: */
0108: private long scanInterval = 60000L;
0109:
0110: /**
0111: * Boolean value. True means that if an error occurs while processing a
0112: * file, the file will be moved to the Hold directory. If value is set to
0113: * false, no special processing will be done when an error occurs. If true,
0114: * then HoldDir must be specified.
0115: */
0116: private boolean hold = false;
0117:
0118: /**
0119: * Glob style file pattern to determine which files in the Source URL will
0120: * be processed. Only files that match the pattern will be processed.
0121: */
0122: private String filePattern = "*";
0123:
0124: private String matchMode = "";
0125:
0126: /**
0127: * Boolean value. Two pass mode causes the component to check the size of
0128: * the files in the Source URL, wait for a set interval and check the sizes
0129: * again. Only files that did not change size during the interval will be
0130: * processed. This is to prevent processing a file that is still being
0131: * written to by an external application. True enables two pass mode, false
0132: * disables it.
0133: */
0134: private boolean twoPass = false;
0135:
0136: /**
0137: * Value in milliseconds to wait between scans during Two Pass mode. This is
0138: * only used when TwoPass is set to true.
0139: */
0140: private long twoPassInterval = 2000L;
0141:
0142: /**
0143: * Value determines what to do with the file after all data is read from it.
0144: * Acceptable values are:<br>
0145: * delete - File is deleted.<br>
0146: * archive - File is moved to archive directory.
0147: */
0148: private String fileCompleteAction = "delete";
0149:
0150: /**
0151: * Integer value that determines the number of records from a file will be
0152: * placed in an individual Normalized Message. 0 indicates that all records
0153: * in the file will be placed in a single message. Any value > 0 will be the
0154: * maximum number of records placed in a single message.
0155: */
0156: private int recordsPerMessage = 0;
0157:
0158: /**
0159: * Value determines how to read a record from the file. Acceptable values
0160: * are:<br>
0161: * raw - The entire file contents is one record.<br>
0162: * newline - each line in the file is one record.
0163: */
0164: private String readStyle = "raw";
0165:
0166: /**
0167: * Value determines the type of data each record contains. Acceptable values
0168: * are:<br>
0169: * xml - each record is well formed XML.<br>
0170: * string - each record is character data.<br>
0171: * binary - each record is binary data.
0172: */
0173: private String recordType = "string";
0174:
0175: /**
0176: * Value is the name of the charset to use to read in character data.
0177: */
0178: private String charset;
0179:
0180: /**
0181: * Describes a file pattern to use to rename the file when being archived.
0182: * This can be used to add a date/time stamp to the file. If the value is
0183: * null, then the file is not renamed when it is moved to archiveDir. The
0184: * pattern may contain literal characters as well as the following macros
0185: * that will be replaced with values at runtime:<br>
0186: * {DATE} - The system date formatted as yyyymmdd.<br>
0187: * {TIME} - The system time formatted as hhmmss.<br>
0188: * {BASENAME} - The original file's base name (name without extension).<br>
0189: * {EXT} - The original file's extension.<br>
0190: * {COUNT} - An automatically incremented value that starts from 1 when the
0191: * component is started.
0192: */
0193: private String archiveFilePattern;
0194:
0195: /**
0196: * Host name or IP address of FTP server to send replies to.
0197: */
0198: private String replyFtpHost;
0199:
0200: /**
0201: * User to login as to send replies.
0202: */
0203: private String replyFtpUser;
0204:
0205: /**
0206: * Password to login to send replies.
0207: */
0208: private String replyFtpPassword;
0209:
0210: /**
0211: * Value should be "active" or "passive".
0212: */
0213: private String replyFtpConnectMode = "passive";
0214:
0215: /**
0216: * Values should be "ascii" or "binary"
0217: */
0218: private String replyFtpTransferMode = "binary";
0219:
0220: /**
0221: * Directory on FTP server to place files containing reply messages.
0222: */
0223: private String replyDir;
0224:
0225: /**
0226: * Value is the name of the charset to use to write character data to the
0227: * file.
0228: */
0229: private String replyCharset;
0230:
0231: /**
0232: * Value determines how records are written to a file. Acceptable values
0233: * are:<br>
0234: * raw - Each record from a Normalized Message is written to an individual
0235: * file.<br>
0236: * newline - Each record from a Normalized Message is written to the same
0237: * file separated by a newline.
0238: */
0239: private String replyWriteStyle = "raw";
0240:
0241: /**
0242: * Describes a file pattern to use to name the file when being written. This
0243: * can be used to add a date/time stamp to the file. The pattern may contain
0244: * literal characters as well as the following macros that will be replaced
0245: * with values at runtime:<br>
0246: * {DATE} - The system date formatted as yyyymmdd.<br>
0247: * {TIME} - The system time formatted as hhmmss.<br>
0248: * {BASENAME} - The original file's base name (name without extension).<br>
0249: * {EXT} - The original file's extension.<br>
0250: * {COUNT} - An automatically incremented value that starts from 1 when the
0251: * component is started.
0252: */
0253: private String replyFilePattern;
0254:
0255: /**
0256: * Destination location for data files.
0257: */
0258: private String destDir;
0259:
0260: /**
0261: * Value determines how records are written to a file. Acceptable values
0262: * are:<br>
0263: * raw - Each record from a Normalized Message is written to an individual
0264: * file.<br>
0265: * newline - Each record from a Normalized Message is written to the same
0266: * file separated by a newline.
0267: */
0268: private String writeStyle = "raw";
0269:
0270: public FtpEndpoint() {
0271: handler = new FtpConsumerHandler(this );
0272: }
0273:
0274: /*
0275: * (non-Javadoc)
0276: *
0277: * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.BaseEndpoint#createConsumerProcessor()
0278: */
0279: protected IComponentProcessor createConsumerProcessor() {
0280: return new CbEmbeddedSchedulerConsumerProcessor(this );
0281: }
0282:
0283: /*
0284: * (non-Javadoc)
0285: *
0286: * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.BaseEndpoint#createProviderProcessor()
0287: */
0288: protected IComponentProcessor createProviderProcessor() {
0289: return new FtpProviderProcessor(this );
0290: }
0291:
0292: /**
0293: * Get the ftpHost.
0294: *
0295: * @return the ftpHost.
0296: */
0297: public String getFtpHost() {
0298: return ftpHost;
0299: }
0300:
0301: /**
0302: * Set the ftpHost.
0303: *
0304: * @param ftpHost
0305: * the ftpHost to set.
0306: */
0307: public void setFtpHost(String ftpHost) {
0308: this .ftpHost = ftpHost;
0309: }
0310:
0311: /**
0312: * Get the ftpUser.
0313: *
0314: * @return the ftpUser
0315: */
0316: public String getFtpUser() {
0317: return ftpUser;
0318: }
0319:
0320: /**
0321: * Set the ftpUser.
0322: *
0323: * @param ftpUser
0324: * the ftpUser to set
0325: */
0326: public void setFtpUser(String ftpUser) {
0327: this .ftpUser = ftpUser;
0328: }
0329:
0330: /**
0331: * Get the ftpPassword.
0332: *
0333: * @return the ftpPassword
0334: */
0335: public String getFtpPassword() {
0336: return ftpPassword;
0337: }
0338:
0339: /**
0340: * Set the ftpPassword.
0341: *
0342: * @param ftpPassword
0343: * the ftpPassword to set
0344: */
0345: public void setFtpPassword(String ftpPassword) {
0346: this .ftpPassword = ftpPassword;
0347: }
0348:
0349: /**
0350: * Get the cmdFile.
0351: *
0352: * @return the cmdFile
0353: */
0354: public String getCmdFile() {
0355: return cmdFile;
0356: }
0357:
0358: /**
0359: * Set the cmdFile.
0360: *
0361: * @param cmdFile
0362: * the cmdFile to set
0363: */
0364: public void setCmdFile(String cmdFile) {
0365: this .cmdFile = cmdFile;
0366: }
0367:
0368: /**
0369: * Get the ftpConnectMode.
0370: *
0371: * @return the ftpConnectMode
0372: */
0373: public String getFtpConnectMode() {
0374: return ftpConnectMode;
0375: }
0376:
0377: /**
0378: * Set the ftpConnectMode.
0379: *
0380: * @param ftpConnectMode
0381: * the ftpConnectMode to set
0382: */
0383: public void setFtpConnectMode(String ftpConnectMode) {
0384: if (ftpConnectMode != null && !"".equals(ftpConnectMode)) {
0385: this .ftpConnectMode = ftpConnectMode;
0386: }
0387: }
0388:
0389: /**
0390: * Get the ftpTransferMode.
0391: *
0392: * @return the ftpTransferMode
0393: */
0394: public String getFtpTransferMode() {
0395: return ftpTransferMode;
0396: }
0397:
0398: /**
0399: * Set the ftpTransferMode.
0400: *
0401: * @param ftpTransferMode
0402: * the ftpTransferMode to set
0403: */
0404: public void setFtpTransferMode(String ftpTransferMode) {
0405: if (ftpTransferMode != null && !"".equals(ftpTransferMode)) {
0406: this .ftpTransferMode = ftpTransferMode;
0407: }
0408: }
0409:
0410: /**
0411: * Get the sourceDir.
0412: *
0413: * @return the sourceDir
0414: */
0415: public String getSourceDir() {
0416: return sourceDir;
0417: }
0418:
0419: /**
0420: * Set the sourceDir.
0421: *
0422: * @param sourceDir
0423: * the sourceDir to set
0424: */
0425: public void setSourceDir(String sourceDir) {
0426: this .sourceDir = sourceDir;
0427: }
0428:
0429: /**
0430: * Get the transferDir.
0431: *
0432: * @return the transferDir
0433: */
0434: public String getTransferDir() {
0435: return transferDir;
0436: }
0437:
0438: /**
0439: * Set the transferDir.
0440: *
0441: * @param transferDir
0442: * the transferDir to set
0443: */
0444: public void setTransferDir(String transferDir) {
0445: this .transferDir = transferDir;
0446: }
0447:
0448: /**
0449: * Get the stageDir.
0450: *
0451: * @return the stageDir
0452: */
0453: public String getStageDir() {
0454: return stageDir;
0455: }
0456:
0457: /**
0458: * Set the stageDir.
0459: *
0460: * @param stageDir
0461: * the stageDir to set
0462: */
0463: public void setStageDir(String stageDir) {
0464: this .stageDir = stageDir;
0465: }
0466:
0467: /**
0468: * Get the archiveDir.
0469: *
0470: * @return the archiveDir
0471: */
0472: public String getArchiveDir() {
0473: return archiveDir;
0474: }
0475:
0476: /**
0477: * Set the archiveDir.
0478: *
0479: * @param archiveDir
0480: * the archiveDir to set
0481: */
0482: public void setArchiveDir(String archiveDir) {
0483: this .archiveDir = archiveDir;
0484: }
0485:
0486: /**
0487: * Get the holdDir.
0488: *
0489: * @return the holdDir
0490: */
0491: public String getHoldDir() {
0492: return holdDir;
0493: }
0494:
0495: /**
0496: * Set the holdDir.
0497: *
0498: * @param holdDir
0499: * the holdDir to set
0500: */
0501: public void setHoldDir(String holdDir) {
0502: this .holdDir = holdDir;
0503: }
0504:
0505: /**
0506: * Get the scanInterval.
0507: *
0508: * @return the scanInterval
0509: */
0510: public long getScanInterval() {
0511: return scanInterval;
0512: }
0513:
0514: /**
0515: * Set the scanInterval.
0516: *
0517: * @param scanInterval
0518: * the scanInterval to set
0519: */
0520: public void setScanInterval(long scanInterval) {
0521: this .scanInterval = scanInterval;
0522: }
0523:
0524: /**
0525: * Set the scanInterval.
0526: *
0527: * @param scanInterval
0528: * the scanInterval to set
0529: */
0530: public void setScanInterval(String scanInterval) {
0531: if (scanInterval != null && !"".equals(scanInterval)) {
0532: this .scanInterval = Long.parseLong(scanInterval);
0533: }
0534: }
0535:
0536: /**
0537: * Get the hold.
0538: *
0539: * @return the hold
0540: */
0541: public boolean isHold() {
0542: return hold;
0543: }
0544:
0545: /**
0546: * Set the hold.
0547: *
0548: * @param hold
0549: * the hold to set
0550: */
0551: public void setHold(boolean hold) {
0552: this .hold = hold;
0553: }
0554:
0555: /**
0556: * Set the hold.
0557: *
0558: * @param hold
0559: * the hold to set
0560: */
0561: public void setHold(String hold) {
0562: if (hold != null && hold.compareToIgnoreCase("true") == 0) {
0563: this .hold = true;
0564: }
0565: }
0566:
0567: /**
0568: * Get the filePattern.
0569: *
0570: * @return the filePattern
0571: */
0572: public String getFilePattern() {
0573: return filePattern;
0574: }
0575:
0576: /**
0577: * Set the filePattern.
0578: *
0579: * @param filePattern
0580: * the filePattern to set
0581: */
0582: public void setFilePattern(String filePattern) {
0583: if (filePattern != null && !"".equals(filePattern)) {
0584: this .filePattern = filePattern;
0585: }
0586: }
0587:
0588: public String getMatchMode() {
0589: return matchMode;
0590: }
0591:
0592: public void setMatchMode(String matchMode) {
0593: this .matchMode = matchMode;
0594: }
0595:
0596: /**
0597: * Get the twoPass.
0598: *
0599: * @return the twoPass
0600: */
0601: public boolean isTwoPass() {
0602: return twoPass;
0603: }
0604:
0605: /**
0606: * Set the twoPass.
0607: *
0608: * @param twoPass
0609: * the twoPass to set
0610: */
0611: public void setTwoPass(boolean twoPass) {
0612: this .twoPass = twoPass;
0613: }
0614:
0615: /**
0616: * Set the twoPass.
0617: *
0618: * @param twoPass
0619: * the twoPass to set
0620: */
0621: public void setTwoPass(String twoPass) {
0622: if (twoPass != null && twoPass.compareToIgnoreCase("true") == 0) {
0623: this .twoPass = true;
0624: }
0625: }
0626:
0627: /**
0628: * Get the twoPassInterval.
0629: *
0630: * @return the twoPassInterval
0631: */
0632: public long getTwoPassInterval() {
0633: return twoPassInterval;
0634: }
0635:
0636: /**
0637: * Set the twoPassInterval.
0638: *
0639: * @param twoPassInterval
0640: * the twoPassInterval to set
0641: */
0642: public void setTwoPassInterval(long twoPassInterval) {
0643: this .twoPassInterval = twoPassInterval;
0644: }
0645:
0646: /**
0647: * Set the twoPassInterval.
0648: *
0649: * @param twoPassInterval
0650: * the twoPassInterval to set
0651: */
0652: public void setTwoPassInterval(String twoPassInterval) {
0653: if (twoPassInterval != null && !"".equals(twoPassInterval)) {
0654: this .twoPassInterval = Long.parseLong(twoPassInterval);
0655: }
0656: }
0657:
0658: /**
0659: * Get the fileCompleteAction.
0660: *
0661: * @return the fileCompleteAction
0662: */
0663: public String getFileCompleteAction() {
0664: return fileCompleteAction;
0665: }
0666:
0667: /**
0668: * Set the fileCompleteAction.
0669: *
0670: * @param fileCompleteAction
0671: * the fileCompleteAction to set
0672: */
0673: public void setFileCompleteAction(String fileCompleteAction) {
0674: if (fileCompleteAction != null
0675: && !"".equals(fileCompleteAction)) {
0676: this .fileCompleteAction = fileCompleteAction;
0677: }
0678: }
0679:
0680: /**
0681: * Get the recordsPerMessage.
0682: *
0683: * @return the recordsPerMessage
0684: */
0685: public int getRecordsPerMessage() {
0686: return recordsPerMessage;
0687: }
0688:
0689: /**
0690: * Set the recordsPerMessage.
0691: *
0692: * @param recordsPerMessage
0693: * the recordsPerMessage to set
0694: */
0695: public void setRecordsPerMessage(int recordsPerMessage) {
0696: this .recordsPerMessage = recordsPerMessage;
0697: }
0698:
0699: /**
0700: * Set the recordsPerMessage.
0701: *
0702: * @param recordsPerMessage
0703: * the recordsPerMessage to set
0704: */
0705: public void setRecordsPerMessage(String recordsPerMessage) {
0706: if (recordsPerMessage != null && !"".equals(recordsPerMessage)) {
0707: this .recordsPerMessage = Integer
0708: .parseInt(recordsPerMessage);
0709: }
0710: }
0711:
0712: /**
0713: * Get the readStyle.
0714: *
0715: * @return the readStyle
0716: */
0717: public String getReadStyle() {
0718: return readStyle;
0719: }
0720:
0721: /**
0722: * Set the readStyle.
0723: *
0724: * @param readStyle
0725: * the readStyle to set
0726: */
0727: public void setReadStyle(String readStyle) {
0728: if (readStyle != null && !"".equals(readStyle)) {
0729: this .readStyle = readStyle;
0730: }
0731: }
0732:
0733: /**
0734: * Get the recordType.
0735: *
0736: * @return the recordType
0737: */
0738: public String getRecordType() {
0739: return recordType;
0740: }
0741:
0742: /**
0743: * Set the recordType.
0744: *
0745: * @param recordType
0746: * the recordType to set
0747: */
0748: public void setRecordType(String recordType) {
0749: if (recordType != null && !"".equals(recordType)) {
0750: this .recordType = recordType;
0751: }
0752: }
0753:
0754: /**
0755: * Get the charset.
0756: *
0757: * @return the charset
0758: */
0759: public String getCharset() {
0760: return charset;
0761: }
0762:
0763: /**
0764: * Set the charset.
0765: *
0766: * @param charset
0767: * the charset to set
0768: */
0769: public void setCharset(String charset) {
0770: this .charset = charset;
0771: }
0772:
0773: /**
0774: * Get the archiveFilePattern.
0775: *
0776: * @return the archiveFilePattern
0777: */
0778: public String getArchiveFilePattern() {
0779: return archiveFilePattern;
0780: }
0781:
0782: /**
0783: * Set the archiveFilePattern.
0784: *
0785: * @param archiveFilePattern
0786: * the archiveFilePattern to set
0787: */
0788: public void setArchiveFilePattern(String archiveFilePattern) {
0789: this .archiveFilePattern = archiveFilePattern;
0790: }
0791:
0792: /**
0793: * Get the replyFtpHost.
0794: *
0795: * @return the replyFtpHost
0796: */
0797: public String getReplyFtpHost() {
0798: return replyFtpHost;
0799: }
0800:
0801: /**
0802: * Set the replyFtpHost.
0803: *
0804: * @param replyFtpHost
0805: * the replyFtpHost to set
0806: */
0807: public void setReplyFtpHost(String replyFtpHost) {
0808: this .replyFtpHost = replyFtpHost;
0809: }
0810:
0811: /**
0812: * Get the replyFtpUser.
0813: *
0814: * @return the replyFtpUser
0815: */
0816: public String getReplyFtpUser() {
0817: return replyFtpUser;
0818: }
0819:
0820: /**
0821: * Set the replyFtpUser.
0822: *
0823: * @param replyFtpUser
0824: * the replyFtpUser to set
0825: */
0826: public void setReplyFtpUser(String replyFtpUser) {
0827: this .replyFtpUser = replyFtpUser;
0828: }
0829:
0830: /**
0831: * Get the replyFtpPassword.
0832: *
0833: * @return the replyFtpPassword
0834: */
0835: public String getReplyFtpPassword() {
0836: return replyFtpPassword;
0837: }
0838:
0839: /**
0840: * Set the replyFtpPassword.
0841: *
0842: * @param replyFtpPassword
0843: * the replyFtpPassword to set
0844: */
0845: public void setReplyFtpPassword(String replyFtpPassword) {
0846: this .replyFtpPassword = replyFtpPassword;
0847: }
0848:
0849: /**
0850: * Get the replyFtpConnectMode.
0851: *
0852: * @return the replyFtpConnectMode
0853: */
0854: public String getReplyFtpConnectMode() {
0855: return replyFtpConnectMode;
0856: }
0857:
0858: /**
0859: * Set the replyFtpConnectMode.
0860: *
0861: * @param replyFtpConnectMode
0862: * the replyFtpConnectMode to set
0863: */
0864: public void setReplyFtpConnectMode(String replyFtpConnectMode) {
0865: if (replyFtpConnectMode != null
0866: && !"".equals(replyFtpConnectMode)) {
0867: this .replyFtpConnectMode = replyFtpConnectMode;
0868: }
0869: }
0870:
0871: /**
0872: * Get the replyFtpTransferMode.
0873: *
0874: * @return the replyFtpTransferMode
0875: */
0876: public String getReplyFtpTransferMode() {
0877: return replyFtpTransferMode;
0878: }
0879:
0880: /**
0881: * Set the replyFtpTransferMode.
0882: *
0883: * @param replyFtpTransferMode
0884: * the replyFtpTransferMode to set
0885: */
0886: public void setReplyFtpTransferMode(String replyFtpTransferMode) {
0887: if (replyFtpTransferMode != null
0888: && !"".equals(replyFtpTransferMode)) {
0889: this .replyFtpTransferMode = replyFtpTransferMode;
0890: }
0891: }
0892:
0893: /**
0894: * Get the replyDir.
0895: *
0896: * @return the replyDir
0897: */
0898: public String getReplyDir() {
0899: return replyDir;
0900: }
0901:
0902: /**
0903: * Set the replyDir.
0904: *
0905: * @param replyDir
0906: * the replyDir to set
0907: */
0908: public void setReplyDir(String replyDir) {
0909: this .replyDir = replyDir;
0910: }
0911:
0912: /**
0913: * Get the replyCharset.
0914: *
0915: * @return the replyCharset
0916: */
0917: public String getReplyCharset() {
0918: return replyCharset;
0919: }
0920:
0921: /**
0922: * Set the replyCharset.
0923: *
0924: * @param replyCharset
0925: * the replyCharset to set
0926: */
0927: public void setReplyCharset(String replyCharset) {
0928: this .replyCharset = replyCharset;
0929: }
0930:
0931: /**
0932: * Get the replyWriteStyle.
0933: *
0934: * @return the replyWriteStyle
0935: */
0936: public String getReplyWriteStyle() {
0937: return replyWriteStyle;
0938: }
0939:
0940: /**
0941: * Set the replyWriteStyle.
0942: *
0943: * @param replyWriteStyle
0944: * the replyWriteStyle to set
0945: */
0946: public void setReplyWriteStyle(String replyWriteStyle) {
0947: if (replyWriteStyle != null && !"".equals(replyWriteStyle)) {
0948: this .replyWriteStyle = replyWriteStyle;
0949: }
0950: }
0951:
0952: /**
0953: * Get the replyFilePattern.
0954: *
0955: * @return the replyFilePattern
0956: */
0957: public String getReplyFilePattern() {
0958: return replyFilePattern;
0959: }
0960:
0961: /**
0962: * Set the replyFilePattern.
0963: *
0964: * @param replyFilePattern
0965: * the replyFilePattern to set
0966: */
0967: public void setReplyFilePattern(String replyFilePattern) {
0968: this .replyFilePattern = replyFilePattern;
0969: }
0970:
0971: /**
0972: * Get the destDir.
0973: *
0974: * @return the destDir
0975: */
0976: public String getDestDir() {
0977: return destDir;
0978: }
0979:
0980: /**
0981: * Set the destDir.
0982: *
0983: * @param destDir
0984: * the destDir to set
0985: */
0986: public void setDestDir(String destDir) {
0987: this .destDir = destDir;
0988: }
0989:
0990: /**
0991: * Get the writeStyle.
0992: *
0993: * @return the writeStyle
0994: */
0995: public String getWriteStyle() {
0996: return writeStyle;
0997: }
0998:
0999: /**
1000: * Set the writeStyle.
1001: *
1002: * @param writeStyle
1003: * the writeStyle to set
1004: */
1005: public void setWriteStyle(String writeStyle) {
1006: if (writeStyle != null && !"".equals(writeStyle)) {
1007: this .writeStyle = writeStyle;
1008: }
1009: }
1010:
1011: /**********************************************************************************
1012: * These attributes and methods customize the LifeCycleEndpoint for this component
1013: ***********************************************************************************/
1014:
1015: /*
1016: * The display parameters are general information for the admin console to display.
1017: */
1018: public String[] getDisplayParameterTitles() {
1019: return new String[] { FtpPropertiesEnumeration.FTP_HOST.name(),
1020: FtpPropertiesEnumeration.FTP_USER.name(),
1021: FtpPropertiesEnumeration.FTP_CONNECT_MODE.name(),
1022: FtpPropertiesEnumeration.SOURCE_DIR.name(),
1023: FtpPropertiesEnumeration.DEST_DIR.name() };
1024:
1025: }
1026:
1027: /*
1028: * The values returned here correspond to the titles above.
1029: */
1030: public String[] getDisplayParameters() {
1031: return new String[] {
1032: FtpPropertiesEnumeration.FTP_HOST.getValue(this ),
1033: FtpPropertiesEnumeration.FTP_USER.getValue(this ),
1034: FtpPropertiesEnumeration.FTP_CONNECT_MODE
1035: .getValue(this ),
1036: FtpPropertiesEnumeration.SOURCE_DIR.getValue(this ),
1037: FtpPropertiesEnumeration.DEST_DIR.getValue(this ) };
1038:
1039: }
1040:
1041: /*
1042: * This returns a list of properties that can be read.
1043: */
1044: public String[] getGetableProperties() {
1045: FtpPropertiesEnumeration[] fps = FtpPropertiesEnumeration
1046: .values();
1047: List<String> result = new ArrayList<String>();
1048: for (int i = 0; i < fps.length; i++) {
1049: result.add(fps[i].name());
1050: }
1051: String[] sr = new String[result.size()];
1052: return result.toArray(sr);
1053: }
1054:
1055: /*
1056: * This gets one property from the list above.
1057: */
1058: public String getProperty(int index) {
1059: return FtpPropertiesEnumeration.values()[index].getValue(this );
1060: }
1061:
1062: /*
1063: * This gets one property from the list above.
1064: */
1065: public String getProperty(String property) {
1066: return FtpPropertiesEnumeration.valueOf(property)
1067: .getValue(this );
1068: }
1069:
1070: /*
1071: * This returns a list of properties that can be set.
1072: */
1073: public String[] getSetableProperties() {
1074: FtpPropertiesEnumeration[] fps = FtpPropertiesEnumeration
1075: .values();
1076: List<String> result = new ArrayList<String>();
1077: for (int i = 0; i < fps.length; i++) {
1078: if (fps[i].isSetable())
1079: result.add(fps[i].name());
1080: }
1081: String[] sr = new String[result.size()];
1082: return result.toArray(sr);
1083: }
1084:
1085: /*
1086: * This sets one property from the list above.
1087: */
1088: public void setProperty(int index, String value) {
1089: FtpPropertiesEnumeration.values()[index].setValue(this , value);
1090: }
1091:
1092: /*
1093: * This sets one property from the list above.
1094: */
1095: public void setProperty(String property, String value) {
1096: FtpPropertiesEnumeration.valueOf(property)
1097: .setValue(this , value);
1098: }
1099:
1100: /**************************************************
1101: * Done with LifeCycleEndpoint methods
1102: ***************************************************/
1103:
1104: }
|