KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > configuration > xml > XMLConfigurationFactory


1 /*
2  * CoadunationLib: The coaduntion implementation library.
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * XMLConfigurationException.java
20  *
21  * XMLConfigurationFactory.java
22  *
23  * This class extends the configurtion factory to provide a XML version of the
24  * API.
25  */

26
27 // package
28
package com.rift.coad.lib.configuration.xml;
29
30 // coadunation imports
31
import com.rift.coad.lib.configuration.ConfigurationFactory;
32 import com.rift.coad.lib.configuration.ConfigurationException;
33 import com.rift.coad.lib.configuration.Configuration;
34
35 /**
36  * This class extends the configurtion factory to provide a XML version of the
37  * API.
38  *
39  * @author Brett Chaldecott
40  */

41 public class XMLConfigurationFactory extends ConfigurationFactory {
42     
43     // the classes private member variables
44
private XMLConfigurationParser parser = null;
45     
46     /**
47      * Creates a new instance of XMLConfigurationFactory
48      */

49     public XMLConfigurationFactory() throws XMLConfigurationException {
50         parser = new XMLConfigurationParser();
51     }
52
53     
54     /**
55      * This method returns a reference to the configuration class scoped for the
56      * class reference.
57      *
58      * @return Configuration The reference to the configuration class.
59      * @param classRef The reference to the class that the configuration will be
60      * retrieve for
61      * @exception ConfigurationException
62      */

63     public Configuration getConfig(Class JavaDoc classRef)
64         throws ConfigurationException {
65         if (parser.modified())
66         {
67             parser = new XMLConfigurationParser();
68         }
69         return parser.getConfig(classRef);
70     }
71 }
72
Popular Tags