You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/12/03 23:14:23 UTC

svn commit: r348105 - in /webservices/axis2/trunk/java: etc/ modules/codegen/src/org/apache/axis2/databinding/utils/ modules/codegen/test/org/apache/axis2/databinding/utils/ modules/core/src/org/apache/axis2/ modules/core/src/org/apache/axis2/context/ ...

Author: chinthaka
Date: Mon Nov 21 22:12:40 2005
New Revision: 348105

URL: http://svn.apache.org/viewcvs?rev=348105&view=rev
Log:
- Adding some constants to support the HTTP case
- Adding more features to support Ruchith's request for ADBPullParser. Now user can give QName, String pair as a child for an element. Added a test method for that too.
- added a way to get and set the schema from/to a message reference.

Removed:
    webservices/axis2/trunk/java/etc/maven.xml
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/utils/ADBPullParserTest.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/MessageReference.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/MessageReferenceImpl.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java?rev=348105&r1=348104&r2=348105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java Mon Nov 21 22:12:40 2005
@@ -154,7 +154,7 @@
                         This is the how the passed array should look like
      *                           Key             Value
      *                         String          String
-     *                         QName           ADBBean, OMElement, Bean
+     *                         QName           ADBBean, OMElement, Bean, String
                                String          String[]
                                QName           Object[] - this contains only one type of objects
      *                   <p/>
@@ -226,7 +226,7 @@
             if (complexStringArray.length > ++secondArrayIndex) {
                 // we have some more to process
                 processingADBNameValuePair = true;
-                return processADBNameValuePair(complexStringArrayName, complexStringArray[secondArrayIndex]);
+                return processADBNameValuePair(new QName(complexStringArrayName), complexStringArray[secondArrayIndex]);
             } else {
                 // completed looking at all the entries. Now go forward with normal entries, if any.
                 processingComplexADBNameValuePair = false;
@@ -269,7 +269,10 @@
                     complexArrayQName = (QName) o;
                     getPullParser(complexArray[secondArrayIndex], complexArrayQName);
                     processingComplexArray = true;
-                } else {
+                } else if(object instanceof String) {
+                    processingADBNameValuePair = true;
+                    return processADBNameValuePair((QName)o, (String) object);
+                }else {
                     getPullParser(object, (QName) o);
                 }
                 accessingChildPullParser = true;
@@ -289,7 +292,7 @@
 
                     // use the simple name value pair processing recursively
                     processingADBNameValuePair = true;
-                    return processADBNameValuePair(simplePropertyName, complexStringArray[secondArrayIndex]);
+                    return processADBNameValuePair(new QName(simplePropertyName), complexStringArray[secondArrayIndex]);
 
                 } else if (property instanceof String) {
                     String simplePropertyValue = (String) properties[currentIndex];
@@ -298,7 +301,7 @@
                         processingElementText = true;
                     }
                     processingADBNameValuePair = true;
