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 he...@apache.org on 2004/12/03 07:34:53 UTC

svn commit: r109636 - in webservices/axis/trunk/java/dev/scratch/prototype2/src: java/org/apache/axis/impl/llom java/org/apache/axis/impl/llom/builder java/org/apache/axis/impl/llom/factory java/org/apache/axis/impl/llom/traverse java/org/apache/axis/impl/llom/wrapper java/org/apache/axis/om test/org/apache/axis/om test/org/apache/axis/om/builder test/org/apache/axis/om/impl/streamwrapper

Author: hemapani
Date: Thu Dec  2 22:34:52 2004
New Revision: 109636

URL: http://svn.apache.org/viewcvs?view=rev&rev=109636
Log:
made some changes to introduce a factory .getinstance method. and some refactoring has taken place to push the iterator impls to llom.traverse.
Checkin in onbehalf of Ajith
Added:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/traverse/
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/FactoryFinder.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactoryException.java
Removed:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMChildrenIterator.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMChildrenQNameIterator.java
Modified:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/OMStAXBuilder.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/wrapper/OMXPPWrapper.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java	Thu Dec  2 22:34:52 2004
@@ -2,14 +2,9 @@
 
 import java.util.Iterator;
 
-import org.apache.axis.om.OMAttribute;
-import org.apache.axis.om.OMChildrenIterator;
-import org.apache.axis.om.OMChildrenQNameIterator;
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMNamespace;
-import org.apache.axis.om.OMNode;
-import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.*;
+import org.apache.axis.impl.llom.traverse.OMChildrenQNameIterator;
+import org.apache.axis.impl.llom.traverse.OMChildrenIterator;
 import org.apache.xml.utils.QName;
 
 /**

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/OMStAXBuilder.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/OMStAXBuilder.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/OMStAXBuilder.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/OMStAXBuilder.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/OMStAXBuilder.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/OMStAXBuilder.java	Thu Dec  2 22:34:52 2004
@@ -68,7 +68,7 @@
 
     public OMStAXBuilder(XMLStreamReader parser) {
         this.parser = parser;
-        this.ombuilderFactory = new OMLinkedListImplFactory();
+        this.ombuilderFactory = OMFactory.newInstance();
 
     }
 

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java	Thu Dec  2 22:34:52 2004
@@ -58,7 +58,7 @@
         lastNode = startElement;
         startElement.setBuilder(this);
         this.outObject.setContentHandler(this);
-        omFactory = new OMLinkedListImplFactory();
+        omFactory = OMFactory.newInstance();
     }
 
     public OMEnvelope getOMEnvelope() throws OMException {

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java	Thu Dec  2 22:34:52 2004
@@ -45,6 +45,7 @@
  * Time: 2:21:13 PM
  */
 public class OMLinkedListImplFactory extends OMFactory {
+
     public OMAttribute createOMAttribute(String localName, OMNamespace ns, String value, OMElement parent) {
         return new OMAttributeImpl(localName, ns, value, parent);
     }

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java?view=auto&rev=109636
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/traverse/OMChildrenIterator.java	Thu Dec  2 22:34:52 2004
@@ -0,0 +1,83 @@
+package org.apache.axis.impl.llom.traverse;
+
+
+import org.apache.axis.om.OMNode;
+
+import java.util.Iterator;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * <p/>
+ * User: Eran Chinthaka - Lanka Software Foundation
+ * Date: Oct 11, 2004
+ * Time: 11:23:07 AM
+ */
+public class OMChildrenIterator implements Iterator {
+
+    private OMNode currentChild;
+
+    public OMChildrenIterator(OMNode currentChild) {
+        this.currentChild = currentChild;
+    }
+
+    /**
+     * Removes from the underlying collection the last element returned by the
+     * iterator (optional operation).  This method can be called only once per
+     * call to <tt>next</tt>.  The behavior of an iterator is unspecified if
+     * the underlying collection is modified while the iteration is in
+     * progress in any way other than by calling this method.
+     *
+     * @throws UnsupportedOperationException if the <tt>remove</tt>
+     *                                       operation is not supported by this Iterator.
+     * @throws IllegalStateException         if the <tt>next</tt> method has not
+     *                                       yet been called, or the <tt>remove</tt> method has already
+     *                                       been called after the last call to the <tt>next</tt>
+     *                                       method.
+     */
+    public void remove() {
+        OMNode temp = currentChild.getNextSibling();
+        currentChild.detach();
+        currentChild = temp;
+    }
+
+    /**
+     * Returns <tt>true</tt> if the iteration has more elements. (In other
+     * words, returns <tt>true</tt> if <tt>next</tt> would return an element
+     * rather than throwing an exception.)
+     *
+     * @return <tt>true</tt> if the iterator has more elements.
+     */
+    public boolean hasNext() {
+        return (currentChild != null);
+    }
+
+    /**
+     * Returns the next element in the iteration.
+     *
+     * @return the next element in the iteration.
+     * @throws java.util.NoSuchElementException
+     *          iteration has no more elements.
+     */
+    public Object next() {
+
+        if (hasNext()) {
+            OMNode returnNode = currentChild;
+            currentChild = currentChild.getNextSibling();
+            return returnNode;
+        }
+        return null;
+
+    }
+}

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java?view=auto&rev=109636
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/traverse/OMChildrenQNameIterator.java	Thu Dec  2 22:34:52 2004
@@ -0,0 +1,128 @@
+package org.apache.axis.impl.llom.traverse;
+
+import org.apache.axis.impl.llom.OMNamedNodeImpl;
+import org.apache.axis.impl.llom.OMNodeImpl;
+import org.apache.axis.om.OMNode;
+import org.apache.xml.utils.QName;
+
+import java.util.Iterator;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * <p/>
+ * User: Eran Chinthaka - Lanka Software Foundation
+ * Date: Oct 13, 2004
+ * Time: 11:25:29 AM
+ */
+public class OMChildrenQNameIterator implements Iterator {
+
+    private OMNode omNode;
+    private QName givenQName;
+
+    private boolean picked = false;
+
+    public OMChildrenQNameIterator(OMNodeImpl firstChild, QName qName) {
+        this.omNode = firstChild;
+        this.givenQName = qName;
+    }
+
+    /**
+     * Removes from the underlying collection the last element returned by the
+     * iterator (optional operation).  This method can be called only once per
+     * call to <tt>next</tt>.  The behavior of an iterator is unspecified if
+     * the underlying collection is modified while the iteration is in
+     * progress in any way other than by calling this method.
+     *
+     * @throws UnsupportedOperationException if the <tt>remove</tt>
+     *                                       operation is not supported by this Iterator.
+     * @throws IllegalStateException         if the <tt>next</tt> method has not
+     *                                       yet been called, or the <tt>remove</tt> method has already
+     *                                       been called after the last call to the <tt>next</tt>
+     *                                       method.
+     */
+    public void remove() {
+        throw new UnsupportedOperationException(); //TODO implement this
+    }
+
+    /**
+     * Returns <tt>true</tt> if the iteration has more elements. (In other
+     * words, returns <tt>true</tt> if <tt>next</tt> would return an element
+     * rather than throwing an exception.)
+     *
+     * @return <tt>true</tt> if the iterator has more elements.
+     */
+    public boolean hasNext() {
+
+        boolean needToMoveForward = true;
+        boolean isMatchingNodeFound = false;
+
+        while (needToMoveForward) {
+            if (omNode != null) {
+
+                // check the current node for the criteria
+                if ((omNode instanceof OMNamedNodeImpl) && (isQNamesMatch(((OMNamedNodeImpl) omNode).getQName(), this.givenQName))) {
+                    isMatchingNodeFound = true;
+                    needToMoveForward = false;
+                } else {
+                    // get the next named node
+                    omNode = omNode.getNextSibling();
+                    isMatchingNodeFound = needToMoveForward = !(omNode == null);
+                }
+            } else {
+                needToMoveForward = false;
+            }
+        }
+        return isMatchingNodeFound;
+    }
+
+    /**
+     * Returns the next element in the iteration.
+     *
+     * @return the next element in the iteration.
+     * @throws java.util.NoSuchElementException
+     *          iteration has no more elements.
+     */
+    public Object next() {
+        OMNode tempNode = omNode;
+        omNode = omNode.getNextSibling();
+        return tempNode;
+    }
+
+     /**
+     *    Here I can not use the overriden equals method of QName, as one might want to get
+     * some element just by giving the localname, even though a matching element has a namespace uri as well.
+     * This will not be supported in the equals method of the QName
+     * @param elementQName
+     * @param qNameToBeMatched
+     * @return
+     */
+    private boolean isQNamesMatch(QName elementQName, QName qNameToBeMatched){
+
+         // if no QName was given, that means one needs all
+         if(qNameToBeMatched == null){
+             return true;
+         }
+
+        // if the given localname is null, whatever value this.qname has, its a match
+        boolean localNameMatch = qNameToBeMatched.getLocalName() == null || qNameToBeMatched.getLocalName() == "" || (elementQName != null && elementQName.getLocalName().equalsIgnoreCase(qNameToBeMatched.getLocalName()));
+        boolean namespaceURIMatch = qNameToBeMatched.getNamespaceURI() == null || qNameToBeMatched.getNamespaceURI() == "" ||  (elementQName != null && elementQName.getNamespaceURI().equalsIgnoreCase(qNameToBeMatched.getNamespaceURI()));
+
+        return localNameMatch && namespaceURIMatch;
+
+
+    }
+
+
+}

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/wrapper/OMXPPWrapper.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/wrapper/OMXPPWrapper.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/wrapper/OMXPPWrapper.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/wrapper/OMXPPWrapper.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/wrapper/OMXPPWrapper.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/wrapper/OMXPPWrapper.java	Thu Dec  2 22:34:52 2004
@@ -61,7 +61,7 @@
 
     public OMXPPWrapper(XmlPullParser parser) {
         this.parser = parser;
-        ombuilderFactory = new OMLinkedListImplFactory();
+        ombuilderFactory = OMFactory.newInstance();
 
     }
 

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/FactoryFinder.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/FactoryFinder.java?view=auto&rev=109636
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/FactoryFinder.java	Thu Dec  2 22:34:52 2004
@@ -0,0 +1,53 @@
+package org.apache.axis.om;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @author Axis team
+ * Date: Dec 3, 2004
+ * Time: 10:16:43 AM
+ *
+ * This is the static factory finder. It searches for the relevant class
+ * Note - It has only package access!!!
+ */
+class FactoryFinder {
+
+    private static final String defaultClassName = "org.apache.axis.impl.llom.factory.OMLinkedListImplFactory";
+
+    /**
+     * This needs to be improved. Currently the factory is loaded only from the default implementation
+     * However provisions should be made to load a custom factory depending on the users setting
+     * Say an environment variable
+     * @param loader
+     * @return
+     */
+    public static OMFactory findFactory(ClassLoader loader) throws OMFactoryException {
+        Object factory = null;
+
+        try {
+            if (loader == null) {
+                factory = Class.forName(defaultClassName).newInstance();
+            } else {
+                factory = loader.loadClass(defaultClassName).newInstance();
+            }
+
+        } catch (Exception e) {
+            throw new OMFactoryException(e);
+        }
+
+         return (OMFactory)factory;
+
+    }
+}

Deleted: /webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMChildrenIterator.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMChildrenIterator.java?view=auto&rev=109635
==============================================================================

Deleted: /webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMChildrenQNameIterator.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMChildrenQNameIterator.java?view=auto&rev=109635
==============================================================================

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.java	Thu Dec  2 22:34:52 2004
@@ -24,7 +24,7 @@
  */
 public abstract class OMFactory {
 
-    // -----------------------------   OM Attribute -----------------------------------------------------------------
+
     /**
      * @param localName
      * @param ns
@@ -42,9 +42,8 @@
      */
     public abstract OMAttribute createOMAttribute(String localName, OMNamespace ns, String value);
 
-    // --------------------------------------------------------------------------------------------------------------
 
-    // -----------------------------   OM Element -----------------------------------------------------------------
+
     /**
      * @param parent
      * @return
@@ -67,9 +66,6 @@
      */
     public abstract OMElement createOMElement(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder);
 
-    // --------------------------------------------------------------------------------------------------------------
-
-    // -----------------------------   OM NamedNode -----------------------------------------------------------------
 
     /**
      * @param localName
@@ -85,17 +81,12 @@
      */
     public abstract OMNamedNode createOMNamedNode(OMElement parent);
 
-    // --------------------------------------------------------------------------------------------------------------
-    // -----------------------------   OM Namespace -----------------------------------------------------------------
     public abstract OMNamespace createOMNamespace(String uri, String prefix);
 
-    // --------------------------------------------------------------------------------------------------------------
-    // -----------------------------   OM Node -----------------------------------------------------------------
+
 
     public abstract OMNode createOMNode(OMElement parent);
 
-    // --------------------------------------------------------------------------------------------------------------
-    // -----------------------------   OM TextNode -----------------------------------------------------------------
     /**
      * @param parent
      * @param text
@@ -109,8 +100,6 @@
      */
     public abstract OMText createText(String s);
 
-    // --------------------------------------------------------------------------------------------------------------
-    // -----------------------------   OM TextNode -----------------------------------------------------------------
 
     /**
      * @param localName
@@ -128,8 +117,6 @@
      */
     public abstract OMBodyBlock createOMBodyBlock(String localName, OMNamespace ns);
 
-    // --------------------------------------------------------------------------------------------------------------
-    // -----------------------------   OM OMBody -----------------------------------------------------------------
     /**
      * @param envelope
      * @return
@@ -145,8 +132,6 @@
      */
     public abstract OMBody createOMBody(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder);
 
-    // --------------------------------------------------------------------------------------------------------------
-    // -----------------------------   OM OMEnvelope -----------------------------------------------------------------
 
     /**
      * @param localName
@@ -163,8 +148,6 @@
      */
     public abstract OMEnvelope createOMEnvelope(String localName, OMNamespace ns);
 
-    // --------------------------------------------------------------------------------------------------------------
-    // -----------------------------   OM OMHeader -----------------------------------------------------------------
     /**
      * @param envelope
      */
@@ -180,8 +163,6 @@
     public abstract OMHeader createHeader(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder);
 
 
-    // --------------------------------------------------------------------------------------------------------------
-    // -----------------------------   OM OMHeaderBlock -----------------------------------------------------------------
     /**
      * @param localName
      * @param ns
@@ -197,5 +178,13 @@
      */
     public abstract OMHeaderBlock createOMHeaderBlock(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper builder);
 
+
+    //make the constructor protected
+    protected OMFactory() {
+    }
+
+    public static OMFactory newInstance(){
+        return FactoryFinder.findFactory(null);
+    }
 
 }

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactoryException.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactoryException.java?view=auto&rev=109636
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactoryException.java	Thu Dec  2 22:34:52 2004
@@ -0,0 +1,40 @@
+package org.apache.axis.om;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @author Axis team
+ * Date: Dec 3, 2004
+ * Time: 10:30:05 AM
+ *
+ * Exception thrown when the factory returns an error
+ */
+public class OMFactoryException extends OMException{
+
+    public OMFactoryException() {
+    }
+
+    public OMFactoryException(String message) {
+        super(message);
+    }
+
+    public OMFactoryException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public OMFactoryException(Throwable cause) {
+        super(cause);
+    }
+}

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java	Thu Dec  2 22:34:52 2004
@@ -50,7 +50,7 @@
     protected void setUp() throws Exception {
         XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
                 createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage1.xml")));
-        OMFactory factory = new OMLinkedListImplFactory();
+        OMFactory factory = OMFactory.newInstance();
         builder = new OMStAXBuilder(factory, xmlStreamReader);
         envelope = builder.getOMEnvelope();
         serilizer = new SimpleOMSerializer();

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java	Thu Dec  2 22:34:52 2004
@@ -42,7 +42,7 @@
     public static OMXMLParserWrapper getOMBuilder(File file) throws Exception {
 
         XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(file));
-        OMStAXBuilder builder =   new OMStAXBuilder(new OMLinkedListImplFactory(),parser);
+        OMStAXBuilder builder =   new OMStAXBuilder(OMFactory.newInstance(),parser);
 
         return builder;
     }
@@ -57,7 +57,7 @@
         while(it.hasNext()){
             OMNode ele = (OMNode)it.next();
             TestCase.assertNotNull("once the has next is not null, the " +
-                "eleemnt should not be null",ele);
+                "element should not be null",ele);
             
             if(ele instanceof OMElement){
                 walkThrough((OMElement)ele);

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java	Thu Dec  2 22:34:52 2004
@@ -41,7 +41,7 @@
     protected void setUp() throws Exception {
         super.setUp();
         outObject = new DummyOutObject();
-        omFactory = new OMLinkedListImplFactory();
+        omFactory = OMFactory.newInstance();
 
         element = omFactory.createOMElement("Body", null);
         objectToOMBuilder = new ObjectToOMBuilder(element, outObject);

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java	Thu Dec  2 22:34:52 2004
@@ -51,7 +51,7 @@
     protected void setUp() throws Exception {
         XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
                 createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage1.xml")));
-        OMFactory factory = new OMLinkedListImplFactory();
+        OMFactory factory = OMFactory.newInstance();
         omStAXBuilder = new OMStAXBuilder(factory, xmlStreamReader);
         envelope = omStAXBuilder.getOMEnvelope();
         serilizer = new SimpleOMSerializer();

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java?view=diff&rev=109636&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java&r1=109635&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java&r2=109636
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java	Thu Dec  2 22:34:52 2004
@@ -46,7 +46,7 @@
     }
 
     protected void setUp() throws Exception {
-        factory = new OMLinkedListImplFactory();
+        factory = OMFactory.newInstance();
         XMLStreamReader reader = XMLInputFactory.newInstance().
                 createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage1.xml")));
         builder = new OMStAXBuilder(factory,reader);