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 ch...@apache.org on 2005/08/28 15:58:06 UTC

svn commit: r263876 - in /webservices/axis/trunk/java: modules/samples/ modules/samples/resources/ modules/samples/resources/om/ modules/samples/resources/om/binary/ modules/samples/src/sample/om/ modules/samples/src/sample/om/binary/ modules/xml/src/o...

Author: chinthaka
Date: Sun Aug 28 06:57:00 2005
New Revision: 263876

URL: http://svn.apache.org/viewcvs?rev=263876&view=rev
Log:
- Adding CData support
- Test case to check the OMDocument serialization 
- fixing couple of bugs

Added:
    webservices/axis/trunk/java/modules/samples/resources/
    webservices/axis/trunk/java/modules/samples/resources/om/
    webservices/axis/trunk/java/modules/samples/resources/om/binary/
    webservices/axis/trunk/java/modules/samples/src/sample/om/
    webservices/axis/trunk/java/modules/samples/src/sample/om/binary/
Modified:
    webservices/axis/trunk/java/modules/samples/project.properties
    webservices/axis/trunk/java/modules/samples/project.xml
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java
    webservices/axis/trunk/java/xdocs/Axis2ArchitectureGuide.html

Modified: webservices/axis/trunk/java/modules/samples/project.properties
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/project.properties?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/project.properties (original)
+++ webservices/axis/trunk/java/modules/samples/project.properties Sun Aug 28 06:57:00 2005
@@ -14,5 +14,5 @@
 # limitations under the License.
 # -------------------------------------------------------------------
 
-maven.repo.remote=http://cvs.apache.org/repository/, http://www.ibiblio.org/maven,http://www.apache.org/dist/java-repository/
+maven.repo.remote=http://cvs.apache.org/repository/, http://www.ibiblio.org/maven,http://www.apache.org/dist/java-repository/, http://people.apache.org/~dims/maven/
 maven.multiproject.type=jar

Modified: webservices/axis/trunk/java/modules/samples/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/project.xml?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/project.xml (original)
+++ webservices/axis/trunk/java/modules/samples/project.xml Sun Aug 28 06:57:00 2005
@@ -20,9 +20,9 @@
     <pomVersion>3</pomVersion>
     <extend>../../etc/project.xml</extend>
 
-    <name>Apache Axis 2.0 - Samples</name>
-    <id>axis2-samples</id>
-    <groupId>axis2</groupId>
+    <name>Apache Axis 2.0 - Samples</name>
+    <id>axis2-samples</id>
+    <groupId>axis2</groupId>
     <description>Samples for Axis 2.0</description>
 
     <dependencies>
@@ -87,22 +87,22 @@
             </properties>
             <url>http://dist.codehaus.org/groovy/jars/</url>
         </dependency>
-        <dependency>
-            <groupId>commons-httpclient</groupId>
-            <artifactId>commons-httpclient</artifactId>
-            <version>3.0-rc3</version>
-            <properties>
-                <module>true</module>
-            </properties>
-        </dependency>
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-            <version>1.3</version>
-            <properties>
-                <module>true</module>
-            </properties>
-        </dependency>
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.0-rc3</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.3</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
         <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
@@ -129,6 +129,11 @@
             <properties>
                 <module>true</module>
             </properties>
+        </dependency>
+        <dependency>
+            <groupId>fastinfoset</groupId>
+            <artifactId>FastInfoset</artifactId>
+            <version>0.1</version>
         </dependency>
         <dependency>
             <groupId>geronimo-spec</groupId>

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java Sun Aug 28 06:57:00 2005
@@ -32,12 +32,12 @@
     /**
      * The node is a <code>Text</code> node.
      */
-    public static final short TEXT_NODE = 3;
+    public static final short TEXT_NODE = 4;
 
     /**
      * The node is a <code>CDATASection</code>.
      */
-    public static final short CDATA_SECTION_NODE = 4;
+    public static final short CDATA_SECTION_NODE = 12;
 
     /**
      * The node is a <code>Comment</code>.

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java Sun Aug 28 06:57:00 2005
@@ -34,6 +34,7 @@
         super(parentNode);
         this.value = contentText;
         nodeType = OMNode.COMMENT_NODE;
+        this.done = true;
     }
 
     /**

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java Sun Aug 28 06:57:00 2005
@@ -17,7 +17,6 @@
 
 import org.apache.axis2.om.*;
 import org.apache.axis2.om.impl.OMOutputImpl;
-import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
 import org.apache.axis2.om.impl.llom.traverse.OMChildrenIterator;
 import org.apache.axis2.om.impl.llom.traverse.OMChildrenQNameIterator;
 import org.apache.axis2.om.impl.llom.util.EmptyIterator;

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java Sun Aug 28 06:57:00 2005
@@ -68,6 +68,9 @@
      * Field parserAccessed
      */
     protected boolean parserAccessed = false;
