|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.schwarzrot.data.access.pref.PreferencesManager
public class PreferencesManager
class to abstract operating system differences in preferences handling. This
class is used by the PreferencesConfigure
in very early application
setup stage, as well as by PreferencesEntityManager
the application
standard to access preferences by ready configured application.
This class should be considered internal to the persistence layer. Normally
there's no need to use it at application level. Use descendants of
AbstractConfigBase
and the transaction layer.
Windows path separator sometimes break originally java preferences, so we
care about that path handling/patching. This class could be considered like
the connection class from jdbc-layer. It covers all Preferences
access and offers accessor creation. Those accessors could be considered the
counterpart to jdbc resultset.
Node paths segments may be separated by "." or "/" or mixed by both. Main purpose of this class is to handle those mixtures and use the right path syntax for the operating system.
System preferences all go to the same root, where as user preferences are prefixed by the schema name.
Constructor Summary | |
---|---|
PreferencesManager(String ApplicationName,
String schemaName)
|
Method Summary | |
---|---|
void |
clearSystemNode(String nodePath)
|
void |
clearUserNode(String nodePath)
|
protected void |
flushSystemConfig()
|
protected void |
flushUserConfig()
|
protected String |
getPathSeparator()
|
PreferencesAccessor |
getPreferencesAccessor(EntityDescriptor ed)
convenience call. |
PreferencesAccessor |
getPreferencesAccessor(EntityDescriptor ed,
String subPath)
convenience call. |
PreferencesAccessor |
getPreferencesAccessor(String nodePath)
convenience call. |
Preferences |
getSystemNode(Class<?> clazz)
|
Preferences |
getSystemNode(Class<?> clazz,
boolean create)
|
Preferences |
getSystemNode(Class<?> clazz,
String subPath)
|
Preferences |
getSystemNode(Class<?> clazz,
String subPath,
boolean create)
|
Preferences |
getSystemNode(String path)
|
Preferences |
getSystemNode(String path,
boolean create)
|
Preferences |
getSystemNode(String path,
String subPath)
|
Preferences |
getSystemNode(String rawPath,
String subPath,
boolean create)
|
Preferences |
getUserNode(Class<?> clazz)
returns the node matching the class name from user space. |
Preferences |
getUserNode(Class<?> clazz,
boolean create)
returns the node matching the class name from user space. |
Preferences |
getUserNode(Class<?> clazz,
String subPath)
returns the child node of the given class. |
Preferences |
getUserNode(Class<?> clazz,
String subPath,
boolean create)
returns the child node of the given class. |
Preferences |
getUserNode(String path)
returns the node from user space matching the given path. |
Preferences |
getUserNode(String path,
boolean create)
returns the node from user space matching the given path. |
Preferences |
getUserNode(String path,
String subPath)
returns a childs node from node matching given path. |
Preferences |
getUserNode(String rawPath,
String subPath,
boolean create)
returns a child node from node matching given path. |
boolean |
isSystemWritable()
|
protected String |
pathConvert(String rawPath)
allow usage of classnames as node-paths, so this call converts dots into slashes. |
String |
readProperty(String propertyPath)
method to read a single property from preferences. |
void |
sync()
could be considered as the counterpart of commit of a jdbc connection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PreferencesManager(String ApplicationName, String schemaName)
Method Detail |
---|
public void clearSystemNode(String nodePath)
public void clearUserNode(String nodePath)
public PreferencesAccessor getPreferencesAccessor(EntityDescriptor ed)
ed
- - EntityDescriptor holding meta information about an
Entity
PreferencesAccessor
public PreferencesAccessor getPreferencesAccessor(EntityDescriptor ed, String subPath)
ed
- - EntityDescriptor holding meta information about an
Entity
subPath
- - path to the referred child
PreferencesAccessor
public PreferencesAccessor getPreferencesAccessor(String nodePath)
nodePath
- - path to preferences node
PreferencesAccessor
public Preferences getSystemNode(Class<?> clazz)
public Preferences getSystemNode(Class<?> clazz, boolean create)
public Preferences getSystemNode(Class<?> clazz, String subPath)
public Preferences getSystemNode(Class<?> clazz, String subPath, boolean create)
public Preferences getSystemNode(String path)
public Preferences getSystemNode(String path, boolean create)
public Preferences getSystemNode(String path, String subPath)
public Preferences getSystemNode(String rawPath, String subPath, boolean create)
public Preferences getUserNode(Class<?> clazz)
clazz
- - classname used as path to the node
Preferences
node or nullpublic Preferences getUserNode(Class<?> clazz, boolean create)
create
is set to true
, the node will be created if it
does not exist.
clazz
- - classname used as path to the nodecreate
- - true - to create the nodePreferences
node or nullpublic Preferences getUserNode(Class<?> clazz, String subPath)
null
if the node does not exist.
clazz
- - classname used as path to the nodesubPath
- - the name of the child, or the path to the child
Preferences
node or nullpublic Preferences getUserNode(Class<?> clazz, String subPath, boolean create)
create
is set to
true
, the node will be created if it does not already exist.
clazz
- - classname used as path to the nodecreate
- - true - to create the nodesubPath
- - the name of the child, or the path to the child
Preferences
node or nullpublic Preferences getUserNode(String path)
null
for non existing
nodes.
path
- - path to the node
Preferences
node or nullpublic Preferences getUserNode(String path, boolean create)
create
is set to true
and the node does not exists, it
will be created.
path
- - path to the nodecreate
- - true - create the nodePreferences
node or nullpublic Preferences getUserNode(String path, String subPath)
path
- - path to the parent nodesubPath
- - path to the child (relative to the parent)
Preferences
node or nullpublic Preferences getUserNode(String rawPath, String subPath, boolean create)
subPath
may
be null, so this call will return the parents node denoted by
rawPath
. Setting create
to true
will create non
existing nodes.
rawPath
- - raw path denoting the parents node. Path segements may be
separated any combination of ".", "/" or system dependant path
separators.subPath
- - path to the child (relative to the parent)create
- - true - create non existing nodesPreferences
node or nullpublic boolean isSystemWritable()
public String readProperty(String propertyPath)
propertyPath
- - the absolute path of a property, which means, the last
segment is the key and the preceeding part is the path of the
node.
public void sync()
protected void flushSystemConfig()
protected void flushUserConfig()
protected String getPathSeparator()
protected String pathConvert(String rawPath)
rawPath
- - path to convert
|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |