axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leif Mortenson (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Created: (AXIS-2375) Patch: deploy.wsdd does not contain documentation elements.
Date Thu, 19 Jan 2006 06:59:42 GMT
Patch: deploy.wsdd does not contain documentation elements.
-----------------------------------------------------------

         Key: AXIS-2375
         URL: http://issues.apache.org/jira/browse/AXIS-2375
     Project: Apache Axis
        Type: Improvement
  Components: Deployment / Registries  
    Versions: 1.3    
    Reporter: Leif Mortenson


It is possible to declare documentation elements within the WSDL file.  When you then run
WSDLToJava, that documentation will be used to create javadocs within the generated java source.

At the same time, a deploy.wsdd file is generated.  This file is then used to deploy the service
and generate a server-config.wsdd file.  That file is then used to by the deployed service
to generate the WSDL file downloaded by users and for populating meta data used by custom
code.  (classes in the org.apache.axis.description package).

The problem is that the documentation elements are not being added when the deploy.wsdd file
is generated.  If I add them manually and then deploy using the modified deploy.wsdd file,
everything elase works.

I have modified three files: org.apache.axis.wsdl.toJava.JavaDeployWriter.java, org.apache.axis.wsdl.symbolTable.Parameter.java,
and org.apache.axis.wsdl.symbolTable.SymbolTable.java
These changes cause the deploy.wsdd file to include any documentation tags, filling in the
missing link, and making documentation work everywhere.

I need this for a production system and am currently use a patched version of axis-1.3.jar
 I would appreciate if these changes could be included for the next release.

Cheers,
Leif

cvs diff -u 
cvs diff: Diffing .
cvs diff: Diffing fromJava
cvs diff: Diffing gen
cvs diff: Diffing symbolTable
Index: symbolTable/Parameter.java
===================================================================
RCS file: /home/cvspublic/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Parameter.java,v
retrieving revision 1.12
diff -u -r1.12 Parameter.java
--- symbolTable/Parameter.java	30 Jun 2005 20:09:17 -0000	1.12
+++ symbolTable/Parameter.java	18 Jan 2006 04:26:25 -0000
@@ -43,6 +43,9 @@
 
     /** Field name */
     private String name;
+    
+    /** Documentation for the parameter. */
+    private String documentation;
 
     // The MIME type of this parameter, null if it isn't a MIME type.
 
@@ -129,6 +132,24 @@
             this.qname = new QName("", name);
         }
     }
