axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r359748 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/description/ integration/test/org/apache/axis2/engine/util/profiling/ saaj/src/org/apache/axis2/om/impl/dom/factory/ xml/src/org/apache/axis2/om/ xml/src/org/apac...
Date Thu, 29 Dec 2005 07:12:04 GMT
Author: chinthaka
Date: Wed Dec 28 23:11:30 2005
New Revision: 359748

URL: http://svn.apache.org/viewcvs?rev=359748&view=rev
Log:
- removing unnecessary call to OMText to set the type. Now this will be passed thru the constructor
itself.
- adding namespace table in to factory. Now there won't be two namespace objects with the
same URI and prefix.

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=359748&r1=359747&r2=359748&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
Wed Dec 28 23:11:30 2005
@@ -42,7 +42,11 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Writer;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
 
 /**
  * Class AxisService
@@ -350,7 +354,7 @@
             WSDLDescription desc = axisService2WOM.generateWOM();
             
             // populate it with policy information ..
-            //PolicyUtil.populatePolicy(desc, this);
+            PolicyUtil.populatePolicy(desc, this);
             
             WOMWriter womWriter = WOMWriterFactory.createWriter(org.apache.wsdl.WSDLConstants.WSDL_1_1);
             womWriter.setdefaultWSDLPrefix("wsdl");

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java?rev=359748&r1=359747&r2=359748&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/profiling/ContextMemoryHandlingUtil.java
Wed Dec 28 23:11:30 2005
@@ -1,6 +1,11 @@
 package org.apache.axis2.engine.util.profiling;
 
-import org.apache.axis2.engine.EchoRawXMLTest;
+import org.apache.axis2.Constants;
+import org.apache.axis2.client.Call;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.engine.util.TestConstants;
+import org.apache.axis2.integration.TestingUtils;
+import org.apache.axis2.om.OMElement;
 
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -18,23 +23,34 @@
  * limitations under the License.
  */
 
