ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1696733 - in /webservices/axiom/trunk: aspects/core-aspects/src/main/java/org/apache/axiom/core/ aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/ aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/ im...
Date Thu, 20 Aug 2015 09:17:19 GMT
Author: veithen
Date: Thu Aug 20 09:17:18 2015
New Revision: 1696733

URL: http://svn.apache.org/r1696733
Log:
Unify some of the createOMElement methods.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java?rev=1696733&r1=1696732&r2=1696733&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java
Thu Aug 20 09:17:18 2015
@@ -23,6 +23,7 @@ public interface NodeFactory {
     CoreDocumentTypeDeclaration createDocumentTypeDeclaration();
     CoreCharacterDataNode createCharacterDataNode();
     CoreCDATASection createCDATASection();
+    CoreNSAwareElement createNSAwareElement();
     CoreNSUnawareAttribute createAttribute(CoreDocument document, String name, String value,
String type);
     CoreNSAwareAttribute createAttribute(CoreDocument document, String namespaceURI, String
localName, String prefix, String value, String type);
     CoreNamespaceDeclaration createNamespaceDeclaration(CoreDocument document, String prefix,
String namespaceURI);

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj?rev=1696733&r1=1696732&r2=1696733&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
Thu Aug 20 09:17:18 2015
@@ -65,6 +65,11 @@ import org.apache.commons.logging.LogFac
 public aspect AxiomElementSupport {
     private static final Log log = LogFactory.getLog(AxiomElementSupport.class);
     
+    public final void AxiomElement.initName(String localName, OMNamespace ns, boolean generateNSDecl)
{
+        internalSetLocalName(localName);
+        internalSetNamespace(generateNSDecl ? handleNamespace(this, ns, false, true) : ns);
+    }
+    
     final void AxiomElement.beforeSetLocalName() {
         forceExpand();
     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj?rev=1696733&r1=1696732&r2=1696733&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AxiomNodeFactorySupport.aj
Thu Aug 20 09:17:18 2015
@@ -24,6 +24,7 @@ import org.apache.axiom.ext.stax.datahan
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocType;
 import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMProcessingInstruction;
@@ -32,6 +33,7 @@ import org.apache.axiom.om.OMXMLParserWr
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.common.AxiomCDATASection;
 import org.apache.axiom.om.impl.common.AxiomCharacterDataNode;
+import org.apache.axiom.om.impl.common.AxiomContainer;
 import org.apache.axiom.om.impl.common.AxiomDocType;
 import org.apache.axiom.om.impl.common.AxiomDocument;
 import org.apache.axiom.om.impl.common.AxiomElement;
@@ -180,4 +182,28 @@ public aspect AxiomNodeFactorySupport {
         }
         return node;
     }
+
+    public final OMElement AxiomNodeFactory.createOMElement(String localName, OMNamespace
ns) {
+        return createOMElement(localName, ns, null);
+    }
+
+    public final OMElement AxiomNodeFactory.createOMElement(String localName, OMNamespace
ns, OMContainer parent) {
+        AxiomElement element = (AxiomElement)createNSAwareElement();
+        if (parent != null) {
+            parent.addChild(element);
+        }
+        element.initName(localName, ns, true);
+        return element;
+    }
+
+    public final OMElement AxiomNodeFactory.createOMElement(String localName, OMContainer
parent,
+            OMXMLParserWrapper builder) {
+        AxiomElement element = (AxiomElement)createNSAwareElement();
+        element.coreSetBuilder(builder);
+        if (parent != null) {
+            ((AxiomContainer)parent).addChild(element, true);
+        }
+        element.initName(localName, null, false);
+        return element;
+    }
 }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1696733&r1=1696732&r2=1696733&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Thu Aug 20 09:17:18 2015
@@ -50,10 +50,13 @@ public class ElementImpl extends ParentN
 
     private int lineNumber;
 
+    public ElementImpl(OMFactory factory) {
+        super(factory);
+    }
+    
     public ElementImpl(ParentNode parentNode, String localName, OMNamespace ns, OMXMLParserWrapper
builder,
                        OMFactory factory, boolean generateNSDecl) {
         super(factory);
-        internalSetLocalName(localName);
         coreSetBuilder(builder);
         if (parentNode != null) {
             // TODO: dirty hack to get the correct semantics (reordering) if the parent is
a SOAP envelope
@@ -63,7 +66,7 @@ public class ElementImpl extends ParentN
                 parentNode.coreAppendChild(this, builder != null);
             }
         }
-        internalSetNamespace(generateNSDecl ? handleNamespace(this, ns, false, true) : ns);
+        initName(localName, ns, generateNSDecl);
     }
 
     private final String checkNamespaceIsDeclared(String prefix, String namespaceURI, boolean
allowDefaultNamespace, boolean declare) {

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java?rev=1696733&r1=1696732&r2=1696733&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
Thu Aug 20 09:17:18 2015
@@ -24,6 +24,7 @@ import org.apache.axiom.core.CoreCharact
 import org.apache.axiom.core.CoreDocument;
 import org.apache.axiom.core.CoreDocumentTypeDeclaration;
 import org.apache.axiom.core.CoreNSAwareAttribute;
+import org.apache.axiom.core.CoreNSAwareElement;
 import org.apache.axiom.core.CoreNSUnawareAttribute;
 import org.apache.axiom.core.CoreNamespaceDeclaration;
 import org.apache.axiom.core.CoreProcessingInstruction;
@@ -43,7 +44,6 @@ import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMProcessingInstruction;
 import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.common.AxiomNamespaceDeclaration;
@@ -59,8 +59,6 @@ import org.apache.axiom.om.impl.dom.Enti
 import org.apache.axiom.om.impl.dom.NamespaceDeclaration;
 import org.apache.axiom.om.impl.dom.NSAwareAttribute;
 import org.apache.axiom.om.impl.dom.NSUnawareAttribute;
-import org.apache.axiom.om.impl.dom.OMDOMException;
-import org.apache.axiom.om.impl.dom.ParentNode;
 import org.apache.axiom.om.impl.dom.ProcessingInstructionImpl;
 import org.apache.axiom.om.impl.dom.TextImpl;
 import org.apache.axiom.om.impl.util.OMSerializerUtil;
@@ -86,25 +84,6 @@ public class OMDOMFactory implements Axi
         return metaFactory;
     }
 
