ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1608621 - in /webservices/axiom/trunk/modules: axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/ axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/
Date Mon, 07 Jul 2014 21:53:13 GMT
Author: veithen
Date: Mon Jul  7 21:53:12 2014
New Revision: 1608621

URL: http://svn.apache.org/r1608621
Log:
More duplicate code reduction.

Modified:
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj?rev=1608621&r1=1608620&r2=1608621&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
Mon Jul  7 21:53:12 2014
@@ -23,6 +23,7 @@ import java.util.Iterator;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.sax.SAXSource;
 
 import org.apache.axiom.om.NodeUnavailableException;
 import org.apache.axiom.om.OMContainer;
@@ -38,10 +39,12 @@ import org.apache.axiom.om.impl.builder.
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.common.serializer.pull.OMXMLStreamReaderExAdapter;
 import org.apache.axiom.om.impl.common.serializer.pull.PullSerializer;
+import org.apache.axiom.om.impl.common.serializer.push.sax.XMLReaderImpl;
 import org.apache.axiom.om.impl.traverse.OMChildrenIterator;
 import org.apache.axiom.om.util.OMXMLStreamReaderValidator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.xml.sax.InputSource;
 
 public aspect OMContainerSupport {
     declare parents: (InformationItem+ && OMContainer+) implements IContainer;
@@ -50,6 +53,14 @@ public aspect OMContainerSupport {
     
     private static final OMXMLStreamReaderConfiguration defaultReaderConfiguration = new
OMXMLStreamReaderConfiguration();
     
+    public boolean IContainer.isComplete() {
+        return getState() == COMPLETE;
+    }
+
+    public final void IContainer.discarded() {
+        coreSetState(DISCARDED);
+    }
+
     public XMLStreamReader OMContainer.getXMLStreamReader() {
         return getXMLStreamReader(true);
     }
@@ -253,6 +264,10 @@ public aspect OMContainerSupport {
                 (OMElement) omNode : null;
     }
 
+    public final SAXSource IContainer.getSAXSource(boolean cache) {
+        return new SAXSource(new XMLReaderImpl(this, cache), new InputSource());
+    }
+
     public SAXResult OMContainer.getSAXResult() {
         SAXResultContentHandler handler = new SAXResultContentHandler(this);
         SAXResult result = new SAXResult();

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj?rev=1608621&r1=1608620&r2=1608621&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj
Mon Jul  7 21:53:12 2014
@@ -49,6 +49,10 @@ import org.apache.axiom.util.stax.XMLStr
 public aspect OMElementSupport {
     declare parents: (InformationItem+ && OMElement+) implements IElement;
     
+    public final int OMElement.getType() {
+        return OMNode.ELEMENT_NODE;
+    }
+    
     public NamespaceContext OMElement.getNamespaceContext(boolean detached) {
         if (detached) {
             Map namespaces = new HashMap();

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java?rev=1608621&r1=1608620&r2=1608621&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
Mon Jul  7 21:53:12 2014
@@ -89,20 +89,12 @@ public class DocumentFragmentImpl extend
         return new DocumentFragmentImpl(factory);
     }
 
-    public final boolean isComplete() {
-        return true;
-    }
-
     public final void setComplete(boolean state) {
         if (state != true) {
             throw new IllegalStateException();
         }
     }
 
-    public final void discarded() {
-        throw new UnsupportedOperationException();
-    }
-
     public final void build() {
         // A document fragment doesn't have a builder
     }

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1608621&r1=1608620&r2=1608621&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
Mon Jul  7 21:53:12 2014
@@ -569,18 +569,10 @@ public class DocumentImpl extends RootNo
         return new DocumentImpl(factory);
     }
     
-    public final boolean isComplete() {
-        return getState() == COMPLETE;
-    }
-
     public final void setComplete(boolean complete) {
         coreSetState(complete ? COMPLETE : INCOMPLETE);
     }
 
-    public final void discarded() {
-        coreSetState(DISCARDED);
-    }
-
     public final void build() {
         defaultBuild();
     }

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1608621&r1=1608620&r2=1608621&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Mon Jul  7 21:53:12 2014
@@ -194,19 +194,6 @@ public class ElementImpl extends ParentN
     }
 
     // /
-    // /org.apache.axiom.om.OMNode methods
-    // /
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.axiom.om.OMNode#getType()
-     */
-    public int getType() throws OMException {
-        return OMNode.ELEMENT_NODE;
-    }
-
-    // /
     // / org.w3c.dom.Element methods
     // /
 
@@ -1023,10 +1010,6 @@ public class ElementImpl extends ParentN
         super.normalize(config);
     }
 
-    public final boolean isComplete() {
-        return getState() == COMPLETE;
-    }
-
     public final void setComplete(boolean complete) {
         coreSetState(complete ? COMPLETE : INCOMPLETE);
         ParentNode parentNode = parentNode();
@@ -1039,10 +1022,6 @@ public class ElementImpl extends ParentN
         }
     }
 
-    public final void discarded() {
-        coreSetState(DISCARDED);
-    }
-
     OMNode detach(boolean useDomSemantics) {
         if (getState() == INCOMPLETE) {
             build();

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?rev=1608621&r1=1608620&r2=1608621&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
Mon Jul  7 21:53:12 2014
@@ -23,16 +23,11 @@ import org.apache.axiom.om.OMCloneOption
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.impl.common.CoreChildNode;
-import org.apache.axiom.om.impl.common.IContainer;
 import org.apache.axiom.om.impl.common.CoreParentNode;
-import org.apache.axiom.om.impl.common.serializer.push.sax.XMLReaderImpl;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-
-import javax.xml.transform.sax.SAXSource;
 
 public abstract class ParentNode extends NodeImpl implements NodeList, CoreParentNode {
     protected ParentNode(OMFactory factory) {
@@ -418,10 +413,6 @@ public abstract class ParentNode extends
         }
     }
 
-    public SAXSource getSAXSource(boolean cache) {
-        return new SAXSource(new XMLReaderImpl((IContainer)this, cache), new InputSource());
-    }
-
     void normalize(DOMConfigurationImpl config) {
         CoreChildNode child = coreGetFirstChild();
         while (child != null) {

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java?rev=1608621&r1=1608620&r2=1608621&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
Mon Jul  7 21:53:12 2014
@@ -32,10 +32,6 @@ import org.apache.axiom.om.impl.common.I
 import org.apache.axiom.om.impl.common.OMDocumentHelper;
 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.common.serializer.push.sax.XMLReaderImpl;
-import org.xml.sax.InputSource;
-
-import javax.xml.transform.sax.SAXSource;
 
 import java.util.Iterator;
 
@@ -101,10 +97,6 @@ public class OMDocumentImpl extends OMSe
         }
     }
 
-    public boolean isComplete() {
-        return getState() == COMPLETE;
-    }
-
     /**
      * Method setComplete.
      *
@@ -114,10 +106,6 @@ public class OMDocumentImpl extends OMSe
         coreSetState(complete ? COMPLETE : INCOMPLETE);
     }
 
-    public void discarded() {
-        coreSetState(DISCARDED);
-    }
-
     public final void checkChild(OMNode child) {
         if (child instanceof OMElement) {
             if (getOMDocumentElement() != null) {
@@ -185,10 +173,6 @@ public class OMDocumentImpl extends OMSe
         }
     }
     
-    public SAXSource getSAXSource(boolean cache) {
-        return new SAXSource(new XMLReaderImpl(this, cache), new InputSource());
-    }
-
     public void build() {
         defaultBuild();
     }

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=1608621&r1=1608620&r2=1608621&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
Mon Jul  7 21:53:12 2014
@@ -38,18 +38,15 @@ import org.apache.axiom.om.impl.common.O
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 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.common.serializer.push.sax.XMLReaderImpl;
 import org.apache.axiom.om.impl.util.EmptyIterator;
 import org.apache.axiom.om.impl.util.OMSerializerUtil;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.xml.sax.InputSource;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.sax.SAXSource;
 
 import java.io.StringWriter;
 import java.util.HashMap;
@@ -509,10 +506,6 @@ public class OMElementImpl extends OMNod
         return this;
     }
 
-    public int getType() {
-        return OMNode.ELEMENT_NODE;
-    }
-
     public void build() throws OMException {
         /**
          * builder is null. Meaning this is a programatical created element but it has children
which are not completed
@@ -529,10 +522,6 @@ public class OMElementImpl extends OMNod
 
     }
 
-    public boolean isComplete() {
-        return getState() == COMPLETE;
-    }
-
     public void setComplete(boolean complete) {
         coreSetState(complete ? COMPLETE : INCOMPLETE);
         if (parent != null) {
@@ -546,10 +535,6 @@ public class OMElementImpl extends OMNod
         }
     }
 
-    public void discarded() {
-        coreSetState(DISCARDED);
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -773,9 +758,5 @@ public class OMElementImpl extends OMNod
             this.setComplete(true);
         }
     }
-
-    public SAXSource getSAXSource(boolean cache) {
-        return new SAXSource(new XMLReaderImpl(this, cache), new InputSource());
-    }
 }
 

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java?rev=1608621&r1=1608620&r2=1608621&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Mon Jul  7 21:53:12 2014
@@ -54,7 +54,6 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.sax.SAXSource;
 
 import java.io.IOException;
 import java.io.OutputStream;
@@ -685,11 +684,6 @@ public class OMSourcedElementImpl extend
         super.detach();
     }
 
-    public int getType() {
-        // no need to expand the tree, just call base method directly
-        return super.getType();
-    }
-
     public void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache)
             throws OutputException {
         if (isExpanded()) {
@@ -1005,15 +999,6 @@ public class OMSourcedElementImpl extend
         }
     }
     
-    public void discarded() {
-        // TODO: will we ever get here?
-        super.discarded();
-    }
-
-    public SAXSource getSAXSource(boolean cache) {
-        return super.getSAXSource(cache);
-    }
-
     public SAXResult getSAXResult() {
         return super.getSAXResult();
     }



Mime
View raw message