| java.lang.Object org.enhydra.util.AbsConfigFile
All known Subclasses: com.lutris.util.ConfigFile, org.enhydra.util.XMLConfigFile,
AbsConfigFile | abstract public class AbsConfigFile implements ConfigFileInterface(Code) | | AbsConfigFile is abstract class which contains methods used to manipulate
application's configuration file to read its configuration parameters.
See Also: Config, ConfigFileInterface author: Tanja Jovanovic version: 1.0 |
Field Summary | |
protected Hashtable | comments Comments of configuration parameters. | protected Config | config The configuration object to which this configuration file belongs to. | protected File | file The associated file (if any). | protected JNDIAdapter | jndiAdapt JNDI Adapter used for reading application's parameters. | protected Hashtable | jndiParameterNames Parameters from configuration file whose values are jndi names of resources. | protected Vector | order Order in which are configuration parameters added. |
Method Summary | |
public void | addEntry(String key, String[] values, String comment) Adds an entry to the configuration.
Parameters: key - The config element name. Parameters: values - A string array of values. Parameters: comment - A string containing a properly commented configuration file comment. | public void | addEntry(String kkey, String value, String comment) Adds an entry to the configuration. | public String | getComment(String key) Returns the comment associated with a given key, or null if
there is no comment. | public Config | getConfig() Returns the Config object representing the config data in the file. | public File | getFile() Gets the associated file. | protected void | readJndi() Reads application configuration parameters using JNDI Context. | public void | removeEntry(String key) Removes an entry from the configuration. | public void | setFile(File file) Sets the configuration file. | public void | write() Writes this config to the associated configuration file. | abstract public void | write(OutputStream outputStream) Writes out a configuration file to the OutputStream specified. |
comments | protected Hashtable comments(Code) | | Comments of configuration parameters.
|
config | protected Config config(Code) | | The configuration object to which this configuration file belongs to.
|
file | protected File file(Code) | | The associated file (if any).
|
jndiAdapt | protected JNDIAdapter jndiAdapt(Code) | | JNDI Adapter used for reading application's parameters.
|
jndiParameterNames | protected Hashtable jndiParameterNames(Code) | | Parameters from configuration file whose values are jndi names of resources.
|
order | protected Vector order(Code) | | Order in which are configuration parameters added.
|
AbsConfigFile | public AbsConfigFile()(Code) | | Default constructor for an empty configuration file.
|
addEntry | public void addEntry(String key, String[] values, String comment) throws KeywordValueException(Code) | | Adds an entry to the configuration.
Parameters: key - The config element name. Parameters: values - A string array of values. Parameters: comment - A string containing a properly commented configuration file comment. exception: KeywordValueException - |
addEntry | public void addEntry(String kkey, String value, String comment) throws KeywordValueException(Code) | | Adds an entry to the configuration.
Parameters: key - The config element name. Parameters: value - A String value. Parameters: comment - A string containing a properly commented configuration file comment. exception: KeywordValueException - |
getComment | public String getComment(String key)(Code) | | Returns the comment associated with a given key, or null if
there is no comment. Pass in ConfigFileInterface.TRAILING_COMMENT to get
the trailing comment.
Parameters: key - the key to look up. the associated comment or null |
getConfig | public Config getConfig()(Code) | | Returns the Config object representing the config data in the file.
The Config object for this ConfigFile. |
getFile | public File getFile()(Code) | | Gets the associated file. If no file is associated with this config, null is
returned.
associated file |
readJndi | protected void readJndi() throws ConfigException(Code) | | Reads application configuration parameters using JNDI Context.
Subclasses should override this method.
|
setFile | public void setFile(File file)(Code) | | Sets the configuration file. This method can be useful in case when in
construction of ConfigFile object is not defined associated file. After the
file is set, Configuration parameters are read by using JNDI Context.
Parameters: file - given reference to configuration file represented as File object. |
write | abstract public void write(OutputStream outputStream)(Code) | | Writes out a configuration file to the OutputStream specified.
Parameters: outputStream - The output stream on which to write the config file. |
|
|