|
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.Objectoracle.portal.provider.v2.personalize.PortletPersonalizationManager
oracle.portal.provider.v2.personalize.DBPersonalizationManager
public class DBPersonalizationManager
The DBPersonalizationManager class implements a
PortletPersonalizationManager using data objects to persist
customized data in a database.
The class of the data objects managed by a
DBPersonalizationManager is registered using PortletPersonalizationManager.setDataClass(String). Most commonly this will be the result of a
declaration in the provider XML registry (e.g.
<dataClass>className</dataClass>).
Your data class must implements the PersonalizationObject
interface. It will be responsible for reading and writing its
own content through its read() and write()
methods.
The framework includes an implementation of the PersonalizationObject
interface that allows you to store data in terms of name/value pairs.
You can use this or create your own implementation.
The persisted data is stored in a database table; one row per customization.
Connections to the database are retrieved from a 'pool', managed by the J2EE
environment; therefore, you must ensure that you have configured an
appropriate data source. In OC4J, this is done in the data-sources.xml file
The name of the data source a DBPersonalizationManager will use to store
customizations is specified using setConnection(String).
The name of the database table to be used to store customizations defaults
to JPDK_PREFERENCE_STORE, but can be overriden with a call to
setTable(String). A table with this default name can be created
in a database using the script in
providers/dbPersonalization/jpdk_preference_store.sql.
If a table of a different name is to be used, it must conform to the same
design.
| Constructor Summary | |
|---|---|
DBPersonalizationManager()
Null Constructor |
|
| Method Summary | |
|---|---|
void |
copy(PortletReference from,
PortletReference to,
ProviderUser user)
Copies the instance customizations from one reference to another. |
void |
create(PortletReference ref,
PersonalizationObject o,
ProviderUser user)
Creates the initial personalization reference for this (new) PortletReference. |
void |
create(PortletReference ref,
ProviderUser user)
Creates the initial personalization reference for this (new) PortletReference and establishes its (static) defaults. |
void |
destroy(PortletReference ref,
ProviderUser user)
Destroys a given Portlet instance from the repository by reference. |
void |
destroy(ProviderInstance pi,
PortletDefinition pd)
Called to allow the Portlet Personalization manager to destroy its repository. |
boolean |
exists(PortletReference ref,
ProviderUser user)
Returns true if a customization exists for this given reference. |
void |
init(PortletDefinition p)
Initializes the repository for this DBPersonalizationManager. |
PersonalizationObject |
read(PortletReference ref,
ProviderUser user)
Returns a data object containing the customizations particular to this reference. |
void |
setConnection(java.lang.String dataSourcePath)
Sets the path to the DataSource from which this
DBPersonalizationManager should retrieve its database
connections. |
void |
setTable(java.lang.String tableName)
Sets the name of the database table in which this DBPersonalizationManager should store customization data. |
void |
validate(java.lang.String context,
ValidationError errors)
Validates the internal state of this DBPersonalizationManager instance. |
void |
write(PortletReference ref,
PersonalizationObject o,
ProviderUser user)
Updates this reference's customization using the passed data object. |
| Methods inherited from class oracle.portal.provider.v2.personalize.PortletPersonalizationManager |
|---|
getDataClass, setDataClass |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DBPersonalizationManager()
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
public void setConnection(java.lang.String dataSourcePath)
throws java.io.IOException
DataSource from which this
DBPersonalizationManager should retrieve its database
connections.
dataSourcePath - JNDI path to a DataSource for a
pooled database connection
java.io.IOException - if a DataSource of the
given name cannot be retrievedpublic void setTable(java.lang.String tableName)
DBPersonalizationManager should store customization data.
If not set explicitly, the default name is
"JPDK_PREFERENCE_STORE".
tableName - name of the database table storing customization datapublic void init(PortletDefinition p)
DBPersonalizationManager. This
method is invoked on each of a Provider's
PortletPersonalizationManagers whenever the Provider is registered on a
Portal Node (when the Provider's register() method is
called). This gives the personalization manager an opportunity to
initialize the repository for the corresponding Portlet.
The DBPersonalizationManager currently does nothing in response to
this call.
init in class PortletPersonalizationManagerp - the portlet this DBPersonalizationManager is controlling.
public void destroy(ProviderInstance pi,
PortletDefinition pd)
throws AccessControlException,
java.io.IOException
In response to this call, the DBPersonalizationManager
removes all rows from the database table that pertain to this Portlet.
destroy in class PortletPersonalizationManagerpi - the provider instance to which the personalization object
belongspd - the portlet definition for which the personalization data
will be destroyed
AccessControlException
java.io.IOException
public void create(PortletReference ref,
ProviderUser user)
throws java.io.IOException,
PortletAlreadyExistsException,
AccessControlException
In response to this call, the DBPersonalizationManager
creates a new instance of the data object class that is registered to
it, and calls its init() method. Finally, a default row for
the instance is created in the database table, ensuring the initial data
persists.
create in class PortletPersonalizationManagerref - the PortletReference. The details of the PortletReference
determine whether this creates the default, system instance or a specific
user instance.user - the user attempting this operation. The manager is expected
to authorize the user before completing this operation.
java.io.IOException
PortletAlreadyExistsException
AccessControlException
public void create(PortletReference ref,
PersonalizationObject o,
ProviderUser user)
throws PortletAlreadyExistsException,
AccessControlException,
java.io.IOException
In response to this call, the DBPersonalizationManager
saves the passed object to a row in the database table, ensuring the
initial data persists.
create in class PortletPersonalizationManagerref - the PortletReference. The details of the PortletReference
determine whether this creates the default, system instance
or a specific user instance.o - the PersonalizationObject representing the initial values for
this instance.user - the user attempting this operation. The manager is expected
to authorize the user before completing this operation.
PortletAlreadyExistsException
AccessControlException
java.io.IOException
public boolean exists(PortletReference ref,
ProviderUser user)
throws AccessControlException
exists in class PortletPersonalizationManagerref - the portlet instance to checkuser - the user making this request -- passed to give the manager access
the the session.
AccessControlException
public PersonalizationObject read(PortletReference ref,
ProviderUser user)
throws PortletNotFoundException,
AccessControlException,
java.io.IOException
PortletNotFoundException is thrown.
read in class PortletPersonalizationManagerref - the portlet reference that identifies the instance whose
customizations are being requested.user - the user attempting this operation. The manager is expected
to authorize the user before completing this operation.
setDataClass) containing the customizations particular to
this reference
PortletNotFoundException - if no customizations exist
AccessControlException
java.io.IOException
public void write(PortletReference ref,
PersonalizationObject o,
ProviderUser user)
throws java.io.IOException,
PortletNotFoundException,
AccessControlException
write in class PortletPersonalizationManagerref - the portlet reference that identifies the instance whose
customizations are being updated.o - the data object containing the new values (should implement
PersonalizationObject).user - the user attempting this operation. The manager is expected
to authorize the user before completing this operation.
java.io.IOException
PortletNotFoundException
AccessControlException
public void destroy(PortletReference ref,
ProviderUser user)
throws PortletNotFoundException,
AccessControlException,
java.io.IOException
destroy in class PortletPersonalizationManagerref - the portlet reference that identifies the instance whose
customizations are being deleted.user - the user attempting this operation. The manager is expected
to authorize the user before completing this operation.
PortletNotFoundException
AccessControlException
java.io.IOException
public void copy(PortletReference from,
PortletReference to,
ProviderUser user)
throws PortletNotFoundException,
AccessControlException,
java.io.IOException
copy in class PortletPersonalizationManagerfrom - reference for the portlet instance we are copying from.to - reference for the portlet instance we are copying to.user - the user attempting this operation. The manager is expected
to authorize the user before completing this operation.
PortletNotFoundException
AccessControlException
java.io.IOException
public void validate(java.lang.String context,
ValidationError errors)
DBPersonalizationManager instance. Errors found are
reported using the supplied ValidationError instance.
validate in interface Validateablevalidate in class PortletPersonalizationManagercontext - 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 | ||||||||