dev@jax-ws.java.net

extending WSDLGeneratorExtension

From: Fabian Ritzmann <Fabian.Ritzmann_at_Sun.COM>
Date: Wed, 23 Aug 2006 14:47:25 +0300

Hi,

I'd need additional name parameters being passed into the
WSDLGeneratorExtension methods. Right now, all you get when e.g.
addOperationExtension is invoked is a TypedXmlWriter and a
java.lang.reflect.Method. That is not sufficient to reliably determine
the QName of the operation. We need the QName in order to find any
policy attached to an operation.

Attached are my proposed changes to WSDLGeneratorExtension as a cvs diff
text file. Additionally of course, one would need to adapt the code in
WSDLGenerator/WSDLGeneratorExtensionFacade that invokes the
WSDLGeneratorExtension methods. That should be simple and I can provide
a diff for them as well if necessary.

A short search did not reveal any implementations of
WSDLGeneratorExtension other than my own PolicyWSDLGeneratorExtension.
Please let me know if I overlooked any.

When would be a suitable time to check in these changes? It can wait
some days or weeks if necessary. Does somebody want to make the code
changes or should I check them in after review?

Fabian


# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /Users/fr159072/workspace/jax-ws-sources_rearch-2005/jaxws-ri/rt/src/com/sun/xml/ws/api/wsdl/writer
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: WSDLGeneratorExtension.java
*** /Users/fr159072/workspace/jax-ws-sources_rearch-2005/jaxws-ri/rt/src/com/sun/xml/ws/api/wsdl/writer/WSDLGeneratorExtension.java Base (1.1.2.13)
--- /Users/fr159072/workspace/jax-ws-sources_rearch-2005/jaxws-ri/rt/src/com/sun/xml/ws/api/wsdl/writer/WSDLGeneratorExtension.java Locally Modified (Based On 1.1.2.13)
***************
*** 33,38 ****
--- 33,39 ----
  import com.sun.istack.Nullable;
  
  import java.lang.reflect.Method;
+ import javax.xml.namespace.QName;
  
  /**
   * This is a callback interface used to extend the WSDLGenerator. Implementors
***************
*** 95,102 ****
       * element can be generated.
       *
       * @param service This is the <code>wsdl:service</code> element that the extension can be added to.
       */
! public void addServiceExtension(TypedXmlWriter service) {
      }
  
      /**
--- 96,107 ----
       * element can be generated.
       *
       * @param service This is the <code>wsdl:service</code> element that the extension can be added to.
+ * @param serviceName This is the fully qualified name of the <code>wsdl:service</code> element.
       */
! public void addServiceExtension(TypedXmlWriter service, QName serviceName) {
! // The serviceName parameter could also be derived from the SEIModel that is made available
! // in the start method. But a separate parameter better matches the signatures of the
! // other methods of this interface.
      }
  
      /**
***************
*** 103,121 ****
       * This method is invoked so that extensions to a <code>wsdl:port</code>
       * element can be generated.
       *
! * @param port This is the wsdl:port element that the extension can be added to.
       */
! public void addPortExtension(TypedXmlWriter port) {
      }
  
      /**
       * This method is invoked so that extensions to a <code>wsdl:portType</code>
       * element can be generated.
- * <p/>
       *
! * @param portType This is the wsdl:portType element that the extension can be added to.
       */
! public void addPortTypeExtension(TypedXmlWriter portType) {
      }
  
      /**
--- 108,133 ----
       * This method is invoked so that extensions to a <code>wsdl:port</code>
       * element can be generated.
       *
! * @param port This is the <code>wsdl:port</code> element that the extension can be added to.
! * @param portName This is the fully qualified name of the <code>wsdl:port</code> element.
       */
! public void addPortExtension(TypedXmlWriter port, QName portName) {
! // The portName parameter could also be derived from the SEIModel that is made available
! // in the start method. But a separate parameter better matches the signatures of the
! // other methods of this interface.
      }
  
      /**
       * This method is invoked so that extensions to a <code>wsdl:portType</code>
       * element can be generated.
       *
! * @param portType This is the <code>wsdl:portType</code> element that the extension can be added to.
! * @param portTypeName This is the fully qualified name of the <code>wsdl:portType</code> element.
       */
! public void addPortTypeExtension(TypedXmlWriter portType, QName portTypeName) {
! // The portTypeName parameter could also be derived from the SEIModel that is made available
! // in the start method. But a separate parameter better matches the signatures of the
! // other methods of this interface.
      }
  
      /**
***************
*** 122,133 ****
       * This method is invoked so that extensions to a <code>wsdl:binding</code>
       * element can be generated.
       *
! * <p>
! * TODO: Some other information may need to be passed
! *
! * @param binding This is the wsdl:binding element that the extension can be added to.
       */
