org.jboss.mq.sm
Class AbstractStateManager

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.mq.sm.AbstractStateManager
All Implemented Interfaces:
AbstractStateManagerMBean (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src) , StateManager (src)
Direct Known Subclasses:
DynamicStateManager (src) , JDBCStateManager (src)

public abstract class AbstractStateManager
extends ServiceMBeanSupport (src)
implements StateManager (src) , AbstractStateManagerMBean (src)

An abstract baseclass to make it a little bit easier to implement new StateManagers.

Apart from one methods in StateManager subclasses implement the protected abstract callback methods to do its work.


Nested Class Summary
protected  class AbstractStateManager.DurableSubscription (src)
          Abstracts the data between a subclass and this class.
 
Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
AbstractStateManager()
          Create a new abstract state manager
 
Method Summary
 void addLoggedOnClientId(java.lang.String ID)
          Ad a logged in clientID to the statemanager.
protected abstract  void checkLoggedOnClientId(java.lang.String clientID)
          Check if the clientID is allowed to logg in from the particular state managers perspective.
 java.lang.String checkUser(java.lang.String login, java.lang.String passwd)
          Check if a user has a preconfigured clientID and return it.
protected abstract  AbstractStateManager.DurableSubscription (src) getDurableSubscription(DurableSubscriptionID (src)  sub)
          Get a DurableSubscription.
abstract  java.util.Collection getDurableSubscriptionIdsForTopic(SpyTopic (src)  topic)
          Get all configured durable subscriptions for a particular topic.
 SpyTopic (src) getDurableTopic(DurableSubscriptionID (src)  sub)
          Get the destination a subscription is for.
protected abstract  java.lang.String getPreconfClientId(java.lang.String login, java.lang.String passwd)
          Get preconfigured clientID for login/user, and if state manager wants do authentication.
protected abstract  void removeDurableSubscription(AbstractStateManager.DurableSubscription (src)  ds)
          Remove the subscription and save to persistent storage.
 void removeLoggedOnClientId(java.lang.String ID)
          Remove the logged in clientID.
protected abstract  void saveDurableSubscription(AbstractStateManager.DurableSubscription (src)  ds)
          Add to durable subs and save the subsrcription to persistent storage.
 void setDurableSubscription(JMSDestinationManager (src)  server, DurableSubscriptionID (src)  sub, SpyTopic (src)  topic)
          Ad, change or delete a durable subsciption.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, startService, stop, stopService
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, 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.mq.sm.AbstractStateManagerMBean (src)
getInstance
 
Methods inherited from interface org.jboss.system.ServiceMBean (src)
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service (src)
create, destroy, start, stop
 

Constructor Detail

AbstractStateManager

public AbstractStateManager()
Create a new abstract state manager

Method Detail

setDurableSubscription

public void setDurableSubscription(JMSDestinationManager (src)  server,
                                   DurableSubscriptionID (src)  sub,
                                   SpyTopic (src)  topic)
                            throws JMSException (src) 
Description copied from interface: StateManager (src)
Ad, change or delete a durable subsciption. The contract is that the StateManager, must physically create the durable subscription. And when the method returns the information must be persisted.

Specified by:
setDurableSubscription in interface StateManager (src)
Parameters:
server - The JMSServer
sub - The id of the durable subscription
topic - The topic to subscribe durable on, if null the subscription will be removed.
Throws:
JMSException (src) - Description of Exception

getDurableTopic

public SpyTopic (src)  getDurableTopic(DurableSubscriptionID (src)  sub)
                         throws JMSException (src) 
Description copied from interface: StateManager (src)
Get the destination a subscription is for.

Specified by:
getDurableTopic in interface StateManager (src)
Throws:
JMSException (src)

checkUser

public java.lang.String checkUser(java.lang.String login,
                                  java.lang.String passwd)
                           throws JMSException (src) 
Description copied from interface: StateManager (src)
Check if a user has a preconfigured clientID and return it. If the user has a preconfigured clienID it will be added to the current logged in clientID's and returned. The state manager may also use this method to authenticate a user. If a SecurityManager is installed this is not necesarry.

Specified by:
checkUser in interface StateManager (src)
Parameters:
login - user name
passwd - password
Returns:
a preconfigured clientID.
Throws:
JMSException (src) - if the user

addLoggedOnClientId

public void addLoggedOnClientId(java.lang.String ID)
                         throws JMSException (src) 
Description copied from interface: StateManager (src)
Ad a logged in clientID to the statemanager. The clientID must not be active. The StateManager should somehow assure that a clientID that is preconfigured for a user is not allowed to be added this way.

Specified by:
addLoggedOnClientId in interface StateManager (src)
Parameters:
ID - a clientID
Throws:
JMSException (src) - Description of Exception

removeLoggedOnClientId

public void removeLoggedOnClientId(java.lang.String ID)
Description copied from interface: StateManager (src)
Remove the logged in clientID.

Specified by:
removeLoggedOnClientId in interface StateManager (src)
Parameters:
ID - clientID.

getDurableSubscriptionIdsForTopic

public abstract java.util.Collection getDurableSubscriptionIdsForTopic(SpyTopic (src)  topic)
                                                                throws JMSException (src) 
Description copied from interface: StateManager (src)
Get all configured durable subscriptions for a particular topic.

Specified by:
getDurableSubscriptionIdsForTopic in interface StateManager (src)
Parameters:
topic - the topic.
Returns:
a collection of DurableSubscriptionID
Throws:
JMSException (src) - Description of Exception

getPreconfClientId

protected abstract java.lang.String getPreconfClientId(java.lang.String login,
                                                       java.lang.String passwd)
                                                throws JMSException (src) 
Get preconfigured clientID for login/user, and if state manager wants do authentication. This is NOT recomended when using a SecurityManager.

Parameters:
login - the user name
passwd - the password
Returns:
any preconfigured client id
Throws:
JMSException (src) - for any error

checkLoggedOnClientId

protected abstract void checkLoggedOnClientId(java.lang.String clientID)
                                       throws JMSException (src) 
Check if the clientID is allowed to logg in from the particular state managers perspective.

Parameters:
clientID - the client id to check
Throws:
JMSException (src) - for any error

getDurableSubscription

protected abstract AbstractStateManager.DurableSubscription (src)  getDurableSubscription(DurableSubscriptionID (src)  sub)
                                                                            throws JMSException (src) 
Get a DurableSubscription.

Parameters:
sub - the durable subscription id
Returns:
the durable subscription or null if not found
Throws:
JMSException (src) - for any error

saveDurableSubscription

protected abstract void saveDurableSubscription(AbstractStateManager.DurableSubscription (src)  ds)
                                         throws JMSException (src) 
Add to durable subs and save the subsrcription to persistent storage.

Called by this class so the sublclass can save. This may be both a new subscription or a changed one. It is up to the sublcass to know how to find a changed on. (Only the topic will have changed, and it is the same DurableSubscription that is saved again that this class got through getDurableSubscription.

Parameters:
ds - the durable subscription to save
Throws:
JMSException (src) - for any error

removeDurableSubscription

protected abstract void removeDurableSubscription(AbstractStateManager.DurableSubscription (src)  ds)
                                           throws JMSException (src) 
Remove the subscription and save to persistent storage.

Called by this class so the sublclass can remove.

Parameters:
ds - the durable subscription to save
Throws:
JMSException (src) - for any error