ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1685428 - in /webservices/axiom/branches/attrs-aspects: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/ implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ implementations/axiom-impl/src/main/java/org/ap...
Date Sun, 14 Jun 2015 17:21:41 GMT
Author: veithen
Date: Sun Jun 14 17:21:40 2015
New Revision: 1685428

URL: http://svn.apache.org/r1685428
Log:
Rewrite the getAttribute and getAttributeValue implementations.

Modified:
    webservices/axiom/branches/attrs-aspects/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
    webservices/axiom/branches/attrs-aspects/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
    webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java

Modified: webservices/axiom/branches/attrs-aspects/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/attrs-aspects/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj?rev=1685428&r1=1685427&r2=1685428&view=diff
==============================================================================
--- webservices/axiom/branches/attrs-aspects/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
(original)
+++ webservices/axiom/branches/attrs-aspects/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
Sun Jun 14 17:21:40 2015
@@ -303,4 +303,13 @@ public aspect AxiomElementSupport {
     public final Iterator AxiomElement.getAllAttributes() {
         return coreGetAttributesByType(AxiomAttribute.class, attributeIdentityMapper);
     }
+    
+    public final OMAttribute AxiomElement.getAttribute(QName qname) {
+        return (AxiomAttribute)coreGetAttribute(Policies.ATTRIBUTE_MATCHER, qname.getNamespaceURI(),
qname.getLocalPart());
+    }
+
+    public final String AxiomElement.getAttributeValue(QName qname) {
+        OMAttribute attr = getAttribute(qname);
+        return attr == null ? null : attr.getAttributeValue();
+    }
 }

Modified: webservices/axiom/branches/attrs-aspects/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/attrs-aspects/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1685428&r1=1685427&r2=1685428&view=diff
==============================================================================
--- webservices/axiom/branches/attrs-aspects/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++ webservices/axiom/branches/attrs-aspects/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Sun Jun 14 17:21:40 2015
@@ -47,7 +47,6 @@ import org.apache.axiom.om.impl.common.O
 import org.apache.axiom.om.impl.common.Policies;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
-import org.apache.axiom.om.impl.util.EmptyIterator;
 import org.apache.axiom.om.impl.util.OMSerializerUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -56,11 +55,9 @@ import org.w3c.dom.DOMException;
 import org.w3c.dom.NamedNodeMap;
 
 import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 
 import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
 import java.util.Iterator;
 
 /** Implementation of the org.w3c.dom.Element and org.apache.axiom.om.Element interfaces.
*/
@@ -71,8 +68,6 @@ public class ElementImpl extends ParentN
     
     private int lineNumber;
 
-    private static final EmptyIterator EMPTY_ITERATOR = new EmptyIterator();
-
     public ElementImpl(ParentNode parentNode, String localName, OMNamespace ns, OMXMLParserWrapper
builder,
                        OMFactory factory, boolean generateNSDecl) {
         super(factory);
@@ -379,31 +374,6 @@ public class ElementImpl extends ParentN
         return null;
     }
 
-    /**
-     * Returns a named attribute if present.
-     *
-     * @see org.apache.axiom.om.OMElement#getAttribute (javax.xml.namespace.QName)
-     */
-    public OMAttribute getAttribute(QName qname) {
-        if (qname.getNamespaceURI().equals("")) {
-            return (NSAwareAttribute) this.getAttributeNode(qname.getLocalPart());
-        } else {
-            return (NSAwareAttribute) this.getAttributeNodeNS(qname.getNamespaceURI(),
-                                                      qname.getLocalPart());
-        }
-    }
-
-    /**
-     * Returns a named attribute's value, if present.
-     *
-     * @param qname the qualified name to search for
-     * @return Returns a String containing the attribute value, or null.
-     */
-    public String getAttributeValue(QName qname) {
-        OMAttribute attr = getAttribute(qname);
-        return (attr == null) ? null : attr.getAttributeValue();
-    }
-
     public void removeAttribute(OMAttribute attr) {
         if (attr.getOwner() != this) {
             throw new OMException("The attribute is not owned by this element");

Modified: webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=1685428&r1=1685427&r2=1685428&view=diff
==============================================================================
--- webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
Sun Jun 14 17:21:40 2015
@@ -330,27 +330,6 @@ public class OMElementImpl extends OMNod
     }
 
     /**
-     * Returns a named attribute if present.
-     *
-     * @param qname the qualified name to search for
-     * @return Returns an OMAttribute with the given name if found, or null
-     */
-    public OMAttribute getAttribute(QName qname) {
-        return attributes == null ? null : (OMAttribute) attributes.get(qname);
-    }
-
-    /**
-     * Returns a named attribute's value, if present.
-     *
-     * @param qname the qualified name to search for
-     * @return Returns a String containing the attribute value, or null.
-     */
-    public String getAttributeValue(QName qname) {
-        OMAttribute attr = getAttribute(qname);
-        return (attr == null) ? null : attr.getAttributeValue();
-    }
-
-    /**
      * Inserts an attribute to this element. Implementor can decide as to insert this in
the front
      * or at the end of set of attributes.
      *

Modified: webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java?rev=1685428&r1=1685427&r2=1685428&view=diff
==============================================================================
--- webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
(original)
+++ webservices/axiom/branches/attrs-aspects/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Sun Jun 14 17:21:40 2015
@@ -383,11 +383,6 @@ public class OMSourcedElementImpl extend
         return super.getAllDeclaredNamespaces();
     }
 
-    public Iterator getAllAttributes() {
-        forceExpand();
-        return super.getAllAttributes();
-    }
-
     public OMAttribute getAttribute(QName qname) {
         forceExpand();
         return super.getAttribute(qname);



Mime
View raw message