On 8/9/01 4:31 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> jon         01/08/09 01:31:17
> 
> Modified:    src/services/java/org/apache/fulcrum/velocity
>                       TurbineVelocityService.java
> Log:
> I just added the ability to specify an "absolute:" path to the templates
> directory.
> 
> It works something like this:
> 
> services.VelocityService.file.resource.loader.path =
> @ABSOLUTE_PATH@/templates,@ABSOLUTE_PATH@/templates/flux
> 
> You can then use Ant to do the filtering of the TR.props file:
> 
>         <filter token="ABSOLUTE_PATH" value="absolute:${src.dir}"/>
>         <copy todir="${build.project.webinf}/conf" filtering="yes">
>             <fileset dir="${src.conf.dir}/" defaultexcludes="no">
>                 <include name="*.properties"/>
>                 <include name="*.xml"/>
>             </fileset>
>         </copy>
> 
> This has been tested and works wonderfully!
 
> What this means is that your build system can define an absolute path and
> you don't need to copy the templates into the webapp's directory anymore!
> You can simply point at them in any directory for development purposes.
> This makes it easier for designers because the templates directory doesn't
> need to be nested way down in a complicated directory structure. It also
> removes the need to have a "build" step in order to copy the modified
> templates into another directory.
> 
> I'm open to suggestions for something other than "absolute:", but this
> works for me for now.
> 
> woo hoo! I have been wanting to solve this problem for a long while now.

We definitely need a solution, but I was thinking of something a little more
general for the services. Paths with a leading '/' are treated as absolute
paths whereas something without will be treated relative the application
root. This won't really affect anything but the general solution of
absolute/relative paths should be be resolved in fulcrum at the service
level. This require a bit of work in fulcrum.
 
> -jon
> 
> Revision  Changes    Path
> 1.3       +5 -1  
> jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/velocity/TurbineV
> elocityService.java
> 
> Index: TurbineVelocityService.java
> ===================================================================
> RCS file: 
> /home/cvs/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/velocit
> y/TurbineVelocityService.java,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- TurbineVelocityService.java    2001/08/08 23:34:07    1.2
> +++ TurbineVelocityService.java    2001/08/09 08:31:17    1.3
> @@ -91,7 +91,7 @@
>   * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
>   * @author <a href="mailto:[EMAIL PROTECTED]";>Sean Legassick</a>
>   * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
> - * @version $Id: TurbineVelocityService.java,v 1.2 2001/08/08 23:34:07 dlr
> Exp $
> + * @version $Id: TurbineVelocityService.java,v 1.3 2001/08/09 08:31:17 jon
> Exp $
>   */
>  public class TurbineVelocityService
>      extends BaseTemplateEngineService
> @@ -380,6 +380,10 @@
>                              path = path.substring(9);
>                          }
>                          path = "jar:file:" + getRealPath(path) + entry;
> +                    }
> +                    else if (path.startsWith("absolute:"))
> +                    {
> +                        path = path.substring ("absolute:".length(),
> path.length());
>                      }
>                      else if (!path.startsWith("jar:"))
>                      {
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to