org.jboss.portal.wsrp.consumer
Class WSRPConsumerImpl

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.portal.jems.as.system.AbstractJBossService
              extended by org.jboss.portal.wsrp.consumer.WSRPConsumerImpl
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, PortalEventListener, PortletInvoker, WSRPConsumer, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class WSRPConsumerImpl
extends AbstractJBossService
implements WSRPConsumer

Since:
2.4
Version:
$Revision: 8846 $
Author:
Boleslaw Dawidowicz, Chris Laprun

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
WSRPConsumerImpl()
           
 
Method Summary
 void activate()
          Prepares this Consumer to be used: service is started, endpoints are ready.
 PortletContext createClone(PortletContext portletContext)
          Clone a portlet.
 void deactivate()
          Removes this Consumer from service.
 java.util.List destroyClones(java.util.List portletContexts)
          Destroy a cloned portlet.
 WSRP_v1_Markup_PortType getMarkupService()
           
 Portlet getPortlet(PortletContext portletContext)
          Get information about a specific portlet.
 java.util.Map getPortletGroupMap()
           
 WSRP_v1_PortletManagement_PortType getPortletManagementService()
           
 java.util.Set getPortlets()
          Return the set of portlet exposed.
 java.lang.String getProducerId()
          Retrieves the identifier for the producer this consumer is associated with.
 ProducerInfo getProducerInfo()
           
 ProducerSessionInformation getProducerSessionInformationFrom(javax.servlet.http.HttpSession session)
          Retrieves the session information for the producer associated with this consumer.
 ProducerSessionInformation getProducerSessionInformationFrom(PortletInvocation invocation)
          Retrieves the session information for the producer associated with this consumer.
 PropertyMap getProperties(PortletContext portletContext)
          Return all the properties of the specified portlet.
 PropertyMap getProperties(PortletContext portletContext, java.util.Set keys)
          Return a subset of the properties of the specified portlet.
 WSRP_v1_Registration_PortType getRegistrationService()
           
 WSRP_v1_ServiceDescription_PortType getServiceDescriptionService()
           
 SessionHandler getSessionHandler()
           
 java.util.Set getSupportedUserScopes()
           
 PortletInvocationResponse invoke(PortletInvocation invocation)
          Invoke an operation on a specific portlet.
 boolean isActive()
           
 boolean isRefreshNeeded()
           
 void onEvent(PortalEventContext eventContext, PortalEvent event)
          Just delegate to SessionHandler
 RefreshResult refresh(boolean forceRefresh)
           
 void refreshProducerInfo()
           
 void releaseSessions()
          Releases all the sessions held by this Consumer
 void setProducerInfo(ProducerInfo producerInfo)
           
 PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes)
          Set the properties on the specified portlet.
 void setServiceFactory(ServiceFactory serviceFactory)
          Needed to wire Consumer tests.
protected  void startService()
           
protected  void stopService()
           
 boolean supportsUserScope(java.lang.String userScope)
          Determines whether the specified user scope (for markup caching) is supported.
 
Methods inherited from class org.jboss.portal.jems.as.system.AbstractJBossService
create, destroy, getState, getStateString, start, stop
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
createService, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Constructor Detail

WSRPConsumerImpl

public WSRPConsumerImpl()
Method Detail

getProducerInfo

public ProducerInfo getProducerInfo()
Specified by:
getProducerInfo in interface WSRPConsumer
Returns:

setProducerInfo

public void setProducerInfo(ProducerInfo producerInfo)
Specified by:
setProducerInfo in interface WSRPConsumer

getPortlets

public java.util.Set getPortlets()
                          throws InvokerUnavailableException
Description copied from interface: PortletInvoker
Return the set of portlet exposed.

Specified by:
getPortlets in interface PortletInvoker
Returns:
the set of exposed portlets
Throws:
InvokerUnavailableException

getPortlet

public Portlet getPortlet(PortletContext portletContext)
                   throws java.lang.IllegalArgumentException,
                          PortletInvokerException
