package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part;
import com.bostechcorp.cbesb.common.sa.component.AbstractComponent;
import com.bostechcorp.cbesb.common.sa.component.CanScheduleComponent;
import com.bostechcorp.cbesb.common.sa.service.EndPoint;
import com.bostechcorp.cbesb.common.sa.service.PropertiesKey;
import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.ComponentFlowEditorElement;
import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.DefaultMepType;
import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.FTP;
import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.FTPConsumer;
import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.FTPProvider;
import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.FTPScriptModeType;
public class FtpResourceGenerator extends CanScheduleResourceGenerator {
FTP ftp;
public FtpResourceGenerator(ComponentFlowEditorElement model,
ComponentFlowEditorResourceGenerator parent) {
super(model,parent);
ftp=(FTP)model;
}
@Override
public AbstractComponent getComponent() throws Exception{
AbstractComponent component = getComponent(
PropertiesKey.COMPONENTTYPE_FTP);
String prefix=PropertiesKey.FTP;
if (ftp.getScriptMode().getValue()==FTPScriptModeType.BASE) {
if (ftp.isConsumer()) {
prefix+=PropertiesKey.CONSUMER;
FTPConsumer ftpRead = ftp.getFtpBase()
.getFtpConsumer();
EndPoint endPoint = new EndPoint();
endPoint.setRole(PropertiesKey.ROLE_CONSUMER);
endPoint.setName(ftpRead.getEndPointName());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_CHARSET,
ftpRead.getCharset());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_READ_COMPLETION_ACTION, ftpRead
.getFileCompletion().getAction().toString());
endPoint
.addSetting(
PropertiesKey.FTP_WSDL_READ_COMPLETION_ARCHIVEDIRECTORY,
ftpRead.getFileCompletion()
.getArchiveDirectory());
endPoint
.addSetting(
PropertiesKey.FTP_WSDL_READ_COMPLETION_ARCHIVEFILEPATTERN,
ftpRead.getFileCompletion()
.getArchiveFilePattern());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_DEFAULTMEP,
ftpRead.getDefaultMep().toString());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_FILEPATTERN,
ftpRead.getFilePattern());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_FTPCONNECTMODE,
ftpRead.getConnectMode().toString());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_FTPHOST,
ftpRead.getFtpHost());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_FTPPASSWORD,
ftpRead.getFtpPassword());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_READ_FTPTRANSFERMODE, ftpRead
.getTransferMode().toString());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_FTPUSER,
ftpRead.getFtpUser());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_HOLD_ENABLED,
Boolean.toString(ftpRead.isHoldEnabled()));
endPoint.addSetting(
PropertiesKey.FTP_WSDL_READ_HOLD_HOLDDIRECTORY, ftpRead
.getHoldDirectory());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_READSTYLE,
ftpRead.getReadStyle().toString());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_READ_RECORDPERMESSAGE, ftpRead
.getRecordsPerMessage());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_RECORDYYPE,
ftpRead.getRecordType().toString());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_REPLY_CHARSET,
ftpRead.getFtpReply().getReplyCharset());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_REPLY_DIR,
ftpRead.getFtpReply().getReplyDir());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_READ_REPLY_FILEPATTERN, ftpRead
.getFilePattern());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_REPLY_FTPCONNECTMODE,
ftpRead.getFtpReply().getConnectMode().toString());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_REPLY_FTPHOST,
ftpRead.getFtpReply().getFtpHost());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_REPLY_FTPPASSWORD,
ftpRead.getFtpReply().getFtpPassword());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_READ_REPLY_FTPTRANSFERMODE, ftpRead
.getFtpReply().getTransferMode().toString());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_REPLY_FTPUSER,
ftpRead.getFtpReply().getFtpUser());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_SOURCEDIR,
ftpRead.getSourceDir());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_STAGEDIRECTORY,
ftpRead.getStageDir());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_TRANSFERDIR,
ftpRead.getTransferDir());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_READ_TWOPASS_MODEENABLED,
Boolean.toString(ftpRead.isTwoPassModeIntevalEnabled()));
endPoint.addSetting(
PropertiesKey.FTP_WSDL_READ_TWOPASS_MODEINTERVAL,
ftpRead.getTwoPassModeInterval());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_CMDFILE,
ftpRead.getCmdFile());
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_MATCHMODE,
ftpRead.getMatchModel().toString());
this.handleCCSL(endPoint, false);
endPoint.addSetting(
PropertiesKey.FTP_WSDL_READ_REPLY_WRITESTYLE, ftpRead
.getFtpReply().getReplyWriteStyle().toString());
if (ftpRead.isUseScheduler()) {
super.addSchedulerProperty(endPoint, prefix);
} else {
endPoint.addSetting(PropertiesKey.FTP_WSDL_READ_SCANINTERVAL,
ftpRead.getScanInterval());
}
component.addEndPoint(endPoint);
if (ftpRead.isUseScheduler()) handleSchedule((CanScheduleComponent)component, ftpRead.getScheduler());
}
if (ftp.isProvider()) {
FTPProvider ftpWrite = ftp.getFtpBase().getFtpProvider();
EndPoint endPoint = new EndPoint();
endPoint.setRole(PropertiesKey.ROLE_PROVIDER);
endPoint.setName(ftpWrite.getEndPointName());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_MODE, "base");
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_WRITESTYLE,
ftpWrite.getWriteStyle().toString());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_WRITE_STATGEDIRECTORY, ftpWrite
.getStageDir());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_FTPUSER,
ftpWrite.getFtpUser());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_WRITE_FTPTRANSFERMODE, ftpWrite
.getTransferMode().toString());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_FTPPASSWORD,
ftpWrite.getFtpPassword());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_FTPHOST,
ftpWrite.getFtpHost());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_WRITE_FTPCONNECTMODE, ftpWrite
.getConnectMode().toString());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_FILEPATTERN,
ftpWrite.getFilePattern());
endPoint
.addSetting(
PropertiesKey.FTP_WSDL_WRITE_FILECOMPLETEACTION,
ftpWrite.getFileCompletion().getAction()
.toString());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_WRITE_DESTINATIONDIRECTORY,
ftpWrite.getDestDir());
// endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_DEFAULTMEP,
// ftpWrite.getDefaultMep().toString());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_CHARSET,
ftpWrite.getCharset().toString());
endPoint.addSetting(
PropertiesKey.FTP_WSDL_WRITE_ARCHIVEFILEPATTERN,
ftpWrite.getFileCompletion()
.getArchiveFilePattern());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_ARCHIVEDIR,
ftpWrite.getFileCompletion().getArchiveDirectory());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_TRANSFERDIR,
ftpWrite.getTransferDir());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_CMDFILE,
ftpWrite.getCmdFile());
this.handleCCSL(endPoint, true);
component.addEndPoint(endPoint);
}
}
else {
if(ftp.isProvider()) {
EndPoint endPoint = new EndPoint();
endPoint.setRole(PropertiesKey.ROLE_PROVIDER);
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_MODE,
"advance");
endPoint.setName(component.getName());
endPoint.addSetting(PropertiesKey.FTP_WSDL_WRITE_DEFAULTMEP,
DefaultMepType.INOUT_LITERAL.getLiteral());
this.handleCCSL(endPoint, true);
component.addEndPoint(endPoint);
}
}
return component;
}
}
|