Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 17156 invoked from network); 7 Nov 2003 11:53:53 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 7 Nov 2003 11:53:53 -0000 Received: (qmail 1258 invoked by uid 500); 7 Nov 2003 11:53:48 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 1210 invoked by uid 500); 7 Nov 2003 11:53:48 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 1169 invoked by uid 500); 7 Nov 2003 11:53:47 -0000 Delivered-To: apmail-cocoon-2.1-cvs@apache.org Received: (qmail 1153 invoked from network); 7 Nov 2003 11:53:47 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 7 Nov 2003 11:53:47 -0000 Received: (qmail 17023 invoked by uid 1260); 7 Nov 2003 11:53:47 -0000 Date: 7 Nov 2003 11:53:47 -0000 Message-ID: <20031107115347.17022.qmail@minotaur.apache.org> From: cziegeler@apache.org To: cocoon-2.1-cvs@apache.org Subject: cvs commit: cocoon-2.1/src/blocks/jxforms/java/org/apache/cocoon/generation JXFormsGenerator.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N cziegeler 2003/11/07 03:53:47 Modified: . status.xml src/java/org/apache/cocoon/generation JXTemplateGenerator.java src/blocks/jxforms/java/org/apache/cocoon/generation JXFormsGenerator.java Log: Applying patch from Sam Coward (samc@atnet.net.au) for reducing setDocumentLocator calls in JXTemplateGenerator and JXFormsGenerator. Revision Changes Path 1.187 +5 -1 cocoon-2.1/status.xml Index: status.xml =================================================================== RCS file: /home/cvs/cocoon-2.1/status.xml,v retrieving revision 1.186 retrieving revision 1.187 diff -u -r1.186 -r1.187 --- status.xml 7 Nov 2003 10:49:58 -0000 1.186 +++ status.xml 7 Nov 2003 11:53:47 -0000 1.187 @@ -192,6 +192,10 @@ + + Applying patch from Sam Coward (samc@atnet.net.au) for reducing + setDocumentLocator calls in JXTemplateGenerator and JXFormsGenerator. + sitemap-viewer added to the scratchpad samples 1.18 +41 -5 cocoon-2.1/src/java/org/apache/cocoon/generation/JXTemplateGenerator.java Index: JXTemplateGenerator.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/generation/JXTemplateGenerator.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- JXTemplateGenerator.java 6 Nov 2003 20:23:04 -0000 1.17 +++ JXTemplateGenerator.java 7 Nov 2003 11:53:47 -0000 1.18 @@ -395,6 +395,38 @@ } /** + * Facade to the Locator to be set on the consumer prior to + * sending other events, location member changeable + */ + public class LocatorFacade implements Locator { + private Locator locator; + + public LocatorFacade(Locator intialLocator) { + this.locator = intialLocator; + } + + public void setDocumentLocator(Locator newLocator) { + this.locator = newLocator; + } + + public int getColumnNumber() { + return this.locator.getColumnNumber(); + } + + public int getLineNumber() { + return this.locator.getLineNumber(); + } + + public String getPublicId() { + return this.locator.getPublicId(); + } + + public String getSystemId() { + return this.locator.getSystemId(); + } + } + + /** * Jexl Introspector that supports Rhino JavaScript objects * as well as Java Objects */ @@ -2800,10 +2832,12 @@ private void executeRaw(final XMLConsumer consumer, Event startEvent, Event endEvent) - throws SAXException { + throws SAXException { Event ev = startEvent; + LocatorFacade loc = new LocatorFacade(ev.location); + consumer.setDocumentLocator(loc); while (ev != endEvent) { - consumer.setDocumentLocator(ev.location); + loc.setDocumentLocator(ev.location); if (ev instanceof Characters) { TextEvent text = (TextEvent)ev; consumer.characters(text.raw, 0, text.raw.length); @@ -2918,10 +2952,12 @@ MyJexlContext jexlContext, JXPathContext jxpathContext, Event startEvent, Event endEvent) - throws SAXException { + throws SAXException { Event ev = startEvent; + LocatorFacade loc = new LocatorFacade(ev.location); + consumer.setDocumentLocator(loc); while (ev != endEvent) { - consumer.setDocumentLocator(ev.location); + loc.setDocumentLocator(ev.location); if (ev instanceof Characters) { TextEvent text = (TextEvent)ev; Iterator iter = text.substitutions.iterator(); 1.6 +35 -1 cocoon-2.1/src/blocks/jxforms/java/org/apache/cocoon/generation/JXFormsGenerator.java Index: JXFormsGenerator.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/jxforms/java/org/apache/cocoon/generation/JXFormsGenerator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- JXFormsGenerator.java 24 Sep 2003 22:04:40 -0000 1.5 +++ JXFormsGenerator.java 7 Nov 2003 11:53:47 -0000 1.6 @@ -167,6 +167,38 @@ final static String XF_VALUE = "xf:value"; + /** + * Facade to the Locator to be set on the consumer prior to + * sending other events, location member changeable + */ + public class LocatorFacade implements Locator { + private Locator locator; + + public LocatorFacade(Locator intialLocator) { + this.locator = intialLocator; + } + + public void setDocumentLocator(Locator newLocator) { + this.locator = newLocator; + } + + public int getColumnNumber() { + return this.locator.getColumnNumber(); + } + + public int getLineNumber() { + return this.locator.getLineNumber(); + } + + public String getPublicId() { + return this.locator.getPublicId(); + } + + public String getSystemId() { + return this.locator.getSystemId(); + } + } + static class XPathExpr { final CompiledExpression jxpath; @@ -1254,8 +1286,10 @@ Event startEvent, Event endEvent) throws SAXException { Event ev = startEvent; + LocatorFacade loc = new LocatorFacade(ev.location); + consumer.setDocumentLocator(loc); while (ev != endEvent) { - consumer.setDocumentLocator(ev.location); + loc.setDocumentLocator(ev.location); if (ev instanceof Characters) { TextEvent text = (TextEvent)ev; consumer.characters(text.chars, 0, text.chars.length);