ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1733354 - in /webservices/axiom/trunk/aspects: core-aspects/src/main/java/org/apache/axiom/core/impl/ core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/ core-aspects/src/main/java/org/apache/axiom/core/stream/ core-aspects/src/ma...
Date Wed, 02 Mar 2016 19:19:49 GMT
Author: veithen
Date: Wed Mar  2 19:19:49 2016
New Revision: 1733354

URL: http://svn.apache.org/viewvc?rev=1733354&view=rev
Log:
Increase consistency of the internal event model.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreDocumentSupport.aj
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/DocumentElementExtractingFilterHandler.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandler.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandlerWrapper.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/ContentHandlerXmlHandler.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/XmlDeclarationRewriterHandler.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/XmlHandlerStreamWriter.java

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
Wed Mar  2 19:19:49 2016
@@ -220,7 +220,7 @@ public final class TreeWalkerImpl implem
             
             switch (state) {
                 case STATE_START_FRAGMENT:
-//                    handler.startEntity(true, null);
+                    handler.startFragment();
                     break;
                 case STATE_LEAF:
                     ((CoreLeafNode)nextNode).internalSerialize(handler, preserve);
@@ -236,7 +236,7 @@ public final class TreeWalkerImpl implem
                     break;
                 case STATE_VISITED:
                     if (nextNode == null) {
-//                        handler.completed();
+                        handler.completed();
                     } else {
                         ((CoreParentNode)nextNode).serializeEndEvent(handler);
                     }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreDocumentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreDocumentSupport.aj?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreDocumentSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreDocumentSupport.aj
Wed Mar  2 19:19:49 2016
@@ -104,6 +104,6 @@ public aspect CoreDocumentSupport {
     }
     
     public final void CoreDocument.serializeEndEvent(XmlHandler handler) throws StreamException
{
-        handler.endDocument();
+        handler.completed();
     }
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/DocumentElementExtractingFilterHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/DocumentElementExtractingFilterHandler.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/DocumentElementExtractingFilterHandler.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/DocumentElementExtractingFilterHandler.java
Wed Mar  2 19:19:49 2016
@@ -30,7 +30,7 @@ public final class DocumentElementExtrac
     }
 
     @Override
