oracle.portal.provider.v1
Interface PortletPersonalizationManager

All Known Implementing Classes:
DBPersonalizationManager, DBPersonalizationManager2, FilePersonalizationManager

public interface PortletPersonalizationManager

The PortletPersonalizationManager manages a portlets customizations. Each customization must be created before it can be read/written. create() establishes a new entry and fills it with default values. An alternative create() method is defined to allow clients to create a new instance with specific values.

Once created, customization attributes are controlled by reading them using the read() method, updating the attributes on customization object, and then writing them back using the write() method.

A customization is identified by its PortletReference. This reference may refer to a specific user instance or the default instance (see PortletReference for details). Unfortunately, the portal doesn't have knowledge of a specific user instance. It merely understands that a (single) portlet instance exists on a given page. The portal therefore leaves this determination up to the provider. Except when the operation is explicitly constrained to the default portlet instance, the JPDK always generates the deepest PortletReference. I.e. a reference to the per user customization. This interface dictates it throws a PortletNotFoundException in the case where this per user customization doesn't exist. Clients must be prepared to check for this situation and implement their own recovery rules. This includes retying the operation using a self-generated PortletReference to the default portlet.


Method Summary
 void copy(PortletReference from, PortletReference to, ProviderUser user)
          Copies the instance customizations from one reference to another.
 void create(PortletReference ref, java.lang.Object 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(Portlet p)
          Called to allow the Portlet Personalization manager to destroy its repository.
 void destroy(PortletReference ref, ProviderUser user)
          Destroys a given Portlet instance from the repository by reference.
 boolean exists(PortletReference ref, ProviderUser user)
          Returns true is a customization exists for this given reference.
 void init(Portlet p)
          Called to allow this PortletPersonalizationManager to initialize its repository.
 void initInstance(Portlet p)
          Initializes a new PortletPersonalizationManager instance.
 java.lang.Object read(PortletReference ref, ProviderUser user)
          Returns an object containing the customizations particular to this reference.
 void write(PortletReference ref, java.lang.Object o, ProviderUser user)
          Updates this references customizations.
 

Method Detail

initInstance

public void initInstance(Portlet p)
Initializes a new PortletPersonalizationManager instance. This method should be invoked on each of a Provider's PortletPersonalizationManagers whenever the Provider instance is initialized on startup (by the Provider's init() method).
Parameters:
p - the portlet this PortletPersonalizationManager is controlling.

init

public void init(Portlet p)
Called to allow this PortletPersonalizationManager to initialize its repository. 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.

Parameters:
p - the portlet this PortletPersonalizationManager is controlling. From the Portlet you can get the Provider to identify the specific instance being created.

destroy

public void destroy(Portlet p)
             throws AccessControlException,
                    java.io.IOException
Called to allow the Portlet Personalization manager to destroy its repository. This method is called each time a Provider that manages this PortletPersonalizationManager's Portlet is deregistered (from a portal).
Parameters:
p - the portlet this PortletPersonalizationManager is controlling. From the Portlet you can get the Provider to identify the specific instance going away.

create

public void create(PortletReference ref,
                   ProviderUser user)
            throws PortletAlreadyExistsException,
                   AccessControlException,
                   java.io.IOException
Creates the initial personalization reference for this (new) PortletReference and establishes its (static) defaults.
Parameters:
ref - 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.

create

public void create(PortletReference ref,
                   java.lang.Object o,
                   ProviderUser user)
            throws PortletAlreadyExistsException,
                   AccessControlException,
                   java.io.IOException
Creates the initial personalization reference for this (new) PortletReference. The initial setting are set from the object passed in .
Parameters:
ref - the PortletReference. The details of the PortletReference determine whether this creates the default, system instance or a specific user instance.
o - object containing the customizations. It is expected that the manager know how to access/control this object to maintain a persistent store.
user - the user attempting this operation. The manager is expected to authorize the user before completing this operation.

exists

public boolean exists(PortletReference ref,
                      ProviderUser user)
               throws AccessControlException
Returns true is a customization exists for this given reference. This will be true if a create() has been previously called.
Parameters:
ref - the portlet instance to check

read

public java.lang.Object read(PortletReference ref,
                             ProviderUser user)
                      throws PortletNotFoundException,
                             AccessControlException,
                             java.io.IOException
Returns an object containing the customizations particular to this reference. If no customizations exist then the PortletNotFoundException is thrown.
Parameters:
ref - the portlet referecne 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.

write

public void write(PortletReference ref,
                  java.lang.Object o,
                  ProviderUser user)
           throws java.io.IOException,
                  PortletNotFoundException,
                  AccessControlException
Updates this references customizations.
Parameters:
ref - the portlet reference that identifies the instance whose customizations are being updated.
o - the object containing the new values.
user - the user attempting this operation. The manager is expected to authorize the user before completing this operation.

destroy

public void destroy(PortletReference ref,
                    ProviderUser user)
             throws PortletNotFoundException,
                    AccessControlException,
                    java.io.IOException
Destroys a given Portlet instance from the repository by reference. If the reference refers to the system (default) instance the manager should additionally delete all user customizations that correspond.
Parameters:
ref - 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.

copy

public void copy(PortletReference from,
                 PortletReference to,
                 ProviderUser user)
          throws PortletNotFoundException,
                 AccessControlException,
                 java.io.IOException
Copies the instance customizations from one reference to another. If the customization for the to reference doesn't exist it is created else the current values are overwritten.
Parameters:
from - reference for the portlet isntance we are copying from.
to - reference for the portlet isntance we are copying to.
user - the user attempting this operation. The manager is expected to authorize the user before completing this operation.