|
EAF 7.6 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.enhydra.util.AbsConfigFile
public abstract class AbsConfigFile
AbsConfigFile is abstract class which contains methods used to manipulate application's configuration file to read its configuration parameters.
Config, ConfigFileInterface
Field Summary | |
---|---|
protected java.util.Hashtable |
comments
Comments of configuration parameters. |
protected com.lutris.util.Config |
config
The configuration object to which this configuration file belongs to. |
protected java.io.File |
file
The associated file (if any). |
protected org.enhydra.util.JNDIAdapter |
jndiAdapt
JNDI Adapter used for reading application's parameters. |
protected java.util.Hashtable |
jndiParameterNames
Parameters from configuration file whose values are jndi names of resources. |
protected java.util.Vector |
order
Order in which are configuration parameters added. |
Fields inherited from interface org.enhydra.util.ConfigFileInterface |
---|
TRAILING_COMMENT |
Constructor Summary | |
---|---|
AbsConfigFile()
Default constructor for an empty configuration file. |
|
AbsConfigFile(java.io.File file)
Constructor from a File. |
|
AbsConfigFile(com.lutris.util.KeywordValueTable kvt)
Constructor from a KeywordValueTable. |
Method Summary | |
---|---|
void |
addEntry(java.lang.String key,
java.lang.String[] values,
java.lang.String comment)
Adds an entry to the configuration. |
void |
addEntry(java.lang.String kkey,
java.lang.String value,
java.lang.String comment)
Adds an entry to the configuration. |
java.lang.String |
getComment(java.lang.String key)
Returns the comment associated with a given key, or null if
there is no comment. |
com.lutris.util.Config |
getConfig()
Returns the Config object representing the config data in the file. |
java.io.File |
getFile()
Gets the associated file. |
protected void |
readJndi()
Reads application configuration parameters using JNDI Context. |
void |
removeEntry(java.lang.String key)
Removes an entry from the configuration. |
void |
setFile(java.io.File file)
Sets the configuration file. |
void |
write()
Writes this config to the associated configuration file. |
abstract void |
write(java.io.OutputStream outputStream)
Writes out a configuration file to the OutputStream specified. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected com.lutris.util.Config config
protected java.util.Vector order
protected java.util.Hashtable comments
protected java.io.File file
protected org.enhydra.util.JNDIAdapter jndiAdapt
protected java.util.Hashtable jndiParameterNames
Constructor Detail |
---|
public AbsConfigFile()
public AbsConfigFile(java.io.File file) throws ConfigException, java.io.IOException
file
- The local file to parse.
java.io.IOException
ConfigException
public AbsConfigFile(com.lutris.util.KeywordValueTable kvt) throws ConfigException
kvt
- A KeywordValueTable from which to populate the configuration file.
ConfigException
Method Detail |
---|
protected void readJndi() throws ConfigException
ConfigException
public com.lutris.util.Config getConfig()
getConfig
in interface ConfigFileInterface
public java.lang.String getComment(java.lang.String key)
null
if
there is no comment. Pass in ConfigFileInterface.TRAILING_COMMENT
to get
the trailing comment.
getComment
in interface ConfigFileInterface
key
- the key to look up.
null
public void addEntry(java.lang.String key, java.lang.String[] values, java.lang.String comment) throws KeywordValueException
addEntry
in interface ConfigFileInterface
key
- The config element name.values
- A string array of values.comment
- A string containing a properly commented configuration file
comment.
KeywordValueException
public void addEntry(java.lang.String kkey, java.lang.String value, java.lang.String comment) throws KeywordValueException
addEntry
in interface ConfigFileInterface
key
- The config element name.value
- A String value.comment
- A string containing a properly commented configuration file
comment.
KeywordValueException
public void removeEntry(java.lang.String key) throws KeywordValueException
removeEntry
in interface ConfigFileInterface
key
- The config element name.
KeywordValueException
public java.io.File getFile()
null
is
returned.
getFile
in interface ConfigFileInterface
public void setFile(java.io.File file)
setFile
in interface ConfigFileInterface
file
- given reference to configuration file represented as File object.public void write() throws java.io.IOException, java.io.FileNotFoundException
FileNotFoundException
.
write
in interface ConfigFileInterface
java.io.IOException
java.io.FileNotFoundException
public abstract void write(java.io.OutputStream outputStream)
write
in interface ConfigFileInterface
outputStream
- The output stream on which to write the config file.
|
EAF 7.6 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |