01: package org.apache.ojb.broker.util.configuration;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * 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: * this method allows to set a logger that tracks configuration events.
49: * @param loggerInstance the logger to set
50: */
51: public void setLogger(Logger loggerInstance);
52:
53: /**
54: * configures the <code>Configurable</code> instance target.
55: * @param target the <code>Configurable</code> instance.
56: * @throws ConfigurationException
57: */
58: public void configure(Configurable target)
59: 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)
69: throws ConfigurationException;
70: }
|