-    public OMElement createOMElement(String localName, OMNamespace ns) {
-        return new ElementImpl(null, localName, ns, null, this, true);
-    }
-
-    public OMElement createOMElement(String localName, OMNamespace ns,
-                                     OMContainer parent) throws OMDOMException {
-        if (parent == null) {
-            return createOMElement(localName, ns);
-        } else {
-            return new ElementImpl((ParentNode) parent, localName, ns, null, this, true);
-        }
-    }
-
-    /** Creates an OMElement with the builder. */
-    public OMElement createOMElement(String localName, OMContainer parent,
-                                     OMXMLParserWrapper builder) {
-        return new ElementImpl((ParentNode) parent, localName, null, builder, this, false);
-    }
-
     public OMSourcedElement createOMElement(OMDataSource source) {
         throw new UnsupportedOperationException("Not supported for DOM");
     }
@@ -310,6 +289,10 @@ public class OMDOMFactory implements Axi
         return new CDATASectionImpl(this);
     }
 
+    public final CoreNSAwareElement createNSAwareElement() {
+        return new ElementImpl(this);
+    }
+
     public final CoreNSUnawareAttribute createAttribute(CoreDocument document, String name,
String value, String type) {
         NSUnawareAttribute attr = new NSUnawareAttribute((DocumentImpl)document, this);
         attr.coreSetName(name);

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=1696733&r1=1696732&r2=1696733&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
Thu Aug 20 09:17:18 2015
@@ -50,12 +50,11 @@ public class OMElementImpl extends OMNod
     public OMElementImpl(OMContainer parent, String localName, OMNamespace ns, OMXMLParserWrapper
builder,
                     OMFactory factory, boolean generateNSDecl) {
         super(factory);
-        internalSetLocalName(localName);
         coreSetBuilder(builder);
         if (parent != null) {
             ((AxiomContainer)parent).addChild(this, builder != null);
         }
-        internalSetNamespace(generateNSDecl ? handleNamespace(this, ns, false, true) : ns);
+        initName(localName, ns, generateNSDecl);
     }
 
     /**
@@ -74,12 +73,7 @@ public class OMElementImpl extends OMNod
         internalSetNamespace(handleNamespace(qname));
     }
     
-    /**
-     * Constructor reserved for use by {@link OMSourcedElementImpl}.
-     * 
-     * @param factory
-     */
-    OMElementImpl(OMFactory factory) {
+    public OMElementImpl(OMFactory factory) {
         super(factory);
     }
 

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=1696733&r1=1696732&r2=1696733&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
Thu Aug 20 09:17:18 2015
@@ -24,6 +24,7 @@ import org.apache.axiom.core.CoreCharact
 import org.apache.axiom.core.CoreDocument;
 import org.apache.axiom.core.CoreDocumentTypeDeclaration;
 import org.apache.axiom.core.CoreNSAwareAttribute;
+import org.apache.axiom.core.CoreNSAwareElement;
 import org.apache.axiom.core.CoreNSUnawareAttribute;
 import org.apache.axiom.core.CoreNamespaceDeclaration;
 import org.apache.axiom.core.CoreProcessingInstruction;
@@ -42,7 +43,6 @@ import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMProcessingInstruction;
 import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.common.AxiomNamespaceDeclaration;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
@@ -87,34 +87,6 @@ public class OMLinkedListImplFactory imp
         return metaFactory;
     }
 
-    /**
-     * Method createOMElement.
-     *
-     * @param localName
-     * @param ns
-     * @return Returns OMElement.
-     */
-    public OMElement createOMElement(String localName, OMNamespace ns) {
-        return new OMElementImpl(null, localName, ns, null, this, true);
-    }
-
-    public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent)
{
-        return new OMElementImpl(parent, localName, ns, null, this, true);
-    }
-
-    /**
-     * Method createOMElement.
-     *
-     * @param localName
-     * @param parent
-     * @param builder
-     * @return Returns OMElement.
-     */
-    public OMElement createOMElement(String localName, OMContainer parent,
-                                     OMXMLParserWrapper builder) {
-        return new OMElementImpl(parent, localName, null, builder, this, false);
-    }
-
     public OMElement createOMElement(String localName, String namespaceURI, String prefix)
{
         if (namespaceURI == null) {
             throw new IllegalArgumentException("namespaceURI must not be null");
@@ -312,6 +284,10 @@ public class OMLinkedListImplFactory imp
         return new CDATASectionImpl(this);
     }
 
+    public final CoreNSAwareElement createNSAwareElement() {
+        return new OMElementImpl(this);
+    }
+
     public CoreNSUnawareAttribute createAttribute(CoreDocument document, String name, String
value,
             String type) {
         // TODO



Mime
View raw message