View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.services.template;
18  
19  import org.apache.turbine.services.Service;
20  import org.apache.turbine.util.RunData;
21  
22  import java.util.Locale;
23  
24  /***
25   * <p>This interface is a facade for all template location related operations.
26   * Template location algorithms are different from the Velocity template location,
27   * since Jetspeed has a specialized template directory structure.
28   * This is a fix to get us through unti the TurbineTemplateService can locate
29   * resources by NLS and mediatype. Then it can be removed</p>
30   *
31   * <p>The directory structure is currently layout out in the following order:
32   *    /templateType/mediaType/LanguageCode/CountryCode</p>
33   * <p>Example: /screens/html/en/US/resource.vm</p>
34   *
35   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
36   * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
37   * @author <a href="mailto:kimptoc_mail@yahoo.com">Chris Kimpton</a>
38   * @version $Id: TemplateLocatorService.java,v 1.8 2004/02/23 03:38:54 jford Exp $
39   */
40  
41  public interface TemplateLocatorService extends Service
42  {
43   
44      /*** The name of this service */
45      public String SERVICE_NAME = "TemplateLocator";
46  
47      /***
48       * Locate a screen template using Jetspeed template location algorithm, searching by
49       * mediatype and language criteria extracted from the request state in rundata.
50       *
51       * @param data The rundata for the request.
52       * @param template The name of the template.
53       *
54       * @return The path relative to the screens directory for the requested screen template,
55       *          or null if not found.
56       */
57      public String locateScreenTemplate(RunData data, String template);
58  
59      /***
60       * Locate a layout template using Jetspeed template location algorithm, searching by
61       * mediatype and language criteria extracted from the request state in rundata.
62       *
63       * @param data The rundata for the request.
64       * @param template The name of the template.
65       *
66       * @return The path relative to the layouts directory for the requested layout template,
67       *          or null if not found.
68       */
69      public String locateLayoutTemplate(RunData data, String template);
70  
71      /***
72       * Locate a portlet template using Jetspeed template location algorithm, searching by
73       * mediatype and language criteria extracted from the request state in rundata.
74       *
75       * @param data The rundata for the request.
76       * @param template The name of the template.
77       *
78       * @return The path relative to the portlets directory for the requested portlet template,
79       *          or null if not found.
80       */
81      public String locatePortletTemplate(RunData data, String template);
82  
83      /***
84       * Locate a control template using Jetspeed template location algorithm, searching by
85       * mediatype and language criteria extracted from the request state in rundata.
86       *
87       * @param data The rundata for the request.
88       * @param template The name of the template.
89       *
90       * @return The path relative to the controls directory for the requested control template,
91       *          or null if not found.
92       */
93      public String locateControlTemplate(RunData data, String template);
94  
95      /***
96       * Locate a controller template using Jetspeed template location algorithm, searching by
97       * mediatype and language criteria extracted from the request state in rundata.
98       *
99       * @param data The rundata for the request.
100      * @param template The name of the template.
101      *
102      * @return The path relative to the controllers directory for the requested controller template,
103      *          or null if not found.
104      */
105     public String locateControllerTemplate(RunData data, String template);
106 
107     /***
108      * Locate a navigation template using Jetspeed template location algorithm, searching by
109      * mediatype and language criteria extracted from the request state in rundata.
110      *
111      * @param data The rundata for the request.
112      * @param template The name of the template.
113      *
114      * @return The path relative to the controllers directory for the requested controller template,
115      *          or null if not found.
116      */
117     public String locateNavigationTemplate(RunData data, String template);
118 
119     /***
120      * Locate an email template using Jetspeed template location algorithm, searching by
121      * language criteria extracted from the request state in rundata.
122      *
123      * @param data The rundata for the request.
124      * @param template The name of the template.
125      *
126      * @return The path relative to the emails directory for the requested email template,
127      *          or null if not found.
128      */
129     public String locateEmailTemplate(RunData data, String template);
130 
131     /***
132      * Locate an email template using Jetspeed template location algorithm
133      *
134      * @param data The rundata for the request.
135      * @param template The name of the template.
136      * @param locale The locale of the template.
137      *
138      * @return The path relative to the emails directory for the requested email template,
139      *          or null if not found.
140      */
141     public String locateEmailTemplate(RunData data, String template, Locale locale);
142 
143     /***
144      * Locate a parameter style template using Jetspeed template location algorithm, searching by
145      * mediatype and language criteria extracted from the request state in rundata.
146      *
147      * @param data The rundata for the request.
148      * @param template The name of the template.
149      *
150      * @return The path relative to the parameters directory for the requested portlet template,
151      *          or null if not found.
152      */
153     public String locateParameterTemplate(RunData data, String template);
154 
155 }