01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU General Public License as published by the
09: * Free Software Foundation; either version 2 of the License, or (at your option)
10: * any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15: * for more details.
16: *
17: * You should have received a copy of the GNU General Public License along with
18: * this program; if not, write to the Free Software Foundation, Inc.,
19: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: *
21: *
22: * $Id: FileOutputDeserializer.java 9391 2007-09-30 01:58:45Z lzheng $
23: */
24: package com.bostechcorp.cbesb.runtime.component.file.wsdl;
25:
26: import javax.wsdl.Definition;
27: import javax.wsdl.WSDLException;
28: import javax.wsdl.extensions.ExtensibilityElement;
29: import javax.wsdl.extensions.ExtensionDeserializer;
30: import javax.wsdl.extensions.ExtensionRegistry;
31: import javax.xml.namespace.QName;
32:
33: import org.apache.commons.logging.Log;
34: import org.apache.commons.logging.LogFactory;
35: import org.w3c.dom.Element;
36: import org.w3c.dom.NamedNodeMap;
37:
38: import com.bostechcorp.cbesb.common.util.macro.MacroUtil;
39: import com.bostechcorp.cbesb.runtime.component.util.wsdl.BaseCommonAttributeDeserializer;
40: import com.ibm.wsdl.util.xml.DOMUtils;
41:
42: public class FileOutputDeserializer extends
43: BaseCommonAttributeDeserializer implements
44: ExtensionDeserializer {
45:
46: private static final Log log = LogFactory
47: .getLog(FileOutputDeserializer.class);
48:
49: public ExtensibilityElement unmarshall(Class parentType,
50: QName elementType, Element el, Definition def,
51: ExtensionRegistry extReg) throws WSDLException {
52: log.debug("");
53: log.debug("FileOutputDeserializer");
54: log.debug(" " + el.getNodeName());
55: log.debug(" Attributes:");
56: NamedNodeMap attrMap = el.getAttributes();
57: for (int i = 0; i < attrMap.getLength(); i++) {
58: log.debug(" attr[" + i + "]="
59: + attrMap.item(i).getNodeName() + ", "
60: + attrMap.item(i).getNodeValue());
61: }
62: // FileOutput fileAddress = (FileOutput) extReg.createExtension(parentType,
63: // elementType);
64: FileOutput fileAddress = (FileOutput) super.unmarshall(
65: parentType, elementType, el, def, extReg);
66:
67: fileAddress.setDestDir(MacroUtil.resolveUserMacro(DOMUtils
68: .getAttribute(el, FileOutputExtension.DEST_DIR)));
69: fileAddress.setStageDir(MacroUtil.resolveUserMacro(DOMUtils
70: .getAttribute(el, FileOutputExtension.STAGE_DIR)));
71: fileAddress.setCharset(DOMUtils.getAttribute(el,
72: FileOutputExtension.CHARSET));
73: fileAddress.setWriteStyle(DOMUtils.getAttribute(el,
74: FileOutputExtension.WRITE_STYLE));
75: fileAddress.setFilePattern(DOMUtils.getAttribute(el,
76: FileOutputExtension.FILE_PATTERN));
77: return fileAddress;
78: }
79: }
|