public abstract class AbstractPreferencesService extends Object implements IPreferencesService
/@application1/@USER - user preferences of application 1
/@application1/@SYSTEM - system preferences of application 1
/@application2/@USER - user preferences of application 2
/@application2/@SYSTEM - system preferences of application 2
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractPreferencesService.FlushingThread
A thread running all flushs.
|
| Constructor and Description |
|---|
AbstractPreferencesService()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
checkNodeName(String s)
Checks the name of the node to be correct.
|
protected ReadWriteLock |
createReadWriteLock()
Creates a new
ReadWriteLock. |
protected abstract IPreferences |
createRootNode()
Creates the root node.
|
void |
flush(IPreferences node)
Flushes any changes made in this node.
|
protected abstract void |
flushSystemPreferences(IPreferences node,
String applicationName)
Flushes the system preferences from the given node.
|
protected abstract void |
flushUserPreferences(IPreferences node,
String applicationName)
Flushes the user preferences from the given node.
|
protected String |
getApplicationName(IPreferences node)
Returns the application name of the given node.
|
protected IPreferences |
getApplicationNode(IPreferences node)
Returns the application node rom the given node
|
protected IPreferences |
getApplicationPreferences(String applicationName)
Returns the application preferences.
|
protected IPreferences |
getLockNode(IPreferences node)
Returns the node where locks will be placed upon.
|
Lock |
getReadLock(IPreferences node)
Returns the read lock object for the given node.
|
protected ReadWriteLock |
getReadWriteLock(IPreferences node)
Returns the correct lock for the given node.
|
IPreferences |
getSystemPreferences(String applicationName)
Returns the system preferences for the given application.
|
IPreferences |
getUserPreferences(String applicationName)
Returns the user preferences for the given application.
|
Lock |
getWriteLock(IPreferences node)
Returns the write lock object for the given node.
|
protected abstract void |
loadSystemPreferences(IPreferences node,
String applicationName)
Loads the system preferences into the given node.
|
protected abstract void |
loadUserPreferences(IPreferences node,
String applicationName)
Loads the user preferences into the given node.
|
void |
nodeChanged(IPreferences node)
A node changed.
|
void |
sync(IPreferences node)
Wait for any modifications to be flushed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSystemPreferencesHome, getUserPreferencesHomeprotected abstract IPreferences createRootNode()
protected IPreferences getApplicationPreferences(String applicationName) throws BackingStoreException
applicationName - name of applicationBackingStoreExceptionprotected ReadWriteLock createReadWriteLock()
ReadWriteLock.ReentrantReadWriteLockpublic Lock getReadLock(IPreferences node)
getReadLock in interface IPreferencesServicenode - the node that requires a read lockLock objectpublic Lock getWriteLock(IPreferences node)
getWriteLock in interface IPreferencesServicenode - the node that requires a write lockLock objectprotected ReadWriteLock getReadWriteLock(IPreferences node)
node - node to get the lock forReadWriteLockprotected IPreferences getLockNode(IPreferences node)
node - the node where a lock is requiredprotected abstract void loadUserPreferences(IPreferences node, String applicationName) throws BackingStoreException
node - node that shall be populatedapplicationName - name of application to be loadedBackingStoreExceptionprotected abstract void loadSystemPreferences(IPreferences node, String applicationName) throws BackingStoreException
node - node that shall be populatedapplicationName - name of application to be loadedBackingStoreExceptionprotected abstract void flushUserPreferences(IPreferences node, String applicationName) throws BackingStoreException
node - node that shall be flushedapplicationName - name of application to be flushedBackingStoreExceptionprotected abstract void flushSystemPreferences(IPreferences node, String applicationName) throws BackingStoreException
node - node that shall be flushedapplicationName - name of application to be flushedBackingStoreExceptionpublic IPreferences getUserPreferences(String applicationName) throws BackingStoreException
getUserPreferences in interface IPreferencesServiceapplicationName - name of applicationBackingStoreExceptionpublic IPreferences getSystemPreferences(String applicationName) throws BackingStoreException
getSystemPreferences in interface IPreferencesServiceapplicationName - name of applicationBackingStoreExceptionprotected static void checkNodeName(String s)
s - string to be checkedpublic void nodeChanged(IPreferences node)
node - the node that changedpublic void flush(IPreferences node) throws BackingStoreException
flush in interface IPreferencesServicenode - the node to be flushedBackingStoreException - when there has been a communication problem with the backing store.protected IPreferences getApplicationNode(IPreferences node)
node - child nodeprotected String getApplicationName(IPreferences node)
node - any child nodepublic void sync(IPreferences node) throws BackingStoreException
sync in interface IPreferencesServicenode - the node to be flushedBackingStoreException - when there has been a communication problem with the backing store.Copyright © 2014. All rights reserved.