+    
+    /**
+     * Gets the documentation of the parameter.  May be null.
+     *
+     * @return
+     */
+    public String getDocumentation() {
+        return documentation;
+    }
+    
+    /**
+     * Sets the documentation of the parameter.  May be null.
+     *
+     * @param documentation
+     */
+    public void setDocumentation(String documentation) {
+        this.documentation = documentation;
+    }
 
     /**
      * Set the QName of the parameter.
Index: symbolTable/SymbolTable.java
===================================================================
RCS file: /home/cvspublic/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
retrieving revision 1.127
diff -u -r1.127 SymbolTable.java
--- symbolTable/SymbolTable.java	1 Aug 2005 03:16:44 -0000	1.127
+++ symbolTable/SymbolTable.java	18 Jan 2006 04:29:08 -0000
@@ -2028,6 +2028,22 @@
     }    // addOutParm
 
     /**
+     * Safely returns the value of an Element.
+     *
+     * @param element Element whose value is to be returned.  May be null.
+     *
+     * @return The element value or null if it does not exist.
+     */
+    private String getElementValue( org.w3c.dom.Element element )
+    {
+        if ( ( element == null ) || ( element.getFirstChild() == null ) )
+        {
+            return null;
+        }
+        return element.getFirstChild().getNodeValue();
+    }
+
+    /**
      * This method returns a vector containing Parameters which represent
      * each Part (shouldn't we call these "Parts" or something?)
      *
@@ -2095,6 +2111,7 @@
             QName elementName = part.getElementName();
             QName typeName = part.getTypeName();
             String partName = part.getName();
+            param.setDocumentation(getElementValue(part.getDocumentationElement()));
 
             // if we are either:
             //   1. encoded
@@ -3061,7 +3078,7 @@
      */
 
     private void populateServices(Definition def) throws IOException {
-    	String originalName = null;
+        String originalName = null;
         Iterator i = def.getServices().values().iterator();
 
         while (i.hasNext()) {
@@ -3311,7 +3328,7 @@
             TypeEntry refType = entry.getRefType();
 
             if (nestedType == null) {
-            	continue;
+                continue;
             }
 
             // If this entry has a referenced type that isn't
cvs diff: Diffing toJava
Index: toJava/JavaDeployWriter.java
===================================================================
RCS file: /home/cvspublic/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v
retrieving revision 1.98
diff -u -r1.98 JavaDeployWriter.java
--- toJava/JavaDeployWriter.java	12 Jun 2005 14:54:44 -0000	1.98
+++ toJava/JavaDeployWriter.java	18 Jan 2006 07:01:48 -0000
@@ -25,6 +25,7 @@
 import org.apache.axis.constants.Use;
 import org.apache.axis.utils.JavaUtils;
 import org.apache.axis.utils.Messages;
+import org.apache.axis.utils.XMLUtils;
 import org.apache.axis.wsdl.symbolTable.BindingEntry;
 import org.apache.axis.wsdl.symbolTable.FaultInfo;
 import org.apache.axis.wsdl.symbolTable.Parameter;
@@ -34,6 +35,8 @@
 import org.apache.axis.wsdl.symbolTable.TypeEntry;
 import org.apache.commons.logging.Log;
 
+import org.w3c.dom.Element;
+
 import javax.wsdl.Binding;
 import javax.wsdl.BindingOperation;
 import javax.wsdl.Definition;
@@ -92,7 +95,7 @@
         this.definition = definition;
         this.symbolTable = symbolTable;
     }    // ctor
-
+    
     /**
      * Generate deploy.wsdd.  Only generate it if the emitter
      * is generating server-side mappings.
@@ -107,6 +110,22 @@
     }    // generate
 
     /**
+     * Safely returns the value of an Element.
+     *
+     * @param element Element whose value is to be returned.  May be null.
+     *
+     * @return The element value or null if it does not exist.
+     */
+    private String getElementValue( Element element )
+    {
+        if ( ( element == null ) || ( element.getFirstChild() == null ) )
+        {
+            return null;
+        }
+        return element.getFirstChild().getNodeValue();
+    }
+
+    /**
      * Return the fully-qualified name of the deploy.wsdd file
      * to be generated.
      *
@@ -444,6 +463,13 @@
         }
         pw.println("      <parameter name=\"wsdlServicePort\" value=\""
                 + serviceName + "\"/>");
+        
+        String documentation = getElementValue( service.getDocumentationElement() );
+        if ( documentation != null )
+        {
+            pw.println("      <documentation>"
+                + XMLUtils.xmlEncodeString(documentation.trim()) + "</documentation>"
);
+        }
 
         writeDeployBinding(pw, bEntry);
         writeDeployTypes(pw, bEntry.getBinding(), hasLiteral, hasMIME, use);
@@ -463,16 +489,16 @@
         Binding binding = bEntry.getBinding();
         String className = bEntry.getName();
 
-		if (emitter.isSkeletonWanted()) {
-			 className += "Skeleton";
-		 } else
-		 {
-			 String customClassName  = emitter.getImplementationClassName();
-			 if ( customClassName != null )
-				 className = customClassName;
-			 else
-				 className += "Impl";
-		 }
+        if (emitter.isSkeletonWanted()) {
+             className += "Skeleton";
+         } else
+         {
+             String customClassName  = emitter.getImplementationClassName();
+             if ( customClassName != null )
+                 className = customClassName;
+             else
+                 className += "Impl";
+         }
 
         pw.println("      <parameter name=\"className\" value=\"" + className
                 + "\"/>");
@@ -507,7 +533,7 @@
 
                 ServiceDesc serviceDesc = emitter.getServiceDesc();
                 if (emitter.isDeploy() && serviceDesc != null) {
-               		// If the emitter works in deploy mode, sync the java operation name with
it of the ServiceDesc
+                    // If the emitter works in deploy mode, sync the java operation name
with it of the ServiceDesc
                     OperationDesc[] operDescs = serviceDesc.getOperationsByQName(new QName(namespaceURI,
operation.getName()));
                     if (operDescs.length == 0) {
                         log.warn("Can't find operation in the Java Class for WSDL binding
operation : " + operation.getName());
@@ -527,6 +553,8 @@
 
                 allowedMethods.add(javaOperName);
 
+                String documentation = getElementValue( operation.getDocumentationElement()
);
+                
                 // We pass "" as the namespace argument because we're just
                 // interested in the return type for now.
                 Parameters params =
@@ -563,7 +591,7 @@
 
                     // Write the operation metadata
                     writeOperation(pw, javaOperName, elementQName, returnQName,
-                            returnType, params, binding.getQName(),
+                            returnType, documentation, params, binding.getQName(),
                             faults, SOAPAction);
                 }
             }
@@ -613,9 +641,9 @@
      */
     protected void writeOperation(PrintWriter pw, String javaOperName,
                                   QName elementQName, QName returnQName,
-                                  QName returnType, Parameters params,
-                                  QName bindingQName, ArrayList faults,
-                                  String SOAPAction) {
+                                  QName returnType, String documentation,
+                                  Parameters params, QName bindingQName,
+                                  ArrayList faults, String SOAPAction) {
 
         pw.print("      <operation name=\"" + javaOperName + "\"");
 
@@ -675,6 +703,12 @@
 
         pw.println(" >");
 
+        if ( documentation != null )
+        {
+            pw.println("        <documentation>"
+                + XMLUtils.xmlEncodeString(documentation.trim()) + "</documentation>"
);
+        }
+
         Vector paramList = params.list;
 
         for (int i = 0; i < paramList.size(); i++) {
@@ -717,8 +751,15 @@
                 pw.print(Utils.genQNameAttributeString(itemQName, "itns"));
                 pw.print("\"");
             }
-
-            pw.println("/>");
+            
+            if (param.getDocumentation() == null) {
+                pw.println("/>");
+            } else {
+                pw.println(">");
+                pw.println("          <documentation>"
+                    + XMLUtils.xmlEncodeString(param.getDocumentation().trim()) + "</documentation>");
+                pw.println("        </parameter>");
+            }
         }
 
         if (faults != null) {
@@ -750,6 +791,29 @@
     }
 
     /**
+     * Raw routine that writes out the operation and parameters.
+     *
+     * @param pw
+     * @param javaOperName
+     * @param elementQName
+     * @param returnQName
+     * @param returnType
+     * @param params
+     * @param bindingQName
+     * @param faults
+     *
+     * @deprecated Should use version which takes a documentation value.
+     */
+    protected void writeOperation(PrintWriter pw, String javaOperName,
+                                  QName elementQName, QName returnQName,
+                                  QName returnType, Parameters params,
+                                  QName bindingQName, ArrayList faults,
+                                  String SOAPAction) {
+        writeOperation(pw, javaOperName, elementQName, returnQName, returnType, null, params,
+            bindingQName, faults, SOAPAction);
+    }
+
+    /**
      * Method getModeString
      *
      * @param mode


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message