+    protected OMDocument document;
+
+
 
     /**
      * Constructor StAXBuilder
@@ -143,7 +146,7 @@
      * @return
      * @throws OMException
      */
-    protected OMNode createOMText() throws OMException {
+    protected OMNode createOMText(int textType) throws OMException {
         if (lastNode == null) {
             throw new OMException();
         }
@@ -156,6 +159,7 @@
             OMElement e = (OMElement) lastNode;
             node = omfactory.createText(e, parser.getText());
         }
+        node.setType(textType);
         return node;
     }
 

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java Sun Aug 28 06:57:00 2005
@@ -21,6 +21,7 @@
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
+
 /**
  * This will construct an OM without using SOAP specific classes like SOAPEnvelope, SOAPHeader, SOAPHeaderBlock and SOAPBody.
  * And this will habe the Document concept also.
@@ -29,7 +30,7 @@
     /**
      * Field document
      */
-    protected OMDocumentImpl document;
+    protected OMDocument document;
 
     /**
      * Constructor StAXOMBuilder
@@ -135,9 +136,9 @@
         }
         return node;
     }
-    
+
     protected void endElement(){
-    	if (lastNode.isComplete()) {
+        if (lastNode.isComplete()) {
             OMElement parent = (OMElement) lastNode.getParent();
             parent.setComplete(true);
             lastNode = parent;
@@ -145,8 +146,8 @@
             OMElement e = (OMElement) lastNode;
             e.setComplete(true);
         }
-    	
-    	//return lastNode;
+
+        //return lastNode;
     }
 
     /**
@@ -173,16 +174,19 @@
                     //We've already assumed that start document has passed!
                     break;
                 case XMLStreamConstants.CHARACTERS:
-                    lastNode = createOMText();
+                    lastNode = createOMText(XMLStreamConstants.CHARACTERS);
+                    break;
+                case XMLStreamConstants.CDATA:
+                    lastNode = createOMText(XMLStreamConstants.CDATA);
                     break;
                 case XMLStreamConstants.END_ELEMENT:
-                	endElement();
+                    endElement();
                     break;
                 case XMLStreamConstants.END_DOCUMENT:
                     done = true;
                     break;
                 case XMLStreamConstants.SPACE:
-                    next();
+                    handleSpace();
                     break;
                 case XMLStreamConstants.COMMENT:
                     createComment();
@@ -200,10 +204,15 @@
         } catch (OMException e) {
             throw e;
         } catch (Exception e) {
+            e.printStackTrace();
             throw new OMException(e);
         }
     }
 
+    private void handleSpace() {
+        //TODO
+    }
+
     /**
      * Method getDocumentElement
      *
@@ -251,7 +260,7 @@
         }
     }
 
-    public OMDocumentImpl getDocument() {
+    public OMDocument getDocument() {
         return document;
     }
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java Sun Aug 28 06:57:00 2005
@@ -201,9 +201,9 @@
         return new OMCommentImpl(parent, content);
     }
 
-	/* (non-Javadoc)
-	 * @see org.apache.axis2.om.OMFactory#createOMDocument()
-	 */
+    /* (non-Javadoc)
+    * @see org.apache.axis2.om.OMFactory#createOMDocument()
+    */
 	public OMDocument createOMDocument() {
 		return new OMDocumentImpl();
 	}

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java Sun Aug 28 06:57:00 2005
@@ -447,7 +447,7 @@
         return soapMessage;
     }
 