Description copied from interface: PortletInvoker
Get information about a specific portlet.

Specified by:
getPortlet in interface PortletInvoker
Parameters:
portletContext - the portlet context in the scope of this invoker
Returns:
the PortletInfo for the specified portlet
Throws:
java.lang.IllegalArgumentException - if the portlet context is null
PortletInvokerException

invoke

public PortletInvocationResponse invoke(PortletInvocation invocation)
                                 throws PortletInvokerException
Description copied from interface: PortletInvoker
Invoke an operation on a specific portlet.

Specified by:
invoke in interface PortletInvoker
Parameters:
invocation - the portlet invocation
Returns:
the invocation response
Throws:
PortletInvokerException

createClone

public PortletContext createClone(PortletContext portletContext)
                           throws java.lang.IllegalArgumentException,
                                  PortletInvokerException,
                                  java.lang.UnsupportedOperationException
Description copied from interface: PortletInvoker
Clone a portlet.

Specified by:
createClone in interface PortletInvoker
Returns:
the clone id
Throws:
java.lang.IllegalArgumentException - if the portletId is null
java.lang.UnsupportedOperationException - if the invoker does not support this operation
PortletInvokerException

destroyClones

public java.util.List destroyClones(java.util.List portletContexts)
                             throws java.lang.IllegalArgumentException,
                                    PortletInvokerException,
                                    java.lang.UnsupportedOperationException
Description copied from interface: PortletInvoker
Destroy a cloned portlet.

Specified by:
destroyClones in interface PortletInvoker
Parameters:
portletContexts - a list of portlet contexts to destroy
Returns:
a list of DestroyCloneFailure, one per clone that couldn't be destroyed
Throws:
java.lang.IllegalArgumentException - if the portletContext is null
java.lang.UnsupportedOperationException - if the invoker does not support this operation
PortletInvokerException

getProperties

public PropertyMap getProperties(PortletContext portletContext,
                                 java.util.Set keys)
                          throws java.lang.IllegalArgumentException,
                                 PortletInvokerException,
                                 java.lang.UnsupportedOperationException
Description copied from interface: PortletInvoker
Return a subset of the properties of the specified portlet.

Specified by:
getProperties in interface PortletInvoker
Parameters:
portletContext - the portlet context
keys - the set of keys to retrieve
Returns:
the properties
Throws:
java.lang.IllegalArgumentException - if the portletContext or the keys arguments are null
java.lang.UnsupportedOperationException - if the invoker does not support this operation
PortletInvokerException

getProperties

public PropertyMap getProperties(PortletContext portletContext)
                          throws java.lang.IllegalArgumentException,
                                 PortletInvokerException,
                                 java.lang.UnsupportedOperationException
Description copied from interface: PortletInvoker
Return all the properties of the specified portlet.

Specified by:
getProperties in interface PortletInvoker
Parameters:
portletContext - the portlet context
Returns:
the properties
Throws:
java.lang.IllegalArgumentException - if the portletContext is null
java.lang.UnsupportedOperationException - if the invoker does not support this operation
PortletInvokerException

setProperties

public PortletContext setProperties(PortletContext portletContext,
                                    PropertyChange[] changes)
                             throws java.lang.IllegalArgumentException,
                                    PortletInvokerException,
                                    java.lang.UnsupportedOperationException
Description copied from interface: PortletInvoker
Set the properties on the specified portlet.

Specified by:
setProperties in interface PortletInvoker
Parameters:
portletContext - the portlet context
changes - the changes
Throws:
java.lang.IllegalArgumentException - if the portletContext or the properties is null
java.lang.UnsupportedOperationException - if the invoker does not support this operation
PortletInvokerException

getProducerId

public java.lang.String getProducerId()
Description copied from interface: WSRPConsumer
Retrieves the identifier for the producer this consumer is associated with.

Specified by:
getProducerId in interface WSRPConsumer
Returns:
the identifier of the associated producer

getSessionHandler

public SessionHandler getSessionHandler()

getPortletGroupMap

public java.util.Map getPortletGroupMap()
                                 throws PortletInvokerException
