org.jboss.portal.core.impl.portlet.state
Class PersistentPortletStatePersistenceManager

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.core.impl.portlet.state.PersistentPortletStatePersistenceManager
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, PortletStatePersistenceManager, RegistrationPersistenceManager, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class PersistentPortletStatePersistenceManager
extends AbstractJBossService
implements PortletStatePersistenceManager, RegistrationPersistenceManager

Version:
$Revision: 8786 $
Author:
Julien Viet

Field Summary
protected  ObjectContextualizer contextualizer
          .
protected  org.hibernate.SessionFactory sessionFactory
          .
protected  java.lang.String sessionFactoryJNDIName
          .
 
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
PersistentPortletStatePersistenceManager()
           
 
Method Summary
 Consumer addConsumerToGroupNamed(java.lang.String consumerId, java.lang.String groupName)
           
 Registration addRegistrationFor(java.lang.String consumerId, java.util.Map registrationProperties)
           
 java.lang.String cloneState(java.lang.String stateId)
          Clone an existing state.
 java.lang.String cloneState(java.lang.String stateId, PropertyMap propertyMap)
          Clone an existing state.
 Consumer createConsumer(java.lang.String consumerId, java.lang.String consumerName)
          Creates a Consumer with the specified identity and name (which might be the same, depending on the policy)
 ConsumerGroup createConsumerGroup(java.lang.String name)
          Creates a new ConsumerGroup with the associated name.
 java.lang.String createState(java.lang.String portletId, PropertyMap propertyMap)
          Create the initial state.
 void destroyState(java.lang.String stateId)
          Destroy the state.
 Consumer getConsumerById(java.lang.String consumerId)
          Return an existing consumer from its id.
 ConsumerGroup getConsumerGroup(java.lang.String name)
          Retrieves the ConsumerGroup identified by the specified name.
 java.util.Collection getConsumerGroups()
           
 java.util.Collection getConsumers()
           
protected  org.hibernate.Session getCurrentSession()
           
 Registration getRegistration(java.lang.String registrationId)
           
 java.util.Collection getRegistrations()
           
 java.lang.String getSessionFactoryJNDIName()
           
 PortletStateContext loadState(java.lang.String id)
          Load the state.
 void removeConsumer(java.lang.String consumerId)
           
 void removeConsumerGroup(java.lang.String name)
           
 void removeRegistration(java.lang.String registrationId)
           
 void setSessionFactoryJNDIName(java.lang.String sessionFactoryJNDIName)
           
protected  void startService()
           
protected  void stopService()
           
 void updateState(java.lang.String stateId, PropertyMap propertyMap)
          Update the state.
 
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
 

Field Detail

sessionFactory

protected org.hibernate.SessionFactory sessionFactory
.


sessionFactoryJNDIName

protected java.lang.String sessionFactoryJNDIName
.


contextualizer

protected ObjectContextualizer contextualizer
.

Constructor Detail

PersistentPortletStatePersistenceManager

public PersistentPortletStatePersistenceManager()
Method Detail

getSessionFactoryJNDIName

public java.lang.String getSessionFactoryJNDIName()

setSessionFactoryJNDIName

public void setSessionFactoryJNDIName(java.lang.String sessionFactoryJNDIName)

loadState

public PortletStateContext loadState(java.lang.String id)
                              throws InvalidStateIdException,
                                     NoSuchStateException
Description copied from interface: PortletStatePersistenceManager
Load the state.

Specified by:
loadState in interface PortletStatePersistenceManager
Parameters:
id - the state id
Returns:
the value map or null if it does not exist
Throws:
InvalidStateIdException - if the state id is not valid
NoSuchStateException - is the specified state does not exist

createState

public java.lang.String createState(java.lang.String portletId,
                                    PropertyMap propertyMap)
Description copied from interface: PortletStatePersistenceManager
Create the initial state.

Specified by:
createState in interface PortletStatePersistenceManager
Parameters:
portletId - the id that this state refers to
Returns:
the id of the state created

cloneState

public java.lang.String cloneState(java.lang.String stateId,
                                   PropertyMap propertyMap)
                            throws InvalidStateIdException,
                                   NoSuchStateException
Description copied from interface: PortletStatePersistenceManager
Clone an existing state.

Specified by:
cloneState in interface PortletStatePersistenceManager
Parameters:
stateId - the id that this state refers to
propertyMap - the values of the cloned state
Returns:
the state id
Throws:
InvalidStateIdException - if the state id is not valid
NoSuchStateException - is the specified state does not exist

cloneState

public java.lang.String cloneState(java.lang.String stateId)
                            throws java.lang.IllegalArgumentException,
                                   NoSuchStateException,
                                   InvalidStateIdException
