@Service(value=org.tentackle.prefs.PersistedPreferencesFactory.class) public class DbPreferencesFactory extends Object implements PersistedPreferencesFactory
| Constructor and Description |
|---|
DbPreferencesFactory()
Creates the factory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addKey(DbPreferencesKey key)
Adds a key/value pair.
|
void |
addPreferences(DbPreferences prefs)
Adds a preferences node the maps.
|
DbPreferencesKey |
createKey()
Creates a new DbPreferencesKey.
|
DbPreferencesNode |
createNode()
Creates a new DbPreferencesNode.
All nodes are created through this method. |
DbPreferences |
createPreferences(boolean userMode)
Creates a DbPreferences instance.
|
DbPreferences |
createPreferences(DbPreferences parent,
DbPreferencesNode node)
Creates a DbPreferences instance from a parent and a node.
|
DbPreferences |
createPreferences(DbPreferences parent,
String name)
Creates a DbPreferences instance from a parent and a name.
|
void |
expireKeys(long maxSerial)
Expire the preferences keys.
Invoked from the ModificationTracker (registered in DbPreferencesKey) |
void |
expireNodes(long maxSerial)
Expires the preferences nodes.
Invoked from the ModificationTracker (registered in DbPreferencesNode). |
DbPreferences |
getPreferences(long nodeId)
Gets the cached preferences by node id.
|
DbPreferences |
getPreferences(String user,
String path)
Gets the cached preferences by user and node path.
|
Session |
getSession()
Gets the session for a persistence operation.
|
PersistedPreferences |
getSystemRoot() |
PersistedPreferences |
getUserRoot() |
void |
importPreferences(InputStream is) |
boolean |
isAutoSync() |
boolean |
isReadOnly() |
boolean |
isSystemOnly() |
protected static String |
nodeName(Class<?> clazz)
Returns the absolute path name of the node corresponding to the package of the specified object.
|
void |
removeKey(DbPreferencesKey key)
Removes a key.
|
void |
removeNode(DbPreferencesNode node)
Removes a node.
|
void |
setAutoSync(boolean autoSync) |
void |
setReadOnly(boolean readOnly) |
void |
setSystemOnly(boolean systemOnly) |
DbPreferences |
systemNodeForPackage(Class<?> c) |
DbPreferences |
systemRoot() |
void |
updateKeyTableSerial(long newTableSerial)
Updates the highest keys table serial.
|
void |
updateNodeTableSerial(long newTableSerial)
Updates the highest node table serial.
|
DbPreferences |
userNodeForPackage(Class<?> c) |
DbPreferences |
userRoot() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInstancepublic Session getSession()
public void updateNodeTableSerial(long newTableSerial)
newTableSerial - the new serialpublic void updateKeyTableSerial(long newTableSerial)
newTableSerial - the new serialpublic void addPreferences(DbPreferences prefs)
prefs - the preferences nodepublic void removeNode(DbPreferencesNode node)
node - the nodepublic DbPreferences getPreferences(long nodeId)
nodeId - the node idpublic DbPreferences getPreferences(String user, String path)
user - the userpath - the node pathpublic void addKey(DbPreferencesKey key)
key - the keypublic void removeKey(DbPreferencesKey key)
key - the keypublic void expireKeys(long maxSerial)
maxSerial - is the current tableserialpublic void expireNodes(long maxSerial)
maxSerial - is the current tableserialpublic DbPreferences userRoot()
userRoot in interface PreferencesFactorypublic PersistedPreferences getUserRoot()
getUserRoot in interface PersistedPreferencesFactorypublic DbPreferences systemRoot()
systemRoot in interface PreferencesFactorypublic PersistedPreferences getSystemRoot()
getSystemRoot in interface PersistedPreferencesFactorypublic boolean isAutoSync()
isAutoSync in interface PersistedPreferencesFactorypublic void setAutoSync(boolean autoSync)
setAutoSync in interface PersistedPreferencesFactorypublic boolean isReadOnly()
isReadOnly in interface PersistedPreferencesFactorypublic void setReadOnly(boolean readOnly)
setReadOnly in interface PersistedPreferencesFactorypublic boolean isSystemOnly()
isSystemOnly in interface PersistedPreferencesFactorypublic void setSystemOnly(boolean systemOnly)
setSystemOnly in interface PersistedPreferencesFactorypublic DbPreferences userNodeForPackage(Class<?> c)
userNodeForPackage in interface PersistedPreferencesFactorypublic DbPreferences systemNodeForPackage(Class<?> c)
systemNodeForPackage in interface PersistedPreferencesFactorypublic void importPreferences(InputStream is) throws IOException, InvalidPreferencesFormatException
importPreferences in interface PersistedPreferencesFactoryIOExceptionInvalidPreferencesFormatExceptionpublic DbPreferences createPreferences(boolean userMode)
userMode - true if user modepublic DbPreferences createPreferences(DbPreferences parent, String name)
parent - the parent preferences nodename - the name of the child nodepublic DbPreferences createPreferences(DbPreferences parent, DbPreferencesNode node) throws BackingStoreException
parent - the parent preferencesnode - the nodeBackingStoreException - if creation failedpublic DbPreferencesNode createNode()
public DbPreferencesKey createKey()
protected static String nodeName(Class<?> clazz)
clazz - the classIllegalArgumentException - if the package has node preferences node associated with it.Copyright © 2016 Krake Softwaretechnik. All rights reserved.