cziegeler 2004/03/08 05:38:18
Modified: src/java/org/apache/cocoon/xml SaxBuffer.java Log: Make SAXBuffer serializable (to store it somewhere) Revision Changes Path 1.4 +34 -68 cocoon-2.2/src/java/org/apache/cocoon/xml/SaxBuffer.java Index: SaxBuffer.java =================================================================== RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/xml/SaxBuffer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SaxBuffer.java 1 Mar 2004 08:24:59 -0000 1.3 +++ SaxBuffer.java 8 Mar 2004 13:38:18 -0000 1.4 @@ -1,53 +1,18 @@ /* - - ============================================================================ - The Apache Software License, Version 1.1 - ============================================================================ - - Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. - - Redistribution and use in source and binary forms, with or without modifica- - tion, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. The end-user documentation included with the redistribution, if any, must - include the following acknowledgment: "This product includes software - developed by the Apache Software Foundation (http://www.apache.org/)." - Alternately, this acknowledgment may appear in the software itself, if - and wherever such third-party acknowledgments normally appear. - - 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be - used to endorse or promote products derived from this software without - prior written permission. For written permission, please contact - [EMAIL PROTECTED] - - 5. Products derived from this software may not be called "Apache", nor may - "Apache" appear in their name, without prior written permission of the - Apache Software Foundation. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - This software consists of voluntary contributions made by many individuals - on behalf of the Apache Software Foundation and was originally created by - Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache - Software Foundation, please see <http://www.apache.org/>. - -*/ + * Copyright 1999-2004 The Apache Software Foundation. + * + * Licensed 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.cocoon.xml; import org.xml.sax.ContentHandler; @@ -58,6 +23,7 @@ import org.apache.excalibur.xml.sax.XMLizable; import org.apache.avalon.excalibur.pool.Recyclable; +import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -79,7 +45,7 @@ * @author <a href="mailto:[email protected]">Apache Cocoon Team</a> * @version CVS $Id$ */ -public class SaxBuffer implements XMLConsumer, XMLizable, Recyclable { +public class SaxBuffer implements XMLConsumer, XMLizable, Recyclable, Serializable { /** * Stores list of [EMAIL PROTECTED] SaxBit} objects. @@ -224,21 +190,21 @@ public void send(ContentHandler contentHandler) throws SAXException; } - final static class StartDocument implements SaxBit { + final static class StartDocument implements SaxBit, Serializable { static public final StartDocument SINGLETON = new StartDocument(); public void send(ContentHandler contentHandler) throws SAXException { contentHandler.startDocument(); } } - final static class EndDocument implements SaxBit { + final static class EndDocument implements SaxBit, Serializable { static public final EndDocument SINGLETON = new EndDocument(); public void send(ContentHandler contentHandler) throws SAXException { contentHandler.endDocument(); } } - final static class PI implements SaxBit { + final static class PI implements SaxBit, Serializable { private final String target; private final String data; @@ -252,7 +218,7 @@ } } - final static class StartDTD implements SaxBit { + final static class StartDTD implements SaxBit, Serializable { private final String name; private final String publicId; private final String systemId; @@ -269,7 +235,7 @@ } } - final static class EndDTD implements SaxBit { + final static class EndDTD implements SaxBit, Serializable { static public final EndDTD SINGLETON = new EndDTD(); public void send(ContentHandler contentHandler) throws SAXException { if (contentHandler instanceof LexicalHandler) @@ -277,7 +243,7 @@ } } - final static class StartEntity implements SaxBit { + final static class StartEntity implements SaxBit, Serializable { private final String name; public StartEntity(String name) { @@ -290,7 +256,7 @@ } } - final static class EndEntity implements SaxBit { + final static class EndEntity implements SaxBit, Serializable { private final String name; public EndEntity(String name) { @@ -303,7 +269,7 @@ } } - final static class SkippedEntity implements SaxBit { + final static class SkippedEntity implements SaxBit, Serializable { private final String name; public SkippedEntity(String name) { @@ -315,7 +281,7 @@ } } - final static class StartPrefixMapping implements SaxBit { + final static class StartPrefixMapping implements SaxBit, Serializable { private final String prefix; private final String uri; @@ -329,7 +295,7 @@ } } - final static class EndPrefixMapping implements SaxBit { + final static class EndPrefixMapping implements SaxBit, Serializable { private final String prefix; public EndPrefixMapping(String prefix) { @@ -341,7 +307,7 @@ } } - final static class StartElement implements SaxBit { + final static class StartElement implements SaxBit, Serializable { private final String namespaceURI; private final String localName; private final String qName; @@ -359,7 +325,7 @@ } } - final static class EndElement implements SaxBit { + final static class EndElement implements SaxBit, Serializable { private final String namespaceURI; private final String localName; private final String qName; @@ -375,7 +341,7 @@ } } - final static class Characters implements SaxBit { + final static class Characters implements SaxBit, Serializable { private final char[] ch; public Characters(char[] ch, int start, int length) { @@ -393,7 +359,7 @@ } } - final static class Comment implements SaxBit { + final static class Comment implements SaxBit, Serializable { private final char[] ch; public Comment(char[] ch, int start, int length) { @@ -408,7 +374,7 @@ } } - final static class StartCDATA implements SaxBit { + final static class StartCDATA implements SaxBit, Serializable { static public final StartCDATA SINGLETON = new StartCDATA(); public void send(ContentHandler contentHandler) throws SAXException { if (contentHandler instanceof LexicalHandler) @@ -416,7 +382,7 @@ } } - final static class EndCDATA implements SaxBit { + final static class EndCDATA implements SaxBit, Serializable { static public final EndCDATA SINGLETON = new EndCDATA(); public void send(ContentHandler contentHandler) throws SAXException { if (contentHandler instanceof LexicalHandler) @@ -424,7 +390,7 @@ } } - final static class IgnorableWhitespace implements SaxBit { + final static class IgnorableWhitespace implements SaxBit, Serializable { private final char[] ch; public IgnorableWhitespace(char[] ch, int start, int length) {
