View Javadoc

1   /**
2    * $Id: ConfigurationReader.java 17 2006-10-19 15:11:35Z maldito_orco $
3    * $Revision: 17 $
4    * $Date: 2006-10-19 12:11:35 -0300 (Thu, 19 Oct 2006) $
5    *
6    * =========================================================================
7    *
8    * Copyright 2005 Tubo
9    *
10   *  Licensed under the Apache License, Version 2.0 (the "License");
11   *  you may not use this file except in compliance with the License.
12   *  You may obtain a copy of the License at
13   *
14   *     http://www.apache.org/licenses/LICENSE-2.0
15   *
16   *  Unless required by applicable law or agreed to in writing, software
17   *  distributed under the License is distributed on an "AS IS" BASIS,
18   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   *  See the License for the specific language governing permissions and
20   *  limitations under the License.
21   */
22  package org.tubo.configuration.reader;
23  
24  //configuration
25  import org.tubo.configuration.def.Configuration;
26  //exception
27  import org.tubo.exception.TuboConfigurationException;
28  
29  import java.net.URL;
30  import java.io.Reader;
31  
32  /**
33   * Created: Jun 23, 2005 6:31:20 AM
34   * Last Modification Date: $Date: 2006-10-19 12:11:35 -0300 (Thu, 19 Oct 2006) $
35   *
36   * @author jvlio (jvlio@users.sourceforge.net)
37   * @version $Revision: 17 $
38   */
39  public interface ConfigurationReader {
40      public static final String RCS_ID = "$Id: ConfigurationReader.java 17 2006-10-19 15:11:35Z maldito_orco $";
41  
42      /**
43       * Create a new Configuration Object based on resource configuration.
44       * @param resource Configuration Resource
45       * @return A new configuration
46       * @throws org.tubo.exception.TuboConfigurationException If something occurs.
47       */
48      Configuration load(String resource) throws TuboConfigurationException;
49  
50      /**
51       * This method append configuration data stored on resource object to config object, replacing duplicated items.
52       * @param resource A class loader resource. see ClassLoader.getResource()
53       * @return config object with resource data append.
54       * @throws org.tubo.exception.TuboConfigurationException
55       */
56      Configuration append(String resource, Configuration config) throws TuboConfigurationException;
57  
58      /**
59       * This method append configuration data linked by URL to config object, replacing duplicated items.
60       * @param url Link to configuration data
61       * @return config object with resource data append.
62       * @throws org.tubo.exception.TuboConfigurationException
63       */
64      Configuration append(URL url, Configuration config) throws TuboConfigurationException;
65  
66      /**
67       * This method append configuration data stored in reader object to config object, replacing duplicated items.
68       * @param reader
69       * @param config
70       * @return
71       * @throws org.tubo.exception.TuboConfigurationException
72       */
73      Configuration append(Reader reader, Configuration config) throws TuboConfigurationException;
74  }