-                    return processADBNameValuePair(simplePropertyName, simplePropertyValue);
+                    return processADBNameValuePair(new QName(simplePropertyName), simplePropertyValue);
                 }
                 throw new XMLStreamException("Only String and String[] are accepted as the values when the key is a String");
             } else {
@@ -672,7 +675,7 @@
 // Utill methods inside this class
 // =============================================================================
 
-    private int processADBNameValuePair(String simplePropertyName, String simplePropertyValue) {
+    private int processADBNameValuePair(QName simplePropertyName, String simplePropertyValue) {
         int event = 0;
         if(processingElementText){
             this.parserInformation.setText(simplePropertyValue);
@@ -681,7 +684,7 @@
         } else if (!nameValuePairStartElementProcessed) {
             event = XMLStreamConstants.START_ELEMENT;
             tempParserInfo = parserInformation;
-            parserInformation = new ParserInformation(new QName(simplePropertyName), simplePropertyValue);
+            parserInformation = new ParserInformation(simplePropertyName, simplePropertyValue);
             nameValuePairStartElementProcessed = true;
             finishedProcessingNameValuePair = false;
         } else if (nameValuePairStartElementProcessed && !nameValuePairTextProcessed) {

Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/utils/ADBPullParserTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/utils/ADBPullParserTest.java?rev=348105&r1=348104&r2=348105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/utils/ADBPullParserTest.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/utils/ADBPullParserTest.java Mon Nov 21 22:12:40 2005
@@ -512,6 +512,7 @@
 
         XMLStreamReader pullParser = ADBPullParser.createPullParser(new QName("http://testComplexStringArrayScenario.org", "TestComplexStringArrayScenario", "ns1"), propertyList.toArray(), null);
         String actualXML = getStringXML(pullParser);
+        System.out.println("actualXML = " + actualXML);
 
         try {
             assertXMLEqual(newDocument(expectedXML), newDocument(actualXML));
@@ -531,6 +532,30 @@
         try {
             ArrayList properties = new ArrayList();
             properties.add(ADBPullParser.ELEMENT_TEXT);
+            properties.add("This is some Text for the element");
+
+            XMLStreamReader pullParser = ADBPullParser.createPullParser(new QName("http://testElementText.org", "testElementText", "ns1"), properties.toArray(), null);
+
+            String actualXML = getStringXML(pullParser);
+
+            assertXMLEqual(newDocument(expectedXML), newDocument(actualXML));
+        } catch (ParserConfigurationException e) {
+            fail("Error has occurred " + e);
+        } catch (SAXException e) {
+            fail("Error has occurred " + e);
+        } catch (IOException e) {
+            fail("Error has occurred " + e);
+        }
+    }
+
+    public void testQualifiedElement() {
+
+        String expectedXML = "<ns1:testElementText xmlns:ns1=\"http://testElementText.org\">" +
+                "<ns2:QualifiedElement xmlns:ns2=\"http://testQElementText.org\">" +
+                "This is some Text for the element</ns2:QualifiedElement></ns1:testElementText>";
+        try {
+            ArrayList properties = new ArrayList();
+            properties.add(new QName("http://testQElementText.org", "QualifiedElement", "ns2"));
             properties.add("This is some Text for the element");
 
             XMLStreamReader pullParser = ADBPullParser.createPullParser(new QName("http://testElementText.org", "testElementText", "ns1"), properties.toArray(), null);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java?rev=348105&r1=348104&r2=348105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java Mon Nov 21 22:12:40 2005
@@ -192,6 +192,11 @@
         public static final String CACHE_ATTACHMENTS = "cacheAttachments";
         public static final String FILE_SIZE_THRESHOLD = "sizeThreshold";
 
+        public static final String HTTP_METHOD_GET = "GET";
+        public static final String HTTP_METHOD = "HTTP_METHOD";
+        public static final String HTTP_METHOD_POST = "POST";
+        public static final String CONTENT_TYPE = "ContentType";
+
         // we need to some times send the message as multipart/related, even if there is no MTOM stuff in the envelope.
         public static final String FORCE_MIME = "ForceMimeBoundary";
     }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java?rev=348105&r1=348104&r2=348105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java Mon Nov 21 22:12:40 2005
@@ -618,8 +618,8 @@
 
 
     /**
-     * To retrive configuration descriptor parameters , it is posible to get paramater specify at
-     * any levle via this method , and the preferance is as follows,
+     * To retrieve configuration descriptor parameters , it is posible to get paramaters specified in
+     * any level via this method , and the preference is as follows,
      * 1. Search in operation description if its there
      * 2. if the paramter not found or operationContext is null will search in
      * AxisService

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/MessageReference.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/MessageReference.java?rev=348105&r1=348104&r2=348105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/MessageReference.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/MessageReference.java Mon Nov 21 22:12:40 2005
@@ -16,7 +16,7 @@
 
 package org.apache.wsdl;
 
-import org.w3c.dom.Element;
+import org.apache.ws.commons.schema.XmlSchemaElement;
 
 import javax.xml.namespace.QName;
 
@@ -63,6 +63,6 @@
      */
     public void setMessageLabel(String messageLabel);
 
-    public Element getElementSchema();
-    public void setElementSchema(Element element);
+    public XmlSchemaElement getElementSchema();
+    public void setElementSchema(XmlSchemaElement element);
 }

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/MessageReferenceImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/MessageReferenceImpl.java?rev=348105&r1=348104&r2=348105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/MessageReferenceImpl.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/MessageReferenceImpl.java Mon Nov 21 22:12:40 2005
@@ -16,8 +16,8 @@
 
 package org.apache.wsdl.impl;
 
+import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.wsdl.MessageReference;
-import org.w3c.dom.Element;
 
 import javax.xml.namespace.QName;
 
@@ -44,7 +44,7 @@
      * Field elementQName
      */
     private QName elementQName;
-    private Element elementSchema;
+    private XmlSchemaElement elementSchema;
 
     /**
      * Method getDirection
@@ -102,11 +102,11 @@
         this.messageLabel = messageLabel;
     }
 
-    public Element getElementSchema() {
+    public XmlSchemaElement getElementSchema() {
         return elementSchema;
     }
 
-    public void setElementSchema(Element element) {
+    public void setElementSchema(XmlSchemaElement element) {
         this.elementSchema = element;
     }
 }