You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2009/08/01 21:09:50 UTC

svn commit: r799907 - in /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax: ./ dialect/ wrapper/

Author: veithen
Date: Sat Aug  1 19:09:49 2009
New Revision: 799907

URL: http://svn.apache.org/viewvc?rev=799907&view=rev
Log:
Added wrapper base classes for XMLInputFactory and XMLOutputFactory and moved all the wrapper base classes to a separate package.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLInputFactory.java   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLOutputFactory.java   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLInputFactoryWrapper.java   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLOutputFactoryWrapper.java   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderWrapper.java
      - copied, changed from r799903, webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamWriterWrapper.java
      - copied, changed from r799903, webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterWrapper.java
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterWrapper.java
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLInputFactoryWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLOutputFactoryWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamReaderWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamWriterWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/WoodstoxStreamReaderWrapper.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLInputFactoryWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLInputFactoryWrapper.java?rev=799907&r1=799906&r2=799907&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLInputFactoryWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLInputFactoryWrapper.java Sat Aug  1 19:09:49 2009
@@ -19,130 +19,20 @@
 
 package org.apache.axiom.util.stax.dialect;
 
-import java.io.InputStream;
-import java.io.Reader;
-
-import javax.xml.stream.EventFilter;
-import javax.xml.stream.StreamFilter;
-import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLReporter;
-import javax.xml.stream.XMLResolver;
-import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.util.XMLEventAllocator;
-import javax.xml.transform.Source;
 
