KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > util > configuration > Configurator


1 package org.apache.ojb.broker.util.configuration;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import org.apache.ojb.broker.util.logging.Logger;
19
20 /**
21  * The <code>Configurator</code> interface defines methods for looking up
22  * Configurations and for configuring <code>Configurable</code> instances.
23  *
24  * call sequence:
25  * 1. The application obtains a <code>Configurator</code> instance (typically from a
26  * Factory).
27  *
28  * 2. The application uses the Configurator to configure <code>Configurable</code>
29  * instances.
30  * The Configurator must lookup the proper <code>Configuration</code> and invoke
31  * the <code>configure</code> method on the <code>Configurable</code> instance.
32  *
33  * <pre>
34  * // 1. obtain Configurator
35  * Configurator configurator = OjbConfigurator.getInstance();
36  *
37  * // 2. ask Configurator to configure the Configurable instance
38  * Configurable obj = ...
39  * configurator.configure(obj);
40  * </pre>
41  *
42  * @author Thomas Mahler
43  * @version $Id: Configurator.java,v 1.5.2.1 2005/12/21 22:28:15 tomdz Exp $
44  */

45 public interface Configurator
46 {
47
48     /**
49      * this method allows to set a logger that tracks configuration events.
50      * @param loggerInstance the logger to set
51      */

52     public void setLogger(Logger loggerInstance);
53
54     /**
55      * configures the <code>Configurable</code> instance target.
56      * @param target the <code>Configurable</code> instance.
57      * @throws ConfigurationException
58      */

59     public void configure(Configurable target) throws ConfigurationException;
60
61     /**
62      * looks up the proper <code>Configuration</code> for
63      * the <code>Configurable</code> instance target.
64      * @param target the <code>Configurable</code> instance.
65      * @return the resulting<code>Configuration</code>.
66      * @throws ConfigurationException
67      */

68     public Configuration getConfigurationFor(Configurable target) throws ConfigurationException;
69 }
70
Popular Tags