|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jini.compat.harness.SysConfig
A class used to simplify the access to properties in property files.
Constructor Summary | |
SysConfig(java.lang.String configFilename)
This constructor will attempt to open the properties file corresponding to the path and filename supplied in configFilename. |
Method Summary | |
boolean |
getBooleanConfigVal(java.lang.String propertyName,
boolean defaultVal)
This method will retrieve from the locally stored property list, the value of a property whose name corresponds to the string contained in the input argument "propertyName" and whose value is of type 'boolean'. |
double |
getDoubleConfigVal(java.lang.String propertyName,
double defaultVal)
This method will retrieve from the locally stored property list, the value of a property whose name corresponds to the string contained in the input argument "propertyName" and whose value is of type 'double'. |
float |
getFloatConfigVal(java.lang.String propertyName,
float defaultVal)
This method will retrieve from the locally stored property list, the value of a property whose name corresponds to the string contained in the input argument "propertyName" and whose value is of type 'float'. |
int |
getIntConfigVal(java.lang.String propertyName,
int defaultVal)
This method will retrieve from the locally stored property list, the value of a property whose name corresponds to the string contained in the input argument "propertyName" and whose value is of type 'int'. |
long |
getLongConfigVal(java.lang.String propertyName,
long defaultVal)
This method will retrieve from the locally stored property list, the value of a property whose name corresponds to the string contained in the input argument "propertyName" and whose value is of type 'long'. |
java.lang.String |
getPathConfigVal(java.lang.String propertyName,
java.lang.String defaultVal)
This method will retrieve from the locally stored property list, the String value of a "propertyName". |
java.lang.String |
getStringConfigVal(java.lang.String propertyName,
java.lang.String defaultVal)
This method will retrieve from the locally stored property list, the value of a property whose name corresponds to the string contained in the input argument "propertyName" and whose value is of type 'String'. |
java.lang.String |
relativeToAbsolutePath(java.lang.String path)
This method constructs a well-formed, absolute path/filename from the given path parameter. |
java.lang.String |
relativeToAbsolutePath(java.lang.String installDir,
java.lang.String path)
This method constructs a well-formed, absolute path/filename from the given installDir and path parameters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SysConfig(java.lang.String configFilename) throws java.io.IOException
configFilename
- the property file nameMethod Detail |
public int getIntConfigVal(java.lang.String propertyName, int defaultVal)
If the property list does not exist, or if the string value of the property can not be "cast" to the expected data type, then the default value will be returned.
public long getLongConfigVal(java.lang.String propertyName, long defaultVal)
If the property list does not exist, or if the string value of the property can not be "cast" to the expected data type, then the default value will be returned.
public float getFloatConfigVal(java.lang.String propertyName, float defaultVal)
If the property list does not exist, or if the string value of the property can not be "cast" to the expected data type, then the default value will be returned.
public double getDoubleConfigVal(java.lang.String propertyName, double defaultVal)
If the property list does not exist, or if the string value of the property can not be "cast" to the expected data type, then the default value will be returned.
public java.lang.String getStringConfigVal(java.lang.String propertyName, java.lang.String defaultVal)
If the property list does not exist, or if the string value of the property can not be "cast" to the expected data type, then the default value will be returned.
public boolean getBooleanConfigVal(java.lang.String propertyName, boolean defaultVal)
If the property list does not exist, or if the string value of the property can not be "cast" to the expected data type, then the default value will be returned.
public java.lang.String getPathConfigVal(java.lang.String propertyName, java.lang.String defaultVal)
If the property list does not exist then the default value will be returned.
The goal of this method is to take the path/filename String represented in the property corresponding to the given propertyName and "compute" a well-formed absolute path/filename. This method is intended to be sensitive to file system dependencies. For example, if the property is written in DOS file format (ex. C:\aaa\bbb\ccc\), but this method is executed on a system with a unix file system, this method will build a String in the unix file system format from the contents of the given String (/aaa/bbb/ccc).
In addition to being sensitive to file system differences, this method is also designed to handle both absolute and relative paths in a well-defined manner.
propertyName
- String
containing the name of the
property whose value should be retrieved and
converted to the appropriate formatdefaultVal
- the String
value to use if the
property given in the propertyName parameter does
not exist, or cannot be retrieved.
String
containing a path/filename constructed
from the value of the propertyName parameter and the
"com.sun.jini.compat.installDir" property in a format that is
appropriate to the current file system.public java.lang.String relativeToAbsolutePath(java.lang.String path)
path
parameter. If the path
parameter
is not already absolute, the OS-dependent absolute path constructed
from the current directory is pre-pended to the path
parameter, and the adjustments are made to the format of the output
for the current file system.
path
- String
containing the name of the
path/filename to process
String
containing a path/filename constructed
from the value of the input parameter in a format that is
appropriate to the current file system.public java.lang.String relativeToAbsolutePath(java.lang.String installDir, java.lang.String path)
installDir
and path
parameters. This
method is intended to be sensitive to file system dependencies.
For example, if the property is written in DOS file format
(ex. C:\aaa\bbb\ccc\), but this method is executed on a system with
a unix file system, this method will build a String in the unix file
system format from the contents of the given String (/aaa/bbb/ccc).
In addition to being sensitive to file system differences, this method
is also designed to handle both absolute and relative paths in a
well-defined manner. If the path/filename corresponding to the given
path
parameter is absolute, that path/filename will be
converted to the appropriate file system format with no other
modifications or additions applied. On the other hand, if the
path
parameter is relative, then the value contained in
installDir
parameter will be prepended to the
path
parameter, and the result will be returned in the
appropriate file system format.
Whether a given path/filename is viewed as relative or absolute is based on the following criteria:
non-DOS file systems abs/rel DOS file systems abs/rel -------------------- -------- ---------------- -------- /aaa/bbb/ccc absolute c:\aaa\bbb\ccc absolute aaa/bbb/ccc relative \aaa\bbb\ccc relative \\aaa\bbb\ccc relative aaa\bbb\ccc relative
Note that this method also attempts to handle the case where the
format of the given path
parameter is different than
the current file system's format. For example,
file sys installDir path abs/rel output -------- ---------- -------------- -------- -------------------- DOS c:\files c:\aaa\bbb\ccc absolute c:\aaa\bbb\ccc unix c:\files c:\aaa\bbb\ccc absolute /aaa/bbb/ccc DOS c:\files aaa\bbb\ccc relative c:\files\aaa\bbb\ccc unix c:\files aaa\bbb\ccc relative /files/aaa/bbb/ccc
installDir
- String
containing the name of the
directory to prepend to the path
parameter; if not an absolute path, it will be
made one using File.getAbsolutePath()path
- String
containing the name of the
path/filename to modify (if necessary); if not
an absolute path, it will be made one by prepending
the absolute path of installDir
String
containing an absolute path/filename
constructed from the value of the input parameters in a
format that is appropriate to the current file system.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |