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.Collections;
25 import java.util.Map;
26
27 import org.apache.tiles.Definition;
28
29 /***
30 * Mock Defintions Reader implementation. Stubs out all functionality.
31 *
32 * @version $Rev: 537196 $ $Date: 2007-05-11 16:07:35 +0200 (Fri, 11 May 2007) $
33 */
34 public class MockDefinitionsReader implements DefinitionsReader {
35
36 /***
37 * Hokey way to verify that this was created.
38 */
39 private static int instanceCount = 0;
40
41 /***
42 * Hokey way to verify that this class was created.
43 *
44 * @return The number of created instances.
45 */
46 public static int getInstanceCount() {
47 return instanceCount;
48 }
49
50 /*** Creates a new instance of MockDefinitionsReader. */
51 public MockDefinitionsReader() {
52 instanceCount++;
53 }
54
55 /***
56 * Reads <code>{@link Definition}</code> objects from a source.
57 *
58 * Implementations should publish what type of source object is expected.
59 *
60 * @param source The source from which definitions will be read.
61 * @return a Map of <code>Definition</code> objects read from
62 * the source.
63 * @throws org.apache.tiles.definition.DefinitionsFactoryException if the source is invalid or
64 * an error occurs when reading definitions.
65 */
66 @SuppressWarnings("unchecked")
67 public Map<String, Definition> read(Object source)
68 throws DefinitionsFactoryException {
69 return Collections.EMPTY_MAP;
70 }
71
72 /***
73 * Initializes the <code>DefinitionsReader</code> object.
74 *
75 * This method must be called before the {@link #read} method is called.
76 *
77 * @param params A map of properties used to set up the reader.
78 * @throws org.apache.tiles.definition.DefinitionsFactoryException if required properties are not
79 * passed in or the initialization fails.
80 */
81 public void init(Map<String, String> params) throws DefinitionsFactoryException {
82 }
83
84 }