Throws:
PortletInvokerException

getSupportedUserScopes

public java.util.Set getSupportedUserScopes()

supportsUserScope

public boolean supportsUserScope(java.lang.String userScope)
Determines whether the specified user scope (for markup caching) is supported.

Parameters:
userScope - the user scope which support is to be determined
Returns:
true if the given user scope is supported, false otherwise

getProducerSessionInformationFrom

public ProducerSessionInformation getProducerSessionInformationFrom(PortletInvocation invocation)
Description copied from interface: WSRPConsumer
Retrieves the session information for the producer associated with this consumer.

Specified by:
getProducerSessionInformationFrom in interface WSRPConsumer
Parameters:
invocation - a portlet invocation from which the session information should be extracted.
Returns:
the session information for the producer associated with this consumer.
See Also:
ProducerSessionInformation

getProducerSessionInformationFrom

public ProducerSessionInformation getProducerSessionInformationFrom(javax.servlet.http.HttpSession session)
Description copied from interface: WSRPConsumer
Retrieves the session information for the producer associated with this consumer.

Specified by:
getProducerSessionInformationFrom in interface WSRPConsumer
Parameters:
session - the session from the information should be extracted.
Returns:
the session information for the producer associated with this consumer.
See Also:
ProducerSessionInformation

activate

public void activate()
              throws java.lang.Exception
Description copied from interface: WSRPConsumer
Prepares this Consumer to be used: service is started, endpoints are ready.

Specified by:
activate in interface WSRPConsumer
Throws:
java.lang.Exception

deactivate

public void deactivate()
                throws java.lang.Exception
Description copied from interface: WSRPConsumer
Removes this Consumer from service. It cannot be used before being activated again.

Specified by:
deactivate in interface WSRPConsumer
Throws:
java.lang.Exception

isActive

public boolean isActive()
Specified by:
isActive in interface WSRPConsumer
Returns:

isRefreshNeeded

public boolean isRefreshNeeded()
Specified by:
isRefreshNeeded in interface WSRPConsumer
Returns:

refresh

public RefreshResult refresh(boolean forceRefresh)
                      throws PortletInvokerException
Specified by:
refresh in interface WSRPConsumer
Returns:
Throws:
PortletInvokerException

startService

protected void startService()
                     throws java.lang.Exception
Overrides:
startService in class org.jboss.system.ServiceMBeanSupport
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Overrides:
stopService in class org.jboss.system.ServiceMBeanSupport
Throws:
java.lang.Exception

setServiceFactory

public void setServiceFactory(ServiceFactory serviceFactory)
Needed to wire Consumer tests.

Parameters:
serviceFactory -

getServiceDescriptionService

public WSRP_v1_ServiceDescription_PortType getServiceDescriptionService()
                                                                 throws PortletInvokerException
Throws:
PortletInvokerException

getMarkupService

public WSRP_v1_Markup_PortType getMarkupService()
                                         throws PortletInvokerException
Throws:
PortletInvokerException

getPortletManagementService

public WSRP_v1_PortletManagement_PortType getPortletManagementService()
                                                               throws PortletInvokerException
Throws:
PortletInvokerException

getRegistrationService

public WSRP_v1_Registration_PortType getRegistrationService()
                                                     throws PortletInvokerException
Throws:
PortletInvokerException

refreshProducerInfo

public void refreshProducerInfo()
                         throws PortletInvokerException
Specified by:
refreshProducerInfo in interface WSRPConsumer
Throws:
PortletInvokerException

releaseSessions

public void releaseSessions()
                     throws PortletInvokerException
Description copied from interface: WSRPConsumer
Releases all the sessions held by this Consumer

Specified by:
releaseSessions in interface WSRPConsumer
Throws:
PortletInvokerException

onEvent

public void onEvent(PortalEventContext eventContext,
                    PortalEvent event)
Just delegate to SessionHandler

Specified by:
onEvent in interface PortalEventListener
Parameters:
eventContext -
event -
Since:
2.6