ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1698429 - in /webservices/axiom/trunk: aspects/core-aspects/src/main/java/org/apache/axiom/core/ aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/ implementati...
Date Fri, 28 Aug 2015 22:25:23 GMT
Author: veithen
Date: Fri Aug 28 22:25:23 2015
New Revision: 1698429

URL: http://svn.apache.org/r1698429
Log:
Clean up the comment node code.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/NodeFactory.java
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.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/CommentImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.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/OMCommentImpl.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMComment.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.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=1698429&r1=1698428&r2=1698429&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
Fri Aug 28 22:25:23 2015
@@ -29,4 +29,5 @@ public interface NodeFactory {
     CoreNamespaceDeclaration createNamespaceDeclaration(CoreDocument document, String prefix,
String namespaceURI);
     CoreProcessingInstruction createProcessingInstruction();
     CoreEntityReference createEntityReference();
+    CoreComment createComment();
 }

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.aj?rev=1698429&r1=1698428&r2=1698429&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMDocumentSupport.aj
Fri Aug 28 22:25:23 2015
@@ -23,6 +23,7 @@ import javax.xml.XMLConstants;
 import org.apache.axiom.core.CoreElement;
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
+import org.w3c.dom.Comment;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.DOMImplementation;
@@ -188,6 +189,13 @@ public aspect DOMDocumentSupport {
         return node;
     }
 
+    public final Comment DOMDocument.createComment(String data) {
+        DOMComment node = (DOMComment)coreGetNodeFactory().createComment();
+        node.coreSetOwnerDocument(this);
+        node.coreSetCharacterData(data, Policies.DETACH_POLICY);
+        return node;
+    }
+
     public final NodeList DOMDocument.getElementsByTagName(String tagname) {
         return new ElementsByTagName(this, tagname);
     }

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=1698429&r1=1698428&r2=1698429&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
Fri Aug 28 22:25:23 2015
@@ -21,6 +21,7 @@ package org.apache.axiom.om.impl.common.
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
+import org.apache.axiom.om.OMComment;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocType;
 import org.apache.axiom.om.OMDocument;
@@ -34,6 +35,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.AxiomComment;
 import org.apache.axiom.om.impl.common.AxiomContainer;
 import org.apache.axiom.om.impl.common.AxiomDocType;
 import org.apache.axiom.om.impl.common.AxiomDocument;
@@ -196,6 +198,19 @@ public aspect AxiomNodeFactorySupport {
         return node;
     }
 
+    public final OMComment AxiomNodeFactory.createOMComment(OMContainer parent, String content)
{
+        return createOMComment(parent, content, false);
+    }
+
+    public final OMComment AxiomNodeFactory.createOMComment(OMContainer parent, String content,
boolean fromBuilder) {
+        AxiomComment node = (AxiomComment)createComment();
+        node.coreSetCharacterData(content, Policies.DETACH_POLICY);
+        if (parent != null) {
+            ((OMContainerEx)parent).addChild(node, fromBuilder);
+        }
+        return node;
+    }
+    
     public final OMElement AxiomNodeFactory.createOMElement(String localName, OMNamespace
ns) {
         return createOMElement(localName, ns, null);
     }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CommentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CommentImpl.java?rev=1698429&r1=1698428&r2=1698429&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CommentImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CommentImpl.java
