01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: * Locate an template using Jetspeed template location algorithm
30: *
31: * @param locator The template locator
32: * @return The template found, or null if not found.
33: * @throws TemplateLocatorException
34: */
35: TemplateDescriptor locateTemplate(LocatorDescriptor locator)
36: throws TemplateLocatorException;
37:
38: /**
39: * Factory to create template locators of the given type.
40: * Known supported locator types, but not limited to:
41: * <code>portlet</code>
42: * <code>email</code>
43: *
44: * @param The type of locator to create
45: * @return a general template locator of the given type
46: * @throws TemplateLocatorException if factory exception or if not valid locator type
47: */
48: LocatorDescriptor createLocatorDescriptor(String type)
49: throws TemplateLocatorException;
50:
51: /**
52: * Creates a locator from a string of format (where brackets are optional]:
53: *
54: * template/<templateType>/[media-type/<mediaType>]/[language/<language>]/[country/<country>]]/name/<templateName
55: *
56: * @param string the string representation of a template locator
57: * @throws TemplateLocatorException
58: */
59: LocatorDescriptor createFromString(String string)
60: throws TemplateLocatorException;
61:
62: /**
63: * Query for a collection of templates given template locator criteria.
64: *
65: * @param locator The template locator criteria.
66: * @return The result list of {@link Template} objects matching the locator criteria.
67: */
68: public Iterator query(LocatorDescriptor locator);
69:
70: }
|