Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 66219 invoked from network); 26 Jun 2002 14:51:24 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by 209.66.108.5 with SMTP; 26 Jun 2002 14:51:24 -0000 Received: (qmail 14118 invoked by uid 97); 26 Jun 2002 14:51:23 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 14058 invoked by uid 97); 26 Jun 2002 14:51:22 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 14047 invoked by uid 97); 26 Jun 2002 14:51:21 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: 26 Jun 2002 14:50:44 -0000 Message-ID: <20020626145044.54576.qmail@icarus.apache.org> From: jstrachan@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core FileTag.java CoreTagLibrary.java ForEachTag.java X-Spam-Rating: 209.66.108.5 1.6.2 0/1000/N X-Spam-Rating: 209.66.108.5 1.6.2 0/1000/N jstrachan 2002/06/26 07:50:44 Modified: jelly/src/test/org/apache/commons/jelly testThread.jelly jelly/src/test/org/apache/commons/jelly/define TestDynamicTags.java jelly build.xml project.xml jelly/src/java/org/apache/commons/jelly/tags/core CoreTagLibrary.java ForEachTag.java Added: jelly/src/test/org/apache/commons/jelly testFile.jelly jelly project-ng.xml jelly/src/java/org/apache/commons/jelly/tags/core FileTag.java Log: Patched the tag so that it works for simple numerical for loops. Also added the tag which will generate a file of the given name with the contents of its body, which is good for generating multiple files from inside a Jelly script Revision Changes Path 1.2 +0 -2 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/testThread.jelly Index: testThread.jelly =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/testThread.jelly,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- testThread.jelly 26 Jun 2002 09:17:44 -0000 1.1 +++ testThread.jelly 26 Jun 2002 14:50:43 -0000 1.2 @@ -3,7 +3,6 @@ About to spawn another thread... - The thread should have started now! 1.1 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/testFile.jelly Index: testFile.jelly =================================================================== a test 1.7 +6 -6 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/define/TestDynamicTags.java Index: TestDynamicTags.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/define/TestDynamicTags.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestDynamicTags.java 25 Jun 2002 19:12:29 -0000 1.6 +++ TestDynamicTags.java 26 Jun 2002 14:50:43 -0000 1.7 @@ -126,7 +126,7 @@ log.info("The output was as follows"); log.info(buffer.toString()); } - + protected void runScript(String name) throws Exception { InputStream in = new FileInputStream(name); Script script = parser.parse(in); 1.58 +6 -0 jakarta-commons-sandbox/jelly/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/build.xml,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- build.xml 26 Jun 2002 09:15:13 -0000 1.57 +++ build.xml 26 Jun 2002 14:50:43 -0000 1.58 @@ -338,6 +338,12 @@ + + + + + 1.29 +2 -2 jakarta-commons-sandbox/jelly/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/project.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- project.xml 25 Jun 2002 16:12:33 -0000 1.28 +++ project.xml 26 Jun 2002 14:50:43 -0000 1.29 @@ -189,8 +189,8 @@ commons-messenger required - 1.0-dev-2 - commons-messenger-1.0-dev-2.jar + 1.0-dev-3 + commons-messenger-1.0-dev-3.jar 1.1 jakarta-commons-sandbox/jelly/project-ng.xml Index: project-ng.xml =================================================================== 3 commons-jelly commons-jelly 1.0-dev Apache Software Foundation http://www.apache.org 2002 org.apache.commons.jelly Commons Jelly jakarta Jelly is a Java and XML based scripting engine. Jelly combines the best ideas from JSTL, Velocity, DVSL, Ant and Cocoon all together in a simple yet powerful scripting engine. http://jakarta.apache.org/commons/sandbox/jelly/ http://nagoya.apache.org/scarab/servlet/scarab/ jakarta.apache.org /www/jakarta.apache.org/commons/sandbox/jelly/ /www/jakarta.apache.org/builds/jakarta-commons-sandbox/jelly/ scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-commons-sandbox/jelly http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/jelly/ b1 1.0-b1 HEAD Commons Dev List commons-dev-subscribe@jakarta.apache.org commons-dev-unsubscribe@jakarta.apache.org http://nagoya.apache.org/eyebrowse/SummarizeList?listName=commons-dev@jakarta.apache.org James Strachan jstrachan jstrachan@apache.org SpiritSoft, Inc. Geir Magnusson Jr. geirm geirm@adeptra.com Adeptra, Inc. Bob McWhirter werken bob@eng.werken.com The Werken Company dIon Gillard dion dion@multitask.com.au Multitask Consulting Interested party ant 1.4.1 ant-1.4.1.jar commons-logging required 1.0 commons-logging-1.0.jar commons-beanutils required 1.4-dev commons-beanutils-1.4-dev.jar commons-collections required 2.0 commons-collections-2.0.jar commons-digester required 1.2 commons-digester-1.2.jar dom4j required 1.4-dev-3 dom4j-1.4-dev-3.jar commons-jexl required 1.0-dev commons-jexl-1.0-dev.jar velocity required 1.4-dev velocity-1.4-dev.jar jdbc-stdext required 2.0 jdbc2_0-stdext.jar werkz required 1.0-beta-2 werkz-1.0-beta-2.jar bsh required 1.2-b3 bsh-1.2-b3.jar bsf required 2.2 bsf-2.2.jar ojb required ojb-0.8.375 ojb-0.8.375.jar jms required 1.0.2b jms-1.0.2b.jar commons-messenger required 1.0-dev-2 commons-messenger-1.0-dev-2.jar commons-httpclient required 2.0-dev commons-httpclient-2.0-dev.jar isorelax required 20020414 isorelax-20020414.jar msv required 20020414 msv-20020414.jar xsdlib required 20020414 xsdlib-20020414.jar relaxngDatatype required 20020414 relaxngDatatype-20020414.jar hsqldb required 1.7.0 hsqldb-1.7.0.jar commons-dev@jakarta.apache.org src/java src/test include = **/Test*.java include = **/*.properties 1.13 +6 -5 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/CoreTagLibrary.java Index: CoreTagLibrary.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/CoreTagLibrary.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- CoreTagLibrary.java 26 Jun 2002 09:14:31 -0000 1.12 +++ CoreTagLibrary.java 26 Jun 2002 14:50:43 -0000 1.13 @@ -100,6 +100,7 @@ registerTag("new", NewTag.class); registerTag("whitespace", WhitespaceTag.class); registerTag("thread", ThreadTag.class); + registerTag("file", FileTag.class); } } 1.15 +20 -5 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ForEachTag.java Index: ForEachTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ForEachTag.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ForEachTag.java 26 Jun 2002 09:24:35 -0000 1.14 +++ ForEachTag.java 26 Jun 2002 14:50:43 -0000 1.15 @@ -161,6 +161,21 @@ if ( end == Integer.MAX_VALUE && begin == 0 ) { throw new MissingAttributeException( "items" ); } + else { + String varName = var; + if ( varName == null ) { + varName = indexVar; + } + + for (index = begin; index < end; index += step ) { + + if (varName != null) { + Object value = new Integer(index); + context.setVariable(varName, value); + } + invokeBody(output); + } + } } } 1.1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/FileTag.java Index: FileTag.java =================================================================== /* * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, 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 acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", 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 apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * 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 (INCLUDING, 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. For more * information on the Apache Software Foundation, please see * . */ package org.apache.commons.jelly.tags.core; import java.io.FileOutputStream; import org.apache.commons.jelly.MissingAttributeException; import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.XMLOutput; /** * A tag that pipes its body to a file. * * @author Vinay Chandran */ public class FileTag extends TagSupport { private String name; public FileTag(){ } // Tag interface //------------------------------------------------------------------------- public void doTag(final XMLOutput output) throws Exception { if ( name == null ) { throw new MissingAttributeException( "name" ); } XMLOutput newOutput = XMLOutput.createXMLOutput(new FileOutputStream(name)); try { newOutput.startDocument(); invokeBody(newOutput); newOutput.endDocument(); } finally { newOutput.close(); } } /** * Sets the file name for the output */ public void setName(String name) { this.name = name; } } -- To unsubscribe, e-mail: For additional commands, e-mail: