com.continuent.tungsten.common.commands
Class PropertyCommands
java.lang.Object
com.continuent.tungsten.common.commands.PropertyCommands
public class PropertyCommands
- extends java.lang.Object
Methods to help loading manipulating a propertlies file
- Version:
- 1.0
- Author:
- Joe Daly
|
Method Summary |
static java.util.Properties |
readPropertyFile(java.lang.String propertyFile)
Loads a property file that in name=value. |
static boolean |
updatePropertyInPropertyFile(java.lang.String property,
java.lang.String value,
java.lang.String propertyFile,
boolean keepBackup,
boolean add)
Updates a property in a file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertyCommands
public PropertyCommands()
readPropertyFile
public static java.util.Properties readPropertyFile(java.lang.String propertyFile)
throws java.lang.Exception
- Loads a property file that in name=value. This is used rather then using
the Properties.load(InputStream inStream) to allow paths on windows to be
loaded without having to add \\ for paths.
- Parameters:
propertyFile - the property file to read in.
- Returns:
- a listing of properties for the given property file
- Throws:
java.lang.Exception - if the property file can not be loaded
updatePropertyInPropertyFile
public static boolean updatePropertyInPropertyFile(java.lang.String property,
java.lang.String value,
java.lang.String propertyFile,
boolean keepBackup,
boolean add)
throws java.lang.Exception
- Updates a property in a file.
- Parameters:
property - the property to updatevalue - the value to update topropertyFile - the file pathkeepBackup - if an update was done, keep the old copy aroundadd - if the property does not exist append to the end of the file
- Returns:
- true if the file was update, false if the property did not exist
and no update was done
- Throws:
java.lang.Exception