1/*2 * $Id: DefinitionsReader.java 652862 2008-05-02 18:22:56Z 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.Map;
2526import org.apache.tiles.Definition;
2728/***29 * Interface for reading <code>{@link Definition}</code> from a source.30 * <p/>31 * <p>This interface provides a standard way to read32 * <code>{@link Definition}</code> objects from a source. Implementations33 * should define what the source is, whether it be a persistent store such as a34 * configuration file or database, or something like a web service. The35 * DefinitionsReader is responsible for reading from a single location. It does36 * 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: 652862 $ $Date: 2008-05-02 20:22:56 +0200 (ven, 02 mag 2008) $40 */41publicinterfaceDefinitionsReader {
4243/***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 not50 * passed in or the initialization fails.51 */52void init(Map<String, String> params);
5354/***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 from61 * the source.62 * @throws DefinitionsFactoryException if the source is invalid or63 * an error occurs when reading definitions.64 */65 Map<String, Definition> read(Object source);
6667 }