ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1741345 - in /webservices/axiom/trunk: aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/builder/ aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/ aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common...
Date Wed, 27 Apr 2016 21:32:23 GMT
Author: veithen
Date: Wed Apr 27 21:32:23 2016
New Revision: 1741345

URL: http://svn.apache.org/viewvc?rev=1741345&view=rev
Log:
Remove namespace repairing logic from the builder.

Added:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilter.java
  (with props)
Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/builder/BuilderImpl.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderFactory.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMParser.java

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/builder/BuilderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/builder/BuilderImpl.java?rev=1741345&r1=1741344&r2=1741345&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/builder/BuilderImpl.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/builder/BuilderImpl.java
Wed Apr 27 21:32:23 2016
@@ -23,7 +23,6 @@ import org.apache.axiom.core.CoreDocumen
 import org.apache.axiom.core.CoreNSAwareElement;
 import org.apache.axiom.core.DeferredParsingException;
 import org.apache.axiom.core.NodeFactory;
-import org.apache.axiom.core.stream.NamespaceRepairingFilterHandler;
 import org.apache.axiom.core.stream.StreamException;
 import org.apache.axiom.core.stream.XmlInput;
 import org.apache.axiom.core.stream.XmlReader;
@@ -34,9 +33,9 @@ public final class BuilderImpl implement
     private Object facade;
 
     public BuilderImpl(XmlInput input, NodeFactory nodeFactory, Model model,
-            CoreNSAwareElement root, boolean repairNamespaces) {
+            CoreNSAwareElement root) {
         builderHandler = new BuilderHandler(nodeFactory, model, root, this);
-        reader = input.createReader(repairNamespaces ? new NamespaceRepairingFilterHandler(builderHandler,
null, false) : builderHandler);
+        reader = input.createReader(builderHandler);
     }
 
     public void addListener(BuilderListener listener) {

Added: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilter.java?rev=1741345&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilter.java
(added)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilter.java
Wed Apr 27 21:32:23 2016
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.core.stream;
+
+public final class NamespaceRepairingFilter implements XmlFilter {
+    public static final NamespaceRepairingFilter DEFAULT = new NamespaceRepairingFilter(null,
false);
+
+    private final NamespaceContextProvider parentNamespaceContext;
+    private final boolean removeRedundantDeclarations;
+
+    public NamespaceRepairingFilter(NamespaceContextProvider parentNamespaceContext,
+            boolean removeRedundantDeclarations) {
+        this.parentNamespaceContext = parentNamespaceContext;
+        this.removeRedundantDeclarations = removeRedundantDeclarations;
+    }
+
+    @Override
+    public XmlHandler createFilterHandler(XmlHandler parent) {
+        return new NamespaceRepairingFilterHandler(parent, parentNamespaceContext,
+                removeRedundantDeclarations);
+    }
+}

Propchange: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderFactory.java?rev=1741345&r1=1741344&r2=1741345&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderFactory.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderFactory.java
Wed Apr 27 21:32:23 2016
@@ -37,6 +37,7 @@ import org.apache.axiom.core.impl.builde
 import org.apache.axiom.core.impl.builder.BuilderListener;
 import org.apache.axiom.core.impl.builder.PlainXMLModel;
 import org.apache.axiom.core.stream.FilteredXmlInput;
+import org.apache.axiom.core.stream.NamespaceRepairingFilter;
 import org.apache.axiom.core.stream.XmlInput;
 import org.apache.axiom.core.stream.dom.DOMInput;
 import org.apache.axiom.core.stream.sax.SAXInput;
@@ -89,17 +90,17 @@ abstract class BuilderFactory<T extends
     final static BuilderFactory<OMXMLParserWrapper> OM = new BuilderFactory<OMXMLParserWrapper>()
{
         @Override
         OMXMLParserWrapper createBuilder(NodeFactory nodeFactory, XmlInput input,
-                boolean repairNamespaces, Detachable detachable) {
+                Detachable detachable) {
             return new OMXMLParserWrapperImpl(new BuilderImpl(input, nodeFactory,
-                    PlainXMLModel.INSTANCE, null, repairNamespaces), detachable);
+                    PlainXMLModel.INSTANCE, null), detachable);
         }
     };
 
     final static BuilderFactory<SOAPModelBuilder> SOAP = new BuilderFactory<SOAPModelBuilder>()
{
         @Override
         SOAPModelBuilder createBuilder(NodeFactory nodeFactory, XmlInput input,
-                boolean repairNamespaces, Detachable detachable) {
-            BuilderImpl builder = new BuilderImpl(new FilteredXmlInput(input, SOAPFilter.INSTANCE),
nodeFactory, new SOAPModel(), null, true);
+                Detachable detachable) {
+            BuilderImpl builder = new BuilderImpl(new FilteredXmlInput(input, SOAPFilter.INSTANCE),
nodeFactory, new SOAPModel(), null);
             // The SOAPFactory instance linked to the SOAPMessage is unknown until we reach
the
             // SOAPEnvelope. Register a post-processor that does the necessary updates on
the
             // SOAPMessage.
@@ -183,9 +184,16 @@ abstract class BuilderFactory<T extends
         return new SourceInfo(reader, detachable, closeable);
     }
     
-    abstract T createBuilder(NodeFactory nodeFactory, XmlInput input, boolean repairNamespaces,
-            Detachable detachable);
+    abstract T createBuilder(NodeFactory nodeFactory, XmlInput input, Detachable detachable);
 
+    final T createBuilder(NodeFactory nodeFactory, XmlInput input, boolean repairNamespaces,
+            Detachable detachable) {
+        return createBuilder(
+                nodeFactory,
+                repairNamespaces ? new FilteredXmlInput(input, NamespaceRepairingFilter.DEFAULT)
: input,
+                detachable);
+    }
+    
     final T createBuilder(NodeFactory nodeFactory, XMLStreamReader reader) {
         int eventType = reader.getEventType();
         switch (eventType) {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj?rev=1741345&r1=1741344&r2=1741345&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
Wed Apr 27 21:32:23 2016
@@ -25,6 +25,8 @@ import org.apache.axiom.core.CoreNode;
 import org.apache.axiom.core.DeferredParsingException;
 import org.apache.axiom.core.impl.builder.BuilderImpl;
 import org.apache.axiom.core.impl.builder.PlainXMLModel;
+import org.apache.axiom.core.stream.FilteredXmlInput;
+import org.apache.axiom.core.stream.NamespaceRepairingFilter;
 import org.apache.axiom.core.stream.StreamException;
 import org.apache.axiom.core.stream.XmlInput;
 import org.apache.axiom.om.OMCloneOptions;
@@ -197,7 +199,7 @@ public aspect AxiomSourcedElementSupport
             if (OMDataSourceUtil.isPushDataSource(dataSource)) {
                 // Disable namespace repairing because the OMDataSource is required to produce
well formed
                 // XML with respect to namespaces.
-                builder = new BuilderImpl(new PushOMDataSourceInput(this, dataSource), coreGetNodeFactory(),
PlainXMLModel.INSTANCE, this, false);
+                builder = new BuilderImpl(new PushOMDataSourceInput(this, dataSource), coreGetNodeFactory(),
PlainXMLModel.INSTANCE, this);
             } else {
                 // Get the XMLStreamReader
                 XMLStreamReader readerFromDS;
@@ -206,7 +208,7 @@ public aspect AxiomSourcedElementSupport
                 } catch (XMLStreamException ex) {
                     throw new OMException("Error obtaining parser from data source for element
" + getPrintableName(), ex);
                 }
-                builder = new BuilderImpl(new StAXPullInput(readerFromDS), coreGetNodeFactory(),
PlainXMLModel.INSTANCE, this, true);
+                builder = new BuilderImpl(new FilteredXmlInput(new StAXPullInput(readerFromDS),
NamespaceRepairingFilter.DEFAULT), coreGetNodeFactory(), PlainXMLModel.INSTANCE, this);
             }
             isExpanded = true;
             coreSetState(ATTRIBUTES_PENDING);

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMParser.java?rev=1741345&r1=1741344&r2=1741345&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
Wed Apr 27 21:32:23 2016
@@ -41,6 +41,8 @@ import org.apache.axiom.core.CoreNode;
 import org.apache.axiom.core.DeferredParsingException;
 import org.apache.axiom.core.impl.builder.BuilderImpl;
 import org.apache.axiom.core.impl.builder.BuilderListener;
+import org.apache.axiom.core.stream.FilteredXmlInput;
+import org.apache.axiom.core.stream.NamespaceRepairingFilter;
 import org.apache.axiom.fom.AbderaNode;
 import org.apache.axiom.fom.FOMSemantics;
 import org.apache.axiom.fom.impl.FOMNodeFactory;
@@ -181,8 +183,12 @@ public class FOMParser extends AbstractP
         throws ParseException {
         try {
             final FOMFactory factory = getFomFactory(options);
-            BuilderImpl builder = new BuilderImpl(new StAXPullInput(new FOMStAXFilter(reader,
options), false, null), FOMNodeFactory.INSTANCE,
-                    factory, null, true); // TODO: probably we can use repairNamespaces=false
here
+            // TODO: we probably don't need namespace repairing here
+            BuilderImpl builder = new BuilderImpl(
+                    new FilteredXmlInput(
+                            new StAXPullInput(new FOMStAXFilter(reader, options), false,
null),
+                            NamespaceRepairingFilter.DEFAULT),
+                    FOMNodeFactory.INSTANCE, factory, null);
             builder.addListener(new BuilderListener() {
                 @Override
                 public Runnable nodeAdded(CoreNode node, int depth) {



Mime
View raw message