You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jt...@apache.org on 2002/02/12 00:58:06 UTC

cvs commit: jakarta-turbine-3/src/rttest/testapp/templates/swt DefaultSymbolFile.swt JGenTest.swt error.swt

jtaylor     02/02/11 15:58:06

  Modified:    .        build-test.xml build.xml default.properties
                        deps.list
               src/rttest/testapp/templates/jsp Index.jsp
  Added:       src/java/org/apache/turbine/pipeline ConditionalValve.java
                        JGenRenderer.java JGenRendererValve.java
                        RequestParameterConditionalValve.java
                        TargetExtensionConditionalValve.java
               src/rttest/conf conditional-testapp-pipeline.xml
               src/rttest/org/apache/turbine
                        ConditionalValveServletTest.java
               src/rttest/org/mycompany/newapp/modules/screens
                        JGenTest.java
               src/rttest/testapp/WEB-INF/conf
                        ConditionalValveTRP.properties iv.properties
               src/rttest/testapp/templates/swt DefaultSymbolFile.swt
                        JGenTest.swt error.swt
  Removed:     src/java/org/apache/turbine/pipeline BypassableValve.java
  Log:
  - Introduces JGenRenderer and JGenRendererValve which allow the pipeline to
    produce SWF output using SWT (Generator) templates
  - ConfitionalValve and corresponding Request/TargetExtension subclasses based
    on BranchPointValve. Renamed from Bypassable valve (still in consideration,
    suggestions?)
  - A cactus test case which uses the TargetExtensionConditionalValve to test
    vm, jsp, and swf in the same pipeline.
  
  Revision  Changes    Path
  1.12      +8 -0      jakarta-turbine-3/build-test.xml
  
  Index: build-test.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/build-test.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- build-test.xml	24 Jan 2002 03:55:25 -0000	1.11
  +++ build-test.xml	11 Feb 2002 23:58:05 -0000	1.12
  @@ -27,6 +27,7 @@
       <pathelement location="${tidy.jar}"/>
       <pathelement location="${junit.jar}"/>
       <pathelement location="${log4j.jar}"/>
  +    <pathelement location="${jgen.jar}"/>
       <pathelement location="${build.dest}"/>
       
       <!-- AspectJ Runtime Jar -->
  @@ -61,6 +62,11 @@
           <pathelement path="${build.dest}"/>
         </classpath>
       </javac>
  +    
  +    <copy todir="${build.dest}/conf">
  +      <fileset dir="${rttest.dir}/conf"/>
  +    </copy>
  +    
     </target>
   
     <!-- ================================================================== -->
  @@ -241,6 +247,8 @@
       <copy file="${log4j.jar}" todir="${build.dir}/rttest/lib"/>
       <copy file="${stratum.jar}" todir="${build.dir}/rttest/lib"/>
       <copy file="${velocity.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${jgen.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${commons-jxpath.jar}" todir="${build.dir}/rttest/lib"/>
       
       <antcall target="copy-aspectj-runtime"/>
   
  
  
  
  1.24      +68 -18    jakarta-turbine-3/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/build.xml,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- build.xml	10 Feb 2002 03:33:39 -0000	1.23
  +++ build.xml	11 Feb 2002 23:58:05 -0000	1.24
  @@ -40,8 +40,8 @@
       <pathelement location="${commons-collections.jar}"/>
       <pathelement location="${commons-util.jar}"/>
       <pathelement location="${stratum.jar}"/>
  -    <pathelement location="${dvsl.jar}"/>
  -
  +    <pathelement location="${jgen.jar}"/>
  +    
       <!-- AspectJ Jars for non-invasive use of aspects -->
       <pathelement location="${aspectjrt.jar}"/>
       <pathelement location="${aspectjtools.jar}"/>
  @@ -202,6 +202,12 @@
         <classpath refid="classpath"/>
       </available>
   
  +    <available
  +      classname="org.apache.velocity.anakia.AnakiaTask"
  +      property="AnakiaTask.present"
  +      classpathref="classpath"
  +    />
  +
     </target>
   
     <target name="check.commons-beanutils"
  @@ -560,30 +566,74 @@
     </target>
   
     <!-- ================================================================== -->
  -  <!-- D V S L  D O C U M E N T A T I O N                                 -->
  +  <!-- A N A K I A  D O C U M E N T A T I O N                             -->
     <!-- ================================================================== -->
   
     <target
  -    name="docs">
  +    name="check_for_jdom">
   
  -    <taskdef name="dvsl" classname="org.apache.tools.dvsl.DVSLTask">
  +    <available
  +      property="jdom.present"
  +      classname="org.jdom.JDOMException">
         <classpath>
  -        <path refid="classpath"/>
  +         <fileset dir="${jakarta.site2}/lib">
  +           <include name="*.jar"/>
  +         </fileset>
         </classpath>
  -    </taskdef>
  +    </available>
  +  </target>
   
  -    <!-- Make sure the target directory -->
  -    <mkdir dir="${docs.dest}"/>
  +  <target depends="check_for_jdom" name="docs-prepare-error"
  +          unless="jdom.present">
  +    <echo>
  +      The Jakarta-Site2 module is not present! Please check
  +      to make sure that you have checked it out from CVS.
   
  -    <dvsl
  -      basedir="${docs.src}"
  -      destdir="${docs.dest}/"
  -      extension=".html"
  -      toolbox="${docs.src}/toolbox.props"
  -      style="${docs.src}/stylesheets/site.dvsl"
  -      excludes="**/project.xml,**/template.xml"
  -      includes="**/*.xml"
  -    />
  +      &lt;http://jakarta.apache.org/site/jakarta-site2.html&gt;
  +    </echo>
  +  </target>
  +
  +  <target
  +    name="docs"
  +    depends="docs-prepare-error"
  +    description="==> generates the HTML documentation"
  +    if="jdom.present">
  +
  +    <taskdef name="anakia"
  +       classname="org.apache.velocity.anakia.AnakiaTask">
  +       <classpath>
  +         <fileset dir="${jakarta.site2}/lib">
  +           <include name="*.jar"/>
  +         </fileset>
  +       </classpath>
  +     </taskdef>
  +
  +     <anakia
  +       basedir="${docs.src}"
  +       destdir="${docs.dest}/"
  +       extension=".html" style="./site.vsl"
  +       projectFile="stylesheets/project.xml"
  +       excludes="**/stylesheets/** empty.xml"
  +       includes="**/*.xml"
  +       lastModifiedCheck="true"
  +       templatePath="${jakarta.site2}/xdocs/stylesheets">
  +     </anakia>
  +
  +     <copy todir="${docs.dest}/images" filtering="no">
  +       <fileset dir="${docs.src}/images">
  +         <include name="**/*.gif"/>
  +         <include name="**/*.jpeg"/>
  +         <include name="**/*.jpg"/>
  +       </fileset>
  +     </copy>
  +
  +     <!-- In case we have CSS someday
  +     <copy todir="${docs.dest}" filtering="no">
  +       <fileset dir="${docs.src}">
  +         <include name="**/*.css"/>
  +       </fileset>
  +     </copy>
  +     -->
     </target>
   
     <!-- ================================================================== -->
  
  
  
  1.15      +2 -1      jakarta-turbine-3/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/default.properties,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- default.properties	9 Feb 2002 18:55:06 -0000	1.14
  +++ default.properties	11 Feb 2002 23:58:05 -0000	1.15
  @@ -30,7 +30,6 @@
   # jar files
   
   velocity.jar = ${lib.repo}/velocity-1.3-dev.jar
  -dvsl.jar = ${lib.repo}/velocity-dvsl-0.31.jar
   log4j.jar = ${lib.repo}/log4j-1.1.3.jar
   servlet.jar = ${lib.repo}/servlet-2.2.jar
   fulcrum.jar = ${lib.repo}/fulcrum-1.0.jar
  @@ -45,6 +44,8 @@
   dom4j.jar = ${lib.repo}/dom4j-1.1.jar
   commons-beanutils.jar = ${lib.repo}/commons-beanutils.jar
   httpclient.jar = ${lib.repo}/httpclient.jar
  +jgen.jar = ${lib.repo}/jgen-1.4-dev.jar
  +commons-jxpath.jar = ${lib.repo}/commons-jxpath-0.1-dev.jar
   
   # -------------------------------------------------------------------
   # T E S T I N G
  
  
  
  1.5       +2 -0      jakarta-turbine-3/deps.list
  
  Index: deps.list
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/deps.list,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- deps.list	9 Feb 2002 18:55:06 -0000	1.4
  +++ deps.list	11 Feb 2002 23:58:05 -0000	1.5
  @@ -19,3 +19,5 @@
   velocity-dvsl-0.31.jar
   xercesImpl-2.0.0.jar
   xmlParserAPIs-2.0.0.jar
  +commons-jxpath-0.1-dev.jar
  +jgen-1.4-dev.jar
  
  
  
  1.1                  jakarta-turbine-3/src/java/org/apache/turbine/pipeline/ConditionalValve.java
  
  Index: ConditionalValve.java
  ===================================================================
  package org.apache.turbine.pipeline;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 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" and "Apache Software Foundation" and
   *    "Apache Turbine" 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",
   *    "Apache Turbine", 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 (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
   * <http://www.apache.org/>.
   */
  
  import java.io.IOException;
  
  import org.apache.turbine.Pipeline;
  import org.apache.turbine.RunData;
  import org.apache.turbine.TurbineException;
  import org.apache.turbine.Valve;
  import org.apache.turbine.ValveContext;
  
  import org.apache.log4j.Category;
  
  /**
   * Valve that conditionally executes a set of valves (internally
   * contained in a <code>TurbinePipeline</code>).
   *
   * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
   * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
   * @version $Id: ConditionalValve.java,v 1.1 2002/02/11 23:58:05 jtaylor Exp $
   */
  public abstract class ConditionalValve
      extends BranchPointValve
  {
      private static final Category log =
          Category.getInstance( ConditionalValve.class );
  
      /**
       * Sets up our <code>TurbinePipeline</code> instance.
       */
      protected ConditionalValve()
      {
          pipelines = new Pipeline[] { new TurbinePipeline() };
      }
  
      /**
       * Adds the provided valve to the contained pipeline.
       */
      public void addValve( Valve valve )
      {
          pipelines[0].addValve( valve );
      }
  
      /**
       * @see org.apache.turbine.Valve#invoke
       */
      public void invoke( RunData data, ValveContext context )
          throws IOException, TurbineException
      {
          if ( shouldInvoke( data ) )
          {
              log.debug("Invoking conditional pipeline");
              pipelines[0].invoke( data );
          }
  
          context.invokeNext( data );
      }
  
      /**
       * Determine whether the contained valves should be
       * run. Subclasses should implement this method.
       *
       * @return Whether the contained valves should be run.
       */
      protected abstract boolean shouldInvoke( RunData data );
  }
  
  
  
  1.1                  jakarta-turbine-3/src/java/org/apache/turbine/pipeline/JGenRenderer.java
  
  Index: JGenRenderer.java
  ===================================================================
  package org.apache.turbine.pipeline;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 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" and "Apache Software Foundation" and 
   *    "Apache Turbine" 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",
   *    "Apache Turbine", 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 (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
   * <http://www.apache.org/>.
   */
  
  import java.io.File;
  import java.io.IOException;
  
  import java.util.Iterator;
  import java.util.HashMap;
  
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.ServletOutputStream;
  import javax.servlet.ServletException;
  
  import org.apache.turbine.TemplateContext;
  import org.apache.turbine.Log;
  import org.apache.turbine.RunData;
  import org.apache.turbine.Turbine;
  import org.apache.turbine.TurbineException;
  import org.apache.turbine.modules.Module;
  
  import org.apache.log4j.Category;
  import org.apache.commons.util.StringUtils;
  
  import com.iv.flash.util.Util;
  import com.iv.flash.context.Context;
  import com.iv.flash.context.BeanContext;
  import com.iv.flash.util.FlashOutput;
  import com.iv.flash.util.IVException;
  import com.iv.flash.api.FlashFile;
  
  /**
   * Renderer that use JGenerator to merge a SWT template with the template
   * context. The template context is wrapped in a JGenerator BeanContext.
   *
   * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
   * @version $Id: JGenRenderer.java,v 1.1 2002/02/11 23:58:05 jtaylor Exp $
   */
  public class JGenRenderer
  {
      // JGenerator expects to be initialized with the directory containing 
      // its 'iv.properties' file. In the future it is expected JGen will
      // support more methods of configuration to support embedded use more
      // cleanly.
      
      // FIXME: Need a better means to do one time initialization of JGenerator
      
      static
      {
       	Util.init( Turbine.getRealPath( "/WEB-INF/conf" ) );   
      }
  
      private static final Category log = 
          Category.getInstance( JGenRenderer.class );
  
      /**
       * RunData of the request this Renderer is for.
       */
      protected RunData data = null;
  
      /**
       * Construct a renderer for the given RunData.
       */
      public JGenRenderer(RunData data)
      {
          this.data = data;
      }
      
      /**
       * Process the request 
       * 
       * @param String the filename of the template.
       * @throws TurbineException Any exception trown while processing will be
       *         wrapped into a TurbineException and rethrown.
       */
      public void render( String target ) 
          throws TurbineException, IVException, IOException, ServletException
      {
          // This obviously can be improved.
          String targetPath = Turbine.getRealPath( "/templates/swt/" + target );
          
          log.debug( "SWT to render: " + targetPath );
          
          if ( targetPath == null )
          {
              throw new TurbineException( "No target path" );
          }
          
          // Build a BeanContext from the TemplateContext. Really we should 
          // be able to just make the TemplateContext the root object, but
          // it seems JXPath is dumber than I thought. 
          
          HashMap map = new HashMap();
          
          TemplateContext tc = Module.getTemplateContext( data );
          
          Iterator keyIterator = tc.keySet().iterator();
  
          String key;
          
          while( keyIterator.hasNext() )
          {
              key = (String) keyIterator.next();
              
              log.debug( "Key '" + key + "' added to context." );
              
              map.put( key, tc.get( key ) );
          }
          
          BeanContext context = 
          	new BeanContext( null, map );
              
          // Process the SWT with the context into a FlashOutput buffer
              
          FlashOutput fob = process( targetPath, context );
          
          send( fob, data.getResponse() );
      }
  
      /**
       * Process template<BR>
       * <UL>
       * <LI>parse template
       * <LI>process (perform substitutions and generator commands)
       * <LI>generate movie
       * </UL>
       *
       * @param fileName template file name
       * @param context  generator context
       * @return generated flash content
       * @exception IVException
       * @exception IOException
       */
      protected FlashOutput process( String fileName, Context context )
          throws IVException, IOException
      {
          FlashFile file = FlashFile.parse( fileName );
  
          file.processFile( context );
  
          return file.generate();
      }
      
      /**
       * Send generator output buffer to the client
       *
       * @param fob flash data to send
       * @param res response to send to
       * @exception ServletException
       * @exception IOException
       */ 
      protected void send( FlashOutput fob, HttpServletResponse res )
          throws ServletException, IOException
      {
          res.setContentLength( fob.getSize() );
          res.setContentType( "application/x-shockwave-flash" );
  
          ServletOutputStream sos = res.getOutputStream();
  
          sos.write( fob.getBuf(), 0, fob.getSize() );
  
          sos.close();
          
      }
  }
  
  
  
  1.1                  jakarta-turbine-3/src/java/org/apache/turbine/pipeline/JGenRendererValve.java
  
  Index: JGenRendererValve.java
  ===================================================================
  package org.apache.turbine.pipeline;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 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" and "Apache Software Foundation" and
   *    "Apache Turbine" 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",
   *    "Apache Turbine", 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 (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
   * <http://www.apache.org/>.
   */
  
  import java.io.IOException;
  import java.util.Enumeration;
  
  import org.apache.turbine.Turbine;
  import org.apache.turbine.RunData;
  import org.apache.turbine.TurbineException;
  import org.apache.turbine.Valve;
  import org.apache.turbine.ValveContext;
  import org.apache.log4j.Category;
  
  /**
   * Valve that delegates to JGenRenderer to produce a view based on a SWT (flash
   * movie template)
   *
   * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
   * @version $Id: JGenRendererValve.java,v 1.1 2002/02/11 23:58:05 jtaylor Exp $
   */
  public class JGenRendererValve
      extends AbstractValve
  {
      private static final Category log = 
           Category.getInstance( JGenRendererValve.class );
  
      /**
       * @see org.apache.turbine.Valve#invoke(RunData, ValveContext)
       */
      public void invoke(RunData data, ValveContext context)
          throws IOException, TurbineException
      {
          try
          { 
              String target = data.getTarget();
              
              if ( log.isDebugEnabled() )
              {
                  log.debug( "Rendering target " + target );
              }
      
              JGenRenderer r = new JGenRenderer( data );
              
              r.render( target );
          }
          catch (Exception e)
          {
              throw new TurbineException( e );
          }
  
          // Pass control to the next Valve in the Pipeline
          context.invokeNext(data);
      }
  }
  
  
  
  
  1.1                  jakarta-turbine-3/src/java/org/apache/turbine/pipeline/RequestParameterConditionalValve.java
  
  Index: RequestParameterConditionalValve.java
  ===================================================================
  package org.apache.turbine.pipeline;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 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" and "Apache Software Foundation" and
   *    "Apache Turbine" 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",
   *    "Apache Turbine", 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 (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
   * <http://www.apache.org/>.
   */
  
  import java.io.IOException;
  
  import org.apache.turbine.RunData;
  import org.apache.turbine.TurbineException;
  import org.apache.turbine.Valve;
  import org.apache.turbine.ValveContext;
  
  /**
   * Conditional valve that tests if a request parameter (key) matches a specific
   * value (value).
   *
   * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
   * @version $Id: RequestParameterConditionalValve.java,v 1.1 2002/02/11 23:58:05 jtaylor Exp $
   */
  public class RequestParameterConditionalValve
      extends ConditionalValve
  {
      /** Request key to test */
      private String key;
      
      /** Value to require */
      private String value;
      
      /**
       * @see org.apache.turbine.pipeline.ConditionalValve#shouldInvoke
       */
      protected  boolean shouldInvoke( RunData data )
      {
          String actualValue = data.getParameters().getString( key );
          
          return ( ( actualValue != null ) && ( actualValue.equals( value ) ) );
      }
      
      /**
       * Mutator for key property
       */
      public void setKey( String key )
      {
          this.key = key;
      }
      
      /**
       * Mutator for value property
       */
      public void setValue( String key )
      {
          this.value = value;   
      }
  }
  
  
  
  1.1                  jakarta-turbine-3/src/java/org/apache/turbine/pipeline/TargetExtensionConditionalValve.java
  
  Index: TargetExtensionConditionalValve.java
  ===================================================================
  package org.apache.turbine.pipeline;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 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" and "Apache Software Foundation" and
   *    "Apache Turbine" 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",
   *    "Apache Turbine", 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 (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
   * <http://www.apache.org/>.
   */
  
  import java.io.IOException;
  
  import org.apache.turbine.RunData;
  import org.apache.turbine.TurbineException;
  import org.apache.turbine.Valve;
  import org.apache.turbine.ValveContext;
  
  import org.apache.log4j.Category;
  
  /**
   * Conditional valve that tests if the extentsion of the target (if it exists)
   * matches a given value.
   *
   * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
   * @version $Id: TargetExtensionConditionalValve.java,v 1.1 2002/02/11 23:58:05 jtaylor Exp $
   */
  public class TargetExtensionConditionalValve
      extends ConditionalValve
  {
      private static final Category log =
          Category.getInstance( TargetExtensionConditionalValve.class );
      
      /** Value to require */
      private String extension;
      
      /**
       * @see org.apache.turbine.pipeline.BaseConditionalValve#doTest
       */
      protected  boolean shouldInvoke( RunData data )
      {
          String target = data.getTarget();
          
          return ( target != null ) && ( target.endsWith( extension ) );
      }
      
      /**
       * Mutator for extension property
       */
      public void setExtension( String extension )
      {
          if ( extension.startsWith( "." ) )
          {
              this.extension = extension;
          }
          else
          {
              this.extension = "." + extension;   
          }
          
          log.debug( "Extension set to " + extension );
      }
  }
  
  
  
  1.1                  jakarta-turbine-3/src/rttest/conf/conditional-testapp-pipeline.xml
  
  Index: conditional-testapp-pipeline.xml
  ===================================================================
  <pipeline>
    <name>TurbineClassicPipeline</name>
    <valves>
      <valve className="org.apache.turbine.pipeline.DetermineActionValve"/>
      <valve className="org.apache.turbine.pipeline.DetermineTargetValve"/>
              
      <valve className="org.apache.turbine.pipeline.TargetExtensionConditionalValve">
          <extension>.vm</extension>
          <valves>
              <valve className="org.apache.turbine.pipeline.DefaultSessionTimeoutValve"/>
              <valve className="org.apache.turbine.pipeline.DefaultLoginValve"/>
              <valve className="org.apache.turbine.pipeline.DefaultSessionValidationValve"/>
              <valve className="org.apache.turbine.pipeline.DefaultACLCreationValve"/>
              <valve className="org.apache.turbine.pipeline.DefaultActionValve"/>
              <valve className="org.apache.turbine.pipeline.RunModulesValve"/>
              <valve className="org.apache.turbine.pipeline.DefaultTargetValve"/>
          </valves>    
      </valve>
      
      <valve className="org.apache.turbine.pipeline.TargetExtensionConditionalValve">
          <extension>.jsp</extension>
          <valves>
              <valve className="org.apache.turbine.pipeline.JspRendererValve"/>
          </valves>    
      </valve>
  
      <valve className="org.apache.turbine.pipeline.TargetExtensionConditionalValve">
          <extension>.swt</extension>
          <valves>
              <valve className="org.apache.turbine.pipeline.RunModulesValve"/>
              <valve className="org.apache.turbine.pipeline.JGenRendererValve"/>
          </valves>    
      </valve>
      
    </valves>
  </pipeline>
  
  
  
  1.1                  jakarta-turbine-3/src/rttest/org/apache/turbine/ConditionalValveServletTest.java
  
  Index: ConditionalValveServletTest.java
  ===================================================================
  package org.apache.turbine;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 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" and "Apache Software Foundation" and
   *    "Apache Turbine" 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",
   *    "Apache Turbine", 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 (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
   * <http://www.apache.org/>.
   */
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  import com.meterware.httpunit.WebTable;
  import com.meterware.httpunit.WebResponse;
  
  import org.apache.cactus.ServletTestCase;
  import org.apache.cactus.WebRequest;
  
  import java.util.Enumeration;
  
  import com.iv.flash.util.Util;
  import com.iv.flash.api.FlashFile;
  import com.iv.flash.api.FlashDef;
  import com.iv.flash.api.text.FontDef;
  
  /**
   * This is the testing servlet for the Turbine core classes. Subsystems like 
   * Torque and Fulcrum are not tested here.
   *
   * This test uses a pipeline contaning the conditional target valve to test 
   * different renderers -- velocity, jsp, and jgenerator -- all in the same
   * pipeline.
   *
   * @author <a href="mailto:jeff.Brekke@qg.com">Jeff Brekke</a>
   * @author <a href="mailto:jvanzyl@zenplex.com">Jason van Zyl</a>
   * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
   * @version $Id: ConditionalValveServletTest.java,v 1.1 2002/02/11 23:58:05 jtaylor Exp $
   */
  public class ConditionalValveServletTest
      extends ServletTestCase
  {
      /**
       * Core Turbine servlet used for testing.
       */
      Turbine turbine;
  
      /**
       * Default Constructor.
       */
      public ConditionalValveServletTest(String name)
      {
          super(name);
      }
  
      /**
       * Default test suite for this test case.
       */
      public static Test suite()
      {
          return new TestSuite(ConditionalValveServletTest.class);
      }
  
      /**
       * This setup will be running server side.  We startup Turbine and
       * get our test port from the properties.  This gets run before
       * each testXXX test.
       */
      protected void setUp()
          throws Exception
      {
          super.setUp();
          config.setInitParameter("properties",
                  "/WEB-INF/conf/ConditionalValveTRP.properties");
          turbine = new Turbine();
          turbine.init(config);
      }
  
      /**
       * After each testXXX test runs, shut down the Turbine servlet.
       */
      protected void tearDown()
          throws Exception
      {
          turbine.destroy();
          super.tearDown();
      }
  
      /**
       * This begin runs client side before the testHompage test runs. 
       * We'll set up our simualated url here.
       */
      public void beginHomepage(WebRequest theRequest)
      {
          theRequest.setURL(null, "/test", "/servlet/test", null, null);
      }
  
      /**
       * Run our actual test.  Here we just call the doGet on the
       * servlet.
       */
      public void testHomepage()
          throws Exception
      {
          turbine.doGet(request, response);
      }
  
      /**
       * Check the response from our test using HttpUnit.
       */
      public void endHomepage(WebResponse theResponse)
          throws Exception
      {
          // Verify the Title
          assertEquals("Test Application", theResponse.getTitle());
  
          // Verify the layout
          WebTable table = theResponse.getTableWithID("layout");
          assertNotNull("Table: layout was not found.", table);
          assertEquals("Incorrect number of rows in layout table.",
                  3, table.getRowCount());
          assertEquals("Incorrect number of columns in layout table.",
                  1, table.getColumnCount());
  
          assertEquals("Turbine Test App",
                  table.getTableCellWithID("topNav").asText().trim());
          assertEquals("Powered By Turbine!",
                  table.getTableCellWithID("bottomNav").asText().trim());
          assertEquals("Please stand by, This is only a test.",
                  table.getTableCellWithID("screen").asText().trim());
      }
  
      /**
       * Setup our request url to attempt to load a bogus action
       * which will cause Turbine to render the Error.vm.
       */
      public void beginErrorTemplate(WebRequest theRequest)
      {
          theRequest.setURL(null, "/test", "/servlet/test",
                  "/action/NoSuchAction", null);
      }
  
      /**
       * Call the doGet on the servlet
       */
      public void testErrorTemplate()
          throws Exception
      {
          turbine.doGet(request, response);
      }
  
      /**
       * Check our response with HttpUnit.  This will be the Error.vm
       * template with our exception.
       */
      public void endErrorTemplate(WebResponse theResponse)
          throws Exception
      {
          // Verify the Title
          assertEquals("Test Application", theResponse.getTitle());
  
          // Verify the error table
          WebTable table = theResponse.getTableWithID("error");
          assertNotNull("Table: error was not found.", table);
          assertEquals("Incorrect number of rows in error table.", 2,
                  table.getRowCount());
          assertEquals("Incorrect number of columns in error table.", 1,
                  table.getColumnCount());
  
          assertEquals("Error", table.getCellAsText(0, 0).trim());
          assertTrue("No exception or stack trace?",
                  table.getCellAsText(1, 0).trim().length() > 0);
      }
      
      /**
       * This begin runs client side before the testHompage test runs. 
       * We'll set up our simualated url here.
       */
      public void beginJspPage(WebRequest theRequest)
      {
          theRequest.setURL(null, "/test", "/servlet/test", 
                            "/template/Index.jsp", null);
      }
  
      /**
       * Run our actual test.  Here we just call the doGet on the
       * servlet.
       */
      public void testJspPage()
          throws Exception
      {
          turbine.doGet(request, response);
      }
  
      /**
       * Check the response from our test using HttpUnit.
       */
      public void endJspPage(WebResponse theResponse)
          throws Exception
      {
          assertEquals("Test Application JSP Page", theResponse.getTitle());
      }
      
          /**
       * This begin runs client side before the testHompage test runs. 
       * We'll set up our simualated url here.
       */
      public void beginJGenPage(WebRequest theRequest)
      {
          theRequest.setURL(null, "/test", "/servlet/test",
                            "/template/JGenTest.swt", null);
      }
  
      /**
       * Run our actual test.  Here we just call the doGet on the
       * servlet.
       */
      public void testJGenPage()
          throws Exception
      {
          turbine.doGet(request, response);
      }
  
      /**
       * Check the response from our test using HttpUnit.
       */
      public void endJGenPage(WebResponse response)
          throws Exception
      {   
          // FIXME: Eventually we should be able to use some limited pieces of 
          // jgen (like parsing a file) without needing configuration, but until
          // then is there a better way to get this path? Using a filter perhaps?
          
          Util.init( "target/rttest/tomcat40/webapps/test/WEB-INF/conf/" );
          
          // If it parses it must be a flash file
          
          FlashFile f = FlashFile.parse( "unknown", response.getInputStream() );
          
          // Now we iterate over the FlashDefs and look for a font, which will
          // only exist if text was added by the Module (otherwise JGen strips
          // it from the file since it is not used anymore).
          
          Enumeration defs = f.definitions();
         
          boolean fontFound = false;
         
          while( defs.hasMoreElements() ) 
          {   
              if ( defs.nextElement() instanceof FontDef )
              {
                  fontFound = true;
              }
          }
          
          if ( ! fontFound )
          {
              fail( "No font def found in returned flash content." );   
          }
      }
  }
  
  
  
  1.1                  jakarta-turbine-3/src/rttest/org/mycompany/newapp/modules/screens/JGenTest.java
  
  Index: JGenTest.java
  ===================================================================
  package org.mycompany.newapp.modules.screens;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 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" and "Apache Software Foundation" and 
   *    "Apache Turbine" 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",
   *    "Apache Turbine", 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 (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
   * <http://www.apache.org/>.
   */
  
  import java.util.HashMap;
   
  import org.apache.turbine.modules.Module;
  import org.apache.turbine.TemplateContext;
  import org.apache.turbine.RunData;
  
  /**
   * Populate the context with some test data for the JGenRenderer test.
   * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
   */
  
  public class JGenTest extends Module
  {
      protected void doBuildTemplate( RunData data,
                                       TemplateContext context )
          throws Exception
      {
          context.put( "items", buildItemList() );
      }
      
      public HashMap buildItemList()
      {
          HashMap map = new HashMap();
          
          map.put( "item1", new Item( "this", "is", "just" ) );
          map.put( "item2", new Item( "another", "silly", "test" ) );
          map.put( "item3", new Item( "i", "like", "f00d" ) );
          map.put( "item4", new Item( "f00d", "iz", "g00d" ) );
          
          return map;
      }
      
      /**
       * A trivial little class with which to populate the context.
       */
      public static class Item
      {
          private String value1;
          private String value2;
          private String value3;
          
          public Item( String value1, String value2, String value3 )
          {
              this.value1 = value1;
              this.value2 = value2;
              this.value3 = value3;
          }
          
          public String getValue1()
          {
              return value1;
          }
          
          public String getValue2()
          {
              return value2;
          }
          
          public String getValue3()
          {
              return value3;
          }
      }
  }
  
  
  
  1.1                  jakarta-turbine-3/src/rttest/testapp/WEB-INF/conf/ConditionalValveTRP.properties
  
  Index: ConditionalValveTRP.properties
  ===================================================================
  # -------------------------------------------------------------------
  # $Id: ConditionalValveTRP.properties,v 1.1 2002/02/11 23:58:06 jtaylor Exp $
  #
  # This is the configuration file for Turbine.
  #
  # Note that strings containing "," (comma) characters must backslash 
  # escape the comma (i.e. '\,')
  #
  # -------------------------------------------------------------------
  
  # -------------------------------------------------------------------
  # 
  #  S Y S T E M  P R O P E R T I E S
  #
  # -------------------------------------------------------------------
  
  # Your mail server for outgoing email.
  #
  # Default: null
  
  system.mail.host=
  
  # SMTP-From header for your outgoing messages
  #
  # All failed delivery messages will be returned to this address.
  # If unset, these messages will be sent to the address in the 
  # From header (standard behaviour)
  #
  # Default: null
  
  system.mail.smtp.from=
  
  # -------------------------------------------------------------------
  # 
  #  L O G G I N G
  #
  # -------------------------------------------------------------------
  # We use Log4J for all Turbine logging and we embed the log4j
  # properties within our application configuration.
  #
  # NOTE:
  # The presence of ${applicationRoot} in the logging configuration
  # is not a mistake. Internally the value of ${applicationRoot}
  # is set so that you can use it with standard log4j
  # properties to get logs to appear in your
  # webapp space.
  # -------------------------------------------------------------------
  
  # This first category is required and the category
  # must be named 'default'. This is used for all logging
  # where an explicit category is not specified (when using the Log
  # utility class).  It should be set to write to the same appender
  # as the org.apache.turbine category.
  
  log4j.category.default = DEBUG, turbine
  
  # This category is used by Turbine.
  
  log4j.category.org.apache.turbine = DEBUG, turbine
  log4j.appender.turbine = org.apache.log4j.FileAppender
  log4j.appender.turbine.file = ${applicationRoot}/logs/turbine.log
  log4j.appender.turbine.layout = org.apache.log4j.PatternLayout
  log4j.appender.turbine.layout.conversionPattern = %d [%t] %-5p %c - %m%n
  log4j.appender.turbine.append = false
  
  # This category is used by Torque.
  
  log4j.category.org.apache.torque = DEBUG, torque
  log4j.appender.torque = org.apache.log4j.FileAppender
  log4j.appender.torque.file = ${applicationRoot}/logs/torque.log
  log4j.appender.torque.layout = org.apache.log4j.PatternLayout
  log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n
  log4j.appender.torque.append = false
  
  # This category is used by Fulcrum the services framework.
  
  log4j.category.org.apache.fulcrum = DEBUG, services
  log4j.appender.services = org.apache.log4j.FileAppender
  log4j.appender.services.file = ${applicationRoot}/logs/services.log
  log4j.appender.services.layout = org.apache.log4j.PatternLayout
  log4j.appender.services.layout.conversionPattern = %d [%t] %-5p %c - %m%n
  log4j.appender.services.append = false
  
  log4j.category.org.apache.stratum = DEBUG, stratum 
  log4j.appender.stratum= org.apache.log4j.FileAppender
  log4j.appender.stratum.file = ${applicationRoot}/logs/stratum.log
  log4j.appender.stratum.layout = org.apache.log4j.PatternLayout
  log4j.appender.stratum.layout.conversionPattern = %d [%t] %-5p %c - %m%n
  log4j.appender.stratum.append = false
  
  # Setup the db service to use the same appender as torque.  Set this
  # category to DEBUG to see generated sql queries
  
  log4j.category.org.apache.fulcrum.db = DEBUG, torque
  
  ## Tracing
  log4j.category.trace = DEBUG, trace
  log4j.appender.trace = org.apache.log4j.FileAppender
  log4j.appender.trace.file = ${applicationRoot}/logs/trace.log
  log4j.appender.trace.layout = org.apache.log4j.PatternLayout
  log4j.appender.trace.layout.conversionPattern = %m%n
  log4j.appender.trace.append = false
  
  # -------------------------------------------------------------------
  #
  #  M O D E
  #
  # -------------------------------------------------------------------
  # If this turbine app will always be invoked from another application
  # mode can be set to integrated which will cause Turbine to pass any
  # errors up to the application that invoked Turbine.  Under standalone
  # operation, Turbine swallows the error after sending an error page
  # as the response.  If this Turbine application operates both as a 
  # normal webapp and can be invoked from another application, set the 
  # mode to standalone and see the Turbine servlet's javadoc for method
  # to set the mode on a request basis.
  #
  # Possible values: standalone, integrated
  # Default: standalone
  # -------------------------------------------------------------------
  
  turbine.mode = standalone
  
  # -------------------------------------------------------------------
  #
  #  R E S O L V E R
  #
  # -------------------------------------------------------------------
  # This determines what resolver to use to find modules and templates.
  # The DefaultResolver uses the ModuleLoader's algorithm (see below) to
  # find modules
  #
  # Default: org.apache.turbine.pipeline.DefaultResolver
  # -------------------------------------------------------------------
  
  resolver.default = org.apache.turbine.pipeline.DefaultResolver
  
  # -------------------------------------------------------------------
  # 
  #  M O D U L E  P A C K A G E S
  #
  # -------------------------------------------------------------------
  # This is the "classpath" for Turbine.  In order to locate your own
  # modules, you should add them to this path.  For example, if you have
  # com.company.actions, com.company.screens, com.company.navigations,
  # then this setting would be "com.company,org.apache.turbine.modules".
  # This path is searched in order.  For example, Turbine comes with a
  # screen module named "Login".  If you wanted to have your own screen
  # module named "Login", then you would specify the path to your
  # modules before the others.
  #
  # Default: org.apache.turbine.modules
  # -------------------------------------------------------------------
  
  module.packages=org.mycompany.newapp.modules,org.apache.turbine.flux.modules
  
  # These are the default modules to emulate the Turbine
  # 2.1 page/layout/nav/screen system.
  
  module.default.actions = actions.TemplateAction
  module.default.layouts = Module
  module.default.navigations = Module
  module.default.screens = Module
  
  # You can define any module type you wish here and
  # they will be added to Turbine's module processing
  # system. You must provide a default module!
  #
  # module.default.woogy = Boogie
  # module.default.floogy = Moogie
  
  # Turbine's default Pipeline implementation uses a (pluggable)
  # descriptor to define which Valves it consists of.
  pipeline.default = org.apache.turbine.pipeline.TurbinePipeline
  pipeline.default.descriptor = conf/conditional-testapp-pipeline.xml
  pipeline.default.targetModuleType = screens
  
  template.default = /Default
  template.default.extension = vm
  
  # -------------------------------------------------------------------
  # 
  #  F R A M E W O R K  S E T T I N G S
  #
  # -------------------------------------------------------------------
  # These are settings that control the behaviour of the framework,
  # such as determining whether a template system is in use, what
  # the default templates and screens are and session handling settings.
  #
  # Non-qualifed Java class names below located relative to the package
  # names listed in the module.packages property.
  # -------------------------------------------------------------------
  
  # This is the template that is shown on an incorrect login attempt. 
  # Setting this property will override any value of screen.login specfied
  # below.
  #
  # Default: Login.vm
  
  template.login=/Login.vm
  
  # Used to set the template homepage if you are using a template
  # layout.
  #
  # Default: /Index.vm
  
  template.homepage=/Index.vm
  
  # This is the template that is used by the respective Template based 
  # ErrorScreen for displaying the error. If you are not using a Template based 
  # ErrorScreen, then this is ignored.
  #
  # Default: /{ViewType}Error.vm
  
  template.error=/Error.vm
  
  # This is the default action to log a user in.
  
  action.login=LoginUser
  
  # This is the default action to log a user out.
  
  action.logout=LogoutUser
  
  # This is the default action to validate whether or not a session is
  # valid.  For example, if you want to make sure if a user has already
  # logged in or not.
  #
  # Default: SessionValidator
  
  action.sessionvalidator=NullSessionValidator
  
  # This is the timeout in seconds for sessions. If left commented out, the
  # servlet container's default timeout will be left as is.
  
  # session.timeout=1800
  
  # This is the default action that builds up the AccessControlList for
  # the individual users session.
  
  action.accesscontroller=AccessController
  
  # Set the default Doctype.  The default Doctype can be set by using
  # the single strings: Html40Strict, Html40Transitional, or
  # Html40Frameset.  Additionally the default can be supplied as two
  # strings separated by a comma giving the DTD and URI.
  #
  # Default: ignored if not set to some value.
  
  default.doctype=Html40Transitional
  
  # -------------------------------------------------------------------
  # 
  #  M E S S A G E S
  #
  # -------------------------------------------------------------------
  # Note that strings containing "," (comma) characters must backslash 
  # escape the comma (i.e. '\,')
  
  # The message that can be displayed before a user logs in.
  
  login.message=Thank you for your visit. Please log into the system.
  
  # The message that can be displayed when no screen is defined.
  
  login.message.noscreen=There has been an error. Your session is valid but the screen variable is not defined.
  
  # The message that can be displayed when a user enters an incorrect
  # password or username.
  
  login.error=Sorry your username or password is incorrect!
  
  # The message that can be displayed when a user logs out.
  
  logout.message=Thank you for using the system. Please come back soon.
  
  # -------------------------------------------------------------------
  # 
  #  T U R B I N E  S E R V I C E S
  #
  # -------------------------------------------------------------------
  
  services.RunDataService.classname=org.apache.turbine.services.rundata.TurbineRunDataService
  services.PullService.classname=org.apache.turbine.services.pull.TurbinePullService
  ## Needed by the RunData Service
  services.MimeTypeService.classname=org.apache.fulcrum.mimetype.TurbineMimeTypeService
  
  # -------------------------------------------------------------------
  # 
  #  P U L L  S E R V I C E
  #
  # -------------------------------------------------------------------
  # These are the properties for the Pull Service, the service
  # that works in conjuction with the Turbine Pull Model API.
  # -------------------------------------------------------------------
  
  # This determines whether the non-request tools are refreshed 
  # on each request (request tools aren't ever, because they're
  # instantiated for the request only anyway).
  services.PullService.toolsPerRequestRefresh=true
  
  # These are tools that are placed in the context by the service
  # These tools will be made available to all your
  # templates. You list the tools in the following way:
  #
  # services.PullService.tool.<scope>.<id> = <classname>
  #
  # <scope>      is the tool scope: global, request, session
  #              or persistent (see below for more details)
  # <id>         is the name of the tool in the context
  #
  # You can configure the tools in this way:
  # services.PullService.tool.<id>.<parameter> = <value>
  #
  # So if you find "global", "request", "session" or "persistent" as second
  # part, it is a configuration to put a tool into the toolbox, else it is a
  # tool specific configuration.
  #
  # For example:
  #
  # services.PullService.tool.global.ui = org.apache.turbine.util.pull.UIManager
  # services.PullService.tool.global.mm = org.apache.turbine.util.pull.MessageManager
  # services.PullService.tool.request.link = org.apache.turbine.util.template.TemplateLink
  # services.PullService.tool.request.page = org.apache.turbine.util.template.TemplatePageAttributes
  #
  # Then:
  #
  # tool.ui.skin = default
  # 
  # configures the value of "skin" for the "ui" tool.
  #
  # Tools are accessible in all templates by the <id> given
  # to the tool. So for the above listings the UIManager would
  # be available as $ui, the MessageManager as $mm, the TemplateLink
  # as $link and the TemplatePageAttributes as $page.
  #
  # You should avoid using tool names called "global", "request",
  # "session" or "persistent" because of clashes with the possible Scopes.
  #
  # Scopes:
  #
  #   global:     tool is instantiated once and that instance is available
  #               to all templates for all requests. Tool must be threadsafe.
  #
  #   request:    tool is instantiated once for each request (although the
  #               PoolService is used to recycle instances). Tool need not
  #               be threadsafe.
  #
  #   session:    tool is instantiated once for each user session, and is
  #               stored in the user's temporary hashtable. Tool should be 
  #               threadsafe.
  #
  #   persistent: tool is instantitated once for each use session, and
  #               is stored in the user's permanent hashtable. This means
  #               for a logged in user the tool will be persisted in the
  #               user's objectdata. Tool should be threadsafe and 
  #               Serializable.
  #
  # Defaults: none
  
  services.PullService.tool.request.link=org.apache.turbine.tool.TemplateLink
  services.PullService.tool.request.page=org.apache.turbine.tool.TemplatePageAttributes
  services.PullService.tool.request.content=org.apache.turbine.tool.ContentURI
  services.PullService.tool.request.l10n=org.apache.turbine.tool.LocalizationTool
  
  # These are intake tools.
  #services.PullService.tool.request.om=org.apache.turbine.tool.OMTool
  #services.PullService.tool.request.intake=org.apache.turbine.tool.IntakeTool
  
  services.PullService.tool.global.ui=org.apache.turbine.tool.UIManager
  
  services.PullService.earlyInit = true
  
  # The UI Manager will allow you to skin your Turbine
  # application using simple properties files that are
  # located in the WEBAPP/resources/ui/skins/ directory
  # hierarchy.
  
  #This is a remain thorn in our side. How to provide properties
  #for pull tools elegantly. This is not good.
  tool.ui.skin=default
  
  # -------------------------------------------------------------------
  #
  #  R U N   D A T A   S E R V I C E
  #
  # -------------------------------------------------------------------
  # Default implementations of base interfaces for request processing.
  # Additional configurations can be defined by using other keys
  # in the place of the <default> key.  
  # -------------------------------------------------------------------
  
  services.RunDataService.default.run.data=org.apache.turbine.services.rundata.DefaultTurbineRunData
  services.RunDataService.default.parameter.parser=org.apache.turbine.ParameterParser
  services.RunDataService.default.cookie.parser=org.apache.fulcrum.util.parser.DefaultCookieParser
  
  ## Needed by DefaultTurbineRunData
  locale.default.language=en
  locale.default.country=US
  locale.default.charset=8859_1
  
  # -------------------------------------------------------------------
  # 
  #  S E C U R E  S O C K E T S  L A Y E R
  #
  # -------------------------------------------------------------------
  # Whether the web server is able to use SSL.  Links in Turbine can
  # check this property to determine if SSL can be used.
  #
  # Default: true
  # -------------------------------------------------------------------
  
  use.ssl=true
  
  #--------------------------------------------------------------------
  #
  # P A R A M E T E R  P A R S E R
  #
  #--------------------------------------------------------------------
  #
  # This variable controls the case folding applied to URL variable
  # names.
  #
  # Allowed values: none, lower, upper
  # Default: lower
  #
  
  url.case.folding=lower
  
  # -------------------------------------------------------------------
  # 
  #  F U L C R U M  C O N F I G U R A T I O N
  #
  # -------------------------------------------------------------------
  
  include = Fulcrum.properties
  
  # -------------------------------------------------------------------
  # 
  #  A D D I T I O N A L  P R O P E R T I E S
  #
  # -------------------------------------------------------------------
  # The full path name to an additional properties file. Properties in 
  # this file will be included in this property set. Duplicate name 
  # values will be replaced, so be careful.
  #
  # Default: none
  # -------------------------------------------------------------------
  
  include = Flux.properties
  
  
  
  1.1                  jakarta-turbine-3/src/rttest/testapp/WEB-INF/conf/iv.properties
  
  Index: iv.properties
  ===================================================================
  # Jgenerator Config
  
  # Log file
  com.iv.flash.logFile=../../logs/jgen.log
  
  # Verbose level (from 0 to 4, 4 most verbose)
  com.iv.flash.verbose=4
  
  # Name of the template which will be sent to a user if there were some errors
  # the template will be parsed with the variable 'bulkErrMessage' set to error message
  com.iv.flash.errorTemplate=../../templates/swt/error.swt
  
  # If false, then all variables' names are case insensitive (same as in Macromedia Generator). 
  # If true, then all variables' names are case sensitive.
  # It is recomended to set it to true if you use xml datasources
  com.iv.flash.varCaseSensitive=false
  
  # If false, then all movie clips' names are case insensitive (same as in Macromedia Generator).
  # If true, the all movie clips' names are case sensitive.
  com.iv.flash.symCaseSensitive=false
  
  # If true then text (its bounds) is rendered in Macromedia Generator style
  # If false then text is rendered in JGenerator style
  # For more information see documentation
  com.iv.flash.textBoundsMMStyle=false
  
  # If true, then you can use wrap assets feature of JGenerator
  # If false, the feature is disabled
  com.iv.flash.wrapAssets=true
  
  # If true, then JGenerator will show errors occured in gen commands right inside the placeholder.
  # If false, then all errors are ignored and logged 
  com.iv.flash.showErrorsInline=true
  
  # Name of the file with stat data
  com.iv.flash.statFileName=../../logs/jgen.stat
  
  # Name of default symbol file
  com.iv.flash.defaultSymbolFile=../../templates/swt/DefaultSymbolFile.swt
  
  # Maximum number of threads
  com.iv.flash.maxThreads=50
  
  # External font location
  com.iv.flash.fontPath=jgen-fonts/
  
  # Run GC after this number of files processed (0-do not run)
  com.iv.flash.garbageCollectAfterJobCount=0
  
  # Admin user name
  com.iv.flash.adminUserName=Admin
  
  # Admin password
  com.iv.flash.adminPassword=!!put your password here!!
  
  # Font configuration for FOP renderer
  com.iv.flash.fopConfig=bin/fop-config.xml
                             
  ###############################################################################
  # Request cache properties
  ###############################################################################
  
  # maximum size of request cache
  com.iv.flash.requestCacheMaxSize=1000000
  # recycle older requests if there is no enough place to add new item
  com.iv.flash.requestCacheRecycle=true
  # default expiration of requests in seconds (overriden by url parameter 'gre')
  com.iv.flash.requestCacheDefaultExpire=1
  # force to cache all requests regardless of url parameters
  com.iv.flash.requestCacheForce=true
  
  ###############################################################################
  # Font cache properties
  ###############################################################################
  
  # maximum size of font cache
  com.iv.flash.fontCacheMaxSize=1000000
  # recycle older fonts if there is no enough place to add new item
  com.iv.flash.fontCacheRecycle=true
  # default expiration of fonts in seconds (0-no expiration)
  com.iv.flash.fontCacheDefaultExpire=0
  # discard cached font if it was modified since last retrieval
  com.iv.flash.fontCacheCheckModifiedSince=false
  
  ###############################################################################
  # Media cache properties
  ###############################################################################
  
  # maximum size of media cache
  com.iv.flash.mediaCacheMaxSize=1000000
  # recycle media object if there is no enough place to add new item
  com.iv.flash.mediaCacheRecycle=true
  # default expiration of media in seconds (overriden by url parameter 'gme')
  com.iv.flash.mediaCacheDefaultExpire=3600
  # force to cache all medias regardless of url parameters
  com.iv.flash.mediaCacheForce=false
  # discard cached media if it was modified since last retrieval
  com.iv.flash.mediaCacheCheckModifiedSince=false
  
  ###############################################################################
  # XML cache properties
  ###############################################################################
  
  # maximum size of xml cache
  com.iv.flash.xmlCacheMaxSize=1000000
  # recycle xml file if there is no enough place to add new item
  com.iv.flash.xmlCacheRecycle=true
  # default expiration of xml in seconds (overriden by url parameter 'gme')
  com.iv.flash.xmlCacheDefaultExpire=3600
  # force to cache all xml files regardless of url parameters
  com.iv.flash.xmlCacheForce=true
  # discard cached xml if it was modified since last retrieval
  com.iv.flash.xmlCacheCheckModifiedSince=true
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  1.2       +1 -1      jakarta-turbine-3/src/rttest/testapp/templates/jsp/Index.jsp
  
  Index: Index.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/rttest/testapp/templates/jsp/Index.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Index.jsp	22 Jan 2002 13:56:53 -0000	1.1
  +++ Index.jsp	11 Feb 2002 23:58:06 -0000	1.2
  @@ -1,6 +1,6 @@
   <html>
   <head>
  -<title>Test Application</title>
  +<title>Test Application JSP Page</title>
   </head>
   <body>
   
  
  
  
  1.1                  jakarta-turbine-3/src/rttest/testapp/templates/swt/DefaultSymbolFile.swt
  
  	<<Binary file>>
  
  
  1.1                  jakarta-turbine-3/src/rttest/testapp/templates/swt/JGenTest.swt
  
  	<<Binary file>>
  
  
  1.1                  jakarta-turbine-3/src/rttest/testapp/templates/swt/error.swt
  
  	<<Binary file>>
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>