[prev in list] [next in list] [prev in thread] [next in thread] 

List:       turbine-dev
Subject:    cvs commit: jakarta-turbine-2/xdocs/services template-service.xml
From:       henning () apache ! org
Date:       2003-07-22 11:14:14
[Download RAW message or body]

henning     2003/07/22 04:14:14

  Modified:    src/java/org/apache/turbine/services/template
                        TurbineTemplateService.java
               xdocs/services template-service.xml
  Added:       src/java/org/apache/turbine/services/template/mapper
                        DirectTemplateMapper.java
  Log:
  Add a mapper for the direct template translation policy of our navigation
  templates. This is the "templating name" equivalent to the DirectMapper for
  classes.
  
  Revision  Changes    Path
  1.18      +3 -2      \
jakarta-turbine-2/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
  
  Index: TurbineTemplateService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/template/TurbineTemplateService.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TurbineTemplateService.java	22 Jul 2003 10:58:49 -0000	1.17
  +++ TurbineTemplateService.java	22 Jul 2003 11:14:13 -0000	1.18
  @@ -82,6 +82,7 @@
   import org.apache.turbine.services.template.mapper.BaseTemplateMapper;
   import org.apache.turbine.services.template.mapper.ClassMapper;
   import org.apache.turbine.services.template.mapper.DirectMapper;
  +import org.apache.turbine.services.template.mapper.DirectTemplateMapper;
   import org.apache.turbine.services.template.mapper.LayoutTemplateMapper;
   import org.apache.turbine.services.template.mapper.Mapper;
   import org.apache.turbine.services.template.mapper.ScreenTemplateMapper;
  @@ -739,7 +740,7 @@
               ClassMapper.class.getName(),
               LayoutTemplateMapper.class.getName(),
               ScreenTemplateMapper.class.getName(),
  -            ScreenTemplateMapper.class.getName()
  +            DirectTemplateMapper.class.getName()
           };
   
           int [] mapperCacheSize = new int [] {
  
  
  
  1.1                  \
jakarta-turbine-2/src/java/org/apache/turbine/services/template/mapper/DirectTemplateMapper.java
  
  Index: DirectTemplateMapper.java
  ===================================================================
  package org.apache.turbine.services.template.mapper;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2003 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 org.apache.commons.lang.StringUtils;
  
  import org.apache.turbine.services.template.TemplateService;
  
  /**
   * The most primitive templating mapper. It is used for the navigation template
   * objects. It never caches and simply returns what is given to it but keeps
   * the template extension.
   *
   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
   * @version $Id: DirectTemplateMapper.java,v 1.1 2003/07/22 11:14:14 henning Exp $
   */
  public class DirectTemplateMapper
      extends BaseTemplateMapper
      implements Mapper
  {
      /**
       * Default C'tor. If you use this C'tor, you must use
       * the bean setter to set the various properties needed for
       * this mapper before first usage.
       */
      public DirectTemplateMapper()
      {
      }
  
      /**
       * Replace all "," with ".", but keep the extension.
       *
       * about,directions,Driving.vm --> about/directions/Driving.vm
       *
       * @param template The template name.
       * @return A class name for the given template.
       */
      public String doMapping(String template)
      {
          String [] components
              = StringUtils.split(template, \
String.valueOf(TemplateService.TEMPLATE_PARTS_SEPARATOR));  
          return StringUtils.join(components, String.valueOf(separator));
      }
  }
  
  
  
  1.5       +28 -21    jakarta-turbine-2/xdocs/services/template-service.xml
  
  Index: template-service.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/xdocs/services/template-service.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- template-service.xml	22 Jul 2003 10:44:44 -0000	1.4
  +++ template-service.xml	22 Jul 2003 11:14:14 -0000	1.5
  @@ -20,7 +20,7 @@
   
   <source><![CDATA[
   # -------------------------------------------------------------------
  -# 
  +#
   #  S E R V I C E S
   #
   # -------------------------------------------------------------------
  @@ -35,7 +35,7 @@
   .
   .
   # -------------------------------------------------------------------
  -# 
  +#
   #  T E M P L A T E  S E R V I C E
   #
   # -------------------------------------------------------------------
  @@ -51,13 +51,14 @@
   #
   # These are the mapper classes responsible for the lookup of Page, Screen, Layout \
and Navigation classes according  # to the supplied template Name. They also map \
                template names on the Layout and Screen file names to be used.
  -# 
  -services.TemplateService.mapper.page.class            = \
                org.apache.turbine.services.template.mapper.TemplateDirectMapper
  -services.TemplateService.mapper.screen.class          = \
                org.apache.turbine.services.template.mapper.TemplateClassMapper
  -services.TemplateService.mapper.layout.class          = \
                org.apache.turbine.services.template.mapper.TemplateClassMapper
  -services.TemplateService.mapper.navigation.class      = \
                org.apache.turbine.services.template.mapper.TemplateClassMapper
  -services.TemplateService.mapper.layout.template.class = \
                org.apache.turbine.services.template.mapper.TemplateLayoutMapper
  -services.TemplateService.mapper.screen.template.class = \
org.apache.turbine.services.template.mapper.TemplateScreenMapper    +#
  +services.TemplateService.mapper.page.class                = \
org.apache.turbine.services.template.mapper.DirectMapper  \
+services.TemplateService.mapper.screen.class              = \
org.apache.turbine.services.template.mapper.ClassMapper  \
+services.TemplateService.mapper.layout.class              = \
org.apache.turbine.services.template.mapper.ClassMapper  \
+services.TemplateService.mapper.navigation.class          = \
org.apache.turbine.services.template.mapper.ClassMapper  \
+services.TemplateService.mapper.layout.template.class     = \
org.apache.turbine.services.template.mapper.LayoutTemplateMapper  \
+services.TemplateService.mapper.screen.template.class     = \
org.apache.turbine.services.template.mapper.ScreenTemplateMapper  \
+services.TemplateService.mapper.navigation.template.class = \
org.apache.turbine.services.template.mapper.DirectTemplateMapper  
   ]]></source>
   
  @@ -74,7 +75,7 @@
   your preferred view service. So if you read "Velocity" in the
   following paragraphs, this means "default configured view
   class". Currently, Turbine includes two supported view services,
  -<a href="services/velocity-service.html">Velocity</a> and 
  +<a href="services/velocity-service.html">Velocity</a> and
   <a href="services/jsp-service.html">Java Server Pages (JSP)</a>.
   </p>
   
  @@ -88,7 +89,7 @@
   
   <ul>
     <li>1) Many examples and docs from older Turbine code show template
  -         pathes with a slashes.<br/> 
  +         pathes with a slashes.<br/>
            Repeat after me: <b>TEMPLATE NAMES NEVER CONTAIN SLASHES!</b><br/>
            Template names are separated by "," (the colon). </li>
     <li>2) Many examples and docs from older Turbine code show templates
  @@ -119,7 +120,7 @@
   
   <p>
     And if you have the following module packages configured in your \
                TurbineResources.properties:
  -  "module.packages = org.apache.turbine.modules, com.mycorp.modules", 
  +  "module.packages = org.apache.turbine.modules, com.mycorp.modules",
     then the class loader will look for
   </p>
   
  @@ -172,7 +173,7 @@
   
   <p>
     If you now wonder how a template name is mapped to an actual file name: This is
  -  scope of the templating engine. <a \
href="services/velocity-service.html">Velocity</a>   +  scope of the templating \
engine. <a href="services/velocity-service.html">Velocity</a>  e.g. has this \
                wonderful option to load templates from jar archives.
     There is no file but if you tell velocity "get about,directions,Driving.vm" and \
                it
     returns the rendered template. So getting the actual template is not the job of \
the  @@ -182,47 +183,53 @@
   
   <section name="Properties">
   <p>
  -  The mapping of classes and template pathes to template names is configured in 
  +  The mapping of classes and template pathes to template names is configured in
     mapper classes. These are pluggable and can be exchanged to configure other \
                mapping
     policies. This is an option for seasoned Turbine developers and the default \
policy  shouldn't be changed lightly.
   </p>
   
  -<ul> 
  +<ul>
     <li>
       services.TemplateService.mapper.page.class configures the mapper
       used for finding a page class suitable for the supplied template
  -    name. Default is \
org.apache.turbine.services.template.mapper.TemplateDirectMapper  +    name. Default \
is org.apache.turbine.services.template.mapper.DirectMapper  </li>
     <li>
       services.TemplateService.mapper.screen.class configures the mapper
       used for finding a screen class suitable for the supplied template
  -    name. Default \
isorg.apache.turbine.services.template.mapper.TemplateClassMapper  +    name. Default \
isorg.apache.turbine.services.template.mapper.ClassMapper  </li>
     <li>
       services.TemplateService.mapper.layout.class configures the mapper
       used for finding a layout class suitable for the supplied template
  -    name. Default is \
org.apache.turbine.services.template.mapper.TemplateClassMapper  +    name. Default \
is org.apache.turbine.services.template.mapper.ClassMapper  </li>
     <li>
       services.TemplateService.mapper.navigation.class configures the
       mapper used for finding navigation classes suitable for the
       supplied template name. This mapper is not used directly but from
       various navigation helpers like TemplateNavigation. Default is
  -    org.apache.turbine.services.template.mapper.TemplateClassMapper
  +    org.apache.turbine.services.template.mapper.ClassMapper
     </li>
     <li>
       services.TemplateService.mapper.layout.template.class configures
       the mapper used for finding a layout template to render your
       screen. This template is used by your Layout class (see above) to
       position the various visual elements like content and navigation
  -    on the Page. Default is \
org.apache.turbine.services.template.mapper.TemplateLayoutMapper  +    on the Page. \
Default is org.apache.turbine.services.template.mapper.LayoutTemplateMapper  </li>
     <li>
       services.TemplateService.mapper.screen.template.class configures
       the mapper used for finding your screen template. This is used
       whenever a screen class is requesting a template to
  -    render. Default is \
org.apache.turbine.services.template.mapper.TemplateScreenMapper  +    render. \
Default is org.apache.turbine.services.template.mapper.ScreenTemplateMapper  +  </li>
  +  <li>
  +    services.TemplateService.mapper.navigation.template.class configures
  +    the mapper used for finding your navigation template. This is used
  +    whenever a navigation class is requesting a template to
  +    render. Default is \
org.apache.turbine.services.template.mapper.DirectTemplateMapper  </li>
   </ul>
   </section>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic