|
EAF 7.6 Util | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.enhydra.util.AbsConfigFile
com.lutris.util.ConfigFile
public class ConfigFile
ConfigFile is used to manipulate Multiserver configuration (*.conf) files. Presents all configuration elements in the form of a keyed table. Configuration elements are grouped by string "keys" according to the function they configure. The syntax is described more formally below.
stream ::= entry | stream entry entry ::= key "=" value_list | comment | blank value_list ::= value | value_list "," value value ::= fragment | value "+" fragment fragment ::= key | quoted_string quoted_string ::= (C/C++ style quoted string) key ::= (A string matching [A-Za-z_\./][A-Za-z0-9_-\./]*) comment ::= "#" (any text up to a newline) blank ::= (A line containing only white space)In addition to the above syntax, some additional semantic rules apply. The operator "+" concatenates the fragment immediately to the left and to the right of it. Thus
ab + cd
results in
abcd
. The operator "," terminates one element and begins
the next element. Thus, the line val = hello, world
creates a configuration entry with the key "val" and the two elements
"hello", and "world". If the characters "+", ",", or "\" occur at
the end of a line, then the entry is continued on the next line.
Trailing and leading whitespaces are ignored, and multiple whitespace
characters are converted by default into a single space. The "+"
operator leaves no whitespace between operands.
Finally, within quoted strings, C-style backslash escapes are
recognized. These include "\n" for newline, "\t" for tab, etc.
An example configuration input file is given below.
#============================================================== # Sample.config #============================================================== LDAP_SERVERS[] = "server1.ldap.gov:338", "server2.ldap.gov:1000" USER_TIMEOUT = 3600 # seconds. Comments can follow on same line. STRANGE_ENTRY = "This is a long long long long long " + "long long line. Notice how the \"+\" " + "operator is used to break this line up " + "into more than one line in the config file." , "And this is the second element." # etc.
Config
Field Summary |
---|
Fields inherited from class org.enhydra.util.AbsConfigFile |
---|
comments, config, file, jndiAdapt, jndiParameterNames, order |
Fields inherited from interface org.enhydra.util.ConfigFileInterface |
---|
TRAILING_COMMENT |
Constructor Summary | |
---|---|
ConfigFile()
|
|
ConfigFile(java.io.File file)
Constructor from a File. |
|
ConfigFile(java.io.InputStream inputStream)
Constructor from an InputStream. |
|
ConfigFile(KeywordValueTable kvt)
Constructor from a KeywordValueTable. |
Method Summary | |
---|---|
protected void |
readJndi()
Reads application configuration parameters by using JNDI Context. |
void |
write(java.io.OutputStream outputStream)
Writes out a config file to the OutputStream specified. |
Methods inherited from class org.enhydra.util.AbsConfigFile |
---|
addEntry, addEntry, getComment, getConfig, getFile, removeEntry, setFile, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigFile(java.io.InputStream inputStream) throws com.lutris.util.ConfigException
inputStream
- The input stream from which to parse the config file.
ConfigException
public ConfigFile()
public ConfigFile(java.io.File file) throws com.lutris.util.ConfigException, java.io.IOException
file
- The local file to parse.
java.io.IOException
ConfigException
public ConfigFile(KeywordValueTable kvt) throws com.lutris.util.ConfigException
kvt
- A KeywordValueTable from which to populate the config file.
ConfigException
Method Detail |
---|
protected void readJndi() throws com.lutris.util.ConfigException
readJndi
in class org.enhydra.util.AbsConfigFile
com.lutris.util.ConfigException
public void write(java.io.OutputStream outputStream)
write
in interface org.enhydra.util.ConfigFileInterface
write
in class org.enhydra.util.AbsConfigFile
outputStream
- The output stream on which to write the config file.
|
EAF 7.6 Util | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |