1 /*
2 * $Id: DefinitionsFactory.java 833737 2009-11-07 19:17:09Z apetrelli $
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 package org.apache.tiles.definition;
23
24 import org.apache.tiles.Definition;
25 import org.apache.tiles.request.Request;
26
27 /**
28 * Interface for creating a {@link Definition}s and managing their contents.
29 * <p/>
30 * <p>
31 * DefinitionsFactory implementations are responsible for maintaining the data
32 * sources of Tiles configuration data and using the data to create Definitions
33 * sets. Implementations also know how to append locale-specific configuration
34 * data to an existing Definitions set.
35 * </p>
36 *
37 * @version $Rev: 833737 $ $Date: 2009-11-08 06:17:09 +1100 (Sun, 08 Nov 2009) $
38 */
39 public interface DefinitionsFactory {
40
41 /**
42 * Property name that specifies the implementation of the DefinitionsReader.
43 */
44 String READER_IMPL_PROPERTY =
45 "org.apache.tiles.definition.DefinitionsReader";
46
47 /**
48 * Property name that specifies the implementation of
49 * {@link org.apache.tiles.locale.LocaleResolver}.
50 */
51 String LOCALE_RESOLVER_IMPL_PROPERTY =
52 "org.apache.tiles.locale.LocaleResolver";
53
54 /**
55 * Constant representing the configuration parameter
56 * used to define the tiles definition resources.
57 *
58 * @since 2.1.0
59 */
60 String DEFINITIONS_CONFIG = "org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG";
61
62 /**
63 * Constant representing the configuration parameter used to define the
64 * definition DAO to use.
65 */
66 String DEFINITION_DAO_INIT_PARAM =
67 "org.apache.tiles.definition.DefinitionsFactory.DefinitionDAO";
68
69 /**
70 * Returns a Definition object that matches the given name and
71 * Tiles context.
72 *
73 * @param name The name of the Definition to return.
74 * @param tilesContext The Tiles context to use to resolve the definition.
75 * @return the Definition matching the given name or null if none
76 * is found.
77 */
78 Definition getDefinition(String name, Request tilesContext);
79 }