1 package org.apache.turbine.services.template.mapper;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import org.apache.commons.lang.StringUtils;
20
21 import org.apache.turbine.services.template.TemplateService;
22
23 /***
24 * The most primitive templating mapper. It is used for the navigation template
25 * objects. It never caches and simply returns what is given to it but keeps
26 * the template extension.
27 *
28 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
29 * @version $Id: DirectTemplateMapper.java 264148 2005-08-29 14:21:04Z henning $
30 */
31 public class DirectTemplateMapper
32 extends BaseTemplateMapper
33 implements Mapper
34 {
35 /***
36 * Default C'tor. If you use this C'tor, you must use
37 * the bean setter to set the various properties needed for
38 * this mapper before first usage.
39 */
40 public DirectTemplateMapper()
41 {
42 }
43
44 /***
45 * Replace all "," with ".", but keep the extension.
46 *
47 * about,directions,Driving.vm --> about/directions/Driving.vm
48 *
49 * @param template The template name.
50 * @return A class name for the given template.
51 */
52 public String doMapping(String template)
53 {
54 String [] components
55 = StringUtils.split(template, String.valueOf(TemplateService.TEMPLATE_PARTS_SEPARATOR));
56
57 return StringUtils.join(components, String.valueOf(separator));
58 }
59 }