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 81 public class JMSFaultPropertySerializer 82 implements ExtensionSerializer, ExtensionDeserializer, Serializable { 83 84 private static final long serialVersionUID = 1L; 85 86 90 public void marshall( 91 Class parentType, 92 QName elementType, 93 javax.wsdl.extensions.ExtensibilityElement extension, 94 java.io.PrintWriter pw, 95 javax.wsdl.Definition def, 96 javax.wsdl.extensions.ExtensionRegistry extReg) 97 throws javax.wsdl.WSDLException { 98 Trc.entry(parentType, elementType, extension, pw, def, extReg); 99 100 if (extension == null) { 101 Trc.exit(); 102 return; 103 } 104 105 JMSFaultProperty jmsFaultProperty = (JMSFaultProperty) extension; 106 String tagName = 107 DOMUtils.getQualifiedValue( 108 JMSConstants.NS_URI_JMS, 109 "faultProperty", 110 def); 111 pw.print(" <" + tagName); 112 113 116 if (jmsFaultProperty.getName() != null) { 117 DOMUtils.printAttribute( 118 JMSConstants.ATTR_NAME, 119 jmsFaultProperty.getName(), 120 pw); 121 } 122 123 if (jmsFaultProperty.getType() != null) { 124 DOMUtils.printQualifiedAttribute( 125 JMSConstants.ATTR_TYPE, 126 jmsFaultProperty.getType(), 127 def, 128 pw); 129 } 130 131 if (jmsFaultProperty.getValue() != null) { 132 DOMUtils.printAttribute( 133 JMSConstants.ATTR_VALUE, 134 jmsFaultProperty.getValue(), 135 pw); 136 } 137 138 if (jmsFaultProperty.getPart() != null) { 139 DOMUtils.printAttribute( 140 JMSConstants.ATTR_PART, 141 jmsFaultProperty.getPart(), 142 pw); 143 } 144 145 Boolean required = extension.getRequired(); 146 if (required != null) { 147 DOMUtils.printQualifiedAttribute( 148 Constants.Q_ATTR_REQUIRED, 149 required.toString(), 150 def, 151 pw); 152 } 153 154 pw.println("/>"); 155 156 Trc.exit(); 157 } 158 159 162 public void registerSerializer(ExtensionRegistry registry) { 163 Trc.entry(this, registry); 164 165 registry.registerSerializer( 167 JMSFaultIndicator.class, 168 JMSConstants.Q_ELEM_JMS_FAULT_PROPERTY, 169 this); 170 registry.registerDeserializer( 171 JMSFaultIndicator.class, 172 JMSConstants.Q_ELEM_JMS_FAULT_PROPERTY, 173 this); 174 registry.mapExtensionTypes( 175 JMSFaultIndicator.class, 176 JMSConstants.Q_ELEM_JMS_FAULT_PROPERTY, 177 JMSFaultProperty.class); 178 179 Trc.exit(); 180 } 181 182 186 public ExtensibilityElement unmarshall( 187 Class parentType, 188 QName elementType, 189 Element el, 190 Definition def, 191 ExtensionRegistry extReg) 192 throws WSDLException { 193 Trc.entry(this, parentType, elementType, el, def, extReg); 194 195 JMSFaultProperty jmsFaultProperty = 196 (JMSFaultProperty) extReg.createExtension(parentType, elementType); 197 198 String name = DOMUtils.getAttribute(el, JMSConstants.ATTR_NAME); 199 if (name != null) { 200 jmsFaultProperty.setName(name); 201 } 202 203 QName type = 204 DOMUtils.getQualifiedAttributeValue( 205 el, 206 JMSConstants.ATTR_TYPE, 207 JMSConstants.ELEM_FAULT_PROPERTY, 208 false); 209 if (type != null) { 210 jmsFaultProperty.setType(type); 211 } 212 213 String value = DOMUtils.getAttribute(el, JMSConstants.ATTR_VALUE); 214 if (value != null) { 215 jmsFaultProperty.setValue(value); 216 } 217 218 String part = DOMUtils.getAttribute(el, JMSConstants.ATTR_PART); 219 if (part != null) { 220 jmsFaultProperty.setPart(part); 221 } 222 223 Trc.exit(jmsFaultProperty); 224 return jmsFaultProperty; 225 } 226 } | Popular Tags |