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
008: * it under the terms of the GNU General Public License as published by
009: * the Free Software Foundation; either version 2 of the License, or
010: * (at your option) 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
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: *
023: * $Id: FtpOutputDeserializer.java 9392 2007-09-30 01:59:18Z lzheng $
024: */
025: package com.bostechcorp.cbesb.runtime.component.ftp.wsdl;
026:
027: import javax.wsdl.Definition;
028: import javax.wsdl.WSDLException;
029: import javax.wsdl.extensions.ExtensibilityElement;
030: import javax.wsdl.extensions.ExtensionDeserializer;
031: import javax.wsdl.extensions.ExtensionRegistry;
032: import javax.xml.namespace.QName;
033:
034: import org.apache.commons.logging.Log;
035: import org.apache.commons.logging.LogFactory;
036: import org.w3c.dom.Element;
037: import org.w3c.dom.NamedNodeMap;
038:
039: import com.bostechcorp.cbesb.common.util.macro.MacroUtil;
040: import com.bostechcorp.cbesb.runtime.component.util.wsdl.BaseCommonAttributeDeserializer;
041: import com.ibm.wsdl.util.xml.DOMUtils;
042:
043: /**
044: * @author j.zhang
045: * @version 1.0.0
046: */
047: public class FtpOutputDeserializer extends
048: BaseCommonAttributeDeserializer implements
049: ExtensionDeserializer {
050:
051: protected final transient Log logger = LogFactory
052: .getLog(getClass());
053:
054: public ExtensibilityElement unmarshall(Class parentType,
055: QName elementType, Element el, Definition def,
056: ExtensionRegistry extReg) throws WSDLException {
057: logger.debug("");
058: logger.debug("FtpOutputDeserializer");
059: logger.debug(" " + el.getNodeName());
060: logger.debug(" Attributes:");
061: NamedNodeMap attrMap = el.getAttributes();
062: for (int i = 0; i < attrMap.getLength(); i++) {
063: logger.debug(" attr[" + i + "]="
064: + attrMap.item(i).getNodeName() + ", "
065: + attrMap.item(i).getNodeValue());
066: }
067:
068: FtpOutput fileAddress = (FtpOutput) super.unmarshall(
069: parentType, elementType, el, def, extReg);
070: fileAddress.setFtpHost(MacroUtil.resolveUserMacro(DOMUtils
071: .getAttribute(el, FtpOutputExtension.FTP_HOST)));
072: fileAddress.setFtpUser(MacroUtil.resolveUserMacro(DOMUtils
073: .getAttribute(el, FtpOutputExtension.FTP_USER)));
074: fileAddress.setFtpPassword(MacroUtil.resolveUserMacro(DOMUtils
075: .getAttribute(el, FtpOutputExtension.FTP_PASSWORD)));
076: fileAddress.setCmdFile(DOMUtils.getAttribute(el,
077: FtpOutputExtension.CMD_FILE));
078: fileAddress.setFtpConnectMode(DOMUtils.getAttribute(el,
079: FtpOutputExtension.FTP_CONNECT_MODE));
080: fileAddress.setFtpTransferMode(DOMUtils.getAttribute(el,
081: FtpOutputExtension.FTP_TRANSFER_MODE));
082: fileAddress.setDestDir(MacroUtil.resolveUserMacro(DOMUtils
083: .getAttribute(el, FtpOutputExtension.DEST_DIR)));
084: fileAddress.setTransferDir(DOMUtils.getAttribute(el,
085: FtpOutputExtension.TRANSFER_DIR));
086: fileAddress.setStageDir(MacroUtil.resolveUserMacro(DOMUtils
087: .getAttribute(el, FtpOutputExtension.STAGE_DIR)));
088: fileAddress.setCharset(DOMUtils.getAttribute(el,
089: FtpOutputExtension.CHARSET));
090: fileAddress.setWriteStyle(DOMUtils.getAttribute(el,
091: FtpOutputExtension.WRITE_STYLE));
092: fileAddress.setFilePattern(DOMUtils.getAttribute(el,
093: FtpOutputExtension.FILE_PATTERN));
094: fileAddress.setFileCompleteAction(DOMUtils.getAttribute(el,
095: FtpOutputExtension.FILE_COMPLETE_ACTION));
096: fileAddress.setArchiveDir(MacroUtil.resolveUserMacro(DOMUtils
097: .getAttribute(el, FtpOutputExtension.ARCHIVE_DIR)));
098: fileAddress.setArchiveFilePattern(DOMUtils.getAttribute(el,
099: FtpOutputExtension.ARCHIVE_FILE_PATTERN));
100: return fileAddress;
101: }
102: }
|