axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r123078 - in webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis: impl/llom impl/llom/builder impl/llom/factory om
Date Wed, 22 Dec 2004 09:24:54 GMT
Author: chinthaka
Date: Wed Dec 22 01:24:49 2004
New Revision: 123078

URL: http://svn.apache.org/viewcvs?view=rev&rev=123078
Log:
Fixed more bugs and added some tests for them to be tested
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/OMNodeImpl.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/builder/StAXBuilder.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/om/OMElement.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.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=123078&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java&r1=123077&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java&r2=123078
==============================================================================
--- 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
Wed Dec 22 01:24:49 2004
@@ -42,13 +42,29 @@
 
 
     public OMElementImpl(String localName, OMNamespace ns) {
-        super(localName, ns, null);
+        super(localName, null, null);
+        if (ns != null) {
+            setNamespace(handleNamespace(ns));
+        }
         done = true;
     }
 
+    private OMNamespace handleNamespace(OMNamespace ns) {
+
+        OMNamespace namespace = findInScopeNamespace(ns.getName(), ns.getPrefix());
+        if (namespace == null) {
+            namespace = declareNamespace(ns);
+        }
+
+        return namespace;
+    }
+
 
     public OMElementImpl(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper
builder) {
-        super(localName, ns, parent);
+        super(localName, null, parent);
+        if (ns != null) {
+            setNamespace(handleNamespace(ns));
+        }
         this.builder = builder;
     }
 
@@ -215,17 +231,17 @@
             // no namespace declared in this element.
             // return a null iterator
             // have to look in to this later
-            return new Iterator(){
+            return new Iterator() {
                 public void remove() {
                     throw new UnsupportedOperationException();
                 }
 
-                public boolean hasNext(){
+                public boolean hasNext() {
                     return false;
                 }
 
                 public Object next() {
-                    throw new UnsupportedOperationException(); 
+                    throw new UnsupportedOperationException();
                 }
             };
         }
@@ -278,17 +294,32 @@
      *
      * @param attr
      */
-    public void insertAttribute(OMAttribute attr) {
+    public OMAttribute insertAttribute(OMAttribute attr) {
         if (attributes == null) {
             attributes = new ArrayList(5);
         }
         attributes.add(attr);
+
+        return attr;
     }
 
     public void removeAttribute(OMAttribute attr) {
         if (attributes.indexOf(attr) != -1) {
             attributes.remove(attr);
         }
+    }
+
+    public OMAttribute insertAttribute(String attributeName, String value, OMNamespace ns)
{
+        OMNamespace namespace = null;
+        if (ns != null) {
+            namespace = findInScopeNamespace(ns.getName(), ns.getPrefix());
+            if (namespace == null) {
+                throw new OMException("Given OMNamespace(" + ns.getName() + ns.getPrefix()
+ ") for " +
+                        "this attribute is not declared in the scope of this element. First
declare the namespace" +
+                        " and then use it with the attribute");
+            }
+        }
+        return insertAttribute(new OMAttributeImpl(localName, ns, value));
     }
 
     public void setBuilder(OMXMLParserWrapper wrapper) {

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java?view=diff&rev=123078&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java&r1=123077&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java&r2=123078
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java
Wed Dec 22 01:24:49 2004
@@ -40,8 +40,9 @@
 
 
     public OMNodeImpl(OMElement parent) {
-        if (parent instanceof OMNodeImpl)
+        if (parent instanceof OMElementImpl){
             this.parent = (OMElementImpl) parent;
+        }
     }
 
     /**

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=123078&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java&r1=123077&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java&r2=123078
==============================================================================
--- 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
Wed Dec 22 01:24:49 2004
@@ -227,7 +227,7 @@
             //todo this needs to be fixed!!!!!
             // throw new OMException("All elements must be namespace qualified!");
 
-                element.insertAttribute(omFactory.createOMAttribute(atts.getLocalName(i),
ns, atts.getValue(i)));
+                element.insertAttribute(atts.getLocalName(i), atts.getValue(i), ns);
         }
 
         element.setComplete(false);

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java?view=diff&rev=123078&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java&r1=123077&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java&r2=123078
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/StAXBuilder.java
Wed Dec 22 01:24:49 2004
@@ -71,9 +71,7 @@
             //todo if the attributes are supposed to namespace qualified all the time
             //todo then this should throw an exception here
 
-            node.insertAttribute(ombuilderFactory.createOMAttribute(parser.getAttributeLocalName(i),
-                    ns,
-                    parser.getAttributeValue(i)));
+            node.insertAttribute(parser.getAttributeLocalName(i),parser.getAttributeValue(i),
ns);
         }
     }
 

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=123078&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java&r1=123077&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java&r2=123078
==============================================================================
--- 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
Wed Dec 22 01:24:49 2004
@@ -22,10 +22,6 @@
 public class OMLinkedListImplFactory extends OMFactory {
 
 
-    public OMAttribute createOMAttribute(String localName, OMNamespace ns, String value)
{
-        return new OMAttributeImpl(localName, ns, value);
-    }
-
     public OMElement createOMElement(OMElement parent) {
         return new OMElementImpl(parent);
     }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMElement.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMElement.java?view=diff&rev=123078&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMElement.java&r1=123077&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMElement.java&r2=123078
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMElement.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMElement.java
Wed Dec 22 01:24:49 2004
@@ -116,7 +116,17 @@
      *
      * @param attr
      */
-    public void insertAttribute(OMAttribute attr);
+    public OMAttribute insertAttribute(OMAttribute attr);
+
+    /**
+     *
+     * @param attributeName
+     * @param value
+     * @param ns - the namespace has to be one of the in scope namespace. i.e. the passed
namespace
+     * must be declared in the parent element of this attribute or ancestors of the parent
element of the attribute
+     * @return
+     */
+    public OMAttribute insertAttribute(String attributeName, String value, OMNamespace ns);
 
     public void removeAttribute(OMAttribute attr);
 

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=123078&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.java&r1=123077&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMFactory.java&r2=123078
==============================================================================
--- 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
Wed Dec 22 01:24:49 2004
@@ -20,15 +20,7 @@
  */
 public abstract class OMFactory {
 
-    /**
-     * @param localName
-     * @param ns
-     * @param value
-     * @return
-     */
-    public abstract OMAttribute createOMAttribute(String localName, OMNamespace ns, String
value);
-
-//    /**
+    //    /**
 //     * @param parent
 //     * @param object
 //     * This is used to construct the elements from an Object

Mime
View raw message