1 /*
2 * This file is part of Pease Plate Template Engine.
3 *
4 * Pease Plate Template Engine is free software: you can redistribute
5 * it and/or modify it under the terms of the GNU Lesser General
6 * Public License as published by the Free Software Foundation,
7 * either version 3 of the License, or any later version.
8 *
9 * Pease Plate Template Engine is distributed in the hope that it
10 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
11 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with Pease Plate Template Engine. If not, see
16 * <http://www.gnu.org/licenses/>.
17 *
18 * Copyright (c) 2008 Manfred HANTSCHEL
19 */
20 package org.peaseplate.locator;
21
22 import java.util.Locale;
23
24 import org.peaseplate.Template;
25 import org.peaseplate.TemplateEngine;
26 import org.peaseplate.TemplateException;
27
28
29 /**
30 * A template locator stores the resource of the template
31 * and is capable of loading it.
32 */
33 public interface TemplateLocator extends Locator {
34
35 /**
36 * Returns a char array with the raw template data
37 * Don't forget to update the timestamp and the rawSize properties
38 * when loading the data.
39 * @return a char array with the raw template data
40 * @throws TemplateException on occasion
41 */
42 public char[] load() throws TemplateException;
43
44 /**
45 * Resolves the template with the specified name relative to this template.
46 * If it can't find the template it tries to resolve the template with
47 * the absolute name, usually by asking the engine.
48 * @param engine the engine
49 * @param name the name, relative or absolute
50 * @param locale the locale
51 * @param encoding the locale for loading
52 * @return the template or null if not found
53 * @throws TemplateException on occasion
54 */
55 public Template resolve(TemplateEngine engine, String name, Locale locale, String encoding) throws TemplateException;
56
57 /**
58 * Create a highlight from the resource with the position at
59 * line and column highlighted :)
60 * May return null.
61 * @param message TODO
62 * @param line the line
63 * @param column the column
64 * @return the highlight or null
65 */
66 public String highlight(String message, int line, int column);
67
68
69 }