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 JMSOperationSerializer 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(this, parentType, elementType, extension, pw, def, extReg); 100 101 if (extension == null) { 102 Trc.exit(); 103 return; 104 } 105 106 JMSOperation jmsOperation = (JMSOperation) extension; 107 String tagName = 108 DOMUtils.getQualifiedValue(JMSConstants.NS_URI_JMS, "operation", def); 109 pw.print(" <" + tagName); 110 111 114 Boolean required = extension.getRequired(); 115 if (required != null) { 116 DOMUtils.printQualifiedAttribute( 117 Constants.Q_ATTR_REQUIRED, 118 required.toString(), 119 def, 120 pw); 121 } 122 123 pw.println("/>"); 124 Trc.exit(); 125 } 126 127 130 public void registerSerializer(ExtensionRegistry registry) { 131 Trc.entry(this, registry); 132 133 registry.registerSerializer( 134 javax.wsdl.BindingOperation.class, 135 JMSConstants.Q_ELEM_JMS_OPERATION, 136 this); 137 registry.registerDeserializer( 138 javax.wsdl.BindingOperation.class, 139 JMSConstants.Q_ELEM_JMS_OPERATION, 140 this); 141 registry.mapExtensionTypes( 142 javax.wsdl.BindingOperation.class, 143 JMSConstants.Q_ELEM_JMS_OPERATION, 144 JMSOperation.class); 145 Trc.exit(); 146 } 147 148 151 public ExtensibilityElement unmarshall( 152 Class parentType, 153 QName elementType, 154 Element el, 155 Definition def, 156 ExtensionRegistry extReg) 157 throws WSDLException { 158 Trc.entry(this, parentType, elementType, el, def, extReg); 159 160 JMSOperation jmsOperation = 161 (JMSOperation) extReg.createExtension(parentType, elementType); 162 163 Trc.exit(jmsOperation); 164 return jmsOperation; 165 } 166 } | Popular Tags |