001: /*
002: * CoadunationLib: The coaduntion implementation library.
003: * Copyright (C) 2006 Rift IT Contracting
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
018: *
019: * Configuration.java
020: *
021: * The interface that defines the configuration specific methods.
022: */
023:
024: // package name
025: package com.rift.coad.lib.configuration;
026:
027: // java imports
028: import java.util.Set;
029:
030: /**
031: * The interface that defines the configuration specific methods.
032: *
033: * @author Brett Chaldecott
034: */
035: public interface Configuration {
036:
037: /**
038: * This method returns the name of the class.
039: *
040: * @return The string containing the name of the class.
041: */
042: public String getClassName();
043:
044: /**
045: * This method returns TRUE if the key supplied is present in the data.
046: *
047: * @return TRUE if the key has been found.
048: * @param key The key to perform the search for.
049: * @exception ConfigurationException
050: */
051: public boolean containsKey(String key)
052: throws ConfigurationException;
053:
054: /**
055: * This method returns the list of keys
056: *
057: * @return The set containing the list of keys.
058: * @exception ConfigurationException
059: */
060: public Set getKeys() throws ConfigurationException;
061:
062: /**
063: * This method returns true if the object is a string.
064: *
065: * @return TRUE if string, FALSE if not.
066: * @param key The key to check the string type of.
067: * @exception ConfigurationException
068: */
069: public boolean isString(String key) throws ConfigurationException;
070:
071: /**
072: * The method that returns the string value for the requested key
073: *
074: * @return The string containing the configuration information.
075: * @param key The key to retrieve the value for.
076: * @exception ConfigurationException
077: */
078: public String getString(String key) throws ConfigurationException;
079:
080: /**
081: * The method that returns the string value for the requested key
082: *
083: * @return The string containing the configuration information.
084: * @param key The key to retrieve the value for.
085: * @param defValue The default value.
086: * @exception ConfigurationException
087: */
088: public String getString(String key, String defValue)
089: throws ConfigurationException;
090:
091: /**
092: * This method set the configuration value for the key.
093: *
094: * @param key The key to set the value for.
095: * @param value The new value to set.
096: * @exception ConfigurationException
097: */
098: public void setString(String key, String value)
099: throws ConfigurationException;
100:
101: /**
102: * This method returns true if the object is a long.
103: *
104: * @return TRUE if long, FALSE if not.
105: * @param key The key to check the long type of.
106: * @exception ConfigurationException
107: */
108: public boolean isLong(String key) throws ConfigurationException;
109:
110: /**
111: * The method that will retrieve the long value from the configuration.
112: *
113: * @return The long value.
114: * @param key identifying the long value.
115: * @exception ConfigurationException
116: */
117: public long getLong(String key) throws ConfigurationException;
118:
119: /**
120: * The method that will retrieve the long value from the configuration.
121: *
122: * @return The long value.
123: * @param key identifying the long value.
124: * @param defValue The default long value.
125: * @exception ConfigurationException
126: */
127: public long getLong(String key, long defValue)
128: throws ConfigurationException;
129:
130: /**
131: * The method to set a configuration key value.
132: *
133: * @param key The key to set the value for.
134: * @param value The value for the key.
135: * @exception ConfigurationException
136: */
137: public void setLong(String key, long value)
138: throws ConfigurationException;
139:
140: /**
141: * This method returns true if the object is a boolean.
142: *
143: * @return TRUE if long, FALSE if not.
144: * @param key The key to check the long type of.
145: * @exception ConfigurationException
146: */
147: public boolean isBoolean(String key) throws ConfigurationException;
148:
149: /**
150: * The method that will retrieve the boolean value from the configuration.
151: *
152: * @return TRUE of FALSE
153: * @param key identifying the boolean value.
154: * @exception ConfigurationException
155: */
156: public boolean getBoolean(String key) throws ConfigurationException;
157:
158: /**
159: * The method that will retrieve the boolean value from the configuration.
160: *
161: * @return The boolean value.
162: * @param key identifying the boolean value.
163: * @param defValue The default boolean value.
164: * @exception ConfigurationException
165: */
166: public boolean getBoolean(String key, boolean defValue)
167: throws ConfigurationException;
168:
169: /**
170: * The method to set a configuration key value.
171: *
172: * @param key The key to set the value for.
173: * @param value The value for the key.
174: * @exception ConfigurationException
175: */
176: public void setBoolean(String key, boolean value)
177: throws ConfigurationException;
178:
179: /**
180: * This method will save the configuration information.
181: *
182: * @exception ConfigurationException
183: */
184: public void saveConfiguration() throws ConfigurationException;
185:
186: }
|