|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Observable
org.pf.settings.impl.ReloadableSettings
public class ReloadableSettings
Implements settings that will be automatically reloaded if their underlying file has been modified. The interval for checking the file for changes can be specified.
| Constructor Summary | |
|---|---|
ReloadableSettings(long checkInterval,
SettingsFileReader reader)
Initialize the new instance with the interval after which the file has to be checked for changes and a reader that can read the file structure into a settings object. |
|
ReloadableSettings(long checkInterval,
SettingsFileReader reader,
boolean mustExist)
Initialize the new instance with the name of underlying file, the interval after which the file has to be checked for changes and a reader that can read the file structure into a settings object. |
|
| Method Summary | |
|---|---|
boolean |
canBeTriggeredBy(Trigger trigger)
Returns whether or not the trigger is allowed to activate the trigger client's triggeredBy() method. |
java.lang.String[] |
getCategoryNames()
Returns an array of all currently known categories. |
ReadOnlySettings |
getDefaults()
Gets the defaults that are looked up, if a setting can't be found in the main settings object. |
java.lang.String[] |
getKeyNamesOf(java.lang.String categoryName)
Returns all currently known key names in the category with the specified name. |
java.lang.String[] |
getKeyNamesOfDefaultCategory()
Returns all currently known key names in the default category. |
java.lang.String |
getName()
Returns the name of the settings object as a whole. |
java.lang.String |
getSettingsNameOf(java.lang.String keyName)
Returns the name of the name of the settings where the specified key is found in the default category. |
java.lang.String |
getSettingsNameOf(java.lang.String categoryName,
java.lang.String keyName)
Returns the name of the name of the settings where the specified category and key are found. |
java.lang.String |
getValueOf(java.lang.String keyName)
Returns the value of keyName in the default category. |
java.lang.String |
getValueOf(java.lang.String categoryName,
java.lang.String keyName)
Returns the value of keyName in the specified category. |
void |
setDefaults(ReadOnlySettings defaults)
Sets defaults that must be looked up, if a setting can't be found in the main settings object. |
void |
setName(java.lang.String aName)
Sets the name of the settings object as a whole. |
void |
startReloading(long checkInterval)
Starts the automatic reloading of changes in the underlying file. |
void |
stopReloading()
Stops the automatic reloading of changes in the underlying file. |
boolean |
triggeredBy(Trigger trigger)
This method will be called by a trigger whenever its timing says so. |
| Methods inherited from class java.util.Observable |
|---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReloadableSettings(long checkInterval,
SettingsFileReader reader)
throws ReloadableSettingsException
checkInterval - the interval in seconds after which the file must be checkedreader - The reader that can read the settings file
ReloadableSettingsException
public ReloadableSettings(long checkInterval,
SettingsFileReader reader,
boolean mustExist)
throws ReloadableSettingsException
checkInterval - the interval in seconds after which the file must be checkedreader - The reader that can read the settings filemustExist - If true, the settings file must exist. If it doesn't exist an exception will be thrown
ReloadableSettingsException| Method Detail |
|---|
public java.lang.String getName()
getName in interface ReadOnlySettingspublic void setName(java.lang.String aName)
setName in interface ReadOnlySettings
public java.lang.String getValueOf(java.lang.String categoryName,
java.lang.String keyName)
getValueOf in interface ReadOnlySettingscategoryName - The name of the category (null means the default category)keyName - The name of a key inside the category
public java.lang.String getValueOf(java.lang.String keyName)
getValueOf in interface ReadOnlySettingskeyName - The name of a key inside the default category
public java.lang.String[] getCategoryNames()
getCategoryNames in interface ReadOnlySettingspublic java.lang.String[] getKeyNamesOf(java.lang.String categoryName)
getKeyNamesOf in interface ReadOnlySettingscategoryName - The name of the category the keys are wanted frompublic java.lang.String[] getKeyNamesOfDefaultCategory()
getKeyNamesOfDefaultCategory in interface ReadOnlySettingspublic ReadOnlySettings getDefaults()
getDefaults in interface ReadOnlySettingspublic void setDefaults(ReadOnlySettings defaults)
setDefaults in interface ReadOnlySettingsdefaults - A settings object with default values or null
public java.lang.String getSettingsNameOf(java.lang.String categoryName,
java.lang.String keyName)
getSettingsNameOf in interface ReadOnlySettingscategoryName - The name of the category (null means the default category)keyName - The name of a key inside the category
public java.lang.String getSettingsNameOf(java.lang.String keyName)
getSettingsNameOf in interface ReadOnlySettingskeyName - The name of a key inside the default category
public boolean canBeTriggeredBy(Trigger trigger)
canBeTriggeredBy in interface TriggerClienttrigger - The trigger that calls this method
Triggerpublic boolean triggeredBy(Trigger trigger)
triggeredBy in interface TriggerClienttrigger - The trigger that calls this method
Triggerpublic void stopReloading()
public void startReloading(long checkInterval)
checkInterval - The interval (in milliseconds) for checking the file's modification timestamp
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||