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 JMSFaultSerializer 82 implements ExtensionSerializer, ExtensionDeserializer, Serializable { 83 84 private static final long serialVersionUID = 1L; 85 86 89 public void marshall( 90 Class parentType, 91 QName elementType, 92 javax.wsdl.extensions.ExtensibilityElement extension, 93 java.io.PrintWriter pw, 94 javax.wsdl.Definition def, 95 javax.wsdl.extensions.ExtensionRegistry extReg) 96 throws javax.wsdl.WSDLException { 97 Trc.entry(parentType, elementType, extension, pw, def, extReg); 98 99 if (extension == null) { 100 Trc.exit(); 101 return; 102 } 103 104 JMSFault jmsFault = (JMSFault) extension; 105 String tagName = 106 DOMUtils.getQualifiedValue(JMSConstants.NS_URI_JMS, "fault", def); 107 pw.print(" <" + tagName); 108 109 112 if (jmsFault.getParts() != null) { 113 DOMUtils.printAttribute( 114 JMSConstants.ATTR_PARTS, 115 com.ibm.wsdl.util.StringUtils.getNMTokens(jmsFault.getParts()), 116 pw); 117 } 118 119 Boolean required = extension.getRequired(); 120 if (required != null) { 121 DOMUtils.printQualifiedAttribute( 122 Constants.Q_ATTR_REQUIRED, 123 required.toString(), 124 def, 125 pw); 126 } 127 128 pw.println("/>"); 129 130 Trc.exit(); 131 } 132 133 136 public void registerSerializer(ExtensionRegistry registry) { 137 Trc.entry(this, registry); 138 139 registry.registerSerializer( 141 javax.wsdl.BindingFault.class, 142 JMSConstants.Q_ELEM_JMS_FAULT, 143 this); 144 registry.registerDeserializer( 145 javax.wsdl.BindingFault.class, 146 JMSConstants.Q_ELEM_JMS_FAULT, 147 this); 148 registry.mapExtensionTypes( 149 javax.wsdl.BindingFault.class, 150 JMSConstants.Q_ELEM_JMS_FAULT, 151 JMSFault.class); 152 153 Trc.exit(); 154 } 155 156 159 public ExtensibilityElement unmarshall( 160 Class parentType, 161 QName elementType, 162 Element el, 163 Definition def, 164 ExtensionRegistry extReg) 165 throws WSDLException { 166 Trc.entry(this, parentType, elementType, el, def, extReg); 167 168 JMSFault jmsFault = (JMSFault) extReg.createExtension(parentType, elementType); 169 170 String parts = DOMUtils.getAttribute(el, JMSConstants.ATTR_PARTS); 171 if (parts != null) { 172 jmsFault.setParts(com.ibm.wsdl.util.StringUtils.parseNMTokens(parts)); 173 } 174 175 Trc.exit(jmsFault); 176 return jmsFault; 177 } 178 } | Popular Tags |