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 it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * 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 MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id: JMSAddressDeserializer.java 1206 2006-09-23 03:51:32Z elu $
023: */
024: package com.bostechcorp.cbesb.runtime.component.jms.wsdl;
025:
026: import javax.wsdl.Definition;
027: import javax.wsdl.WSDLException;
028: import javax.wsdl.extensions.ExtensibilityElement;
029: import javax.wsdl.extensions.ExtensionDeserializer;
030: import javax.wsdl.extensions.ExtensionRegistry;
031: import javax.xml.namespace.QName;
032:
033: import org.apache.commons.logging.Log;
034: import org.apache.commons.logging.LogFactory;
035: import org.w3c.dom.Element;
036: import org.w3c.dom.NamedNodeMap;
037:
038: import com.bostechcorp.cbesb.common.util.macro.MacroUtil;
039: import com.bostechcorp.cbesb.runtime.component.util.wsdl.BaseCommonAttributeDeserializer;
040: import com.ibm.wsdl.util.xml.DOMUtils;
041:
042: public class JMSAddressDeserializer extends
043: BaseCommonAttributeDeserializer implements
044: ExtensionDeserializer {
045:
046: Log log = LogFactory.getLog(JMSAddressDeserializer.class);
047:
048: public ExtensibilityElement unmarshall(Class parentType,
049: QName elementType, Element el, Definition def,
050: ExtensionRegistry extReg) throws WSDLException {
051:
052: log.debug("");
053: log.debug("JMSAddressDeserializer");
054: log.debug(" " + el.getNodeName());
055: log.debug(" Attributes:");
056: NamedNodeMap attrMap = el.getAttributes();
057: for (int i = 0; i < attrMap.getLength(); i++) {
058: log.debug(" attr[" + i + "]="
059: + attrMap.item(i).getNodeName() + ", "
060: + attrMap.item(i).getNodeValue());
061: }
062:
063: JMSAddress jmsAddress = (JMSAddress) super .unmarshall(
064: parentType, elementType, el, def, extReg);
065:
066: jmsAddress.setJndiInitialContextFactory(MacroUtil
067: .resolveUserMacro(DOMUtils.getAttribute(el,
068: JMSExtension.JNDI_INITIAL_CONTEXT_FACTORY)));
069: jmsAddress.setJndiProviderUrl(MacroUtil
070: .resolveUserMacro(DOMUtils.getAttribute(el,
071: JMSExtension.JNDI_PROVIDER_URL)));
072: jmsAddress.setJndiConnectionFactoryName(MacroUtil
073: .resolveUserMacro(DOMUtils.getAttribute(el,
074: JMSExtension.JNDI_CONNECTION_FACTORY_NAME)));
075: jmsAddress.setDestinationStyle(DOMUtils.getAttribute(el,
076: JMSExtension.DESTINATION_STYLE));
077: jmsAddress.setTargetDestinationName(MacroUtil
078: .resolveUserMacro(DOMUtils.getAttribute(el,
079: JMSExtension.TARGET_DESTINATION_NAME)));
080: jmsAddress.setReplyDestinationName(MacroUtil
081: .resolveUserMacro(DOMUtils.getAttribute(el,
082: JMSExtension.REPLY_DESTINATION_NAME)));
083: jmsAddress.setAwaitTimeout(DOMUtils.getAttribute(el,
084: JMSExtension.AWAIT_TIMEOUT));
085: jmsAddress.setReplyTimeout(DOMUtils.getAttribute(el,
086: JMSExtension.REPLY_TIMEOUT));
087: jmsAddress.setRecordsPerMessage(DOMUtils.getAttribute(el,
088: JMSExtension.RECORDS_PER_MESSAGE));
089: jmsAddress.setReadStyle(DOMUtils.getAttribute(el,
090: JMSExtension.READ_STYLE));
091: jmsAddress.setRecordType(DOMUtils.getAttribute(el,
092: JMSExtension.RECORD_TYPE));
093: jmsAddress.setWriteStyle(DOMUtils.getAttribute(el,
094: JMSExtension.WRITE_STYLE));
095: jmsAddress.setCharset(DOMUtils.getAttribute(el,
096: JMSExtension.CHARSET));
097: //JMS 1.2
098: jmsAddress.setTransactional(Boolean.parseBoolean(DOMUtils
099: .getAttribute(el, JMSExtension.TRANSACTION)));
100: jmsAddress.setRetry(Boolean.parseBoolean(DOMUtils.getAttribute(
101: el, JMSExtension.RETRY)));
102:
103: if (Boolean.valueOf(DOMUtils.getAttribute(el,
104: JMSExtension.RETRY))) {
105: jmsAddress.setMaxRetryCount(Integer.parseInt(DOMUtils
106: .getAttribute(el, JMSExtension.RETRY_COUNT)));
107:
108: jmsAddress.setRetryInterval(Integer.parseInt(DOMUtils
109: .getAttribute(el, JMSExtension.RETRY_INTERVAL)));
110: }
111: jmsAddress.setEnableQuery(Boolean.parseBoolean(DOMUtils
112: .getAttribute(el, JMSExtension.ENABLE_QUERY)));
113: jmsAddress.setQueryExpression(MacroUtil
114: .resolveUserMacro(DOMUtils.getAttribute(el,
115: JMSExtension.QUERY_EXPRESSION)));
116:
117: jmsAddress.setDLQ(DOMUtils.getAttribute(el, JMSExtension.DLQ));
118:
119: jmsAddress.setSaveMetadata(Boolean.parseBoolean(DOMUtils
120: .getAttribute(el, JMSExtension.SAVE_METADATA)));
121:
122: //
123: return jmsAddress;
124: }
125: }
|