-    public void endDocument() throws StreamException {
+    public void completed() throws StreamException {
     }
 
     @Override

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandler.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandler.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandler.java
Wed Mar  2 19:19:49 2016
@@ -21,7 +21,13 @@ package org.apache.axiom.core.stream;
 public interface XmlHandler {
     void startDocument(String inputEncoding, String xmlVersion, String xmlEncoding, boolean
standalone) throws StreamException;
     
-    void endDocument() throws StreamException;
+    /**
+     * Notify the handler of the beginning of a fragment.
+     * 
+     * @throws StreamException
+     *             if an error occurs when processing the event
+     */
+    void startFragment() throws StreamException;
     
     void processDocumentTypeDeclaration(String rootName, String publicId,
             String systemId, String internalSubset) throws StreamException;
@@ -127,4 +133,12 @@ public interface XmlHandler {
     void endCDATASection() throws StreamException;
     
     void processEntityReference(String name, String replacementText) throws StreamException;
+    
+    /**
+     * Notify the handler that the document or fragment is complete.
+     * 
+     * @throws StreamException
+     *             if an error occurs when processing the event
+     */
+    void completed() throws StreamException;
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandlerWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandlerWrapper.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandlerWrapper.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/XmlHandlerWrapper.java
Wed Mar  2 19:19:49 2016
@@ -34,8 +34,12 @@ public class XmlHandlerWrapper implement
         parent.startDocument(inputEncoding, xmlVersion, xmlEncoding, standalone);
     }
 
-    public void endDocument() throws StreamException {
-        parent.endDocument();
+    public void startFragment() throws StreamException {
+        parent.startFragment();
+    }
+
+    public void completed() throws StreamException {
+        parent.completed();
     }
 
     public void processDocumentTypeDeclaration(String rootName, String publicId, String systemId,

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/ContentHandlerXmlHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/ContentHandlerXmlHandler.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/ContentHandlerXmlHandler.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/ContentHandlerXmlHandler.java
Wed Mar  2 19:19:49 2016
@@ -38,8 +38,6 @@ public class ContentHandlerXmlHandler im
     private String[] prefixStack = new String[16];
     private int bindings;
     private int[] scopeStack = new int[8];
-    private boolean startDocumentWritten;
-    private boolean autoStartDocument;
     private int depth;
     private Stack<String> elementNameStack = new Stack<String>();
     private String elementURI;
@@ -65,19 +63,23 @@ public class ContentHandlerXmlHandler im
         }
     }
     
-    private void writeStartDocument() throws StreamException {
+    @Override
+    public void startDocument(String inputEncoding, String xmlVersion, String xmlEncoding,
+            boolean standalone) throws StreamException {
         try {
             contentHandler.startDocument();
-            startDocumentWritten = true;
         } catch (SAXException ex) {
             throw new StreamException(ex);
         }
     }
     
     @Override
-    public void startDocument(String inputEncoding, String xmlVersion, String xmlEncoding,
-            boolean standalone) throws StreamException {
-        writeStartDocument();
+    public void startFragment() throws StreamException {
+        try {
+            contentHandler.startDocument();
+        } catch (SAXException ex) {
+            throw new StreamException(ex);
+        }
     }
 
     public void processDocumentTypeDeclaration(String rootName, String publicId, String systemId,
String internalSubset) throws StreamException {
@@ -92,10 +94,6 @@ public class ContentHandlerXmlHandler im
     }
 
     public void startElement(String namespaceURI, String localName, String prefix) throws
StreamException {
-        if (!startDocumentWritten) {
-            writeStartDocument();
-            autoStartDocument = true;
-        }
         elementURI = namespaceURI;
         elementLocalName = localName;
         elementQName = getQName(prefix, localName);
@@ -151,9 +149,6 @@ public class ContentHandlerXmlHandler im
                 contentHandler.endPrefixMapping(prefixStack[i]);
             }
             bindings = scopeStack[--depth];
-            if (depth == 0 && autoStartDocument) {
-                contentHandler.endDocument();
-            }
         } catch (SAXException ex) {
             throw new StreamException(ex);
         }
@@ -283,7 +278,7 @@ public class ContentHandlerXmlHandler im
         }
     }
 
-    public void endDocument() throws StreamException {
+    public void completed() throws StreamException {
         try {
             contentHandler.endDocument();
         } catch (SAXException ex) {

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java
Wed Mar  2 19:19:49 2016
@@ -108,7 +108,7 @@ public final class XmlHandlerContentHand
 
     public void endDocument() throws SAXException {
         try {
-            handler.endDocument();
+            handler.completed();
         } catch (StreamException ex) {
             throw toSAXException(ex);
         }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java
Wed Mar  2 19:19:49 2016
@@ -53,8 +53,14 @@ public final  class SAXResultContentHand
     public void startDocument(String inputEncoding, String xmlVersion, String xmlEncoding,
boolean standalone) {
         target = root;
     }
+    
+    @Override
+    public void startFragment() throws StreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
 
-    public void endDocument() {
+    public void completed() {
     }
 
     public void processDocumentTypeDeclaration(String rootName, String publicId,

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
Wed Mar  2 19:19:49 2016
@@ -131,6 +131,12 @@ public final class BuilderHandler implem
         }
     }
     
+    @Override
+    public void startFragment() throws StreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
     public void processDocumentTypeDeclaration(String rootName, String publicId, String systemId,
             String internalSubset) throws StreamException {
         model.validateEventType(XMLStreamConstants.DTD);
@@ -201,7 +207,7 @@ public final class BuilderHandler implem
         context.processEntityReference(name, replacementText);
     }
     
-    public void endDocument() throws StreamException {
+    public void completed() throws StreamException {
         if (depth != 0) {
             throw new IllegalStateException();
         }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
Wed Mar  2 19:19:49 2016
@@ -302,7 +302,7 @@ public final class Context implements In
     
     public void endDocument() throws StreamException {
         if (passThroughHandler != null) {
-            passThroughHandler.endDocument();
+            passThroughHandler.completed();
             decrementPassThroughDepth();
         } else {
             if (depth != 0) {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java
Wed Mar  2 19:19:49 2016
@@ -234,7 +234,7 @@ public class StAXHelper implements XmlRe
                     handler.endElement();
                     break;
                 case XMLStreamConstants.END_DOCUMENT:
-                    handler.endDocument();
+                    handler.completed();
                     break;
                 case XMLStreamConstants.COMMENT:
                     handler.startComment();

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/XmlDeclarationRewriterHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/XmlDeclarationRewriterHandler.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/XmlDeclarationRewriterHandler.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/XmlDeclarationRewriterHandler.java
Wed Mar  2 19:19:49 2016
@@ -41,4 +41,14 @@ public final class XmlDeclarationRewrite
             super.startDocument(inputEncoding, xmlVersion, xmlEncoding, standalone);
         }
     }
+
+    @Override
+    public void startFragment() throws StreamException {
+        // Ignore this event
+    }
+
+    @Override
+    public void completed() throws StreamException {
+        // Ignore this event
+    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java
Wed Mar  2 19:19:49 2016
@@ -66,6 +66,12 @@ public class StAXSerializer implements X
             throw new StreamException(ex);
         }
     }
+    
+    @Override
+    public void startFragment() throws StreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
 
     public void processDocumentTypeDeclaration(String rootName, String publicId, String systemId,
String internalSubset) throws StreamException {
         try {
@@ -201,7 +207,7 @@ public class StAXSerializer implements X
         return dataHandlerWriter;
     }
 
-    public void endDocument() throws StreamException {
+    public void completed() throws StreamException {
         // TODO: the original StAX serialization code newer called writeEndDocument; this
is probably a mistake
     }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/XmlHandlerStreamWriter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/XmlHandlerStreamWriter.java?rev=1733354&r1=1733353&r2=1733354&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/XmlHandlerStreamWriter.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/XmlHandlerStreamWriter.java
Wed Mar  2 19:19:49 2016
@@ -86,7 +86,7 @@ public class XmlHandlerStreamWriter exte
 
     protected void doWriteEndDocument() throws XMLStreamException {
         try {
-            handler.endDocument();
+            handler.completed();
         } catch (StreamException ex) {
             throw toXMLStreamException(ex);
         }



Mime
View raw message