! public void addBindingExtension(TypedXmlWriter binding) {
      }
  
      /**
--- 134,143 ----
       * This method is invoked so that extensions to a <code>wsdl:binding</code>
       * element can be generated.
       *
! * @param binding This is the <code>wsdl:binding</code> element that the extension can be added to.
! * @param binding This is the fully qualified name of the <code>wsdl:binding</code> element.
       */
! public void addBindingExtension(TypedXmlWriter binding, QName bindingName) {
      }
  
      /**
***************
*** 134,145 ****
       * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation</code>
       * element can be generated.
       *
! * @param operation This is the wsdl:portType/wsdl:operation element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addOperationExtension(TypedXmlWriter operation, Method method) {
      }
  
  
--- 144,158 ----
       * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation</code>
       * element can be generated.
       *
! * @param operation This is the <code>wsdl:portType/wsdl:operation</code> element that the
       * extension can be added to.
+ * @param operationName This is the fully qualified name of the <code>wsdl:portType/wsdl:operation</code> element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addOperationExtension(TypedXmlWriter operation, QName operationName, Method method) {
! // Instead of providing operationName another approach would be to pass a JavaMethod
! // parameter and add getOperationName to the JavaMethod interface.
      }
  
  
***************
*** 147,158 ****
       * This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation</code>
       * element can be generated.
       *
! * @param operation This is the wsdl:binding/wsdl:operation element that the
       * extension can be added to.
       * @param method {_at_link java.lang.annotation.Annotation}s from the {_at_link Method} can be accessed and translated
       * in to WSDL extensibility element on wsdl:operation.
       */
! public void addBindingOperationExtension(TypedXmlWriter operation, Method method) {
      }
  
      /**
--- 160,174 ----
       * This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation</code>
       * element can be generated.
       *
! * @param operation This is the <code>wsdl:binding/wsdl:operation</code> element that the
       * extension can be added to.
+ * @param operationName This is the fully qualified name of the <code>wsdl:binding/wsdl:operation</code> element.
       * @param method {_at_link java.lang.annotation.Annotation}s from the {_at_link Method} can be accessed and translated
       * in to WSDL extensibility element on wsdl:operation.
       */
