You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2003/10/13 21:15:40 UTC

cvs commit: ws-axis/java/src/org/apache/axis/deployment/wsdd WSDDDocumentation.java WSDDElement.java WSDDOperation.java WSDDParameter.java WSDDService.java

dims        2003/10/13 12:15:40

  Modified:    java/src/org/apache/axis/wsdl/fromJava Emitter.java
               java/src/org/apache/axis/description OperationDesc.java
                        ParameterDesc.java ServiceDesc.java
               java/docs reference.html
               java/src/org/apache/axis/deployment/wsdd
                        WSDDDocumentation.java WSDDElement.java
                        WSDDOperation.java WSDDParameter.java
                        WSDDService.java
  Log:
  Fix for Bug 22425 - [Patch] add <documentation> to wsdd and wsdl
  from cchabanois@cognicase.fr (C?dric Chabanois)
  
  Revision  Changes    Path
  1.101     +38 -0     ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- Emitter.java	5 Sep 2003 17:58:54 -0000	1.100
  +++ Emitter.java	13 Oct 2003 19:15:39 -0000	1.101
  @@ -62,6 +62,7 @@
   import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
   import org.apache.axis.AxisFault;
   import org.apache.axis.Constants;
  +import org.apache.axis.InternalException;
   import org.apache.axis.Version;
   import org.apache.axis.description.FaultDesc;
   import org.apache.axis.description.OperationDesc;
  @@ -78,6 +79,7 @@
   import org.w3c.dom.Comment;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
  +import org.w3c.dom.Text;
   import org.xml.sax.SAXException;
   
   import javax.wsdl.Binding;
  @@ -179,6 +181,7 @@
        * Invoke emit to emit the code
        */
       public Emitter () {
  +	  createDocumentFragment();
         namespaces = new Namespaces();
         exceptionMsg = new HashMap();
       }
  @@ -753,6 +756,17 @@
           return binding;
       }
   
  +	Document docHolder;
  +
  +	private void createDocumentFragment() {
  +		try {
  +			this.docHolder = XMLUtils.newDocument();
  +		}  catch (ParserConfigurationException e) {
  +			// This should not occur
  +			throw new InternalException(e);
  +		}
  +	}
  +
       /**
        * Create the service.
        *
  @@ -773,6 +787,13 @@
               def.addService(service);
           }
   
  +		if (serviceDesc.getDocumentation() != null) {
  +			Element element = docHolder.createElement("documentation");
  +			Text textNode = docHolder.createTextNode(serviceDesc.getDocumentation());
  +			element.appendChild(textNode);
  +			service.setDocumentationElement(element);
  +		}
  +
           // Add the port
           Port port = def.createPort();
           port.setBinding(binding);
  @@ -824,6 +845,15 @@
               Operation oper = bindingOper.getOperation();
   
               OperationDesc messageOper = thisOper;
  +            
  +            // add the documentation to oper
  +			if (messageOper.getDocumentation() != null) {
  +				Element element = docHolder.createElement("documentation");
  +				Text textNode = docHolder.createTextNode(messageOper.getDocumentation());
  +				element.appendChild(textNode);
  +				oper.setDocumentationElement(element);
  +			}			
  +            
               if (serviceDesc2 != null) {
                   // If a serviceDesc containing an impl class is provided,
                   // try and locate the corresponding operation
  @@ -1359,6 +1389,14 @@
   
           // Create the Part
           Part part = def.createPart();
  +
  +		if (param.getDocumentation() != null) {
  +			Element element = docHolder.createElement("documentation");
  +			Text textNode = docHolder.createTextNode(param.getDocumentation());
  +			element.appendChild(textNode);
  +			part.setDocumentationElement(element);
  +		}			
  +
   
           // Get the java type to represent in the wsdl
           // (if the mode is OUT or INOUT and this
  
  
  
  1.36      +17 -0     ws-axis/java/src/org/apache/axis/description/OperationDesc.java
  
  Index: OperationDesc.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/description/OperationDesc.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- OperationDesc.java	28 Sep 2003 15:57:45 -0000	1.35
  +++ OperationDesc.java	13 Oct 2003 19:15:39 -0000	1.36
  @@ -125,6 +125,9 @@
       /** If we're a message-style operation, what's our signature? */
       private int messageOperationStyle = -1;
   
  +	/** The documentation for the operation */
  +	private String documentation = null;
  +
       /**
        * Default constructor.
        */
  @@ -159,6 +162,20 @@
       public void setName(String name) {
           this.name = name;
       }
  +
  +	/**
  +	 * get the documentation for the operation
  +	 */
  +	public String getDocumentation() {
  +		return documentation; 
  +	}
  +
  +	/**
  +	 * set the documentation for the operation
  +	 */
  +	public void setDocumentation(String documentation) {
  +		this.documentation = documentation;
  +	}
   
       public QName getReturnQName() {
           return returnDesc.getQName();
  
  
  
  1.28      +18 -0     ws-axis/java/src/org/apache/axis/description/ParameterDesc.java
  
  Index: ParameterDesc.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/description/ParameterDesc.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ParameterDesc.java	22 Apr 2003 19:34:22 -0000	1.27
  +++ ParameterDesc.java	13 Oct 2003 19:15:39 -0000	1.28
  @@ -99,6 +99,10 @@
       private boolean inHeader = false;
       private boolean outHeader = false; 
   
  +	/** The documentation for the parameter */
  +	private String documentation = null;
  +
  +
       public ParameterDesc() {
       }
   
  @@ -316,6 +320,20 @@
       public void setIsReturn(boolean value) {
           isReturn = value;
       }
  +
  +	/**
  +	 * get the documentation for the parameter
  +	 */
  +	public String getDocumentation() {
  +		return documentation; 
  +	}
  +
  +	/**
  +	 * set the documentation for the parameter
  +	 */
  +	public void setDocumentation(String documentation) {
  +		this.documentation = documentation;
  +	}
   
       private void writeObject(ObjectOutputStream out)
           throws IOException {
  
  
  
  1.80      +17 -0     ws-axis/java/src/org/apache/axis/description/ServiceDesc.java
  
  Index: ServiceDesc.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/description/ServiceDesc.java,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- ServiceDesc.java	13 Jul 2003 06:28:57 -0000	1.79
  +++ ServiceDesc.java	13 Oct 2003 19:15:39 -0000	1.80
  @@ -106,6 +106,9 @@
       /** The name of this service */
       private String name = null;
   
  +	/** The documentation of this service */
  +	private String documentation = null;
  +
       /** List of allowed methods */
       /** null allows everything, an empty ArrayList allows nothing */
       private List allowedMethods = null;
  @@ -335,6 +338,20 @@
       public void setName(String name) {
           this.name = name;
       }
  +
  +	/**
  +	 * get the documentation for the service
  +	 */
  +	public String getDocumentation() {
  +		return documentation; 
  +	}
  +
  +	/**
  +	 * set the documentation for the service
  +	 */
  +	public void setDocumentation(String documentation) {
  +		this.documentation = documentation;
  +	}
   
       public ArrayList getStopClasses() {
           return stopClasses;
  
  
  
  1.31      +16 -0     ws-axis/java/docs/reference.html
  
  Index: reference.html
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/docs/reference.html,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- reference.html	11 Aug 2003 14:20:23 -0000	1.30
  +++ reference.html	13 Oct 2003 19:15:39 -0000	1.31
  @@ -565,6 +565,22 @@
     <dd><b></b>A simplified type mapping, which uses pre-defined serializers/deserializers 
       to encode/decode JavaBeans. The class named by &quot;classname&quot; must 
       follow the JavaBean standard pattern of get/set accessors.</dd>
  +  <dt>&nbsp;</dt>
  +  <dt><b><font face="Courier New, Courier, mono">&lt;documentation&gt;</font></b></dt>
  +  <dd>Can be used inside a <b>&lt;service&gt;</b>, an <b>&lt;operation&gt;</b> or an
  +operation <b>&lt;parameter&gt;</b>. The content of the element is arbitrary
  +text which will be put in the generated wsdl inside a wsdl:document
  +element.<br>
  +<br>
  +Example:<br>
  +    <code>&lt;operation name="echoString" &gt;<br>
  +&nbsp;&nbsp;&lt;documentation&gt;This operation echoes a string&lt;/documentation&gt;<br>
  +&nbsp;&nbsp;&lt;parameter name="param"&gt;<br>
  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;documentation&gt;a string&lt;/documentation&gt;<br>
  +&nbsp;&nbsp;&lt;/parameter&gt;<br>
  +&lt;/operation&gt;    
  +    </code> 
  +  </dd>
   </dl>
   <p> </p>
   
  
  
  
  1.10      +13 -6     ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDocumentation.java
  
  Index: WSDDDocumentation.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDocumentation.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- WSDDDocumentation.java	22 Apr 2003 19:34:16 -0000	1.9
  +++ WSDDDocumentation.java	13 Oct 2003 19:15:39 -0000	1.10
  @@ -55,6 +55,7 @@
   package org.apache.axis.deployment.wsdd;
   
   import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.utils.XMLUtils;
   import org.w3c.dom.Element;
   
   import javax.xml.namespace.QName;
  @@ -62,18 +63,25 @@
   
   
   /**
  - *
  + * represents a WSDD documentation 
  + * All WSDDElement can have a documentation but it is used only for 
  + * Services, Operations and Parameters for now
    */
   public class WSDDDocumentation
       extends WSDDElement
   {
  -    private String value;
  +    private String value; /** the documentation */
    
       protected QName getElementName()
       {
           return WSDDConstants.QNAME_DOC;
       }
       
  +    public WSDDDocumentation(String value)
  +    {
  +    	this.value = value;
  +    }
  +    
       /**
        *
        * @param e (Element) XXX
  @@ -83,11 +91,11 @@
           throws WSDDException
       {
           super(e);
  +        value = XMLUtils.getChildCharacterData(e);
       }
   
       /**
  -     *
  -     * @return XXX
  +     * get the documentation
        */
       public String getValue()
       {
  @@ -95,8 +103,7 @@
       }
   
       /**
  -     *
  -     * @param value XXX
  +     * set the documentation
        */
       public void setValue(String value)
       {
  
  
  
  1.21      +1 -14     ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDElement.java
  
  Index: WSDDElement.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDElement.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WSDDElement.java	22 Apr 2003 19:34:16 -0000	1.20
  +++ WSDDElement.java	13 Oct 2003 19:15:39 -0000	1.21
  @@ -73,9 +73,6 @@
       extends WSDDConstants
       implements Serializable
   {
  -    /** If we have documentation, it goes here */
  -    private WSDDDocumentation documentation = null;
  -    
       private String name;
   
       /**
  @@ -148,21 +145,11 @@
   
           return elements;
       }
  -    
  -    /**
  -     * Get documentation (if any) for this WSDDElement.
  -     * 
  -     * @return the WSDDDocumentation object associated with this element, or
  -     *         null.
  -     */
  -    public WSDDDocumentation getDocumentation()
  -    {
  -        return documentation;
  -    }
   
       /**
        * Write this element out to a SerializationContext
        */ 
       public abstract void writeToContext(SerializationContext context)
           throws IOException;
  +        
   }
  
  
  
  1.26      +11 -0     ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDOperation.java
  
  Index: WSDDOperation.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDOperation.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- WSDDOperation.java	22 Apr 2003 19:34:17 -0000	1.25
  +++ WSDDOperation.java	13 Oct 2003 19:15:39 -0000	1.26
  @@ -136,6 +136,12 @@
               WSDDFault fault = new WSDDFault(faultElem);
               desc.addFault(fault.getFaultDesc());
           }
  +
  +        Element docElem = getChildElement(e, ELEM_WSDD_DOC);
  +        if (docElem != null) {
  +            WSDDDocumentation documentation = new WSDDDocumentation(docElem);
  +            desc.setDocumentation(documentation.getValue());
  +        }        
       }
   
       /**
  @@ -173,6 +179,11 @@
   
           context.startElement(getElementName(), attrs);
   
  +        if (desc.getDocumentation() != null) {
  +            WSDDDocumentation documentation = new WSDDDocumentation(desc.getDocumentation());
  +            documentation.writeToContext(context);
  +        }
  +		
           ArrayList params = desc.getParameters();
           for (Iterator i = params.iterator(); i.hasNext();) {
               ParameterDesc parameterDesc = (ParameterDesc) i.next();
  
  
  
  1.17      +12 -0     ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDParameter.java
  
  Index: WSDDParameter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDParameter.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- WSDDParameter.java	22 Apr 2003 19:34:17 -0000	1.16
  +++ WSDDParameter.java	13 Oct 2003 19:15:39 -0000	1.17
  @@ -106,6 +106,12 @@
           if (typeStr != null && !typeStr.equals("")) {
               parameter.setTypeQName(XMLUtils.getQNameFromString(typeStr, e));
           }
  +        
  +        Element docElem = getChildElement(e, ELEM_WSDD_DOC);
  +        if (docElem != null) {
  +            WSDDDocumentation documentation = new WSDDDocumentation(docElem);
  +            parameter.setDocumentation(documentation.getValue());
  +        }        
       }
   
       public WSDDParameter() {
  @@ -159,6 +165,12 @@
           }
           
           context.startElement(getElementName(), attrs);
  +        
  +        if (parameter.getDocumentation() != null) {
  +            WSDDDocumentation documentation = new WSDDDocumentation(parameter.getDocumentation());
  +            documentation.writeToContext(context);
  +        }
  +		        
           context.endElement();
       }
   
  
  
  
  1.100     +11 -0     ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
  
  Index: WSDDService.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- WSDDService.java	22 Apr 2003 19:34:17 -0000	1.99
  +++ WSDDService.java	13 Oct 2003 19:15:39 -0000	1.100
  @@ -222,6 +222,12 @@
               desc.setWSDLFile(fileName);
           }
   
  +        Element docElem = getChildElement(e, ELEM_WSDD_DOC);
  +        if (docElem != null) {
  +            WSDDDocumentation documentation = new WSDDDocumentation(docElem);
  +            desc.setDocumentation(documentation.getValue());
  +        }        
  +
           Element urlElem = getChildElement(e, ELEM_WSDD_ENDPOINTURL);
           if (urlElem != null) {
               String endpointURL = XMLUtils.getChildCharacterData(urlElem);
  @@ -607,6 +613,11 @@
               context.startElement(QNAME_WSDLFILE, null);
               context.writeSafeString(desc.getWSDLFile());
               context.endElement();
  +        }
  +        
  +        if (desc.getDocumentation() != null) {
  +        	WSDDDocumentation documentation = new WSDDDocumentation(desc.getDocumentation());
  +        	documentation.writeToContext(context);
           }
   
           for (int i = 0; i < operations.size(); i++) {