|
Oracle Fusion Middleware Java API Reference for Oracle ADF Share 11g Release 1 (11.1.1) E10686-04 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.prefs.Preferences
java.util.prefs.AbstractPreferences
oracle.adf.share.prefs.ADFPreferences
public class ADFPreferences
An implementation of Preferences
class providing
a MDS repository based persistence mechanism. This class also provides a
richer user level preferences, using the J2EE authenticated user. It also
enables access to preference objects, which return preferences based on a
user over system ordering.
It should be noted that accessing Preference objects directly though the
statics in this class assumes that the Preference Utility is being used
within the context of an ADF Web Application. As such the details required
to connect to the MDS Repository are obtained by the utility from the
ADF Context.
Consumers wanting to use the ADFPreferences Utility outside of the scope of
an ADF Web Application should only access ADFPreferences objects through the
ADFPreferencesFactory class which has been constructed passing into it the
ADFPreferencesSimpleConfig object, that has inturn been constructed by
passing in a MDSInstance object.
Field Summary | |
---|---|
protected static java.lang.String |
FILENAME
The filename used for the MDS preference documents |
protected ADFPreferencesManager |
mManager
The ADFPreferencesManager object that helps manages the preferences |
Fields inherited from class java.util.prefs.AbstractPreferences |
---|
lock, newNode |
Fields inherited from class java.util.prefs.Preferences |
---|
MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_LENGTH |
Constructor Summary | |
---|---|
|
ADFPreferences(java.util.prefs.AbstractPreferences parent,
java.lang.String name)
Creates a preference node with the specified parent and the specified name relative to its parent. |
protected |
ADFPreferences(ADFPreferencesManager manager,
java.lang.String path)
Constructor used to create a Preference object and set against it the specified MDSHelper object, which will have been created with the path and customization context required for this Preference object. |
Method Summary | |
---|---|
java.util.Map<java.lang.String,java.lang.String> |
bulkGet()
This method enables a bulk get of all preference items that are accessible on this particular preference node. |
java.util.Map<java.lang.String,java.lang.String> |
bulkGet(java.util.Set<java.lang.String> prefSet)
This method enables a bulk get of a specified set of preference items that are accessible on this particular preference node. |
void |
bulkPut(java.util.Map<java.lang.String,java.lang.String> putMap)
This method enables bulk putting of a set of Preference items (String key, String value map elements). |
java.lang.String[] |
childrenNamesSpi()
Returns the names of the children of this preference node. |
java.util.prefs.AbstractPreferences |
childSpi(java.lang.String name)
Returns the named child of this preference node, creating it if it does not already exist. |
void |
flushSpi()
This method is invoked with this node locked. |
java.lang.String |
get(java.lang.String key,
java.lang.String def)
|
protected oracle.adf.share.prefs.MDSHelper |
getMDSHelper()
Returns the MDSHelper object associated with this Preference node. |
static java.lang.String |
getMDSPathForExport(java.util.prefs.Preferences prefs)
Returns the full MDS path associated with the Preferences object passed into the method. |
static java.lang.String |
getMDSPathForExport(java.lang.String preferencePath)
Returns the full MDS path associated with the Preferences path passed into the method. |
java.lang.String |
getSpi(java.lang.String key)
Return the value associated with the specified key at this preference node, or null if there is no association for this key, or the association cannot be determined at this time. |
static oracle.mds.cust.CustomizationClass |
getSystemCustomizationClass()
Returns the CustomizationClass associated with the System Customizations. |
static oracle.mds.cust.CustomizationClass |
getUserCustomizationClass()
Returns the CustomizationClass associated with the User Customizations. |
java.lang.String[] |
keysSpi()
Returns all of the keys that have an associated value in this preference node. |
void |
put(java.lang.String key,
java.lang.String val)
|
void |
putSpi(java.lang.String key,
java.lang.String value)
Put the given key-value association into this preference node. |
void |
remove(java.lang.String key)
|
void |
removeNodeSpi()
Removes this preference node, invalidating it and any preferences that it contains. |
void |
removeSpi(java.lang.String key)
Remove the association (if any) for the specified key at this preference node. |
void |
syncSpi()
This method is invoked with this node locked. |
static java.util.prefs.Preferences |
systemNodeForPackage(java.lang.Class<?> c)
Returns the preference node from the system preference tree that is associated (by convention) with the specified class's package. |
static java.util.prefs.Preferences |
systemRoot()
Returns the root preference node for the system. |
static java.util.prefs.Preferences |
userNodeForPackage(java.lang.Class<?> c)
Returns the preference node from the calling user's preference tree that is associated (by convention) with the specified class's package. |
static ADFPreferences |
userOverSystemNodeForPackage(java.lang.Class<?> c)
Returns the preference node associated with the MDS customization array's preference tree that is associated (by convention) with the specified class's package. |
static java.util.prefs.Preferences |
userOverSystemRoot()
Returns the root preference node for MDS sessions customization configuration specified in adf-config.xml |
static java.util.prefs.Preferences |
userRoot()
Returns the root preference node for the calling user. |
Methods inherited from class java.util.prefs.AbstractPreferences |
---|
absolutePath, addNodeChangeListener, addPreferenceChangeListener, cachedChildren, childrenNames, clear, exportNode, exportSubtree, flush, getBoolean, getByteArray, getChild, getDouble, getFloat, getInt, getLong, isRemoved, isUserNode, keys, name, node, nodeExists, parent, putBoolean, putByteArray, putDouble, putFloat, putInt, putLong, removeNode, removeNodeChangeListener, removePreferenceChangeListener, sync, toString |
Methods inherited from class java.util.prefs.Preferences |
---|
importPreferences |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final ADFPreferencesManager mManager
protected static final java.lang.String FILENAME
Constructor Detail |
---|
protected ADFPreferences(ADFPreferencesManager manager, java.lang.String path) throws oracle.mds.config.MDSConfigurationException, oracle.mds.core.MetadataExistsException, oracle.mds.exception.UnsupportedUpdateException, oracle.mds.persistence.MDSIOException, oracle.mds.core.ConcurrentMOChangeException, oracle.mds.core.ValidationException, java.lang.ClassNotFoundException, oracle.mds.exception.MDSException
manager
- The manager associated with this Preference object.
oracle.mds.config.MDSConfigurationException
oracle.mds.core.MetadataExistsException
oracle.mds.exception.UnsupportedUpdateException
oracle.mds.persistence.MDSIOException
oracle.mds.core.ConcurrentMOChangeException
oracle.mds.core.ValidationException
java.lang.ClassNotFoundException
oracle.mds.exception.MDSException
public ADFPreferences(java.util.prefs.AbstractPreferences parent, java.lang.String name)
parent
- the parent of this preference node, or null if this
is the root.name
- the name of this preference node, relative to its parent,
or "" if this is the root.
java.lang.IllegalArgumentException
- if name contains a slash
('/'), or parent is null and
name isn't "".Method Detail |
---|
public java.lang.String getSpi(java.lang.String key)
Generally speaking, this method should not throw an exception under any circumstances. If, however, if it does throw an exception, the exception will be intercepted and treated as a null return value.
This method is invoked with the lock on this node held.
getSpi
in class java.util.prefs.AbstractPreferences
public void putSpi(java.lang.String key, java.lang.String value)
This method is invoked with the lock on this node held.
putSpi
in class java.util.prefs.AbstractPreferences
public void removeSpi(java.lang.String key)
This method is invoked with the lock on this node held.
removeSpi
in class java.util.prefs.AbstractPreferences
public java.util.prefs.AbstractPreferences childSpi(java.lang.String name)
Preferences.MAX_NAME_LENGTH
characters. Also, it is guaranteed that
this node has not been removed. (The implementor needn't check for any
of these things.)
Finally, it is guaranteed that the named node has not been returned
by a previous invocation of this method or AbstractPreferences.getChild(String)
after the last time that it was removed. In other words, a cached
value will always be used in preference to invoking this method.
Subclasses need not maintain their own cache of previously returned
children.
The implementer must ensure that the returned node has not been removed. If a like-named child of this node was previously removed, the implementer must return a newly constructed AbstractPreferences node; once removed, an AbstractPreferences node cannot be "resuscitated."
If this method causes a node to be created, this node is not guaranteed to be persistent until the flush method is invoked on this node or one of its ancestors (or descendants).
This method is invoked with the lock on this node held.
childSpi
in class java.util.prefs.AbstractPreferences
name
- The name of the child node to return, relative to
this preference node.
public void removeNodeSpi() throws java.util.prefs.BackingStoreException
Preferences.removeNode()
method
invokes this method repeatedly in a bottom-up fashion, removing each of
a node's descendants before removing the node itself).
This method is invoked with the lock held on this node and its
parent (and all ancestors that are being removed as a
result of a single invocation to Preferences.removeNode()
).
The removal of a node needn't become persistent until the flush method is invoked on this node (or an ancestor).
If this node throws a BackingStoreException, the exception
will propagate out beyond the enclosing AbstractPreferences.removeNode()
invocation.
removeNodeSpi
in class java.util.prefs.AbstractPreferences
java.util.prefs.BackingStoreException
- if this operation cannot be completed
due to a failure in the backing store, or inability to
communicate with it.public java.lang.String[] keysSpi() throws java.util.prefs.BackingStoreException
This method is invoked with the lock on this node held.
If this node throws a BackingStoreException, the exception
will propagate out beyond the enclosing AbstractPreferences.keys()
invocation.
keysSpi
in class java.util.prefs.AbstractPreferences
java.util.prefs.BackingStoreException
- if this operation cannot be completed
due to a failure in the backing store, or inability to
communicate with it.public java.lang.String[] childrenNamesSpi() throws java.util.prefs.BackingStoreException
This method is invoked with the lock on this node held.
If this node throws a BackingStoreException, the exception
will propagate out beyond the enclosing AbstractPreferences.childrenNames()
invocation.
childrenNamesSpi
in class java.util.prefs.AbstractPreferences
java.util.prefs.BackingStoreException
- if this operation cannot be completed
due to a failure in the backing store, or inability to
communicate with it.public void flushSpi() throws java.util.prefs.BackingStoreException
If this node throws a BackingStoreException, the exception
will propagate out beyond the enclosing AbstractPreferences.flush()
invocation.
flushSpi
in class java.util.prefs.AbstractPreferences
java.util.prefs.BackingStoreException
- if this operation cannot be completed
due to a failure in the backing store, or inability to
communicate with it.public void syncSpi() throws java.util.prefs.BackingStoreException
If this node throws a BackingStoreException, the exception
will propagate out beyond the enclosing AbstractPreferences.sync()
invocation.
syncSpi
in class java.util.prefs.AbstractPreferences
java.util.prefs.BackingStoreException
- if this operation cannot be completed
due to a failure in the backing store, or inability to
communicate with it.public static java.util.prefs.Preferences userOverSystemRoot()
java.lang.SecurityException
- If a security manager is present and
it denies RuntimePermission("preferences").RuntimePermission
public static ADFPreferences userOverSystemNodeForPackage(java.lang.Class<?> c)
This convention does not apply to the unnamed package, whose associated preference node is <unnamed>. This node is not intended for long term use, but for convenience in the early development of programs that do not yet belong to a package, and for "throwaway" programs. Valuable data should not be stored at this node as it is shared by all programs that use it.
A class Foo wishing to access preferences pertaining to its package can obtain a preference node as follows:
static Preferences prefs = Preferences.nodeForPackage(Foo.class);This idiom obviates the need for using a string to describe the preferences node and decreases the likelihood of a run-time failure. (If the class name is misspelled, it will typically result in a compile-time error.)
Invoking this method will result in the creation of the returned node and its ancestors if they do not already exist. If the returned node did not exist prior to this call, this node and any ancestors that were created by this call are not guaranteed to become permanent until the flush method is called on the returned node (or one of its ancestors or descendants).
c
- the class for whose package a MDS Sesson configuration
customization level preference node is desired.
java.lang.NullPointerException
- if c is null.
java.lang.SecurityException
- if a security manager is present and
it denies RuntimePermission("preferences").RuntimePermission
protected oracle.adf.share.prefs.MDSHelper getMDSHelper()
public java.lang.String get(java.lang.String key, java.lang.String def)
get
in class java.util.prefs.AbstractPreferences
public void put(java.lang.String key, java.lang.String val)
put
in class java.util.prefs.AbstractPreferences
public void bulkPut(java.util.Map<java.lang.String,java.lang.String> putMap)
Users of this method will have to access the method directly from the an ADFPreference object as opposed to a java.util.pref.Preferences class.
A usage example is given below:
// Create a bulk set
Map<String, String> prefsPutMap = new HashMap<String, String>();
prefsPutMap.put("pref1", "value1");
prefsPutMap.put("pref2", "value2");
prefsPutMap.put("pref3", "value3");
ADFPreferences pref = (ADFPreferences)mPrefFactory.userNodeForPackage (my.demo.service.PrefAccessor.class);pref.bulkPut(prefsPutMap);
putMap
- The Map (String, String) object containing the String key,
String value map elements to be populated in a bulk manner on the
preference node associated with this preference object.public java.util.Map<java.lang.String,java.lang.String> bulkGet()
ADFPreferences prefNode =(ADFPreferences)mPrefFactory.userNodeForPackage (my.demo.service.PrefAccessor.class);Map<String, String> prefs = pref.bulkGet();
String pref1Value = prefs.get("pref1");
String pref2Value = prefs.get("pref2");
String pref3Value = prefs.get("pref3");
public java.util.Map<java.lang.String,java.lang.String> bulkGet(java.util.Set<java.lang.String> prefSet)
ADFPreferences prefNode =(ADFPreferences)mPrefFactory.userNodeForPackage (my.demo.service.PrefAccessor.class);Set<String> requestedPrefSet= new HashSet<String>(2);
s.add("pref1");
s.add("pref3");
Map<String, String> prefs = pref.bulkGet(requestedPrefSet);
String pref1Value = prefs.get("pref1");
String pref3Value = prefs.get("pref3");
public void remove(java.lang.String key)
remove
in class java.util.prefs.AbstractPreferences
public static java.util.prefs.Preferences systemRoot()
java.lang.SecurityException
- If a security manager is present and
it denies RuntimePermission("preferences").RuntimePermission
public static java.util.prefs.Preferences userRoot()
java.lang.SecurityException
- If a security manager is present and
it denies RuntimePermission("preferences").RuntimePermission
public static java.util.prefs.Preferences userNodeForPackage(java.lang.Class<?> c)
This convention does not apply to the unnamed package, whose associated preference node is <unnamed>. This node is not intended for long term use, but for convenience in the early development of programs that do not yet belong to a package, and for "throwaway" programs. Valuable data should not be stored at this node as it is shared by all programs that use it.
A class Foo wishing to access preferences pertaining to its package can obtain a preference node as follows:
static Preferences prefs = Preferences.userNodeForPackage(Foo.class);This idiom obviates the need for using a string to describe the preferences node and decreases the likelihood of a run-time failure. (If the class name is misspelled, it will typically result in a compile-time error.)
Invoking this method will result in the creation of the returned node and its ancestors if they do not already exist. If the returned node did not exist prior to this call, this node and any ancestors that were created by this call are not guaranteed to become permanent until the flush method is called on the returned node (or one of its ancestors or descendants).
c
- the class for whose package a user preference node is desired.
java.lang.NullPointerException
- if c is null.
java.lang.SecurityException
- if a security manager is present and
it denies RuntimePermission("preferences").RuntimePermission
public static java.util.prefs.Preferences systemNodeForPackage(java.lang.Class<?> c)
This convention does not apply to the unnamed package, whose associated preference node is <unnamed>. This node is not intended for long term use, but for convenience in the early development of programs that do not yet belong to a package, and for "throwaway" programs. Valuable data should not be stored at this node as it is shared by all programs that use it.
A class Foo wishing to access preferences pertaining to its package can obtain a preference node as follows:
static Preferences prefs = Preferences.systemNodeForPackage(Foo.class);This idiom obviates the need for using a string to describe the preferences node and decreases the likelihood of a run-time failure. (If the class name is misspelled, it will typically result in a compile-time error.)
Invoking this method will result in the creation of the returned node and its ancestors if they do not already exist. If the returned node did not exist prior to this call, this node and any ancestors that were created by this call are not guaranteed to become permanent until the flush method is called on the returned node (or one of its ancestors or descendants).
c
- the class for whose package a system preference node is desired.
java.lang.NullPointerException
- if c is null.
java.lang.SecurityException
- if a security manager is present and
it denies RuntimePermission("preferences").RuntimePermission
public static java.lang.String getMDSPathForExport(java.lang.String preferencePath)
preferencePath
- The path to the Preferences node whose MDS root path
is required, .e.g. "my/demo/app"
public static java.lang.String getMDSPathForExport(java.util.prefs.Preferences prefs)
prefs
- The Preferences object whose MDS root path is required.
public static oracle.mds.cust.CustomizationClass getSystemCustomizationClass()
public static oracle.mds.cust.CustomizationClass getUserCustomizationClass()
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Share 11g Release 1 (11.1.1) E10686-04 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |