001    /** 
002     * 
003     * Copyright 2004 Protique Ltd
004     * 
005     * Licensed under the Apache License, Version 2.0 (the "License"); 
006     * you may not use this file except in compliance with the License. 
007     * You may obtain a copy of the License at 
008     * 
009     * http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS, 
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
014     * See the License for the specific language governing permissions and 
015     * limitations under the License. 
016     * 
017     **/
018    package org.codehaus.activesoap.util;
019    
020    import javax.xml.namespace.NamespaceContext;
021    import javax.xml.stream.XMLStreamException;
022    import javax.xml.stream.XMLStreamWriter;
023    
024    /**
025     * A Delegate implementation of {@link XMLStreamWriter} which delegates
026     * all the methods to a child instance - useful for implementing filters.
027     *
028     * @version $Revision: 1.3 $
029     */
030    public abstract class DelegateXMLStreamWriter implements XMLStreamWriter {
031        private XMLStreamWriter delegate;
032    
033        public DelegateXMLStreamWriter(XMLStreamWriter delegate) {
034            if (delegate == null) {
035                throw new NullPointerException("You must specify a delegate instance");
036            }
037            this.delegate = delegate;
038        }
039    
040        public void close() throws XMLStreamException {
041            delegate.close();
042        }
043    
044        public void flush() throws XMLStreamException {
045            delegate.flush();
046        }
047    
048        public NamespaceContext getNamespaceContext() {
049            return delegate != null ? delegate.getNamespaceContext() : null;
050        }
051    
052        public String getPrefix(String s) throws XMLStreamException {
053            return delegate.getPrefix(s);
054        }
055    
056        public Object getProperty(String s) throws IllegalArgumentException {
057            return delegate.getProperty(s);
058        }
059    
060        public void setDefaultNamespace(String s) throws XMLStreamException {
061            delegate.setDefaultNamespace(s);
062        }
063    
064        public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException {
065            delegate.setNamespaceContext(namespaceContext);
066        }
067    
068        public void setPrefix(String s, String s1) throws XMLStreamException {
069            delegate.setPrefix(s, s1);
070        }
071    
072        public void writeAttribute(String s, String s1) throws XMLStreamException {
073            delegate.writeAttribute(s, s1);
074        }
075    
076        public void writeAttribute(String s, String s1, String s2) throws XMLStreamException {
077            delegate.writeAttribute(s, s1, s2);
078        }
079    
080        public void writeAttribute(String s, String s1, String s2, String s3) throws XMLStreamException {
081            delegate.writeAttribute(s, s1, s2, s3);
082        }
083    
084        public void writeCData(String s) throws XMLStreamException {
085            delegate.writeCData(s);
086        }
087    
088        public void writeCharacters(char[] chars, int i, int i1) throws XMLStreamException {
089            delegate.writeCharacters(chars, i, i1);
090        }
091    
092        public void writeCharacters(String s) throws XMLStreamException {
093            delegate.writeCharacters(s);
094        }
095    
096        public void writeComment(String s) throws XMLStreamException {
097            delegate.writeComment(s);
098        }
099    
100        public void writeDefaultNamespace(String s) throws XMLStreamException {
101            delegate.writeDefaultNamespace(s);
102        }
103    
104        public void writeDTD(String s) throws XMLStreamException {
105            delegate.writeDTD(s);
106        }
107    
108        public void writeEmptyElement(String s) throws XMLStreamException {
109            delegate.writeEmptyElement(s);
110        }
111    
112        public void writeEmptyElement(String s, String s1) throws XMLStreamException {
113            delegate.writeEmptyElement(s, s1);
114        }
115    
116        public void writeEmptyElement(String s, String s1, String s2) throws XMLStreamException {
117            delegate.writeEmptyElement(s, s1, s2);
118        }
119    
120        public void writeEndDocument() throws XMLStreamException {
121            delegate.writeEndDocument();
122        }
123    
124        public void writeEndElement() throws XMLStreamException {
125            delegate.writeEndElement();
126        }
127    
128        public void writeEntityRef(String s) throws XMLStreamException {
129            delegate.writeEntityRef(s);
130        }
131    
132        public void writeNamespace(String s, String s1) throws XMLStreamException {
133            delegate.writeNamespace(s, s1);
134        }
135    
136        public void writeProcessingInstruction(String s) throws XMLStreamException {
137            delegate.writeProcessingInstruction(s);
138        }
139    
140        public void writeProcessingInstruction(String s, String s1) throws XMLStreamException {
141            delegate.writeProcessingInstruction(s, s1);
142        }
143    
144        public void writeStartDocument() throws XMLStreamException {
145            delegate.writeStartDocument();
146        }
147    
148        public void writeStartDocument(String s) throws XMLStreamException {
149            delegate.writeStartDocument(s);
150        }
151    
152        public void writeStartDocument(String s, String s1) throws XMLStreamException {
153            delegate.writeStartDocument(s, s1);
154        }
155    
156        public void writeStartElement(String s) throws XMLStreamException {
157            delegate.writeStartElement(s);
158        }
159    
160        public void writeStartElement(String s, String s1) throws XMLStreamException {
161            delegate.writeStartElement(s, s1);
162        }
163    
164        public void writeStartElement(String s, String s1, String s2) throws XMLStreamException {
165            delegate.writeStartElement(s, s1, s2);
166        }
167    }