Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 20FFF4171 for ; Fri, 13 May 2011 19:58:13 +0000 (UTC) Received: (qmail 72055 invoked by uid 500); 13 May 2011 19:58:13 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 72020 invoked by uid 500); 13 May 2011 19:58:13 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 72013 invoked by uid 99); 13 May 2011 19:58:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 May 2011 19:58:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 May 2011 19:58:10 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3E7712388A33; Fri, 13 May 2011 19:57:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1102879 - /sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/DefaultTransformer.java Date: Fri, 13 May 2011 19:57:49 -0000 To: commits@sling.apache.org From: justin@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110513195749.3E7712388A33@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: justin Date: Fri May 13 19:57:48 2011 New Revision: 1102879 URL: http://svn.apache.org/viewvc?rev=1102879&view=rev Log: SLING-2079 - creating a DefaultTransformer class Added: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/DefaultTransformer.java Added: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/DefaultTransformer.java URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/DefaultTransformer.java?rev=1102879&view=auto ============================================================================== --- sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/DefaultTransformer.java (added) +++ sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/DefaultTransformer.java Fri May 13 19:57:48 2011 @@ -0,0 +1,109 @@ +/* + * 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.sling.rewriter; + +import java.io.IOException; + +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; + +/** + * A generic base transformer which simply delegates all ContentHandler method + * invocations to the next ContentHandler. + */ +public class DefaultTransformer implements Transformer { + + private ContentHandler contentHandler; + protected ProcessingComponentConfiguration config; + protected Locator documentLocator; + protected ProcessingContext processingContext; + + public void characters(char[] ac, int i, int j) throws SAXException { + contentHandler.characters(ac, i, j); + } + + public void dispose() { + } + + + public void endDocument() throws SAXException { + contentHandler.endDocument(); + } + + + public void endElement(String s, String s1, String s2) throws SAXException { + contentHandler.endElement(s, s1, s2); + } + + + public void endPrefixMapping(String s) throws SAXException { + contentHandler.endPrefixMapping(s); + } + + + public void ignorableWhitespace(char[] ac, int i, int j) throws SAXException { + contentHandler.ignorableWhitespace(ac, i, j); + } + + + public void init(ProcessingContext context, ProcessingComponentConfiguration config) throws IOException { + this.processingContext = context; + this.config = config; + } + + + public void processingInstruction(String s, String s1) throws SAXException { + contentHandler.processingInstruction(s, s1); + } + + + public final void setContentHandler(ContentHandler handler) { + this.contentHandler = handler; + } + + + public void setDocumentLocator(Locator locator) { + this.documentLocator = locator; + + } + + + public void skippedEntity(String s) throws SAXException { + contentHandler.skippedEntity(s); + } + + + public void startDocument() throws SAXException { + contentHandler.startDocument(); + } + + + public void startElement(String s, String s1, String s2, Attributes attributes) throws SAXException { + contentHandler.startElement(s, s1, s2, attributes); + } + + public void startPrefixMapping(String s, String s1) throws SAXException { + contentHandler.startPrefixMapping(s, s1); + } + + protected ContentHandler getContentHandler() { + return contentHandler; + } + +}