public class WSRPConsumerImpl extends Object implements WSRPConsumerSPI
ProducerInfo class.
Portlet invocations are handled by an InvocationDispatcher which examines the invocation to decide which InvocationHandler
will handle the request. The consumer also delegates session-related information to its SessionHandler instance. It takes care of portlet management functionality
defined by the PortletInvoker interface, i.e. listing portlets it knows about, cloning portlet states, accessing or modifying portlet properties,
etc., in essence, anything that's not directly related to portlet invocations. Finally, it deals with import / export functionality on the consumer side of things.
WSRP consumers are registered and managed by a ConsumerRegistry that takes care of configuring, persisting and dealing with consumers
lifecycle.| Constructor and Description |
|---|
WSRPConsumerImpl(ProducerInfo info) |
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
Prepares this Consumer to be used: service is started, endpoints are ready.
|
org.gatein.pc.api.PortletContext |
createClone(org.gatein.pc.api.PortletStateType stateType,
org.gatein.pc.api.PortletContext portletContext) |
void |
deactivate()
Removes this Consumer from service.
|
List<org.gatein.pc.api.state.DestroyCloneFailure> |
destroyClones(List<org.gatein.pc.api.PortletContext> portletContexts) |
boolean |
equals(Object o) |
org.gatein.pc.api.PortletContext |
exportPortlet(org.gatein.pc.api.PortletStateType stateType,
org.gatein.pc.api.PortletContext originalPortletContext) |
ExportInfo |
exportPortlets(List<String> portletHandles)
Asks the remote producer to export the specified portlets.
|
static javax.servlet.http.HttpServletRequest |
getHttpRequest(org.gatein.pc.api.invocation.PortletInvocation invocation)
Utility method to extract the HttpServletRequest from the PortletInvocation.
|
static javax.servlet.http.HttpSession |
getHttpSession(org.gatein.pc.api.invocation.PortletInvocation invocation)
Gets the consumer HttpSession associated with the specified PortletInvocation.
|
MarkupService |
getMarkupService() |
MigrationService |
getMigrationService()
Retrieves the MigrationService associated with this consumer.
|
org.gatein.pc.api.Portlet |
getPortlet(org.gatein.pc.api.PortletContext portletContext) |
static org.gatein.pc.api.PortletContext |
getPortletContext(org.gatein.pc.api.invocation.PortletInvocation invocation)
Extracts the targeted portlet context from a given PortletInvocation
|
Map<String,Set<org.gatein.pc.api.Portlet>> |
getPortletGroupMap() |
WSRPPortletInfo |
getPortletInfo(org.gatein.pc.api.invocation.PortletInvocation invocation)
Retrieves the WSRP-specific
PortletInfo implementation for the portlet targeted by the specified invocation |
Set<org.gatein.pc.api.Portlet> |
getPortlets() |
String |
getProducerId()
Retrieves the identifier for the producer this consumer is associated with.
|
ProducerInfo |
getProducerInfo()
Retrieves the ProducerInfo associated with this consumer.
|
ProducerSessionInformation |
getProducerSessionInformationFrom(javax.servlet.http.HttpSession session)
Retrieves the session information for the producer associated with this consumer.
|
ProducerSessionInformation |
getProducerSessionInformationFrom(org.gatein.pc.api.invocation.PortletInvocation invocation)
Retrieves the session information for the producer associated with this consumer.
|
org.gatein.pc.api.state.PropertyMap |
getProperties(org.gatein.pc.api.PortletContext portletContext) |
org.gatein.pc.api.state.PropertyMap |
getProperties(org.gatein.pc.api.PortletContext portletContext,
Set<String> keys) |
RegistrationContext |
getRegistrationContext()
Retrieves the current RegistrationContext if any
|
SessionHandler |
getSessionHandler()
Retrieves the SessionHandler associated with this consumer.
|
SessionRegistry |
getSessionRegistry()
Retrieves the SessionRegistry associated with this consumer.
|
org.gatein.pc.api.PortletStatus |
getStatus(org.gatein.pc.api.PortletContext portletContext) |
Set |
getSupportedUserScopes() |
UserContext |
getUserContextFrom(WSRPPortletInfo info,
org.gatein.pc.api.invocation.PortletInvocation invocation,
RuntimeContext runtimeContext)
Retrieves the user context if needed by the portlet from the invocation.
|
org.gatein.common.util.Version |
getWSRPVersion() |
void |
handleInvalidRegistrationFault()
Performs required maintenance when the consumer receives an InvalidaRegistrationFault from the producer.
|
void |
handleModifyRegistrationRequiredFault()
Performs required operations when the consumer receives a ModifyRegistrationRequiredFault from the producer to get the consumer ready to call modifyRegistration.
|
int |
hashCode() |
org.gatein.pc.api.PortletContext |
importPortlet(org.gatein.pc.api.PortletStateType stateType,
org.gatein.pc.api.PortletContext originalPortletContext) |
ImportInfo |
importPortlets(ExportInfo exportInfo,
List<String> portlets)
Imports the specified portlets as identified by their handles associated with a previous export operation as identified by the specified ExportInfo.
|
org.gatein.pc.api.invocation.response.PortletInvocationResponse |
invoke(org.gatein.pc.api.invocation.PortletInvocation invocation) |
boolean |
isActive() |
boolean |
isImportExportSupported()
Do we support the WSRP 2 import/export functionality?
|
boolean |
isRefreshNeeded()
Determines whether this consumer's information needs to be refreshed with respect to its associated remote producer.
|
boolean |
isUsingWSRP2()
Is this consumer compatible with WSRP 2?
|
void |
onSessionEvent(SessionEvent event) |
RefreshResult |
refresh(boolean forceRefresh)
Refreshes this consumer, potentially bypassing any cache, from the associated remote producer.
|
void |
refreshProducerInfo()
Asks this consumer's ProducerInfo to refresh itself by querying the associated remote producer for its service description and parsing it, potentially triggering other WSRP
operations such as registration if required.
|
void |
releaseExport(ExportInfo exportInfo)
Tells the remote producer that we don't need the data associated with the specified ExportInfo.
|
void |
releaseSessions()
Releases all the sessions held by this Consumer
|
org.gatein.pc.api.PortletContext |
setProperties(org.gatein.pc.api.PortletContext portletContext,
org.gatein.pc.api.state.PropertyChange[] changes) |
void |
setTemplatesIfNeeded(WSRPPortletInfo info,
org.gatein.pc.api.invocation.PortletInvocation invocation,
RuntimeContext runtimeContext)
Adds templates (see http://docs.oasis-open.org/wsrp/v2/wsrp-2.0-spec-os-01.html#_Producer_URL_Writing) if required.
|
void |
start()
Gets this consumer ready to receive and send WSRP messages to the remote producer.
|
void |
stop()
Stops this consumer, making it unable to send or receive WSRP messages.
|
boolean |
supportsUserScope(String userScope)
Determines whether the specified user scope (for markup caching) is supported.
|
public WSRPConsumerImpl(ProducerInfo info)
public ProducerInfo getProducerInfo()
WSRPConsumergetProducerInfo in interface WSRPConsumerpublic Set<org.gatein.pc.api.Portlet> getPortlets() throws org.gatein.pc.api.InvokerUnavailableException
getPortlets in interface org.gatein.pc.api.PortletInvokerorg.gatein.pc.api.InvokerUnavailableExceptionpublic org.gatein.pc.api.Portlet getPortlet(org.gatein.pc.api.PortletContext portletContext)
throws IllegalArgumentException,
org.gatein.pc.api.PortletInvokerException
getPortlet in interface org.gatein.pc.api.PortletInvokerIllegalArgumentExceptionorg.gatein.pc.api.PortletInvokerExceptionpublic org.gatein.pc.api.PortletStatus getStatus(org.gatein.pc.api.PortletContext portletContext)
throws IllegalArgumentException,
org.gatein.pc.api.PortletInvokerException
getStatus in interface org.gatein.pc.api.PortletInvokerIllegalArgumentExceptionorg.gatein.pc.api.PortletInvokerExceptionpublic org.gatein.pc.api.invocation.response.PortletInvocationResponse invoke(org.gatein.pc.api.invocation.PortletInvocation invocation)
throws org.gatein.pc.api.PortletInvokerException
invoke in interface org.gatein.pc.api.PortletInvokerorg.gatein.pc.api.PortletInvokerExceptionpublic org.gatein.pc.api.PortletContext createClone(org.gatein.pc.api.PortletStateType stateType,
org.gatein.pc.api.PortletContext portletContext)
throws IllegalArgumentException,
org.gatein.pc.api.PortletInvokerException,
UnsupportedOperationException
createClone in interface org.gatein.pc.api.PortletInvokerIllegalArgumentExceptionorg.gatein.pc.api.PortletInvokerExceptionUnsupportedOperationExceptionpublic List<org.gatein.pc.api.state.DestroyCloneFailure> destroyClones(List<org.gatein.pc.api.PortletContext> portletContexts) throws IllegalArgumentException, org.gatein.pc.api.PortletInvokerException, UnsupportedOperationException
destroyClones in interface org.gatein.pc.api.PortletInvokerIllegalArgumentExceptionorg.gatein.pc.api.PortletInvokerExceptionUnsupportedOperationExceptionpublic org.gatein.pc.api.state.PropertyMap getProperties(org.gatein.pc.api.PortletContext portletContext,
Set<String> keys)
throws IllegalArgumentException,
org.gatein.pc.api.PortletInvokerException,
UnsupportedOperationException
getProperties in interface org.gatein.pc.api.PortletInvokerIllegalArgumentExceptionorg.gatein.pc.api.PortletInvokerExceptionUnsupportedOperationExceptionpublic org.gatein.pc.api.state.PropertyMap getProperties(org.gatein.pc.api.PortletContext portletContext)
throws IllegalArgumentException,
org.gatein.pc.api.PortletInvokerException,
UnsupportedOperationException
getProperties in interface org.gatein.pc.api.PortletInvokerIllegalArgumentExceptionorg.gatein.pc.api.PortletInvokerExceptionUnsupportedOperationExceptionpublic org.gatein.pc.api.PortletContext setProperties(org.gatein.pc.api.PortletContext portletContext,
org.gatein.pc.api.state.PropertyChange[] changes)
throws IllegalArgumentException,
org.gatein.pc.api.PortletInvokerException,
UnsupportedOperationException
setProperties in interface org.gatein.pc.api.PortletInvokerIllegalArgumentExceptionorg.gatein.pc.api.PortletInvokerExceptionUnsupportedOperationExceptionpublic org.gatein.pc.api.PortletContext exportPortlet(org.gatein.pc.api.PortletStateType stateType,
org.gatein.pc.api.PortletContext originalPortletContext)
throws org.gatein.pc.api.PortletInvokerException
exportPortlet in interface org.gatein.pc.api.PortletInvokerorg.gatein.pc.api.PortletInvokerExceptionpublic org.gatein.pc.api.PortletContext importPortlet(org.gatein.pc.api.PortletStateType stateType,
org.gatein.pc.api.PortletContext originalPortletContext)
throws org.gatein.pc.api.PortletInvokerException
importPortlet in interface org.gatein.pc.api.PortletInvokerorg.gatein.pc.api.PortletInvokerExceptionpublic String getProducerId()
WSRPConsumergetProducerId in interface WSRPConsumerpublic SessionHandler getSessionHandler()
WSRPConsumerSPIgetSessionHandler in interface WSRPConsumerSPIpublic Map<String,Set<org.gatein.pc.api.Portlet>> getPortletGroupMap() throws org.gatein.pc.api.PortletInvokerException
org.gatein.pc.api.PortletInvokerExceptionpublic static org.gatein.pc.api.PortletContext getPortletContext(org.gatein.pc.api.invocation.PortletInvocation invocation)
invocation - the invocation which targeted portlet we want to identifypublic WSRPPortletInfo getPortletInfo(org.gatein.pc.api.invocation.PortletInvocation invocation) throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerSPIPortletInfo implementation for the portlet targeted by the specified invocationgetPortletInfo in interface WSRPConsumerSPIinvocation - the invocation targeting the portlet we want info aboutPortletInfo implementation for the portlet targeted by the specified invocationorg.gatein.pc.api.PortletInvokerExceptionpublic Set getSupportedUserScopes()
public boolean supportsUserScope(String userScope)
WSRPConsumerSPIsupportsUserScope in interface WSRPConsumerSPIuserScope - the user scope which support is to be determinedtrue if the given user scope is supported, false otherwisepublic boolean isImportExportSupported()
WSRPConsumerisImportExportSupported in interface WSRPConsumertrue if import/export is supported by this consumer, false otherwisepublic void handleInvalidRegistrationFault()
throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerSPIhandleInvalidRegistrationFault in interface WSRPConsumerSPIorg.gatein.pc.api.PortletInvokerExceptionpublic RegistrationContext getRegistrationContext() throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerSPIgetRegistrationContext in interface WSRPConsumerSPIorg.gatein.pc.api.PortletInvokerExceptionpublic ProducerSessionInformation getProducerSessionInformationFrom(org.gatein.pc.api.invocation.PortletInvocation invocation)
WSRPConsumergetProducerSessionInformationFrom in interface WSRPConsumerinvocation - a portlet invocation from which the session information should be extracted.ProducerSessionInformationpublic ProducerSessionInformation getProducerSessionInformationFrom(javax.servlet.http.HttpSession session)
WSRPConsumergetProducerSessionInformationFrom in interface WSRPConsumersession - the session from the information should be extracted.ProducerSessionInformationpublic void activate()
throws Exception
WSRPConsumeractivate in interface WSRPConsumerExceptionpublic void deactivate()
throws Exception
WSRPConsumerdeactivate in interface WSRPConsumerExceptionpublic boolean isActive()
isActive in interface org.gatein.pc.api.PortletInvokerpublic boolean isRefreshNeeded()
WSRPConsumerisRefreshNeeded in interface WSRPConsumertrue if this consumer needs to be refreshed, false otherwisepublic RefreshResult refresh(boolean forceRefresh) throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerrefresh in interface WSRPConsumerforceRefresh - whether we want to force the refresh (i.e. bypass potential caches).org.gatein.pc.api.PortletInvokerExceptionpublic void start()
throws Exception
WSRPConsumerstart in interface WSRPConsumerExceptionpublic void stop()
throws Exception
WSRPConsumerstop in interface WSRPConsumerExceptionpublic MarkupService getMarkupService() throws org.gatein.pc.api.PortletInvokerException
getMarkupService in interface WSRPConsumerSPIorg.gatein.pc.api.PortletInvokerExceptionpublic void refreshProducerInfo()
throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerrefreshProducerInfo in interface WSRPConsumerorg.gatein.pc.api.PortletInvokerExceptionpublic void releaseSessions()
throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerreleaseSessions in interface WSRPConsumerorg.gatein.pc.api.PortletInvokerExceptionpublic UserContext getUserContextFrom(WSRPPortletInfo info, org.gatein.pc.api.invocation.PortletInvocation invocation, RuntimeContext runtimeContext) throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerSPIgetUserContextFrom in interface WSRPConsumerSPIinfo - the portlet information for the portlet being interacted with, specifically used to see if the portlet stores the user context in the sessioninvocation - the portlet invocationruntimeContext - the WSRP runtime context to check whether a session exists which would indicate that the user context is already in sessionnull if it's asserted that it's stored in the session so that it's not sent againorg.gatein.pc.api.PortletInvokerExceptionpublic void setTemplatesIfNeeded(WSRPPortletInfo info, org.gatein.pc.api.invocation.PortletInvocation invocation, RuntimeContext runtimeContext) throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerSPIsetTemplatesIfNeeded in interface WSRPConsumerSPIinfo - the portlet information for the portlet being interacted with, to check if it requires templatesinvocation - the portlet invocationruntimeContext - the WSRP runtime context to which the templates need to be addedorg.gatein.pc.api.PortletInvokerExceptionpublic static javax.servlet.http.HttpServletRequest getHttpRequest(org.gatein.pc.api.invocation.PortletInvocation invocation)
invocation - the invocation from which we want to get the underlying HttpServletRequestpublic static javax.servlet.http.HttpSession getHttpSession(org.gatein.pc.api.invocation.PortletInvocation invocation)
invocation - the PortletInvocation from which we want to extract the HttpSessionpublic void onSessionEvent(SessionEvent event)
onSessionEvent in interface SessionEventListenerpublic ExportInfo exportPortlets(List<String> portletHandles) throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerexportPortlets in interface WSRPConsumerportletHandles - a list of handles identifying portlets to be exportedorg.gatein.pc.api.PortletInvokerExceptionpublic void releaseExport(ExportInfo exportInfo) throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerreleaseExport in interface WSRPConsumerexportInfo - the metadata identifying the exported portlets we don't need anymoreorg.gatein.pc.api.PortletInvokerExceptionpublic ImportInfo importPortlets(ExportInfo exportInfo, List<String> portlets) throws org.gatein.pc.api.PortletInvokerException
WSRPConsumerimportPortlets in interface WSRPConsumerexportInfo - the export metadata identifying which exported data we want to import from the remote producerportlets - a list of handles identifying which portlets we want to import from the available exported portlets associated with the specified ExportInfoorg.gatein.pc.api.PortletInvokerExceptionpublic boolean isUsingWSRP2()
WSRPConsumerisUsingWSRP2 in interface WSRPConsumertrue if this consumer uses WSRP 2, false otherwisepublic MigrationService getMigrationService()
WSRPConsumergetMigrationService in interface WSRPConsumerpublic org.gatein.common.util.Version getWSRPVersion()
public SessionRegistry getSessionRegistry()
WSRPConsumerSPIgetSessionRegistry in interface WSRPConsumerSPIpublic void handleModifyRegistrationRequiredFault()
WSRPConsumerSPIhandleModifyRegistrationRequiredFault in interface WSRPConsumerSPICopyright © 2006-2014 GateIn. All Rights Reserved.