| java.lang.Object org.griphyn.common.util.VDSProperties
VDSProperties | public class VDSProperties (Code) | | This class creates a common interface to handle package properties.
The package properties are meant as read-only (so far, until
requirements crop up for write access). The class is implemented
as a Singleton pattern.
author: Jens-S. Vöckler author: Yong Zhao author: Karan Vahi version: $Revision: 70 $ |
Method Summary | |
protected static Properties | addProperties(Properties a, Properties b) Adds new properties to an existing set of properties while
substituting variables. | public File | getDataDir() Accessor to $PEGASUS_HOME/share. | public File | getLocalStateDir() Accessor to $PEGASUS_HOME/var. | public String | getPegasusHome() Accessor: Obtains the root directory of the Pegasus runtime
system. | public String | getProperty(String key) Accessor: access to the internal properties as read from file.
An existing system property of the same key will have precedence
over any project property. | public String | getProperty(String key, String defValue) Accessor: access to the internal properties as read from file
An existing system property of the same key will have precedence
over any project property. | public File | getSharedStateDir() Accessor to $PEGASUS_HOME/com. | public File | getSysConfDir() Accessor to $PEGASUS_HOME/etc. | public String | getVDSHome() Accessor: Obtains the root directory of the VDS runtime
system. | public static VDSProperties | instance() Singleton threading: Creates the one and only instance of the
properties in the current application. | public Properties | matchingSubset(String prefix, boolean keepPrefix) Extracts a specific property key subset from the known properties.
The prefix may be removed from the keys in the resulting dictionary,
or it may be kept. | public static Properties | matchingSubset(Properties properties, String prefix, boolean keepPrefix) Extracts a specific property key subset from the properties passed.
The prefix may be removed from the keys in the resulting dictionary,
or it may be kept. | public static VDSProperties | noHassleInstance() Singleton interface: Creates the one and only instance of the
properties in the current application, and does not bother the
programmer with exceptions. | public static VDSProperties | nonSingletonInstance(String propFilename) Create a temporary property that is not attached to the Singleton.
This may be helpful with portal, which do magic things during the
lifetime of a process.
Parameters: propFilename - is the full path name to the location of theproperties file to read. | public Enumeration | propertyNames() | public Object | setProperty(String key, String value) Accessor: Overwrite any properties from within the program.
Parameters: key - is the key to look up Parameters: value - is the new property value to place in the system. | public int | size() Accessor: Obtains the number of properties known to the project. |
OLD_USER_PROPERTY_FILENAME | final public static String OLD_USER_PROPERTY_FILENAME(Code) | | Basename of the (old) file to read for user properties.
Warning, the old name will eventually fall prey to bit rot.
|
PROPERTY_FILENAME | final public static String PROPERTY_FILENAME(Code) | | Basename of the file to read to obtain system properties
|
USER_PROPERTY_FILENAME | final public static String USER_PROPERTY_FILENAME(Code) | | Basename of the (new) file to read for user properties.
|
VDSProperties | protected VDSProperties(String propFilename) throws IOException, MissingResourceException(Code) | | ctor. This initializes the local instance of properties
from a central file.
Parameters: propFilename - is the basename of the file to read. This filewill be looked for in the $PEGASUS_HOME/etc directory. Usually, the namewill be set from the PROPERTY_FILENAME constant above.Alternatively, the name will be ignored, if an alternative propertieslocation is specified via -Dpegasus.properties . exception: IOException - will be thrown if reading the property filegoes awry. exception: MissingResourceException - will be thrown if you forgotto specify the -Dpegasus.home=$PEGASUS_HOME to the runtimeenvironment. |
addProperties | protected static Properties addProperties(Properties a, Properties b)(Code) | | Adds new properties to an existing set of properties while
substituting variables. This function will allow value
substitutions based on other property values. Value substitutions
may not be nested. A value substitution will be ${property.key},
where the dollar-brace and close-brace are being stripped before
looking up the value to replace it with. Note that the ${..}
combination must be escaped from the shell.
Parameters: a - is the initial set of known properties (besides System ones) Parameters: b - is the set of properties to add to a the combined set of properties from a and b. |
getDataDir | public File getDataDir()(Code) | | Accessor to $PEGASUS_HOME/share. The files in this directory have a low
change frequency, are effectively read-only, can be shared via a
networked FS, and they are valid for multiple users.
the "share" directory of the VDS runtime system. |
getLocalStateDir | public File getLocalStateDir()(Code) | | Accessor to $PEGASUS_HOME/var. The files in this directory have a high
change frequency, are effectively read-write, they reside on a
per-machine basis, and they are valid usually for a single user.
the "var" directory of the VDS runtime system. |
getPegasusHome | public String getPegasusHome()(Code) | | Accessor: Obtains the root directory of the Pegasus runtime
system.
the root directory of the Pegasus runtime system, as initiallyset from the system properties. |
getProperty | public String getProperty(String key)(Code) | | Accessor: access to the internal properties as read from file.
An existing system property of the same key will have precedence
over any project property. This method will remove leading and
trailing ASCII control characters and whitespaces.
Parameters: key - is the key to look up the value for the key, or null, if not found. |
getProperty | public String getProperty(String key, String defValue)(Code) | | Accessor: access to the internal properties as read from file
An existing system property of the same key will have precedence
over any project property. This method will remove leading and
trailing ASCII control characters and whitespaces.
Parameters: key - is the key to look up Parameters: defValue - is a default to use, if no value can be found for the key. the value for the key, or the default value, if not found. |
getSharedStateDir | public File getSharedStateDir()(Code) | | Accessor to $PEGASUS_HOME/com. The files in this directory have a high
change frequency, are effectively read-write, they reside on a
per-machine basis, and they are valid usually for a single user.
the "com" directory of the VDS runtime system. |
getSysConfDir | public File getSysConfDir()(Code) | | Accessor to $PEGASUS_HOME/etc. The files in this directory have a low
change frequency, are effectively read-only, they reside on a
per-machine basis, and they are valid usually for a single user.
the "etc" directory of the VDS runtime system. |
getVDSHome | public String getVDSHome()(Code) | | Accessor: Obtains the root directory of the VDS runtime
system. Kept to make ChimeraProperties.java to compile for time being
the root directory of the Pegasus runtime system, as initiallyset from the system properties. |
matchingSubset | public Properties matchingSubset(String prefix, boolean keepPrefix)(Code) | | Extracts a specific property key subset from the known properties.
The prefix may be removed from the keys in the resulting dictionary,
or it may be kept. In the latter case, exact matches on the prefix
will also be copied into the resulting dictionary.
Parameters: prefix - is the key prefix to filter the properties by. Parameters: keepPrefix - if true, the key prefix is kept in the resultingdictionary. As side-effect, a key that matches the prefix exactlywill also be copied. If false, the resulting dictionary's keys areshortened by the prefix. An exact prefix match will not be copied,as it would result in an empty string key. a property dictionary matching the filter key. May bean empty dictionary, if no prefix matches were found. See Also: VDSProperties.getProperty(String) See Also: is used to assemble matches |
matchingSubset | public static Properties matchingSubset(Properties properties, String prefix, boolean keepPrefix)(Code) | | Extracts a specific property key subset from the properties passed.
The prefix may be removed from the keys in the resulting dictionary,
or it may be kept. In the latter case, exact matches on the prefix
will also be copied into the resulting dictionary.
Parameters: prefix - is the key prefix to filter the properties by. Parameters: keepPrefix - if true, the key prefix is kept in the resultingdictionary. As side-effect, a key that matches the prefix exactlywill also be copied. If false, the resulting dictionary's keys areshortened by the prefix. An exact prefix match will not be copied,as it would result in an empty string key. a property dictionary matching the filter key. May bean empty dictionary, if no prefix matches were found. See Also: VDSProperties.getProperty(String) See Also: is used to assemble matches |
noHassleInstance | public static VDSProperties noHassleInstance()(Code) | | Singleton interface: Creates the one and only instance of the
properties in the current application, and does not bother the
programmer with exceptions. Rather, exceptions from the underlying
instance() call are caught, converted to an error
message on stderr, and the program is exited.
a reference to the properties. See Also: VDSProperties.instance() |
nonSingletonInstance | public static VDSProperties nonSingletonInstance(String propFilename) throws IOException, MissingResourceException(Code) | | Create a temporary property that is not attached to the Singleton.
This may be helpful with portal, which do magic things during the
lifetime of a process.
Parameters: propFilename - is the full path name to the location of theproperties file to read. In case of null, the default locationwill be taken a reference to the parsed properties. exception: IOException - will be thrown if reading the property filegoes awry. exception: MissingResourceException - will be thrown if you forgotto specify the -Dpegasus.home=$PEGASUS_HOME to the runtimeenvironment. See Also: VDSProperties.instance() |
propertyNames | public Enumeration propertyNames()(Code) | | Accessor: enumerate all keys known to this property collection
an enumerator for the keys of the properties. |
setProperty | public Object setProperty(String key, String value)(Code) | | Accessor: Overwrite any properties from within the program.
Parameters: key - is the key to look up Parameters: value - is the new property value to place in the system. the old value, or null if it didn't exist before. |
size | public int size()(Code) | | Accessor: Obtains the number of properties known to the project.
number of properties in the project property space. |
|
|