KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > util > configuration > impl > OjbConfigurator


1 package org.apache.ojb.broker.util.configuration.impl;
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.configuration.Configurable;
19 import org.apache.ojb.broker.util.configuration.Configuration;
20 import org.apache.ojb.broker.util.configuration.ConfigurationException;
21 import org.apache.ojb.broker.util.configuration.Configurator;
22 import org.apache.ojb.broker.util.logging.Logger;
23 import org.apache.ojb.broker.util.logging.LoggerFactory;
24
25 /**
26  * The <code>Configurator</code> for the OJB system.
27  * Implemented as a singleton.
28  * @author Thomas Mahler
29  * @version $Id: OjbConfigurator.java,v 1.7.2.1 2005/12/21 22:28:15 tomdz Exp $
30  */

31 public class OjbConfigurator implements Configurator
32 {
33     /**
34      * the logger instance.
35      */

36     private static Logger log = LoggerFactory.getBootLogger();
37
38     /**
39      * the singleton instance of this class.
40      */

41     private static OjbConfigurator instance = new OjbConfigurator();
42
43     /**
44      * the configuration to be used throught OJB
45      */

46     private OjbConfiguration configuration;
47
48     /**
49      * private Constructor. There is no public Constructors.
50      * Use the static method <code>getInstance()</code> to obtain an
51      * instance of this class.
52      */

53     private OjbConfigurator()
54     {
55         configuration = new OjbConfiguration();
56     }
57
58     /**
59      * returns the singleton instance.
60      * @return the singleton instance.
61      */

62     public static OjbConfigurator getInstance()
63     {
64         return instance;
65     }
66
67     /**
68      * @see Configurator#setLogger(Logger)
69      */

70     public void setLogger(Logger logger)
71     {
72         log = logger;
73     }
74
75     /**
76      * @see Configurator#configure(Configurable)
77      */

78     public void configure(Configurable target) throws ConfigurationException
79     {
80         target.configure(configuration);
81     }
82
83     /**
84      * @see Configurator#getConfigurationFor(Configurable)
85      */

86     public Configuration getConfigurationFor(Configurable target)
87             throws ConfigurationException
88     {
89         return configuration;
90     }
91
92 }
93
Popular Tags