ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1728552 - in /webservices/axiom/trunk: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/ aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/ implementations/fom-impl/src/main/java/org/apache/...
Date Thu, 04 Feb 2016 20:22:55 GMT
Author: veithen
Date: Thu Feb  4 20:22:54 2016
New Revision: 1728552

URL: http://svn.apache.org/viewvc?rev=1728552&view=rev
Log:
Prefer composition over inheritance.

Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java?rev=1728552&r1=1728551&r2=1728552&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java
Thu Feb  4 20:22:54 2016
@@ -23,6 +23,8 @@ import org.apache.axiom.om.impl.intf.Axi
 import org.apache.axiom.om.impl.intf.AxiomElement;
 
 public interface Model {
+    void validateEventType(int eventType);
+    
     Class<? extends AxiomDocument> getDocumentType();
     
     /**

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java?rev=1728552&r1=1728551&r2=1728552&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java
Thu Feb  4 20:22:54 2016
@@ -28,6 +28,10 @@ public final class PlainXMLModel impleme
     private PlainXMLModel() {}
 
     @Override
+    public void validateEventType(int eventType) {
+    }
+
+    @Override
     public Class<? extends AxiomDocument> getDocumentType() {
         return AxiomDocument.class;
     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java?rev=1728552&r1=1728551&r2=1728552&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
Thu Feb  4 20:22:54 2016
@@ -815,7 +815,7 @@ public class StAXOMBuilder implements Bu
      * @return Returns OMNode.
      * @throws OMException
      */
-    protected OMNode createDTD() throws OMException {
+    private OMNode createDTD() throws OMException {
         DTDReader dtdReader;
         try {
             dtdReader = (DTDReader)parser.getProperty(DTDReader.PROPERTY);
@@ -872,11 +872,11 @@ public class StAXOMBuilder implements Bu
      * @return Returns OMNode.
      * @throws OMException
      */
-    protected OMNode createPI() throws OMException {
+    private OMNode createPI() throws OMException {
         return omfactory.createOMProcessingInstruction(target, parser.getPITarget(), parser.getPIData(),
true);
     }
 
-    protected OMNode createEntityReference() {
+    private OMNode createEntityReference() {
         return omfactory.createOMEntityReference(target, parser.getLocalName(), parser.getText(),
true);
     }
     
@@ -1004,6 +1004,7 @@ public class StAXOMBuilder implements Bu
                         close();
                     }
                 }
+                model.validateEventType(event);
                 return event;
             } catch (XMLStreamException ex) {
                 throw new DeferredParsingException(ex);

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java?rev=1728552&r1=1728551&r2=1728552&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java
Thu Feb  4 20:22:54 2016
@@ -19,6 +19,8 @@
 
 package org.apache.axiom.soap.impl.common.builder;
 
+import javax.xml.stream.XMLStreamConstants;
+
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.impl.common.builder.Model;
@@ -50,6 +52,18 @@ public final class SOAPModel implements
     private SOAPBuilderHelper builderHelper;
 
     @Override
+    public void validateEventType(int eventType) {
+        switch (eventType) {
+            case XMLStreamConstants.DTD:
+                throw new SOAPProcessingException("SOAP message MUST NOT contain a Document
Type Declaration(DTD)");
+            case XMLStreamConstants.PROCESSING_INSTRUCTION:
+                throw new SOAPProcessingException("SOAP message MUST NOT contain Processing
Instructions(PI)");
+            case XMLStreamConstants.ENTITY_REFERENCE:
+                throw new SOAPProcessingException("A SOAP message cannot contain entity references
because it must not have a DTD");
+        }
+    }
+
+    @Override
     public Class<? extends AxiomDocument> getDocumentType() {
         return AxiomSOAPMessage.class;
     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java?rev=1728552&r1=1728551&r2=1728552&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java
Thu Feb  4 20:22:54 2016
@@ -24,7 +24,6 @@ import java.io.Closeable;
 import org.apache.axiom.core.NodeFactory;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMMetaFactory;
-import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.impl.builder.Detachable;
 import org.apache.axiom.om.impl.common.builder.NodePostProcessor;
@@ -33,7 +32,6 @@ import org.apache.axiom.soap.SOAPEnvelop
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPMessage;
 import org.apache.axiom.soap.SOAPModelBuilder;
-import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axiom.soap.impl.intf.AxiomSOAPEnvelope;
 import org.apache.axiom.soap.impl.intf.AxiomSOAPMessage;
 
@@ -68,20 +66,6 @@ public class StAXSOAPModelBuilder extend
         return (SOAPEnvelope)getDocumentElement();
     }
 
-    /** Method createDTD. Overriding the default behaviour as a SOAPMessage should not have
a DTD. */
-    protected OMNode createDTD() throws OMException {
-        throw new SOAPProcessingException("SOAP message MUST NOT contain a Document Type
Declaration(DTD)");
-    }
-
-    /** Method createPI. Overriding the default behaviour as a SOAP Message should not have
a PI. */
-    protected OMNode createPI() throws OMException {
-        throw new SOAPProcessingException("SOAP message MUST NOT contain Processing Instructions(PI)");
-    }
-
-    protected OMNode createEntityReference() {
-        throw new SOAPProcessingException("A SOAP message cannot contain entity references
because it must not have a DTD");
-    }
-
     public SOAPMessage getSOAPMessage() {
         return (SOAPMessage)getDocument();
     }

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=1728552&r1=1728551&r2=1728552&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
Thu Feb  4 20:22:54 2016
@@ -511,6 +511,10 @@ public class FOMFactory extends OMFactor
     }
 
     @Override
+    public void validateEventType(int eventType) {
+    }
+
+    @Override
     public Class<? extends AxiomDocument> getDocumentType() {
         return FOMDocument.class;
     }



Mime
View raw message