View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.locator;
18  
19  import java.util.Iterator;
20  
21  /***
22   * TemplateLocator interface
23   *
24   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
25   * @version $Id: TemplateLocator.java 516448 2007-03-09 16:25:47Z ate $
26   */
27  public interface TemplateLocator
28  {        
29      /***
30       * Locate an template using Jetspeed template location algorithm
31       *
32       * @param locator The template locator
33       * @return The template found, or null if not found.
34       * @throws TemplateLocatorException
35       */
36      TemplateDescriptor locateTemplate(LocatorDescriptor locator)
37          throws TemplateLocatorException;
38  
39      /***
40       * Factory to create template locators of the given type.
41       * Known supported locator types, but not limited to: 
42       *      <code>portlet</code>
43       *      <code>email</code>
44       * 
45       * @param The type of locator to create
46       * @return a general template locator of the given type
47       * @throws TemplateLocatorException if factory exception or if not valid locator type
48       */
49      LocatorDescriptor createLocatorDescriptor(String type)
50          throws TemplateLocatorException;
51  
52      /***
53       * Creates a locator from a string of format (where brackets are optional]:
54       *
55       *   template/<templateType>/[media-type/<mediaType>]/[language/<language>]/[country/<country>]]/name/<templateName
56       * 
57       * @param string the string representation of a template locator 
58       * @throws TemplateLocatorException
59       */        
60      LocatorDescriptor createFromString(String string)
61          throws TemplateLocatorException;
62          
63      /*** 
64       * Query for a collection of templates given template locator criteria.
65       *
66       * @param locator The template locator criteria.
67       * @return The result list of {@link Template} objects matching the locator criteria.
68       */
69      public Iterator query(LocatorDescriptor locator);
70      
71  }