KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > services > template > mapper > DirectTemplateMapper


1 package org.apache.turbine.services.template.mapper;
2
3 /*
4  * Copyright 2001-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License")
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
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,v 1.1.2.2 2004/05/20 03:06:48 seade Exp $
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 JavaDoc doMapping(String JavaDoc template)
53     {
54         String JavaDoc [] components
55             = StringUtils.split(template, String.valueOf(TemplateService.TEMPLATE_PARTS_SEPARATOR));
56
57         return StringUtils.join(components, String.valueOf(separator));
58     }
59 }
60
Popular Tags