Fri Aug 28 22:25:23 2015
@@ -26,12 +26,11 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.impl.common.AxiomComment;
 
 public class CommentImpl extends LeafNode implements DOMComment, AxiomComment {
-    public CommentImpl(String value, OMFactory factory) {
+    public CommentImpl(OMFactory factory) {
         super(factory);
-        coreSetCharacterData(value, Policies.DETACH_POLICY);
     }
 
     ChildNode createClone(OMCloneOptions options) {
-        return new CommentImpl(getData(), getOMFactory());
+        return (ChildNode)getOMFactory().createOMComment(null, getData());
     }
 }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1698429&r1=1698428&r2=1698429&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
Fri Aug 28 22:25:23 2015
@@ -35,7 +35,6 @@ import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.impl.common.AxiomDocument;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.w3c.dom.Attr;
-import org.w3c.dom.Comment;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.DocumentType;
@@ -60,12 +59,6 @@ public class DocumentImpl extends Parent
     // /org.w3c.dom.Document methods
     // /
 
-    public Comment createComment(String data) {
-        CommentImpl comment = new CommentImpl(data, getOMFactory());
-        comment.coreSetOwnerDocument(this);
-        return comment;
-    }
-
     public DocumentFragment createDocumentFragment() {
         DocumentFragmentImpl fragment = new DocumentFragmentImpl(getOMFactory());
         fragment.coreSetOwnerDocument(this);

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=1698429&r1=1698428&r2=1698429&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
Fri Aug 28 22:25:23 2015
@@ -23,6 +23,7 @@ import javax.xml.namespace.QName;
 
 import org.apache.axiom.core.CoreCDATASection;
 import org.apache.axiom.core.CoreCharacterDataNode;
+import org.apache.axiom.core.CoreComment;
 import org.apache.axiom.core.CoreDocument;
 import org.apache.axiom.core.CoreDocumentTypeDeclaration;
 import org.apache.axiom.core.CoreEntityReference;
@@ -45,7 +46,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.impl.OMContainerEx;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.common.AxiomElement;
 import org.apache.axiom.om.impl.common.AxiomNamespaceDeclaration;
@@ -197,18 +197,6 @@ public class OMDOMFactory implements Axi
         return new NSAwareAttribute(null, localName, ns, value, this);
     }
 
-    public OMComment createOMComment(OMContainer parent, String content) {
-        return createOMComment(parent, content, false);
-    }
-    
-    public OMComment createOMComment(OMContainer parent, String content, boolean fromBuilder)
{
-        CommentImpl comment = new CommentImpl(content, this);
-        if (parent != null) {
-            ((OMContainerEx)parent).addChild(comment, fromBuilder);
-        }
-        return comment;
-    }
-
     /**
      * This method is intended only to be used by Axiom intenals when merging Objects from
different
      * Axiom implementations to the DOOM implementation.
@@ -250,9 +238,7 @@ public class OMDOMFactory implements Axi
             }
             case (OMNode.COMMENT_NODE): {
                 OMComment importedComment = (OMComment) child;
-                OMComment newComment = createOMComment(null, importedComment.getValue());
-                newComment = new CommentImpl(importedComment.getValue(), this);
-                return newComment;
+                return createOMComment(null, importedComment.getValue());
             }
             case (OMNode.DTD_NODE): {
                 OMDocType importedDocType = (OMDocType) child;
@@ -364,4 +350,8 @@ public class OMDOMFactory implements Axi
     public final CoreEntityReference createEntityReference() {
         return new EntityReferenceImpl(this);
     }
+    
+    public final CoreComment createComment() {
+        return new CommentImpl(this);
+    }
 }

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMCommentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMCommentImpl.java?rev=1698429&r1=1698428&r2=1698429&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMCommentImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMCommentImpl.java
Fri Aug 28 22:25:23 2015
@@ -20,24 +20,14 @@
 package org.apache.axiom.om.impl.llom;
 
 import org.apache.axiom.om.OMCloneOptions;
-import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.impl.common.AxiomComment;
 import org.apache.axiom.om.impl.common.AxiomContainer;
-import org.apache.axiom.om.impl.common.Policies;
 
 public class OMCommentImpl extends OMLeafNode implements AxiomComment {
-    /**
-     * Constructor OMCommentImpl.
-     *
-     * @param parentNode
-     * @param contentText
-     */
-    public OMCommentImpl(OMContainer parentNode, String contentText,
-                         OMFactory factory, boolean fromBuilder) {
-        super(parentNode, factory, fromBuilder);
-        coreSetCharacterData(contentText, Policies.DETACH_POLICY);
+    public OMCommentImpl(OMFactory factory) {
+        super(factory);
     }
 
     OMNode clone(OMCloneOptions options, AxiomContainer targetParent) {

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java?rev=1698429&r1=1698428&r2=1698429&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java
Fri Aug 28 22:25:23 2015
@@ -18,19 +18,10 @@
  */
 package org.apache.axiom.om.impl.llom;
 
-import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.common.AxiomLeafNode;
 
 public abstract class OMLeafNode extends OMNodeImpl implements AxiomLeafNode {
-    public OMLeafNode(OMContainer parent, OMFactory factory, boolean fromBuilder) {
-        super(factory);
-        if (parent != null) {
-            ((OMContainerEx)parent).addChild(this, fromBuilder);
-        }
-    }
-
     public OMLeafNode(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=1698429&r1=1698428&r2=1698429&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
Fri Aug 28 22:25:23 2015
@@ -23,6 +23,7 @@ import javax.xml.namespace.QName;
 
 import org.apache.axiom.core.CoreCDATASection;
 import org.apache.axiom.core.CoreCharacterDataNode;
+import org.apache.axiom.core.CoreComment;
 import org.apache.axiom.core.CoreDocument;
 import org.apache.axiom.core.CoreDocumentTypeDeclaration;
 import org.apache.axiom.core.CoreEntityReference;
@@ -201,21 +202,6 @@ public class OMLinkedListImplFactory imp
     }
 
     /**
-     * Creates a comment.
-     *
-     * @param parent
-     * @param content
-     * @return Returns OMComment.
-     */
-    public OMComment createOMComment(OMContainer parent, String content) {
-        return createOMComment(parent, content, false);
-    }
-
-    public OMComment createOMComment(OMContainer parent, String content, boolean fromBuilder)
{
-        return new OMCommentImpl(parent, content, this, fromBuilder);
-    }
-
-    /**
      * This method is intended only to be used by Axiom intenals when merging Objects from
different
      * Axiom implementations to the LLOM implementation.
      *
@@ -372,4 +358,8 @@ public class OMLinkedListImplFactory imp
     public final CoreEntityReference createEntityReference() {
         return new OMEntityReferenceImpl(this);
     }
+    
+    public CoreComment createComment() {
+        return new OMCommentImpl(this);
+    }
 }

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMComment.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMComment.java?rev=1698429&r1=1698428&r2=1698429&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMComment.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMComment.java
Fri Aug 28 22:25:23 2015
@@ -24,10 +24,8 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.impl.llom.OMCommentImpl;
 
 public class FOMComment extends OMCommentImpl implements AbderaComment {
-
-    public FOMComment(OMContainer parent, String contentText,
-            OMFactory factory, boolean fromBuilder) {
-        super(parent, contentText, factory, fromBuilder);
+    public FOMComment(OMFactory factory) {
+        super(factory);
     }
 
     public String getText() {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?rev=1698429&r1=1698428&r2=1698429&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
Fri Aug 28 22:25:23 2015
@@ -58,12 +58,12 @@ import org.apache.abdera.util.MimeTypeHe
 import org.apache.abdera.util.Version;
 import org.apache.axiom.core.CoreCDATASection;
 import org.apache.axiom.core.CoreCharacterDataNode;
+import org.apache.axiom.core.CoreComment;
 import org.apache.axiom.core.CoreDocument;
 import org.apache.axiom.core.CoreNSAwareElement;
 import org.apache.axiom.core.CoreProcessingInstruction;
 import org.apache.axiom.fom.AbderaFactory;
 import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMComment;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
@@ -631,11 +631,6 @@ public class FOMFactory extends OMLinked
     }
 
     @Override
-    public OMComment createOMComment(OMContainer arg0, String arg1) {
-        return new FOMComment(arg0, arg1, this, false);
-    }
-
-    @Override
     public CoreCharacterDataNode createCharacterDataNode() {
         return new FOMCharacterDataNode(this);
     }
@@ -649,4 +644,9 @@ public class FOMFactory extends OMLinked
     public CoreProcessingInstruction createProcessingInstruction() {
         return new FOMProcessingInstruction(this);
     }
+
+    @Override
+    public CoreComment createComment() {
+        return new FOMComment(this);
+    }
 }



Mime
View raw message