1/*2 * $Id: DefinitionsFactory.java 822631 2009-10-07 09:21:12Z apetrelli $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */2122package org.apache.tiles.definition;
2324import org.apache.tiles.context.TilesRequestContext;
25import org.apache.tiles.Definition;
2627import java.util.Map;
2829/***30 * Interface for creating a {@link Definition}s and managing their contents.31 * <p/>32 * <p>33 * DefinitionsFactory implementations are responsible for maintaining the data34 * sources of Tiles configuration data and using the data to create Definitions35 * sets. Implementations also know how to append locale-specific configuration36 * data to an existing Definitions set.37 * </p>38 *39 * @version $Rev: 822631 $ $Date: 2009-10-07 11:21:12 +0200 (mer, 07 ott 2009) $40 */41publicinterfaceDefinitionsFactory {
4243/***44 * Property name that specifies the implementation of the DefinitionsReader.45 */46 String READER_IMPL_PROPERTY =
47"org.apache.tiles.definition.DefinitionsReader";
4849/***50 * Property name that specifies the implementation of51 * {@link org.apache.tiles.locale.LocaleResolver}.52 */53 String LOCALE_RESOLVER_IMPL_PROPERTY =
54"org.apache.tiles.locale.LocaleResolver";
5556/***57 * Constant representing the configuration parameter58 * used to define the tiles definition resources.59 *60 * @since 2.1.061 */62 String DEFINITIONS_CONFIG = "org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG";
6364/***65 * Constant representing the configuration parameter used to define the66 * definition DAO to use.67 */68 String DEFINITION_DAO_INIT_PARAM =
69"org.apache.tiles.definition.DefinitionsFactory.DefinitionDAO";
707172/***73 * Initializes the DefinitionsFactory and its subcomponents. <p/>74 * Implementations may support configuration properties to be passed in via75 * the params Map.76 *77 * @param params The Map of configuration properties.78 * @throws DefinitionsFactoryException If a Tiles exception, such as an initialization79 * error, occurs.80 * @deprecated Parameter based initialization is deprecated, please compose your81 * definitions factory using methods.82 */83void init(Map<String, String> params);
8485/***86 * Returns a Definition object that matches the given name and87 * Tiles context.88 *89 * @param name The name of the Definition to return.90 * @param tilesContext The Tiles context to use to resolve the definition.91 * @return the Definition matching the given name or null if none92 * is found.93 */94 Definition getDefinition(String name, TilesRequestContext tilesContext);
9596/***97 * Adds a source where Definition objects are stored.98 * <p/>99 * Implementations should publish what type of source object they expect.100 * The source should contain enough information to resolve a configuration101 * source containing definitions. The source should be a "base" source for102 * configurations. Internationalization and Localization properties will be103 * applied by implementations to discriminate the correct data sources based104 * on locale.105 *106 * @param source The configuration source for definitions.107 * @deprecated Let the Definitions Factory load its sources by itself.108 */109 @Deprecated
110void addSource(Object source);
111112/***113 * Creates and returns a {@link Definitions} set by reading114 * configuration data from the applied sources.115 *116 * @return The read definitions.117 * @deprecated Let the Definitions Factory use it.118 */119 @Deprecated
120Definitions readDefinitions();
121 }