-    public OMDocumentImpl getDocument() {
+    public OMDocument getDocument() {
         return (OMDocumentImpl) this.soapMessage;
     }
 

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java Sun Aug 28 06:57:00 2005
@@ -9,6 +9,7 @@
 import javax.xml.stream.XMLStreamReader;
 import java.io.ByteArrayOutputStream;
 import java.io.StringReader;
+import java.util.Iterator;
 
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -29,35 +30,48 @@
  */
 
 public class OMDocumentTest extends TestCase {
-    private String sampleXML = "<?xml version='1.0' encoding='utf-8'?>\n" +
-            "<!--This is some comments at the start of the document-->\n" +
-            "<?PITarget PIData?>\n" +
-            "<Axis2>\n" +
-            "    <ProjectName>The Apache Web Sevices Project</ProjectName>\n" +
+    private String sampleXML = "<?xml version='1.0' encoding='utf-8'?>" +
+            "<!--This is some comments at the start of the document-->" +
+            "<?PITarget PIData?>" +
+            "<Axis2>" +
+            "    <ProjectName>The Apache Web Sevices Project</ProjectName>" +
             "</Axis2>";
 
-     public void testOMDocument() throws XMLStreamException {
-         // read the string in to the builder
-         OMDocument omDocument = getSampleOMDocument(sampleXML);
-
-         // serialise it to a string
-         String outXML = "";
-         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-         OMOutputImpl output = new OMOutputImpl(outStream, false);
-         omDocument.serialize(output);
-         output.flush();
-         outXML = new String(outStream.toByteArray());
-         System.out.println("outXML = " + outXML);
-
-         // again load that to another builder
-         OMDocument secondDocument = getSampleOMDocument(outXML);
-
-         // compare the intial one with the later one
-         assertTrue(secondDocument.getFirstChild() instanceof OMComment);
-         assertTrue(secondDocument.getFirstChild().getNextSibling() instanceof OMProcessingInstruction);
+    public void testOMDocument() throws XMLStreamException {
+        // read the string in to the builder
+        OMDocument omDocument = getSampleOMDocument(sampleXML);
+
+        // serialise it to a string
+        String outXML = "";
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+        OMOutputImpl output = new OMOutputImpl(outStream, false);
+        omDocument.serialize(output);
+        output.flush();
+        outXML = new String(outStream.toByteArray());
+        System.out.println("outXML = " + outXML);
+
+        // again load that to another builder
+        OMDocument secondDocument = getSampleOMDocument(outXML);
+
+        // check for the comment and the PI
+        boolean commentFound = false;
+        boolean piFound = false;
+        Iterator children = secondDocument.getChildren();
+        while (children.hasNext()) {
+            OMNode omNode = (OMNode) children.next();
+            if (omNode instanceof OMComment) {
+                commentFound = true;
+            } else if (omNode instanceof OMProcessingInstruction) {
+                piFound = true;
+            } else if (omNode instanceof OMElement && !commentFound && !piFound) {
+               fail("OMElement should come after Comment and PI");
+
+            }
+        }
+        assertTrue(commentFound && piFound);
 
 
-     }
+    }
 
     private OMDocument getSampleOMDocument(String xml) {
         try {

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java Sun Aug 28 06:57:00 2005
@@ -148,8 +148,7 @@
             assertTrue("SOAP 1.2 :- Header block name space uri mismatch",
                     headerBlock.getNamespace().getName().equals(
                             "http://example.org/ts-tests"));
-            assertTrue("SOAP 1.2 :- Header block text mismatch",
-                    headerBlock.getText().trim().equals("foo"));
+            assertEquals("SOAP 1.2 :- Header block text mismatch",headerBlock.getText().trim(),"foo");
 
             Iterator headerBlockAttributes = headerBlock.getAttributes();
             OMAttribute roleAttribute = (OMAttribute) headerBlockAttributes.next();
@@ -446,8 +445,7 @@
             assertTrue("SOAP 1.1 :- Fault code namespace uri mismatch",
                     code.getNamespace().getName().equals(
                             SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-            assertEquals("SOAP 1.1 :- Fault code value mismatch",
-                    code.getValue().getText().trim(),
+            assertEquals("SOAP 1.1 :- Fault code value mismatch", code.getValue().getText().trim(),
                     "env:Sender");
 
             iteratorInFault.next();

Modified: webservices/axis/trunk/java/xdocs/Axis2ArchitectureGuide.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/xdocs/Axis2ArchitectureGuide.html?rev=263876&r1=263875&r2=263876&view=diff
==============================================================================
--- webservices/axis/trunk/java/xdocs/Axis2ArchitectureGuide.html (original)
+++ webservices/axis/trunk/java/xdocs/Axis2ArchitectureGuide.html Sun Aug 28 06:57:00 2005
@@ -298,7 +298,7 @@
 <p><img border="0" src="images/codegen.gif"></p>
 <h3>Serialization and Dezerialization</h3>
 
-<p>Xml-beans supports StAX API and AXIOM is based on a StAX API. Data binding in Axis2 is achieved through interfacing the AXIOM with the Xml-beans using the StAX API which is supported by both parties. At the time of the code generation there will be supporter classes for each WSDL operation that will have the utility methods that can deserialize the from AXIOM to data bound object and serialize from data bound object to AXIOM. For example if the WSDL has an operation called “echoString”, once the code is generated there will be an echoStringDatabindingSupporter.java class generated that will have methods that will look like the following.</p>
+<p>Xml-beans supports StAX API and AXIOM is based on a StAX API. Data binding in Axis2 is achieved through interfacing the AXIOM with the Xml-beans using the StAX API which is supported by both parties. At the time of the code generation there will be supporter classes for each WSDL operation that will have the utility methods that can deserialize the from AXIOM to data bound object and serialize from data bound object to AXIOM. For example if the WSDL has an operation called "echoString", once the code is generated there will be an echoStringDatabindingSupporter.java class generated that will have methods that will look like the following.</p>
 
 <p>public  static org.apache.axis2.om.OMElement  toOM(org.soapinterop.xsd.EchoStringParamDocument param) : This method will handle the serialization.</p>
 
@@ -370,4 +370,4 @@
 
 
 </body>
-</html>
\ No newline at end of file
+</html>