Description copied from interface: PortletStatePersistenceManager
Clone an existing state.

Specified by:
cloneState in interface PortletStatePersistenceManager
Parameters:
stateId - the id that this state refers to
Returns:
the state id
Throws:
java.lang.IllegalArgumentException - if the state id is null
NoSuchStateException - is the specified state does not exist
InvalidStateIdException - if the state id is not valid

updateState

public void updateState(java.lang.String stateId,
                        PropertyMap propertyMap)
                 throws InvalidStateIdException,
                        NoSuchStateException
Description copied from interface: PortletStatePersistenceManager
Update the state.

Specified by:
updateState in interface PortletStatePersistenceManager
propertyMap - the updated state
Throws:
InvalidStateIdException - if the state id is not valid
NoSuchStateException - is the specified state does not exist

destroyState

public void destroyState(java.lang.String stateId)
                  throws InvalidStateIdException,
                         NoSuchStateException
Description copied from interface: PortletStatePersistenceManager
Destroy the state.

Specified by:
destroyState in interface PortletStatePersistenceManager
Throws:
InvalidStateIdException - if the state id is not valid
NoSuchStateException - is the specified state does not exist

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

getCurrentSession

protected org.hibernate.Session getCurrentSession()

createConsumer

public Consumer createConsumer(java.lang.String consumerId,
                               java.lang.String consumerName)
                        throws RegistrationException
Description copied from interface: RegistrationPersistenceManager
Creates a Consumer with the specified identity and name (which might be the same, depending on the policy)

Specified by:
createConsumer in interface RegistrationPersistenceManager
Throws:
RegistrationException

getConsumerGroup

public ConsumerGroup getConsumerGroup(java.lang.String name)
                               throws RegistrationException
Description copied from interface: RegistrationPersistenceManager
Retrieves the ConsumerGroup identified by the specified name.

Specified by:
getConsumerGroup in interface RegistrationPersistenceManager
Parameters:
name - the name of the group to be retrieved
Returns:
the ConsumerGroup identified by the specified name
Throws:
RegistrationException

createConsumerGroup

public ConsumerGroup createConsumerGroup(java.lang.String name)
                                  throws RegistrationException
Description copied from interface: RegistrationPersistenceManager
Creates a new ConsumerGroup with the associated name.

Specified by:
createConsumerGroup in interface RegistrationPersistenceManager
Parameters:
name - the name of the ConsumerGroup to be created
Returns:
a new ConsumerGroup with the associated name
Throws:
RegistrationException

removeConsumerGroup

public void removeConsumerGroup(java.lang.String name)
                         throws RegistrationException
Specified by:
removeConsumerGroup in interface RegistrationPersistenceManager
Throws:
RegistrationException

removeConsumer

public void removeConsumer(java.lang.String consumerId)
                    throws RegistrationException
Specified by:
removeConsumer in interface RegistrationPersistenceManager
Throws:
RegistrationException

removeRegistration

public void removeRegistration(java.lang.String registrationId)
                        throws RegistrationException
Specified by:
removeRegistration in interface RegistrationPersistenceManager
Throws:
RegistrationException

getConsumerById

public Consumer getConsumerById(java.lang.String consumerId)
                         throws RegistrationException
Description copied from interface: RegistrationPersistenceManager
Return an existing consumer from its id.

Specified by:
getConsumerById in interface RegistrationPersistenceManager
Parameters:
consumerId - the consumer id
Returns:
the consumer or null if it does not exist
Throws:
RegistrationException

addRegistrationFor

public Registration addRegistrationFor(java.lang.String consumerId,
                                       java.util.Map registrationProperties)
                                throws RegistrationException
Specified by:
addRegistrationFor in interface RegistrationPersistenceManager
Throws:
RegistrationException

getRegistration

public Registration getRegistration(java.lang.String registrationId)
Specified by:
getRegistration in interface RegistrationPersistenceManager

addConsumerToGroupNamed

public Consumer addConsumerToGroupNamed(java.lang.String consumerId,
                                        java.lang.String groupName)
                                 throws RegistrationException
Specified by:
addConsumerToGroupNamed in interface RegistrationPersistenceManager
Throws:
RegistrationException

getConsumerGroups

public java.util.Collection getConsumerGroups()
Specified by:
getConsumerGroups in interface RegistrationPersistenceManager

getConsumers

public java.util.Collection getConsumers()
Specified by:
getConsumers in interface RegistrationPersistenceManager

getRegistrations

public java.util.Collection getRegistrations()
Specified by:
getRegistrations in interface RegistrationPersistenceManager