-class NormalizingXMLInputFactoryWrapper extends XMLInputFactory {
-    private final XMLInputFactory parent;
+import org.apache.axiom.util.stax.wrapper.WrappingXMLInputFactory;
+
+class NormalizingXMLInputFactoryWrapper extends WrappingXMLInputFactory {
     private final AbstractStAXDialect dialect;
 
     public NormalizingXMLInputFactoryWrapper(XMLInputFactory parent, AbstractStAXDialect dialect) {
-        this.parent = parent;
+        super(parent);
         this.dialect = dialect;
     }
 
-    public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
-            throws XMLStreamException {
-        return parent.createFilteredReader(reader, filter);
-    }
-
-    public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
-            throws XMLStreamException {
-        return dialect.normalize(parent.createFilteredReader(reader, filter));
-    }
-
-    public XMLEventReader createXMLEventReader(InputStream stream, String encoding)
-            throws XMLStreamException {
-        return parent.createXMLEventReader(stream, encoding);
-    }
-
-    public XMLEventReader createXMLEventReader(InputStream stream) throws XMLStreamException {
-        return parent.createXMLEventReader(stream);
-    }
-
-    public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException {
-        return parent.createXMLEventReader(reader);
-    }
-
-    public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException {
-        return parent.createXMLEventReader(source);
-    }
-
-    public XMLEventReader createXMLEventReader(String systemId, InputStream stream)
-            throws XMLStreamException {
-        return parent.createXMLEventReader(systemId, stream);
-    }
-
-    public XMLEventReader createXMLEventReader(String systemId, Reader reader)
-            throws XMLStreamException {
-        return parent.createXMLEventReader(systemId, reader);
-    }
-
-    public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException {
-        return parent.createXMLEventReader(reader);
-    }
-
-    public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding)
-            throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamReader(stream, encoding));
-    }
-
-    public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamReader(stream));
-    }
-
-    public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamReader(reader));
-    }
-
-    public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamReader(source));
-    }
-
-    public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream)
-            throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamReader(systemId, stream));
-    }
-
-    public XMLStreamReader createXMLStreamReader(String systemId, Reader reader)
-            throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamReader(systemId, reader));
-    }
-
-    public XMLEventAllocator getEventAllocator() {
-        return parent.getEventAllocator();
-    }
-
-    public Object getProperty(String name) throws IllegalArgumentException {
-        return parent.getProperty(name);
-    }
-
-    public XMLReporter getXMLReporter() {
-        return parent.getXMLReporter();
-    }
-
-    public XMLResolver getXMLResolver() {
-        return parent.getXMLResolver();
-    }
-
-    public boolean isPropertySupported(String name) {
-        return parent.isPropertySupported(name);
-    }
-
-    public void setEventAllocator(XMLEventAllocator allocator) {
-        parent.setEventAllocator(allocator);
-    }
-
-    public void setProperty(String name, Object value) throws IllegalArgumentException {
-        parent.setProperty(name, value);
-    }
-
-    public void setXMLReporter(XMLReporter reporter) {
-        parent.setXMLReporter(reporter);
-    }
-
-    public void setXMLResolver(XMLResolver resolver) {
-        parent.setXMLResolver(resolver);
+    protected XMLStreamReader wrap(XMLStreamReader reader) {
+        return dialect.normalize(reader);
     }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLOutputFactoryWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLOutputFactoryWrapper.java?rev=799907&r1=799906&r2=799907&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLOutputFactoryWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/NormalizingXMLOutputFactoryWrapper.java Sat Aug  1 19:09:49 2009
@@ -19,67 +19,20 @@
 
 package org.apache.axiom.util.stax.dialect;
 
-import java.io.OutputStream;
-import java.io.Writer;
-
-import javax.xml.stream.XMLEventWriter;
 import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.Result;
 
-class NormalizingXMLOutputFactoryWrapper extends XMLOutputFactory {
-    private final XMLOutputFactory parent;
+import org.apache.axiom.util.stax.wrapper.WrappingXMLOutputFactory;
+
+class NormalizingXMLOutputFactoryWrapper extends WrappingXMLOutputFactory {
     private final AbstractStAXDialect dialect;
     
     public NormalizingXMLOutputFactoryWrapper(XMLOutputFactory parent, AbstractStAXDialect dialect) {
-        this.parent = parent;
+        super(parent);
         this.dialect = dialect;
     }
 
-    public XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding)
-            throws XMLStreamException {
-        return parent.createXMLEventWriter(stream, encoding);
-    }
-
-    public XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException {
-        return parent.createXMLEventWriter(stream);
-    }
-
-    public XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException {
-        return parent.createXMLEventWriter(result);
-    }
-
-    public XMLEventWriter createXMLEventWriter(Writer stream) throws XMLStreamException {
-        return parent.createXMLEventWriter(stream);
-    }
-
-    public XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding)
-            throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamWriter(stream, encoding));
-    }
-
-    public XMLStreamWriter createXMLStreamWriter(OutputStream stream) throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamWriter(stream));
-    }
-
-    public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamWriter(result));
-    }
-
-    public XMLStreamWriter createXMLStreamWriter(Writer stream) throws XMLStreamException {
-        return dialect.normalize(parent.createXMLStreamWriter(stream));
-    }
-
-    public Object getProperty(String name) throws IllegalArgumentException {
-        return parent.getProperty(name);
-    }
-
-    public boolean isPropertySupported(String name) {
-        return parent.isPropertySupported(name);
-    }
-
-    public void setProperty(String name, Object value) throws IllegalArgumentException {
-        parent.setProperty(name, value);
+    protected XMLStreamWriter wrap(XMLStreamWriter writer) {
+        return dialect.normalize(writer);
     }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamReaderWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamReaderWrapper.java?rev=799907&r1=799906&r2=799907&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamReaderWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamReaderWrapper.java Sat Aug  1 19:09:49 2009
@@ -24,7 +24,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.axiom.util.stax.XMLStreamReaderWrapper;
+import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper;
 
 class SJSXPStreamReaderWrapper extends XMLStreamReaderWrapper {
     public SJSXPStreamReaderWrapper(XMLStreamReader parent) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamWriterWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamWriterWrapper.java?rev=799907&r1=799906&r2=799907&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamWriterWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/SJSXPStreamWriterWrapper.java Sat Aug  1 19:09:49 2009
@@ -21,7 +21,7 @@
 
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.axiom.util.stax.XMLStreamWriterWrapper;
+import org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper;
 
 class SJSXPStreamWriterWrapper extends XMLStreamWriterWrapper {
     public SJSXPStreamWriterWrapper(XMLStreamWriter parent) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/WoodstoxStreamReaderWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/WoodstoxStreamReaderWrapper.java?rev=799907&r1=799906&r2=799907&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/WoodstoxStreamReaderWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/dialect/WoodstoxStreamReaderWrapper.java Sat Aug  1 19:09:49 2009
@@ -20,7 +20,7 @@
 
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.axiom.util.stax.XMLStreamReaderWrapper;
+import org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper;
 
 class WoodstoxStreamReaderWrapper extends XMLStreamReaderWrapper {
     public WoodstoxStreamReaderWrapper(XMLStreamReader reader) {

Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLInputFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLInputFactory.java?rev=799907&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLInputFactory.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLInputFactory.java Sat Aug  1 19:09:49 2009
@@ -0,0 +1,140 @@
+/*
+ * 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.util.stax.wrapper;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+
+/**
+ * {@link XMLInputFactory} wrapper that wraps all {@link XMLEventReader} and {@link XMLStreamReader}
+ * instances created from it.
+ */
+public class WrappingXMLInputFactory extends XMLInputFactoryWrapper {
+    /**
+     * Constructor.
+     * 
+     * @param parent the parent factory
+     */
+    public WrappingXMLInputFactory(XMLInputFactory parent) {
+        super(parent);
+    }
+
+    /**
+     * Wrap a reader created from this factory. Implementations should override this method if they
+     * which to wrap {@link XMLEventReader} instances created from the factory. The default
+     * implementation simply returns the unwrapped reader.
+     * 
+     * @param reader
+     *            the reader to wrap
+     * @return the wrapped reader
+     */
+    protected XMLEventReader wrap(XMLEventReader reader) {
+        return reader;
+    }
+    
+    /**
+     * Wrap a reader created from this factory. Implementations should override this method if they
+     * which to wrap {@link XMLStreamReader} instances created from the factory. The default
+     * implementation simply returns the unwrapped reader.
+     * 
+     * @param reader
+     *            the reader to wrap
+     * @return the wrapped reader
+     */
+    protected XMLStreamReader wrap(XMLStreamReader reader) {
+        return reader;
+    }
+
+    public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
+            throws XMLStreamException {
+        return wrap(super.createFilteredReader(reader, filter));
+    }
+
+    public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
+            throws XMLStreamException {
+        return wrap(super.createFilteredReader(reader, filter));
+    }
+
+    public XMLEventReader createXMLEventReader(InputStream stream, String encoding)
+            throws XMLStreamException {
+        return wrap(super.createXMLEventReader(stream, encoding));
+    }
+
+    public XMLEventReader createXMLEventReader(InputStream stream) throws XMLStreamException {
+        return wrap(super.createXMLEventReader(stream));
+    }
+
+    public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException {
+        return wrap(super.createXMLEventReader(reader));
+    }
+
+    public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException {
+        return wrap(super.createXMLEventReader(source));
+    }
+
+    public XMLEventReader createXMLEventReader(String systemId, InputStream stream)
+            throws XMLStreamException {
+        return wrap(super.createXMLEventReader(systemId, stream));
+    }
+
+    public XMLEventReader createXMLEventReader(String systemId, Reader reader)
+            throws XMLStreamException {
+        return wrap(super.createXMLEventReader(systemId, reader));
+    }
+
+    public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException {
+        return wrap(super.createXMLEventReader(reader));
+    }
+
+    public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding)
+            throws XMLStreamException {
+        return wrap(super.createXMLStreamReader(stream, encoding));
+    }
+
+    public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException {
+        return wrap(super.createXMLStreamReader(stream));
+    }
+
+    public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
+        return wrap(super.createXMLStreamReader(reader));
+    }
+
+    public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
+        return wrap(super.createXMLStreamReader(source));
+    }
+
+    public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream)
+            throws XMLStreamException {
+        return wrap(super.createXMLStreamReader(systemId, stream));
+    }
+
+    public XMLStreamReader createXMLStreamReader(String systemId, Reader reader)
+            throws XMLStreamException {
+        return wrap(super.createXMLStreamReader(systemId, reader));
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLInputFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLOutputFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLOutputFactory.java?rev=799907&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLOutputFactory.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLOutputFactory.java Sat Aug  1 19:09:49 2009
@@ -0,0 +1,104 @@
+/*
+ * 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.util.stax.wrapper;
+
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+
+/**
+ * {@link XMLOutputFactory} wrapper that wraps all {@link XMLEventWriter} and {@link XMLStreamWriter}
+ * instances created from it.
+ */
+public class WrappingXMLOutputFactory extends XMLOutputFactoryWrapper {
+    /**
+     * Constructor.
+     * 
+     * @param parent the parent factory
+     */
+    public WrappingXMLOutputFactory(XMLOutputFactory parent) {
+        super(parent);
+    }
+
+    /**
+     * Wrap a writer created from this factory. Implementations should override this method if they
+     * which to wrap {@link XMLEventWriter} instances created from the factory. The default
+     * implementation simply returns the unwrapped writer.
+     * 
+     * @param reader
+     *            the writer to wrap
+     * @return the wrapped writer
+     */
+    protected XMLEventWriter wrap(XMLEventWriter writer) {
+        return writer;
+    }
+    
+    /**
+     * Wrap a writer created from this factory. Implementations should override this method if they
+     * which to wrap {@link XMLStreamWriter} instances created from the factory. The default
+     * implementation simply returns the unwrapped writer.
+     * 
+     * @param reader
+     *            the writer to wrap
+     * @return the wrapped writer
+     */
+    protected XMLStreamWriter wrap(XMLStreamWriter writer) {
+        return writer;
+    }
+
+    public XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding)
+            throws XMLStreamException {
+        return wrap(super.createXMLEventWriter(stream, encoding));
+    }
+
+    public XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException {
+        return wrap(super.createXMLEventWriter(stream));
+    }
+
+    public XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException {
+        return wrap(super.createXMLEventWriter(result));
+    }
+
+    public XMLEventWriter createXMLEventWriter(Writer stream) throws XMLStreamException {
+        return wrap(super.createXMLEventWriter(stream));
+    }
+
+    public XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding)
+            throws XMLStreamException {
+        return wrap(super.createXMLStreamWriter(stream, encoding));
+    }
+
+    public XMLStreamWriter createXMLStreamWriter(OutputStream stream) throws XMLStreamException {
+        return wrap(super.createXMLStreamWriter(stream));
+    }
+
+    public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException {
+        return wrap(super.createXMLStreamWriter(result));
+    }
+
+    public XMLStreamWriter createXMLStreamWriter(Writer stream) throws XMLStreamException {
+        return wrap(super.createXMLStreamWriter(stream));
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/WrappingXMLOutputFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLInputFactoryWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLInputFactoryWrapper.java?rev=799907&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLInputFactoryWrapper.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLInputFactoryWrapper.java Sat Aug  1 19:09:49 2009
@@ -0,0 +1,155 @@
+/*
+ * 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.util.stax.wrapper;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLReporter;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.XMLEventAllocator;
+import javax.xml.transform.Source;
+
+/**
+ * Base class for {@link XMLInputFactory} wrappers. The class provides default implementations for
+ * all methods. Each of them calls the corresponding method in the parent factory.
+ */
+public class XMLInputFactoryWrapper extends XMLInputFactory {
+    private final XMLInputFactory parent;
+
+    /**
+     * Constructor.
+     * 
+     * @param parent the parent factory
+     */
+    public XMLInputFactoryWrapper(XMLInputFactory parent) {
+        this.parent = parent;
+    }
+
+    public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
+            throws XMLStreamException {
+        return parent.createFilteredReader(reader, filter);
+    }
+
+    public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
+            throws XMLStreamException {
+        return parent.createFilteredReader(reader, filter);
+    }
+
+    public XMLEventReader createXMLEventReader(InputStream stream, String encoding)
+            throws XMLStreamException {
+        return parent.createXMLEventReader(stream, encoding);
+    }
+
+    public XMLEventReader createXMLEventReader(InputStream stream) throws XMLStreamException {
+        return parent.createXMLEventReader(stream);
+    }
+
+    public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException {
+        return parent.createXMLEventReader(reader);
+    }
+
+    public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException {
+        return parent.createXMLEventReader(source);
+    }
+
+    public XMLEventReader createXMLEventReader(String systemId, InputStream stream)
+            throws XMLStreamException {
+        return parent.createXMLEventReader(systemId, stream);
+    }
+
+    public XMLEventReader createXMLEventReader(String systemId, Reader reader)
+            throws XMLStreamException {
+        return parent.createXMLEventReader(systemId, reader);
+    }
+
+    public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException {
+        return parent.createXMLEventReader(reader);
+    }
+
+    public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding)
+            throws XMLStreamException {
+        return parent.createXMLStreamReader(stream, encoding);
+    }
+
+    public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException {
+        return parent.createXMLStreamReader(stream);
+    }
+
+    public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
+        return parent.createXMLStreamReader(reader);
+    }
+
+    public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
+        return parent.createXMLStreamReader(source);
+    }
+
+    public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream)
+            throws XMLStreamException {
+        return parent.createXMLStreamReader(systemId, stream);
+    }
+
+    public XMLStreamReader createXMLStreamReader(String systemId, Reader reader)
+            throws XMLStreamException {
+        return parent.createXMLStreamReader(systemId, reader);
+    }
+
+    public XMLEventAllocator getEventAllocator() {
+        return parent.getEventAllocator();
+    }
+
+    public Object getProperty(String name) throws IllegalArgumentException {
+        return parent.getProperty(name);
+    }
+
+    public XMLReporter getXMLReporter() {
+        return parent.getXMLReporter();
+    }
+
+    public XMLResolver getXMLResolver() {
+        return parent.getXMLResolver();
+    }
+
+    public boolean isPropertySupported(String name) {
+        return parent.isPropertySupported(name);
+    }
+
+    public void setEventAllocator(XMLEventAllocator allocator) {
+        parent.setEventAllocator(allocator);
+    }
+
+    public void setProperty(String name, Object value) throws IllegalArgumentException {
+        parent.setProperty(name, value);
+    }
+
+    public void setXMLReporter(XMLReporter reporter) {
+        parent.setXMLReporter(reporter);
+    }
+
+    public void setXMLResolver(XMLResolver resolver) {
+        parent.setXMLResolver(resolver);
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLInputFactoryWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLOutputFactoryWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLOutputFactoryWrapper.java?rev=799907&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLOutputFactoryWrapper.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLOutputFactoryWrapper.java Sat Aug  1 19:09:49 2009
@@ -0,0 +1,92 @@
+/*
+ * 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.util.stax.wrapper;
+
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+
+/**
+ * Base class for {@link XMLOutputFactory} wrappers. The class provides default implementations for
+ * all methods. Each of them calls the corresponding method in the parent factory.
+ */
+public class XMLOutputFactoryWrapper extends XMLOutputFactory {
+    private final XMLOutputFactory parent;
+
+    /**
+     * Constructor.
+     * 
+     * @param parent the parent factory
+     */
+    public XMLOutputFactoryWrapper(XMLOutputFactory parent) {
+        this.parent = parent;
+    }
+
+    public XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding)
+            throws XMLStreamException {
+        return parent.createXMLEventWriter(stream, encoding);
+    }
+
+    public XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException {
+        return parent.createXMLEventWriter(stream);
+    }
+
+    public XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException {
+        return parent.createXMLEventWriter(result);
+    }
+
+    public XMLEventWriter createXMLEventWriter(Writer stream) throws XMLStreamException {
+        return parent.createXMLEventWriter(stream);
+    }
+
+    public XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding)
+            throws XMLStreamException {
+        return parent.createXMLStreamWriter(stream, encoding);
+    }
+
+    public XMLStreamWriter createXMLStreamWriter(OutputStream stream) throws XMLStreamException {
+        return parent.createXMLStreamWriter(stream);
+    }
+
+    public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException {
+        return parent.createXMLStreamWriter(result);
+    }
+
+    public XMLStreamWriter createXMLStreamWriter(Writer stream) throws XMLStreamException {
+        return parent.createXMLStreamWriter(stream);
+    }
+
+    public Object getProperty(String name) throws IllegalArgumentException {
+        return parent.getProperty(name);
+    }
+
+    public boolean isPropertySupported(String name) {
+        return parent.isPropertySupported(name);
+    }
+
+    public void setProperty(String name, Object value) throws IllegalArgumentException {
+        parent.setProperty(name, value);
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLOutputFactoryWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderWrapper.java (from r799903, webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderWrapper.java)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderWrapper.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderWrapper.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderWrapper.java&r1=799903&r2=799907&rev=799907&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderWrapper.java Sat Aug  1 19:09:49 2009
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.axiom.util.stax;
+package org.apache.axiom.util.stax.wrapper;
 
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;

Copied: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamWriterWrapper.java (from r799903, webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterWrapper.java)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamWriterWrapper.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamWriterWrapper.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterWrapper.java&r1=799903&r2=799907&rev=799907&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamWriterWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamWriterWrapper.java Sat Aug  1 19:09:49 2009
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.axiom.util.stax;
+package org.apache.axiom.util.stax.wrapper;
 
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.stream.XMLStreamException;