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