1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.tiles.definition;
23
24 import java.util.Map;
25
26 import org.apache.tiles.Definition;
27
28 /***
29 * Interface for reading <code>{@link Definition}</code> from a source.
30 * <p/>
31 * <p>This interface provides a standard way to read
32 * <code>{@link Definition}</code> objects from a source. Implementations
33 * should define what the source is, whether it be a persistent store such as a
34 * configuration file or database, or something like a web service. The
35 * DefinitionsReader is responsible for reading from a single location. It does
36 * not perform any internationalization duties or inheritance of Definitions.
37 * It only reads from the source and returns a Map of objects read.</p>
38 *
39 * @version $Rev: 537196 $ $Date: 2007-05-11 16:07:35 +0200 (Fri, 11 May 2007) $
40 */
41 public interface DefinitionsReader {
42
43 /***
44 * Initializes the <code>DefinitionsReader</code> object.
45 * <p/>
46 * This method must be called before the {@link #read(java.lang.Object)} method is called.
47 *
48 * @param params A map of properties used to set up the reader.
49 * @throws DefinitionsFactoryException if required properties are not
50 * passed in or the initialization fails.
51 */
52 void init(Map<String, String> params) throws DefinitionsFactoryException;
53
54 /***
55 * Reads <code>{@link Definition}</code> objects from a source.
56 * <p/>
57 * Implementations should publish what type of source object is expected.
58 *
59 * @param source The source from which definitions will be read.
60 * @return a Map of <code>Definition</code> objects read from
61 * the source.
62 * @throws DefinitionsFactoryException if the source is invalid or
63 * an error occurs when reading definitions.
64 */
65 Map<String, Definition> read(Object source) throws DefinitionsFactoryException;
66
67 }