01: /*
02: * CoadunationLib: The coaduntion implementation library.
03: * Copyright (C) 2006 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
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: * This method returns a reference to the configuration class scoped for the
55: * class reference.
56: *
57: * @return Configuration The reference to the configuration class.
58: * @param classRef The reference to the class that the configuration will be
59: * retrieve for
60: * @exception ConfigurationException
61: */
62: public Configuration getConfig(Class classRef)
63: throws ConfigurationException {
64: if (parser.modified()) {
65: parser = new XMLConfigurationParser();
66: }
67: return parser.getConfig(classRef);
68: }
69: }
|