1/*2 * $Id: Definitions.java 537196 2007-05-11 14:07:35Z 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 java.util.Locale;
25import java.util.Map;
2627import org.apache.tiles.Definition;
2829/***30 * Interface for managing collections of {@link Definition} objects.31 * <p/>32 * <p>The Definitions interface provides a pattern for managing33 * Definition objects. Implementations will provide a means to append34 * new Definitions to the collection, add and retrieve lcale-specific35 * Definitions objects, and reset the collections.</p>36 *37 * @version $Rev: 537196 $ $Date: 2007-05-11 16:07:35 +0200 (Fri, 11 May 2007) $38 */39publicinterfaceDefinitions {
4041/***42 * Returns a Definition object that matches the given name.43 *44 * @param name The name of the Definition to return.45 * @return the Definition matching the given name or null if none46 * is found.47 */48 Definition getDefinition(String name);
4950/***51 * Adds new Definition objects to the internal collection and52 * resolves inheritance attraibutes.53 *54 * @param defsMap The new definitions to add.55 * @throws NoSuchDefinitionException if a Definition extends from56 * one that doesn't exist.57 */58void addDefinitions(Map<String, Definition> defsMap) throws NoSuchDefinitionException;
5960/***61 * Adds new locale-specific Definition objects to the internal62 * collection and resolves inheritance attraibutes.63 *64 * @param defsMap The new definitions to add.65 * @param locale The locale to add the definitions to.66 * @throws NoSuchDefinitionException if a Definition extends from67 * one that doesn't exist.68 */69void addDefinitions(Map<String, Definition> defsMap, Locale locale)
70 throws NoSuchDefinitionException;
7172/***73 * Returns a Definition object that matches the given name and locale.74 *75 * @param name The name of the Definition to return.76 * @param locale The locale to use to resolve the definition.77 * @return the Definition matching the given name or null if none78 * is found.79 */80 Definition getDefinition(String name, Locale locale);
8182/***83 * Resolves configuration inheritance properties.84 *85 * @throws NoSuchDefinitionException If parent definitions are not found.86 */87void resolveInheritances() throws NoSuchDefinitionException;
8889/***90 * Resolves locale-specific configuration inheritance properties.91 *92 * @param locale The locale object to use.93 * @throws NoSuchDefinitionException If parent definitions are not found.94 */95void resolveInheritances(Locale locale) throws NoSuchDefinitionException;
9697/***98 * Clears definitions.99 */100void reset();
101102/***103 * Returns base definitions collection.104 *105 * @return A map of the type "definition name -> definition".106 */107 Map<String, Definition> getBaseDefinitions();
108 }