KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > configuration > Configuration


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  * Configuration.java
20  *
21  * The interface that defines the configuration specific methods.
22  */

23
24 // package name
25
package com.rift.coad.lib.configuration;
26
27 // java imports
28
import java.util.Set JavaDoc;
29
30 /**
31  * The interface that defines the configuration specific methods.
32  *
33  * @author Brett Chaldecott
34  */

35 public interface Configuration {
36     
37     /**
38      * This method returns the name of the class.
39      *
40      * @return The string containing the name of the class.
41      */

42     public String JavaDoc getClassName();
43     
44     
45     /**
46      * This method returns TRUE if the key supplied is present in the data.
47      *
48      * @return TRUE if the key has been found.
49      * @param key The key to perform the search for.
50      * @exception ConfigurationException
51      */

52     public boolean containsKey(String JavaDoc key) throws ConfigurationException;
53     
54     
55     /**
56      * This method returns the list of keys
57      *
58      * @return The set containing the list of keys.
59      * @exception ConfigurationException
60      */

61     public Set JavaDoc getKeys() throws ConfigurationException;
62     
63     
64     /**
65      * This method returns true if the object is a string.
66      *
67      * @return TRUE if string, FALSE if not.
68      * @param key The key to check the string type of.
69      * @exception ConfigurationException
70      */

71     public boolean isString(String JavaDoc key) throws ConfigurationException;
72     
73     
74     /**
75      * The method that returns the string value for the requested key
76      *
77      * @return The string containing the configuration information.
78      * @param key The key to retrieve the value for.
79      * @exception ConfigurationException
80      */

81     public String JavaDoc getString(String JavaDoc key) throws ConfigurationException;
82     
83     
84     /**
85      * The method that returns the string value for the requested key
86      *
87      * @return The string containing the configuration information.
88      * @param key The key to retrieve the value for.
89      * @param defValue The default value.
90      * @exception ConfigurationException
91      */

92     public String JavaDoc getString(String JavaDoc key,String JavaDoc defValue)
93         throws ConfigurationException;
94     
95     
96     /**
97      * This method set the configuration value for the key.
98      *
99      * @param key The key to set the value for.
100      * @param value The new value to set.
101      * @exception ConfigurationException
102      */

103     public void setString(String JavaDoc key, String JavaDoc value)
104         throws ConfigurationException;
105     
106     
107     /**
108      * This method returns true if the object is a long.
109      *
110      * @return TRUE if long, FALSE if not.
111      * @param key The key to check the long type of.
112      * @exception ConfigurationException
113      */

114     public boolean isLong(String JavaDoc key) throws ConfigurationException;
115     
116     
117     /**
118      * The method that will retrieve the long value from the configuration.
119      *
120      * @return The long value.
121      * @param key identifying the long value.
122      * @exception ConfigurationException
123      */

124     public long getLong(String JavaDoc key) throws ConfigurationException;
125     
126     
127     /**
128      * The method that will retrieve the long value from the configuration.
129      *
130      * @return The long value.
131      * @param key identifying the long value.
132      * @param defValue The default long value.
133      * @exception ConfigurationException
134      */

135     public long getLong(String JavaDoc key,long defValue) throws ConfigurationException;
136     
137     
138     /**
139      * The method to set a configuration key value.
140      *
141      * @param key The key to set the value for.
142      * @param value The value for the key.
143      * @exception ConfigurationException
144      */

145     public void setLong(String JavaDoc key,long value) throws ConfigurationException;
146     
147     
148     /**
149      * This method returns true if the object is a boolean.
150      *
151      * @return TRUE if long, FALSE if not.
152      * @param key The key to check the long type of.
153      * @exception ConfigurationException
154      */

155     public boolean isBoolean(String JavaDoc key) throws ConfigurationException;
156     
157     
158     /**
159      * The method that will retrieve the boolean value from the configuration.
160      *
161      * @return TRUE of FALSE
162      * @param key identifying the boolean value.
163      * @exception ConfigurationException
164      */

165     public boolean getBoolean(String JavaDoc key) throws ConfigurationException;
166     
167     
168     /**
169      * The method that will retrieve the boolean value from the configuration.
170      *
171      * @return The boolean value.
172      * @param key identifying the boolean value.
173      * @param defValue The default boolean value.
174      * @exception ConfigurationException
175      */

176     public boolean getBoolean(String JavaDoc key,boolean defValue) throws
177             ConfigurationException;
178     
179     
180     /**
181      * The method to set a configuration key value.
182      *
183      * @param key The key to set the value for.
184      * @param value The value for the key.
185      * @exception ConfigurationException
186      */

187     public void setBoolean(String JavaDoc key,boolean value) throws
188             ConfigurationException;
189     
190     
191     /**
192      * This method will save the configuration information.
193      *
194      * @exception ConfigurationException
195      */

196     public void saveConfiguration() throws ConfigurationException;
197     
198 }
199
Popular Tags