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.resolver;
21
22 import org.peaseplate.TemplateEngine;
23 import org.peaseplate.TemplateException;
24 import org.peaseplate.internal.ResourceKey;
25 import org.peaseplate.locator.MessagesLocator;
26 import org.peaseplate.locator.TemplateLocator;
27
28
29 /**
30 * A resolver works on some specified source, like a file system or a class loader.
31 *
32 * It looks for the raw template data and messages. If it found some data it creates a
33 * {@link TemplateLocator} or a {@link MessagesLocator} that describes how the
34 * data can be loaded.
35 */
36 public interface Resolver {
37
38 /**
39 * Resolves the specified template and returns a {@link TemplateLocator} if found
40 * or null otherwise.
41 *
42 * @param engine the Pease Plate engine
43 * @param key the key
44 * @return the template locator or null if not found
45 * @throws TemplateException on occasion
46 */
47 public TemplateLocator resolveTemplate(TemplateEngine engine, ResourceKey key) throws TemplateException;
48
49
50 /**
51 * Resolves the specified messages and returns a {@link MessagesLocator} if found
52 * or null otherwise
53 *
54 * @param engine the Pease Plate engine
55 * @param key the key
56 * @return the messages locator or null if not found
57 * @throws TemplateException on occasion
58 */
59 public MessagesLocator resolveMessages(TemplateEngine engine, ResourceKey key) throws TemplateException;
60
61 }