com.bea.wsrp.consumer.management.portlet
Interface IProxyPortletStateManager


public interface IProxyPortletStateManager

An SPI for managing state of proxy portlets. WebLogic Portal provides a default implementation of this interface. The default implementation requires that proxy portlet be aggregated as part of a desktop, and that the current user is not anonymous. If your applications do not meet these requirements, you may replace the default implementation with your own.

You can specify an implementation in netuix-config.xml of your consumer webapp. Here is an example.

<proxy-portlet-state-manager-spi-class>myspi.ProxyPortletStateManagerImpl<proxy-portlet-state-manager-spi-class>

Note that, when an SPI is deployed like this, you will not be able to use portal admin tools to manage the state of proxy portlets. For instance, when you try to clone a proxy portlet or try to change preferences of a proxy portlet using admin tools, admin tools will not invoke the SPI to manage the state.


Nested Class Summary
static class IProxyPortletStateManager.Factory
          Return an SPI implementation.
 
Method Summary
 String getPortletHandle(String definitionLabel, String instanceLabel, String defaultPortletHandle, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.ServletContext servletContext)
          Given the definition and instance labels of a portlet, return the portletHandle.
 byte[] getPortletState(String definitionLabel, String instanceLabel, PortletInstanceId instanceId, String portletHandle, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.ServletContext servletContext)
          Given the definition and instance labels, and the portlet's portletHandle, return the opaque state of the portlet.
 PortletStateChange getPortletStateChange(String definitionLabel, String instanceLabel, PortletInstanceId instanceId, String portletHandle, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.ServletContext servletContext)
          Returns a flag indicating how to treat the portlet's state.
 PortletInstanceId updatePortletState(String definitionLabel, String instanceLabel, PortletInstanceId instanceId, IPortletContext currentState, IPortletContext newState, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.ServletContext servletContext)
          Ths consumer will call this method when the producer returns new state for a proxy portlet.
 

Method Detail

getPortletHandle

String getPortletHandle(String definitionLabel,
                        String instanceLabel,
                        String defaultPortletHandle,
                        javax.servlet.http.HttpServletRequest httpRequest,
                        javax.servlet.ServletContext servletContext)

Given the definition and instance labels of a portlet, return the portletHandle.

Typically, if the return value is different from supplied defaultPortletHandle, it would be a result of the consumer calling the SPI's updatePortletState method.

Parameters
definitionLabel - definition label
instanceLabel - instance label, if available
defaultPortletHandle - default portlet handle (typically specified at the time of creating the proxy portlet
httpRequest - HTTP request
servletContext - servlet context
Returns
portlet handle

getPortletState

byte[] getPortletState(String definitionLabel,
                       String instanceLabel,
                       PortletInstanceId instanceId,
                       String portletHandle,
                       javax.servlet.http.HttpServletRequest httpRequest,
                       javax.servlet.ServletContext servletContext)
                       throws ProxyPortletManagerException

Given the definition and instance labels, and the portlet's portletHandle, return the opaque state of the portlet.

By default, this state would be null. However, on some invocations, producers may return this opaque state to the consumer, and when that happens, the consumer will notify the SPI by calling the updatePortletState method.

Parameters
definitionLabel - definition label
instanceLabel - instance label, if available
instanceId - instance ID, if available
portletHandle - portlet handle
httpRequest - HTTP request
servletContext - servlet context
Returns
portlet's opaque state
Throws
ProxyPortletManagerException

getPortletStateChange

PortletStateChange getPortletStateChange(String definitionLabel,
                                         String instanceLabel,
                                         PortletInstanceId instanceId,
                                         String portletHandle,
                                         javax.servlet.http.HttpServletRequest httpRequest,
                                         javax.servlet.ServletContext servletContext)
                                         throws ProxyPortletManagerException

Returns a flag indicating how to treat the portlet's state. If the SPI is not unable to accept state changes, it should always return PortletStateChange.readOnly. When updatePortletState has not been called for a portlet, the portlet may consider returning PortletStateChange.cloneBeforeWrite to let the producer know that it should clone the portlet before attempting to make persistent state changes (such as changing portlet preferences). When this value is supplied, if the producer did clone the portlet, the consumer will notify the SPI by calling updatePortletState. Subsequently, the SPI may consider returning PortletStateChange.readWrite so that additional cloning will not performed by the producer.

Parameters
definitionLabel - definition label
instanceLabel - instance label, if available
instanceId - instance ID, if available
portletHandle - portlet handle
httpRequest - HTTP request
servletContext - servlet context
Returns
portlet state change flag
Throws
ProxyPortletManagerException
See Also
PortletStateChange

updatePortletState

PortletInstanceId updatePortletState(String definitionLabel,
                                     String instanceLabel,
                                     PortletInstanceId instanceId,
                                     IPortletContext currentState,
                                     IPortletContext newState,
                                     javax.servlet.http.HttpServletRequest httpRequest,
                                     javax.servlet.ServletContext servletContext)
                                     throws ProxyPortletManagerException

Ths consumer will call this method when the producer returns new state for a proxy portlet. Note that this happens only when the SPI returns PortletStateChange.cloneBeforeWrite or PortletStateChange.readWrite for the getPortletStateChange method.

The SPI is responsible to storing the updates, and return the updated values when the consumer calls one of the getter methods on this interface.

The SPI may return a new instance ID. However, the consumer will not retain the instance ID beyond the current request.

Parameters
definitionLabel - definition label
instanceLabel - instance label
instanceId - instance ID
currentState - current state
newState - new state
httpRequest - HTTP request
servletContext - servlet context
Returns
new instance ID
Throws
ProxyPortletManagerException


Copyright © 2011, Oracle. All rights reserved.