! public void addBindingOperationExtension(TypedXmlWriter operation, QName operationName, Method method) {
! // Instead of providing operationName another approach would be to pass a JavaMethod
! // parameter and add getOperationName to the JavaMethod interface.
      }
  
      /**
***************
*** 159,170 ****
       * This method is invoked so that extensions to an input <code>wsdl:message</code>
       * element can be generated.
       *
! * @param message This is the input wsdl:message element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addInputMessageExtension(TypedXmlWriter message, Method method) {
      }
  
      /**
--- 175,187 ----
       * This method is invoked so that extensions to an input <code>wsdl:message</code>
       * element can be generated.
       *
! * @param message This is the input <code>wsdl:message<code> element that the
       * extension can be added to.
+ * @param messageName This is the fully qualified name of the <code>wsdl:message</code> element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addInputMessageExtension(TypedXmlWriter message, QName messageName, Method method) {
      }
  
      /**
***************
*** 171,182 ****
       * This method is invoked so that extensions to an output <code>wsdl:message</code>
       * element can be generated.
       *
! * @param message This is the output wsdl:message element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addOutputMessageExtension(TypedXmlWriter message, Method method) {
      }
  
  
--- 188,200 ----
       * This method is invoked so that extensions to an output <code>wsdl:message</code>
       * element can be generated.
       *
! * @param message This is the output <code>wsdl:message</code> element that the
       * extension can be added to.
+ * @param messageName This is the fully qualified name of the <code>wsdl:message</code> element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addOutputMessageExtension(TypedXmlWriter message, QName messageName, Method method) {
      }
  
  
***************
*** 185,196 ****
       * <code>wsdl:portType/wsdl:operation/wsdl:input</code>
       * element can be generated.
       *
! * @param input This is the wsdl:portType/wsdl:operation/wsdl:input element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addOperationInputExtension(TypedXmlWriter input, Method method) {
      }
  
  
--- 203,215 ----
       * <code>wsdl:portType/wsdl:operation/wsdl:input</code>
       * element can be generated.
       *
! * @param input This is the <code>wsdl:portType/wsdl:operation/wsdl:input</code> element that the
       * extension can be added to.
+ * @param inputName This is the fully qualified name of the <code>wsdl:portType/wsdl:operation/wsdl:input</code> element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addOperationInputExtension(TypedXmlWriter input, QName inputName, Method method) {
      }
  
  
***************
*** 201,210 ****
       *
       * @param output This is the wsdl:portType/wsdl:operation/wsdl:output element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addOperationOutputExtension(TypedXmlWriter output, Method method) {
      }
  
      /**
--- 220,230 ----
       *
       * @param output This is the wsdl:portType/wsdl:operation/wsdl:output element that the
       * extension can be added to.
+ * @param outputName This is the fully qualified name of the <code>wsdl:portType/wsdl:operation/wsdl:output</code> element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addOperationOutputExtension(TypedXmlWriter output, QName outputName, Method method) {
      }
  
      /**
***************
*** 214,223 ****
       *
       * @param input This is the wsdl:binding/wsdl:operation/wsdl:input element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addBindingOperationInputExtension(TypedXmlWriter input, Method method) {
      }
  
  
--- 234,244 ----
       *
       * @param input This is the wsdl:binding/wsdl:operation/wsdl:input element that the
       * extension can be added to.
+ * @param inputName This is the fully qualified name of the <code>wsdl:binding/wsdl:operation/wsdl:input</code> element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addBindingOperationInputExtension(TypedXmlWriter input, QName inputName, Method method) {
      }
  
  
***************
*** 228,285 ****
       *
       * @param output This is the wsdl:binding/wsdl:operation/wsdl:output element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addBindingOperationOutputExtension(TypedXmlWriter output, Method method) {
      }
  
      /**
- * TODO: Probably it should be removed, apparaently there is no usecase where there is need to read annotations
- * off checked exception class or detail bean that represents wsdl fault.
- * <p>
       * This method is invoked so that extensions to a
       * <code>wsdl:binding/wsdl:operation/wsdl:fault</code>
       * element can be generated.
       *
       * @param fault This is the wsdl:binding/wsdl:operation/wsdl:fault element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addBindingOperationFaultExtension(TypedXmlWriter fault, Method method) {
      }
  
      /**
- * TODO: Probably it should be removed, apparaently there is no usecase where there is need to read annotations
- * off checked exception class or detail bean that represents wsdl fault.
- * <p>
       * This method is invoked so that extensions to a fault <code>wsdl:message</code>
       * element can be generated.
       *
       * @param message This is the fault wsdl:message element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addFaultMessageExtension(TypedXmlWriter message, Method method) {
      }
  
      /**
- * TODO: Probably it should be removed, apparaently there is no usecase where there is need to read annotations
- * off checked exception class or detail bean that represents wsdl fault.
- * <p>
       * This method is invoked so that extensions to a
       * <code>wsdl:portType/wsdl:operation/wsdl:fault</code>
       * element can be generated.
       *
       * @param fault This is the wsdl:portType/wsdl:operation/wsdl:fault element that the
       * extension can be added to.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       * @param ce The CheckedException for this Fault.
       */
! public void addOperationFaultExtension(TypedXmlWriter fault, Method method, CheckedException ce) {
      }
  
  }
--- 249,301 ----
       *
       * @param output This is the wsdl:binding/wsdl:operation/wsdl:output element that the
       * extension can be added to.
+ * @param outputName This is the fully qualified name of the <code>wsdl:binding/wsdl:operation/wsdl:output</code> element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addBindingOperationOutputExtension(TypedXmlWriter output, QName outputName, Method method) {
      }
  
      /**
       * This method is invoked so that extensions to a
       * <code>wsdl:binding/wsdl:operation/wsdl:fault</code>
       * element can be generated.
       *
       * @param fault This is the wsdl:binding/wsdl:operation/wsdl:fault element that the
       * extension can be added to.
+ * @param faultName This is the fully qualified name of the <code>wsdl:binding/wsdl:operation/wsdl:fault</code> element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addBindingOperationFaultExtension(TypedXmlWriter fault, QName faultName, Method method) {
      }
  
      /**
       * This method is invoked so that extensions to a fault <code>wsdl:message</code>
       * element can be generated.
       *
       * @param message This is the fault wsdl:message element that the
       * extension can be added to.
+ * @param messageName This is the fully qualified name of the fault wsdl:message element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       */
! public void addFaultMessageExtension(TypedXmlWriter message, QName messageName, Method method) {
      }
  
      /**
       * This method is invoked so that extensions to a
       * <code>wsdl:portType/wsdl:operation/wsdl:fault</code>
       * element can be generated.
       *
       * @param fault This is the wsdl:portType/wsdl:operation/wsdl:fault element that the
       * extension can be added to.
+ * @param faultName This is the fully qualified name of the <code>wsdl:portType/wsdl:operation/wsdl:fault</code> element.
       * @param method Annotations from the {_at_link Method} can be accessed and translated in to WSDL extensibility
       * element on wsdl:operation.
       * @param ce The CheckedException for this Fault.
       */
! public void addOperationFaultExtension(TypedXmlWriter fault, QName faultName, Method method, CheckedException ce) {
      }
  
  }