1 57 58 package org.apache.wsif.wsdl.extensions.jms; 59 60 import java.io.Serializable ; 61 62 import javax.wsdl.Definition; 63 import javax.wsdl.WSDLException; 64 import javax.wsdl.extensions.ExtensibilityElement; 65 import javax.wsdl.extensions.ExtensionDeserializer; 66 import javax.wsdl.extensions.ExtensionRegistry; 67 import javax.wsdl.extensions.ExtensionSerializer; 68 import javax.xml.namespace.QName ; 69 70 import org.apache.wsif.logging.Trc; 71 import org.w3c.dom.Element ; 72 73 import com.ibm.wsdl.Constants; 74 import com.ibm.wsdl.util.xml.DOMUtils; 75 76 83 public class JMSInputSerializer 84 implements ExtensionSerializer, ExtensionDeserializer, Serializable { 85 86 private static final long serialVersionUID = 1L; 87 88 91 public void marshall( 92 Class parentType, 93 QName elementType, 94 javax.wsdl.extensions.ExtensibilityElement extension, 95 java.io.PrintWriter pw, 96 javax.wsdl.Definition def, 97 javax.wsdl.extensions.ExtensionRegistry extReg) 98 throws javax.wsdl.WSDLException { 99 Trc.entry(parentType, elementType, extension, pw, def, extReg); 100 101 if (extension == null) { 102 Trc.exit(); 103 return; 104 } 105 106 JMSInput jmsInput = (JMSInput) extension; 107 String tagName = 108 DOMUtils.getQualifiedValue(JMSConstants.NS_URI_JMS, "input", def); 109 pw.print(" <" + tagName); 110 111 114 if (jmsInput.getParts() != null) { 115 DOMUtils.printAttribute( 116 JMSConstants.ATTR_PARTS, 117 com.ibm.wsdl.util.StringUtils.getNMTokens(jmsInput.getParts()), 118 pw); 119 } 120 121 if (jmsInput.getSchema() != null) { 122 DOMUtils.printAttribute(JMSConstants.ATTR_SCHEMA, jmsInput.getSchema(), pw); 123 } 124 125 Boolean required = extension.getRequired(); 126 if (required != null) { 127 DOMUtils.printQualifiedAttribute( 128 Constants.Q_ATTR_REQUIRED, 129 required.toString(), 130 def, 131 pw); 132 } 133 134 pw.println("/>"); 135 136 Trc.exit(); 137 } 138 139 142 public void registerSerializer(ExtensionRegistry registry) { 143 Trc.entry(this, registry); 144 145 registry.registerSerializer( 147 javax.wsdl.BindingInput.class, 148 JMSConstants.Q_ELEM_JMS_INPUT, 149 this); 150 registry.registerDeserializer( 151 javax.wsdl.BindingInput.class, 152 JMSConstants.Q_ELEM_JMS_INPUT, 153 this); 154 registry.mapExtensionTypes( 155 javax.wsdl.BindingInput.class, 156 JMSConstants.Q_ELEM_JMS_INPUT, 157 JMSInput.class); 158 159 registry.registerSerializer( 160 javax.wsdl.BindingOutput.class, 161 JMSConstants.Q_ELEM_JMS_INPUT, 162 this); 163 registry.registerDeserializer( 164 javax.wsdl.BindingOutput.class, 165 JMSConstants.Q_ELEM_JMS_INPUT, 166 this); 167 registry.mapExtensionTypes( 168 javax.wsdl.BindingOutput.class, 169 JMSConstants.Q_ELEM_JMS_INPUT, 170 JMSInput.class); 171 172 Trc.exit(); 173 } 174 175 178 public ExtensibilityElement unmarshall( 179 Class parentType, 180 QName elementType, 181 Element el, 182 Definition def, 183 ExtensionRegistry extReg) 184 throws WSDLException { 185 Trc.entry(this, parentType, elementType, el, def, extReg); 186 187 JMSInput jmsInput = (JMSInput) extReg.createExtension(parentType, elementType); 188 189 String parts = DOMUtils.getAttribute(el, JMSConstants.ATTR_PARTS); 190 if (parts != null) { 191 jmsInput.setParts(com.ibm.wsdl.util.StringUtils.parseNMTokens(parts)); 192 } 193 194 String schema = DOMUtils.getAttribute(el, JMSConstants.ATTR_SCHEMA); 195 if (schema != null) { 196 jmsInput.setSchema(schema); 197 } 198 199 Trc.exit(jmsInput); 200 return jmsInput; 201 } 202 } | Popular Tags |