/*
* ChainBuilder ESB
* Visual Enterprise Integration
*
* Copyright (C) 2006 Bostech Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*
* $Id: FtpInputDeserializer.java 9392 2007-09-30 01:59:18Z lzheng $
*/
package com.bostechcorp.cbesb.runtime.component.ftp.wsdl;
import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.ExtensionDeserializer;
import javax.wsdl.extensions.ExtensionRegistry;
import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import com.bostechcorp.cbesb.common.util.macro.MacroUtil;
import com.bostechcorp.cbesb.runtime.component.util.wsdl.BaseCommonAttributeDeserializer;
import com.ibm.wsdl.util.xml.DOMUtils;
/**
* @author j.zhang
* @version 1.0.0
*/
public class FtpInputDeserializer extends BaseCommonAttributeDeserializer
implements ExtensionDeserializer {
protected final transient Log logger = LogFactory.getLog(getClass());
public ExtensibilityElement unmarshall(Class parentType, QName elementType,
Element el, Definition def, ExtensionRegistry extReg) throws WSDLException {
logger.debug("");
logger.debug("FtpInputDeserializer");
logger.debug(" " + el.getNodeName());
logger.debug(" Attributes:");
NamedNodeMap attrMap = el.getAttributes();
for (int i = 0; i < attrMap.getLength(); i++) {
logger.debug(" attr[" + i + "]=" + attrMap.item(i).getNodeName()
+ ", " + attrMap.item(i).getNodeValue());
}
FtpInput ftpAddress = (FtpInput) super.unmarshall(parentType, elementType, el, def, extReg);
// ftpAddress.setDefaultMep(DOMUtils.getAttribute(el, FtpInputExtension.FTP_HOST));
ftpAddress.setFtpHost(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.FTP_HOST)));
ftpAddress.setFtpUser(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.FTP_USER)));
ftpAddress.setFtpPassword(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.FTP_PASSWORD)));
ftpAddress.setCmdFile(DOMUtils.getAttribute(el, FtpInputExtension.CMD_FILE));
ftpAddress.setFtpConnectMode(DOMUtils.getAttribute(el, FtpInputExtension.FTP_CONNECT_MODE));
ftpAddress.setFtpTransferMode(DOMUtils.getAttribute(el, FtpInputExtension.FTP_TRANSFER_MODE));
ftpAddress.setSourceDir(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.SOURCE_DIR)));
ftpAddress.setTransferDir(DOMUtils.getAttribute(el, FtpInputExtension.TRANSFER_DIR));
ftpAddress.setStageDir(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.STAGE_DIR)));
ftpAddress.setArchiveDir(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.ARCHIVE_DIR)));
ftpAddress.setHoldDir(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.HOLD_DIR)));
ftpAddress.setScanInterval(DOMUtils.getAttribute(el, FtpInputExtension.SCAN_INTERVAL));
ftpAddress.setSchedule(DOMUtils.getAttribute(el, FtpInputExtension.SCHEDULE));
String schedSvc = DOMUtils.getAttribute(el, FtpInputExtension.SCHEDULER_SERVICE);
if (schedSvc != null && !schedSvc.equals("")) {
QName schedulerServiceQN = DOMUtils.getQName(schedSvc, el, def);
ftpAddress.setSchedulerService(schedulerServiceQN);
} else {
ftpAddress.setSchedulerService(null);
}
ftpAddress.setSchedulerEndpoint(DOMUtils.getAttribute(el, FtpInputExtension.SCHEDULER_ENDPOINT));
ftpAddress.setHold(DOMUtils.getAttribute(el, FtpInputExtension.HOLD));
ftpAddress.setFilePattern(DOMUtils.getAttribute(el, FtpInputExtension.FILE_PATTERN));
ftpAddress.setFilePattern(DOMUtils.getAttribute(el, FtpInputExtension.MATCH_MODE));
ftpAddress.setTwoPass(DOMUtils.getAttribute(el, FtpInputExtension.TWO_PASS));
ftpAddress.setTwoPassInterval(DOMUtils.getAttribute(el, FtpInputExtension.TWO_PASS_INTERVAL));
ftpAddress.setFileCompleteAction(DOMUtils.getAttribute(el, FtpInputExtension.FILE_COMPLETE_ACTION));
ftpAddress.setRecordsPerMessage(DOMUtils.getAttribute(el, FtpInputExtension.RECORDS_PER_MESSAGE));
ftpAddress.setReadStyle(DOMUtils.getAttribute(el, FtpInputExtension.READ_STYLE));
ftpAddress.setRecordType(DOMUtils.getAttribute(el, FtpInputExtension.RECORD_TYPE));
ftpAddress.setCharset(DOMUtils.getAttribute(el, FtpInputExtension.CHARSET));
ftpAddress.setArchiveFilePattern(DOMUtils.getAttribute(el, FtpInputExtension.ARCHIVE_FILE_PATTERN));
ftpAddress.setReplyFtpHost(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.REPLY_FTP_HOST)));
ftpAddress.setReplyFtpUser(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.REPLY_FTP_USER)));
ftpAddress.setReplyFtpPassword(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.REPLY_FTP_PASSWORD)));
ftpAddress.setReplyFtpConnectMode(DOMUtils.getAttribute(el, FtpInputExtension.REPLY_FTP_CONNECT_MODE));
ftpAddress.setReplyFtpTransferMode(DOMUtils.getAttribute(el, FtpInputExtension.REPLY_FTP_TRANSFER_MODE));
ftpAddress.setReplyDir(MacroUtil.resolveUserMacro(DOMUtils.getAttribute(el, FtpInputExtension.REPLY_DIR)));
ftpAddress.setReplyCharset(DOMUtils.getAttribute(el, FtpInputExtension.REPLY_CHARSET));
ftpAddress.setReplyWriteStyle(DOMUtils.getAttribute(el, FtpInputExtension.REPLY_WRITE_STYLE));
ftpAddress.setReplyFilePattern(DOMUtils.getAttribute(el, FtpInputExtension.REPLY_FILE_PATTERN));
return ftpAddress;
}
}
|