|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.sourceforge.java.feednread.backend.configuration.ConfigurationStore
ConfigurationStore is an
IPersistentPreferenceStore that allows arbitrary persistent
mediums and/or persistence strategies by decoupling the
IPersistentPreferenceStore from the underlying persistence
layer. It uses the IConfigurationPersistenceEngine interface
to retrieve/persist the configuration data.
XMLConfigurationPersistenceEngine
represents a default implementation of a xml based persistence layer.
| Field Summary | |
private IConfigurationPersistenceEngine |
configPersistence
|
private Map |
configuration
|
private IConfigurationPersistenceEngine |
defaultConfigPersistence
|
private Map |
defaults
|
private ListenerList |
listeners
|
private boolean |
modified
|
| Fields inherited from interface org.eclipse.jface.preference.IPreferenceStore |
BOOLEAN_DEFAULT_DEFAULT, DOUBLE_DEFAULT_DEFAULT, FALSE, FLOAT_DEFAULT_DEFAULT, INT_DEFAULT_DEFAULT, LONG_DEFAULT_DEFAULT, STRING_DEFAULT_DEFAULT, TRUE |
| Constructor Summary | |
ConfigurationStore(IConfigurationPersistenceEngine configPersistence,
IConfigurationPersistenceEngine defaultConfigPersistence)
Creates a new ConfigurationStore instance using the
specified IConfigurationPersistenceEngines for
retrieval/storage of the configuration and default settings.
|
|
| Method Summary | |
void |
addPropertyChangeListener(IPropertyChangeListener listener)
Adds the specified IPropertyChangeListener to the list of
registered listeners. |
boolean |
contains(String key)
Returns true if the underlying configuration contains a
value for the denoted key.
|
void |
firePropertyChangeEvent(String key,
Object oldValue,
Object newValue)
Fires a property change event corresponding to a change to the current value of the preference with the given key. |
private boolean |
getBoolean(Map data,
String key)
Helper function: gets a boolean value for a given key. |
boolean |
getBoolean(String key)
Gets the boolean value for the specified key. |
boolean |
getDefaultBoolean(String key)
Gets the default boolean value for the specified key. |
double |
getDefaultDouble(String key)
Gets the default double value for the specified key. |
float |
getDefaultFloat(String key)
Gets the default float value for the specified key. |
int |
getDefaultInt(String key)
Gets the default int value for the specified key. |
long |
getDefaultLong(String key)
Gets the default long value for the specified key. |
String |
getDefaultString(String key)
Gets the default String value for the specified key. |
private double |
getDouble(Map data,
String key)
Helper function: gets a double value for a given key. |
double |
getDouble(String key)
Gets the double value for the specified key. |
private float |
getFloat(Map data,
String key)
Helper function: gets a float value for a given key. |
float |
getFloat(String key)
Gets the float value for the specified key. |
private int |
getInt(Map data,
String key)
Helper function: gets an int value for a given key. |
int |
getInt(String key)
Gets the int value for the specified key. |
private long |
getLong(Map data,
String key)
Helper function: gets a long value for a given key. |
long |
getLong(String key)
Gets the long value for the specified key. |
private String |
getString(Map data,
String key)
Helper function: gets a String value for a given key. |
String |
getString(String key)
Gets the String value for the specified key. |
boolean |
isDefault(String key)
Returns true if the specified key is currently set to its
default value, i.e. has not been modified.
|
boolean |
needsSaving()
Returns true if this ConfigurationStore needs
to be saved due to a modified configuration.
|
void |
putValue(String key,
String value)
Sets the value of the setting denoted by the given key to the given value without sending a property change. |
void |
removePropertyChangeListener(IPropertyChangeListener listener)
Removes the specified IPropertyChangeListener from the list of
registered listeners.
|
void |
save()
Saves the configuration. |
void |
setDefault(String key,
boolean value)
Sets the default value for the specified key. |
void |
setDefault(String key,
double value)
Sets the default value for the specified key. |
void |
setDefault(String key,
float value)
Sets the default value for the specified key. |
void |
setDefault(String key,
int value)
Sets the default value for the specified key. |
void |
setDefault(String key,
long value)
Sets the default value for the specified key. |
void |
setDefault(String key,
String value)
Sets the default value for the specified key. |
void |
setToDefault(String key)
Sets the value denoted by the specified key back to its default value. |
private void |
setValue(Map data,
String key,
boolean value)
Helper method: Sets a boolean value for a given key. |
private void |
setValue(Map data,
String key,
double value)
Helper method: Sets a double value for a given key. |
private void |
setValue(Map data,
String key,
float value)
Helper method: Sets a float value for a given key. |
private void |
setValue(Map data,
String key,
int value)
Helper method: Sets an int value for a given key. |
private void |
setValue(Map data,
String key,
long value)
Helper method: Sets a long value for a given key. |
private void |
setValue(Map data,
String key,
String value)
Helper method: Sets a String value for a given key. |
void |
setValue(String key,
boolean value)
Sets the value for the specified key. |
void |
setValue(String key,
double value)
Sets the value for the specified key. |
void |
setValue(String key,
float value)
Sets the value for the specified key. |
void |
setValue(String key,
int value)
Sets the value for the specified key. |
void |
setValue(String key,
long value)
Sets the value for the specified key. |
void |
setValue(String key,
String value)
Sets the value for the specified key. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private ListenerList listeners
private IConfigurationPersistenceEngine configPersistence
private IConfigurationPersistenceEngine defaultConfigPersistence
private Map configuration
private Map defaults
private boolean modified
| Constructor Detail |
public ConfigurationStore(IConfigurationPersistenceEngine configPersistence,
IConfigurationPersistenceEngine defaultConfigPersistence)
throws PersistenceException
Creates a new ConfigurationStore instance using the
specified IConfigurationPersistenceEngines for
retrieval/storage of the configuration and default settings.
configPersistence - the PersistenceEngine responsible
for retrieving/storing the configuration datadefaultConfigPersistence - the PersistenceEngine
responsible for retrieving/storing the default settings
PersistenceException - if an error occured while retreiving/storing
the configuration data through the specified
PersistenceEngine instances| Method Detail |
public void save()
throws IOException
Saves the configuration. By default calls
IConfigurationPersistenceEngine.persist() on both, the
configuration itself and the default settings.
save in interface IPersistentPreferenceStoreIOExceptionIPersistentPreferenceStore.save()public void addPropertyChangeListener(IPropertyChangeListener listener)
Adds the specified IPropertyChangeListener to the list of
registered listeners. These listeners are to be informed when the current
value of a preference changes.
addPropertyChangeListener in interface IPreferenceStorelistener - the IPropertyChangeListener to addIPreferenceStore.addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)public void removePropertyChangeListener(IPropertyChangeListener listener)
Removes the specified IPropertyChangeListener from the list of
registered listeners.
removePropertyChangeListener in interface IPreferenceStorelistener - the IPropertyChangeListener to removedIPreferenceStore.removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)public boolean contains(String key)
Returns true if the underlying configuration contains a
value for the denoted key.
contains in interface IPreferenceStorekey - the key to test for existence
true if the underlying configuration contains a
value for the key denoted by the specified name; false
otherwiseIPreferenceStore.contains(java.lang.String)
public void firePropertyChangeEvent(String key,
Object oldValue,
Object newValue)
Fires a property change event corresponding to a change to the current value of the preference with the given key. This method is provided on this interface to simplify the implementation of decorators. There is normally no need to call this method since setValue and setToDefault report such events in due course. Implementations should funnel all preference changes through this method.
firePropertyChangeEvent in interface IPreferenceStorekey - the key identifying the setting to be used as the property in the
event objectoldValue - the old valuenewValue - the new valueIPreferenceStore.firePropertyChangeEvent(java.lang.String,
java.lang.Object, java.lang.Object)public boolean getBoolean(String key)
Gets the boolean value for the specified key.
getBoolean in interface IPreferenceStorekey - the key to get the boolean value for
IPreferenceStore.getBoolean(java.lang.String)public double getDouble(String key)
Gets the double value for the specified key.
getDouble in interface IPreferenceStorekey - the key to get the double value for
IPreferenceStore.getDouble(java.lang.String)public float getFloat(String key)
Gets the float value for the specified key.
getFloat in interface IPreferenceStorekey - the key to get the float value for
IPreferenceStore.getFloat(java.lang.String)public int getInt(String key)
Gets the int value for the specified key.
getInt in interface IPreferenceStorekey - the key to get the int value for
IPreferenceStore.getInt(java.lang.String)public long getLong(String key)
Gets the long value for the specified key.
getLong in interface IPreferenceStorekey - the key to get the long value for
IPreferenceStore.getLong(java.lang.String)public String getString(String key)
Gets the String value for the specified key.
getString in interface IPreferenceStorekey - the key to get the String value for
IPreferenceStore.getString(java.lang.String)public boolean getDefaultBoolean(String key)
Gets the default boolean value for the specified key.
getDefaultBoolean in interface IPreferenceStorekey - the key to get the default boolean value for
IPreferenceStore.getDefaultBoolean(java.lang.String)public double getDefaultDouble(String key)
Gets the default double value for the specified key.
getDefaultDouble in interface IPreferenceStorekey - the key to get the default double value for
IPreferenceStore.getDefaultDouble(java.lang.String)public float getDefaultFloat(String key)
Gets the default float value for the specified key.
getDefaultFloat in interface IPreferenceStorekey - the key to get the default float value for
IPreferenceStore.getDefaultFloat(java.lang.String)public int getDefaultInt(String key)
Gets the default int value for the specified key.
getDefaultInt in interface IPreferenceStorekey - the key to get the default int value for
IPreferenceStore.getDefaultInt(java.lang.String)public long getDefaultLong(String key)
Gets the default long value for the specified key.
getDefaultLong in interface IPreferenceStorekey - the key to get the default long value for
IPreferenceStore.getDefaultLong(java.lang.String)public String getDefaultString(String key)
Gets the default String value for the specified key.
getDefaultString in interface IPreferenceStorekey - the key to get the default String value for
IPreferenceStore.getDefaultString(java.lang.String)public boolean isDefault(String key)
Returns true if the specified key is currently set to its
default value, i.e. has not been modified.
isDefault in interface IPreferenceStorekey - the key to test
true if the specified key is currently set to its
default value, i.e. has not been modified; false otherwiseIPreferenceStore.isDefault(java.lang.String)public boolean needsSaving()
Returns true if this ConfigurationStore needs
to be saved due to a modified configuration.
needsSaving in interface IPreferenceStoretrue if this ConfigurationStore needs
to be saved due to a modified configuration; false otherwiseIPreferenceStore.needsSaving()
public void putValue(String key,
String value)
Sets the value of the setting denoted by the given key to the given value without sending a property change. This method does not fire a property change event and should only be used for setting internal preferences that are not meant to be processed by listeners. Normal clients should instead call #setValue.
putValue in interface IPreferenceStorekey - the key identifying the setting to be setvalue - the new value to setIPreferenceStore.putValue(java.lang.String,
java.lang.String)
public void setDefault(String key,
double value)
Sets the default value for the specified key.
setDefault in interface IPreferenceStorekey - the key to set the default value forvalue - the value to set as new default valueIPreferenceStore.setDefault(java.lang.String, double)
public void setDefault(String key,
float value)
Sets the default value for the specified key.
setDefault in interface IPreferenceStorekey - the key to set the default value forvalue - the value to set as new default valueIPreferenceStore.setDefault(java.lang.String, float)
public void setDefault(String key,
int value)
Sets the default value for the specified key.
setDefault in interface IPreferenceStorekey - the key to set the default value forvalue - the value to set as new default valueIPreferenceStore.setDefault(java.lang.String, int)
public void setDefault(String key,
long value)
Sets the default value for the specified key.
setDefault in interface IPreferenceStorekey - the key to set the default value forvalue - the value to set as new default valueIPreferenceStore.setDefault(java.lang.String, long)
public void setDefault(String key,
String value)
Sets the default value for the specified key.
setDefault in interface IPreferenceStorekey - the key to set the default value forvalue - the value to set as new default valueIPreferenceStore.setDefault(java.lang.String, java.lang.String)
public void setDefault(String key,
boolean value)
Sets the default value for the specified key.
setDefault in interface IPreferenceStorekey - the key to set the default value forvalue - the value to set as new default valueIPreferenceStore.setDefault(java.lang.String, boolean)public void setToDefault(String key)
Sets the value denoted by the specified key back to its default value.
setToDefault in interface IPreferenceStorekey - the key whose value to be set back to defaultIPreferenceStore.setToDefault(java.lang.String)
public void setValue(String key,
double value)
Sets the value for the specified key.
setValue in interface IPreferenceStorekey - the key to set the value forvalue - the value to setIPreferenceStore.setValue(java.lang.String, double)
public void setValue(String key,
float value)
Sets the value for the specified key.
setValue in interface IPreferenceStorekey - the key to set the value forvalue - the value to setIPreferenceStore.setValue(java.lang.String, float)
public void setValue(String key,
int value)
Sets the value for the specified key.
setValue in interface IPreferenceStorekey - the key to set the value forvalue - the value to setIPreferenceStore.setValue(java.lang.String, int)
public void setValue(String key,
long value)
Sets the value for the specified key.
setValue in interface IPreferenceStorekey - the key to set the value forvalue - the value to setIPreferenceStore.setValue(java.lang.String, long)
public void setValue(String key,
String value)
Sets the value for the specified key.
setValue in interface IPreferenceStorekey - the key to set the value forvalue - the value to setIPreferenceStore.setValue(java.lang.String, java.lang.String)
public void setValue(String key,
boolean value)
Sets the value for the specified key.
setValue in interface IPreferenceStorekey - the key to set the value forvalue - the value to setIPreferenceStore.setValue(java.lang.String, boolean)
private boolean getBoolean(Map data,
String key)
Helper function: gets a boolean value for a given key.
data - the Map holding the valuekey - the key to access the value for
private double getDouble(Map data,
String key)
Helper function: gets a double value for a given key.
data - the Map holding the valuekey - the key to access the value for
private float getFloat(Map data,
String key)
Helper function: gets a float value for a given key.
data - the Map holding the valuekey - the key to access the value for
private int getInt(Map data,
String key)
Helper function: gets an int value for a given key.
data - the Map holding the valuekey - the key to access the value for
private long getLong(Map data,
String key)
Helper function: gets a long value for a given key.
data - the Map holding the valuekey - the key to access the value for
private String getString(Map data,
String key)
Helper function: gets a String value for a given key.
data - the Map holding the valuekey - the key to access the value for
private void setValue(Map data,
String key,
double value)
Helper method: Sets a double value for a given key.
data - the Map to store the value inkey - the key to set the value forvalue - the updated value
private void setValue(Map data,
String key,
float value)
Helper method: Sets a float value for a given key.
data - the Map to store the value inkey - the key to set the value forvalue - the updated value
private void setValue(Map data,
String key,
int value)
Helper method: Sets an int value for a given key.
data - the Map to store the value inkey - the key to set the value forvalue - the updated value
private void setValue(Map data,
String key,
long value)
Helper method: Sets a long value for a given key.
data - the Map to store the value inkey - the key to set the value forvalue - the updated value
private void setValue(Map data,
String key,
boolean value)
Helper method: Sets a boolean value for a given key.
data - the Map to store the value inkey - the key to set the value forvalue - the updated value
private void setValue(Map data,
String key,
String value)
Helper method: Sets a String value for a given key.
data - the Map to store the value inkey - the key to set the value forvalue - the updated value
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||