|
Oracle Fusion Middleware Java API Reference for Oracle PDK Java 11g Release 1 (11.1.1) E10691-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.portal.provider.v2.preference.PreferenceStore oracle.portal.provider.v2.preference.FilePreferenceStore
public class FilePreferenceStore
FilePreferenceStore
is a lightweight implementation of the
PreferenceStore
storage mechanism that persists data using the
filesystem.
All data is persisted in subdirectories of a designated root directory on
the filesystem, one data file per user preference. This root directory can
be registered explicitly using setRootDirectory(String)
. If not set
explicitly, however, the path returned by ProviderContext.getRepositoryPath()
will be used as the root directory. If
the provider is running under DefaultProviderLoader
, this will be the same
directory as the provider's XML definition file.
If the 'path hashing' feature has been activated (i.e. setUseHashing(true)
has been called, then each
preference data file stored in an extra subdirectory whose name is
determined by 'hashing' the data file name. This can improve filesystem
performance by limiting the number of preference data files stored in a
single directory.
Note that this class is directly compatible with data from persisted from
PersonalizationObject
s using the old
oracle.portal.provider.v1.FilePersonalizationManager
class.
Field Summary |
---|
Fields inherited from class oracle.portal.provider.v2.preference.PreferenceStore |
---|
DEFAULT_CUSTOMIZATION_TYPE, PATH_SEPARATOR_CHAR, PATH_SEPARATOR_STRING, USER_CUSTOMIZATION_TYPE |
Constructor Summary | |
---|---|
FilePreferenceStore()
Null Constructor |
Method Summary | |
---|---|
void |
destroy(Preference pref)
Destroys the data persisted for the given Preference . |
void |
destroy(java.lang.String context,
java.util.List preferenceTypes)
Destroys all of the Preference objects in this
PreferenceStore stored under the given context path with
one of the given preference types. |
boolean |
exists(Preference pref)
Returns true if persisted data exists for the given
Preference . |
java.io.InputStream |
getInputStream(Preference pref)
Gets an InputStream for reading the data of the given
Preference . |
java.io.OutputStream |
getOutputStream(Preference pref,
boolean overwrite)
Gets an OutputStream for writing the data of the given
Preference directly into storage. |
java.util.Iterator |
list(java.lang.String context,
java.util.List preferenceTypes)
Gets an Iterator over all of the Preference objects
in this PreferenceStore stored under the given context path
with one of the given preference types. |
void |
postInitialize()
Ensures any JNDI environment entry for the root directory location takes precedence over any value set thus far. |
void |
preInitialize(java.lang.Object parent)
Should be called immediately after construction of a FilePreferenceStore to associate it with its parent ProviderDefinition . |
void |
setRootDirectory(java.lang.String root)
Sets the path to the filesystem directory under which preference data will be stored. |
void |
setUseHashing(boolean useHashing)
Activate or deactivate the 'path hashing' feature for this FilePreferenceStore. |
void |
setUseHashing(java.lang.String useHashing)
Activate or deactivate the 'path hashing' feature for this FilePreferenceStore. |
void |
validate(java.lang.String context,
ValidationError errors)
Validates the internal state of this FilePreferenceStore
instance. |
Methods inherited from class oracle.portal.provider.v2.preference.PreferenceStore |
---|
copy, copy, copy, destroy, getName, list, read, setName, write |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FilePreferenceStore()
Method Detail |
---|
public void preInitialize(java.lang.Object parent) throws NodeHandlerException
FilePreferenceStore
to associate it with its parent ProviderDefinition
.
preInitialize
in interface InitializableXMLObject
parent
- the provider definition object. Should be a ProviderDefinition
NodeHandlerException
- if the given object is not a
ProviderDefinition
public void postInitialize()
FilePreferenceStore
.
postInitialize
in interface InitializableXMLObject
public void setRootDirectory(java.lang.String root)
root
- physical path to serve as the root directory for the
preference data repository.public void setUseHashing(boolean useHashing)
useHashing
- boolean indicating whether the 'path hashing' feature
should be used when determining the filesystem path in which to store a
preference data file for a particular portlet reference. If
false
, then data files for all preferences with the same
context path will be stored in a single directory corresponding to that
context path. If true
, then an extra level of directories
below the context path directory, with names derived by a hash function
of the preference data file name, will be used in order to limit the
number of preference data files stored in a single directory.public void setUseHashing(java.lang.String useHashing)
useHashing
- String representation of boolean ("true" or "false")
indicating whether the 'path hashing' feature should be used when
determining the filesystem path in which to store a preference data
file for a particular portlet reference.setUseHashing(boolean)
public java.util.Iterator list(java.lang.String context, java.util.List preferenceTypes) throws PreferenceStoreException
Iterator
over all of the Preference
objects
in this PreferenceStore
stored under the given context path
with one of the given preference types. Note that this listing is
'recursive', in that Preference
s stored in context paths
below the given one will also be returned. Note also that the data
object is not loaded into any of the listed Preference
s.
list
in class PreferenceStore
context
- the context path under which Preference
s
should be listed.preferenceTypes
- a list of strings, naming the preference types to
include, or null
if all preference types should be
included.
PreferenceStoreException
- if an error occurs during the
operation.public void destroy(java.lang.String context, java.util.List preferenceTypes) throws PreferenceStoreException
Preference
objects in this
PreferenceStore
stored under the given context path with
one of the given preference types. Note that this operation is
'recursive', in that Preference
s stored in context paths
below the given one will also be destroyed.
destroy
in class PreferenceStore
context
- the context path under which Preference
s
should be listed.preferenceTypes
- a list of strings, naming the preference types to
include, or null
if all preference types should be
included.
PreferenceStoreException
- if an error occurs during the
operation.public boolean exists(Preference pref) throws PreferenceStoreException
true
if persisted data exists for the given
Preference
.
exists
in class PreferenceStore
true
if persisted data exists for the given
Preference
, false
otherwise.
PreferenceStoreException
public java.io.InputStream getInputStream(Preference pref) throws EntryNotFoundException, PreferenceStoreException
InputStream
for reading the data of the given
Preference
.
This method is provided in conjunction with getOutputStream(oracle.portal.provider.v2.preference.Preference, boolean)
as
a way of streamlining the process of copying data between
PreferenceStore
s, since data can be copied directly from
the InputStream
of one Preference
to the
OutputStream
of another, without having to instantiate a
PreferenceDataObject
.
getInputStream
in class PreferenceStore
EntryNotFoundException
- if no data for the given
Preference
exists.
PreferenceStoreException
- if any other error occurs during the
operation.public java.io.OutputStream getOutputStream(Preference pref, boolean overwrite) throws EntryAlreadyExistsException, PreferenceStoreException
OutputStream
for writing the data of the given
Preference
directly into storage.
This method is provided in conjunction with getInputStream(oracle.portal.provider.v2.preference.Preference)
as a
way of streamlining the process of copying data between
PreferenceStore
s, since data can be copied directly from
the InputStream
of one Preference
to the
OutputStream
of another, without having to instantiate a
PreferenceDataObject
.
getOutputStream
in class PreferenceStore
EntryAlreadyExistsException
- if overwrite
was
false
and data for the given Preference
already exists in storage.
PreferenceStoreException
- if any other error occurs during the
operation.public void destroy(Preference pref) throws PreferenceStoreException
Preference
.
destroy
in class PreferenceStore
pref
- the Preference
whose persisted data should be
destroyed.
PreferenceStoreException
- if an error occurs during the
operation.public void validate(java.lang.String context, ValidationError errors)
FilePreferenceStore
instance. Errors found are reported using the supplied ValidationError
instance.
validate
in interface Validateable
validate
in class PreferenceStore
context
- The context of the calling instance.errors
- The current list of errors.
|
Oracle Fusion Middleware Java API Reference for Oracle PDK Java 11g Release 1 (11.1.1) E10691-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |