ca.spaz.cron
Class CRONConfiguration

java.lang.Object
  extended by ca.spaz.cron.CRONConfiguration

public final class CRONConfiguration
extends java.lang.Object


Method Summary
 void addPropertyValidator(PropertyValidator validator)
          Add a PropertyValidator to the configuration.
static CRONConfiguration getInstance()
          Get the global singleton instance of the configuration manager
 java.lang.String getProperty(java.lang.String property)
          Get a property from the configuration set.
 java.lang.String getProperty(java.lang.String property, boolean expandEnv)
           
 java.lang.String getProperty(java.lang.String property, java.lang.String defaultValue)
          Get a property from the configuration set, with a provided default value.
 java.lang.String getProperty(java.lang.String property, java.lang.String defaultValue, boolean expandEnv)
           
 java.util.Set keySet()
          Retrieve the set of all keys in both the user and system configurations.
static void main(java.lang.String[] args)
          The main method.
 void removePropertyValidator(PropertyValidator validator)
          Remove a validator from the configuration.
 java.lang.String setProperty(java.lang.String key, java.lang.String value)
          Sets the value of a property in the user configuration section.
 void setWriteOnChange(boolean writeOnChange)
          Set this value to determine if the configuration manager should write to disk on every change to the configuration, or if it should wait until store() is called to proceed.
 boolean store()
          Write the configuration to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static final CRONConfiguration getInstance()
Get the global singleton instance of the configuration manager

Returns:
a unique instance of CRONConfiguration.

setProperty

public java.lang.String setProperty(java.lang.String key,
                                    java.lang.String value)
Sets the value of a property in the user configuration section. If writeOnChange is true, this will immediately commit the change to the user config file. Otherwise, it will write to the properties in memory, and the caller must invoke store() to write the configuration to permanent storage.

Parameters:
key - The name of the property to set.
value - The new value of the property
Returns:
the value that the property held prior to being set. null, if the property had not previously been set.

addPropertyValidator

public void addPropertyValidator(PropertyValidator validator)
Add a PropertyValidator to the configuration. This will be checked against each time a property is set.

Parameters:
validator - the validator.

removePropertyValidator

public void removePropertyValidator(PropertyValidator validator)
Remove a validator from the configuration.

Parameters:
validator - The validator to remove.

getProperty

public java.lang.String getProperty(java.lang.String property,
                                    java.lang.String defaultValue,
                                    boolean expandEnv)

getProperty

public java.lang.String getProperty(java.lang.String property,
                                    boolean expandEnv)

getProperty

public java.lang.String getProperty(java.lang.String property,
                                    java.lang.String defaultValue)
Get a property from the configuration set, with a provided default value.

Parameters:
property - The name of the property to retrieve.
defaultValue - The default value of the named property.
Returns:
The value of the property in the configuration, or defaultValue if none was set.

getProperty

public java.lang.String getProperty(java.lang.String property)
Get a property from the configuration set.

Parameters:
property - The name of the property to retrieve.
Returns:
The value of the property in the configuration, or null if none was set.

setWriteOnChange

public void setWriteOnChange(boolean writeOnChange)
Set this value to determine if the configuration manager should write to disk on every change to the configuration, or if it should wait until store() is called to proceed.

Parameters:
writeOnChange - Set to true to enable writes, false to disable.

store

public boolean store()
Write the configuration to disk. This will flush the user config into their configuration file.

Returns:
true if the write succeeded, false if some exception was thrown.

keySet

public java.util.Set keySet()
Retrieve the set of all keys in both the user and system configurations.

Returns:
a Set containing the union of the property keys in both the user properties and system properties.

main

public static void main(java.lang.String[] args)
The main method. This is what is run when the app is executed.

Parameters:
args - The command-line arguments for the application.


Copyright © 2005 Spaz. All Rights Reserved.