-public class ContextMemoryHandlingUtil extends EchoRawXMLTest {
+public class ContextMemoryHandlingUtil implements TestConstants {
 
-    public ContextMemoryHandlingUtil() {
-    }
+//    public static final EndpointReference targetEPR = new EndpointReference(
+//            "http://192.168.1.219:" + 8080
+//                    + "/axis2/services/echo/echoOMElement");
+//
+//    public static final QName serviceName = new QName("echo");
+//    public static final QName operationName = new QName("echoOMElement");
 
-    public void startup() throws Exception {
-        super.setUp();
+    public ContextMemoryHandlingUtil() {
     }
 
     public void runOnce() throws Exception {
-        super.testEchoXMLSync();
-    }
-
-    public void shutdown() throws Exception {
-        super.tearDown();
+        OMElement payload = TestingUtils.createDummyOMElement();
 
+        Call call =
+                new Call("target/test-resources/integrationRepo");
 
+        Options options = new Options();
+        call.setClientOptions(options);
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+        OMElement result =
+                call.invokeBlocking(operationName.getLocalPart(),
+                        payload);
+        TestingUtils.campareWithCreatedOMElement(result);
+        call.close();
     }
 
     public static void main(String[] args) throws Exception {
@@ -46,15 +62,12 @@
             int numberOfTimes = 0;
 
             while (true) {
-
                 System.out.println("Iterations # = " + ++numberOfTimes);
                 contextMemoryHandlingTest.runOnce();
                 System.out.println("Memory Usage = " + (initialMemory - Runtime.getRuntime().freeMemory()));
-
             }
         } catch (Exception e) {
             e.printStackTrace();
-            contextMemoryHandlingTest.shutdown();
             System.exit(-1);
         }
     }

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java?rev=359748&r1=359747&r2=359748&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java
Wed Dec 28 23:11:30 2005
@@ -15,27 +15,9 @@
  */
 package org.apache.axis2.om.impl.dom.factory;
 
-import org.apache.axis2.om.OMAttribute;
-import org.apache.axis2.om.OMComment;
-import org.apache.axis2.om.OMContainer;
-import org.apache.axis2.om.OMDocType;
-import org.apache.axis2.om.OMDocument;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMException;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMProcessingInstruction;
-import org.apache.axis2.om.OMText;
-import org.apache.axis2.om.OMXMLParserWrapper;
-import org.apache.axis2.om.impl.dom.AttrImpl;
-import org.apache.axis2.om.impl.dom.CommentImpl;
-import org.apache.axis2.om.impl.dom.DocumentFragmentimpl;
-import org.apache.axis2.om.impl.dom.DocumentImpl;
-import org.apache.axis2.om.impl.dom.ElementImpl;
-import org.apache.axis2.om.impl.dom.NamespaceImpl;
-import org.apache.axis2.om.impl.dom.OMDOMException;
-import org.apache.axis2.om.impl.dom.ParentNode;
-import org.apache.axis2.om.impl.dom.TextImpl;
+import org.apache.axis2.om.*;
+import org.apache.axis2.om.impl.OMNodeEx;
+import org.apache.axis2.om.impl.dom.*;
 import org.w3c.dom.Node;
 
 import javax.xml.namespace.QName;
@@ -165,14 +147,20 @@
 			return txt;
 	}
 
-	/**
-	 * Create a OMDOM Text node carrying the given value
-	 * 
-	 * @see org.apache.axis2.om.OMFactory#createText(java.lang.String)
-	 */
-	public OMText createText(String s) {
-		return new TextImpl(s);
-	}
+    public OMText createText(OMElement parent, String text, int type) {
+        OMText textNode = createText(parent, text);
+        ((OMNodeEx) textNode).setType(type);
+        return textNode;
+    }
+
+    /**
+     * Create a OMDOM Text node carrying the given value
+     *
+     * @see org.apache.axis2.om.OMFactory#createText(java.lang.String)
+     */
+    public OMText createText(String s) {
+        return new TextImpl(s);
+    }
 
 	/**
 	 * Create a Character node of the given type

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java?rev=359748&r1=359747&r2=359748&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java Wed Dec
28 23:11:30 2005
@@ -90,6 +90,16 @@
     public OMText createText(OMElement parent, String text);
 
     /**
+     *
+     * @param parent
+     * @param text
+     * @param type - this should be either of XMLStreamConstants.CHARACTERS, XMLStreamConstants.CDATA,
+     * XMLStreamConstants.SPACE, XMLStreamConstants.ENTITY_REFERENCE
+     * @return
+     */
+    public OMText createText(OMElement parent, String text, int type);
+
+    /**
      * @param s
      * @return
      */

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java?rev=359748&r1=359747&r2=359748&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java Wed Dec 28
23:11:30 2005
@@ -123,6 +123,9 @@
      * <p>Removes a node from its parent.  Partially complete nodes will be completed
before
      * they are detached from the model.  A node cannot be detached until its next sibling
      * has been identified, so that the next sibling and parent can be updated appropriately.
+     * Please note that this will not handle the namespaces. For example, if there you have
used a
+     * namespace within the detaching node and which is defined outside the detaching node,
user has
+     * to handle it manually.
      * </p>
      *
      * @throws OMException If a node is not complete, the detach can trigger further

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java?rev=359748&r1=359747&r2=359748&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
Wed Dec 28 23:11:30 2005
@@ -29,11 +29,10 @@
 import org.apache.axis2.util.Base64;
 import org.apache.axis2.util.UUIDGenerator;
 
-import java.io.IOException;
-import java.io.InputStream;
-
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
+import java.io.IOException;
+import java.io.InputStream;
 
 public class OMTextImpl extends OMNodeImpl implements OMText, OMConstants {
     protected String value = null;
@@ -104,6 +103,13 @@
         this.value = text;
         done = true;
         this.nodeType = TEXT_NODE;
+    }
+
+    public OMTextImpl(OMElement parent, String text, int nodeType) {
+        super(parent);
+        this.value = text;
+        done = true;
+        this.nodeType = nodeType;
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java?rev=359748&r1=359747&r2=359748&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
Wed Dec 28 23:11:30 2005
@@ -16,20 +16,12 @@
 
 package org.apache.axis2.om.impl.llom.builder;
 
+import org.apache.axis2.om.*;
+import org.apache.axis2.om.impl.OMNodeEx;
+
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMConstants;
-import org.apache.axis2.om.OMDocument;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMException;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMNode;
-import org.apache.axis2.om.OMXMLParserWrapper;
-import org.apache.axis2.om.impl.OMNodeEx;
-
 /**
  * OM should be able to built from any data source. And the model it builds may be a SOAP
specific one
  * or just an XML model. This class will give some common functionality of OM Building from
StAX.
@@ -149,11 +141,9 @@
         if (lastNode == null) {
             return null;
         } else if (!lastNode.isComplete()) {
-            node = omfactory.createText((OMElement) lastNode, parser.getText());
-            ((OMNodeEx)node).setType(textType);
+            node = omfactory.createText((OMElement) lastNode, parser.getText(), textType);
         } else if (!(lastNode.getParent() instanceof OMDocument)) {
-            node = omfactory.createText((OMElement)lastNode.getParent(), parser.getText());
-            ((OMNodeEx)node).setType(textType);
+            node = omfactory.createText((OMElement)lastNode.getParent(), parser.getText(),
textType);
         }
         return node;
     }

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java?rev=359748&r1=359747&r2=359748&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
Wed Dec 28 23:11:30 2005
@@ -26,7 +26,6 @@
 import org.apache.axis2.om.OMText;
 import org.apache.axis2.om.impl.OMContainerEx;
 import org.apache.axis2.om.impl.OMNodeEx;
-import org.apache.axis2.om.impl.llom.OMDocumentImpl;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamConstants;

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=359748&r1=359747&r2=359748&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
Wed Dec 28 23:11:30 2005
@@ -27,15 +27,20 @@
 import org.apache.axis2.om.impl.llom.OMTextImpl;
 
 import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Class OMLinkedListImplFactory
  */
 public class OMLinkedListImplFactory implements OMFactory {
+
+    private static final String uriAndPrefixSeparator = ";";
     /**
-     * Field MAX_TO_POOL
+     * This is a map of namespaces with the namespace URI as the key and
+     * Namespace object itself as the value
      */
-    public static final int MAX_TO_POOL = 100;
+    protected Map namespaceTable = new HashMap(5);
 
     /**
      * Method createOMElement
@@ -104,7 +109,13 @@
      * @return namespace
      */
     public OMNamespace createOMNamespace(String uri, String prefix) {
-        return new OMNamespaceImpl(uri, prefix);
+        String key = uri + uriAndPrefixSeparator + prefix;
+        OMNamespace existingNamespaceObject = (OMNamespace) namespaceTable.get(key);
+        if (existingNamespaceObject == null) {
+            existingNamespaceObject = new OMNamespaceImpl(uri, prefix);
+            namespaceTable.put(key, existingNamespaceObject);
+        }
+        return existingNamespaceObject;
     }
 
     /**
@@ -118,6 +129,10 @@
         return new OMTextImpl(parent, text);
     }
 
+    public OMText createText(OMElement parent, String text, int type) {
+        return new OMTextImpl(parent, text, type);
+    }
+
     /**
      * Method createText
      *
@@ -134,6 +149,7 @@
 
     /**
      * create Text
+     *
      * @param s
      * @param mimeType
      * @param optimize
@@ -145,6 +161,7 @@
 
     /**
      * create text
+     *
      * @param dataHandler
      * @param optimize
      * @return text
@@ -152,14 +169,15 @@
     public OMText createText(Object dataHandler, boolean optimize) {
         return new OMTextImpl(dataHandler, optimize);
     }
-    
+
     public OMText createText(String contentID, OMElement parent,
-            OMXMLParserWrapper builder) {
-    	return new OMTextImpl(contentID, parent,builder);
+                             OMXMLParserWrapper builder) {
+        return new OMTextImpl(contentID, parent, builder);
     }
 
     /**
      * create text
+     *
      * @param parent
      * @param s
      * @param mimeType
@@ -175,6 +193,7 @@
 
     /**
      * create attribute
+     *
      * @param localName
      * @param ns
      * @param value
@@ -188,6 +207,7 @@
 
     /**
      * create DocType/DTD
+     *
      * @param parent
      * @param content
      * @return doctype
@@ -198,6 +218,7 @@
 
     /**
      * create a PI
+     *
      * @param parent
      * @param piTarget
      * @param piData
@@ -209,6 +230,7 @@
 
     /**
      * create a comment
+     *
      * @param parent
      * @param content
      * @return comment
@@ -220,14 +242,14 @@
     /* (non-Javadoc)
     * @see org.apache.axis2.om.OMFactory#createOMDocument()
     */
-	public OMDocument createOMDocument() {
-		return new OMDocumentImpl();
-	}
-
-	/* (non-Javadoc)
-	 * @see org.apache.axis2.om.OMFactory#createOMDocument(org.apache.axis2.om.OMXMLParserWrapper)
-	 */
-	public OMDocument createOMDocument(OMXMLParserWrapper builder) {
-		return new OMDocumentImpl(builder);
-	}
+    public OMDocument createOMDocument() {
+        return new OMDocumentImpl();
+    }
+
+    /* (non-Javadoc)
+      * @see org.apache.axis2.om.OMFactory#createOMDocument(org.apache.axis2.om.OMXMLParserWrapper)
+      */
+    public OMDocument createOMDocument(OMXMLParserWrapper builder) {
+        return new OMDocumentImpl(builder);
+    }
 }



Mime
View raw message