站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 messaging API Documentation 英文版文档

AbstractStateManager (JBoss Messaging API) - JBoss 4.0.1 sp1 messaging API Documentation 英文版文档


org.jboss.mq.sm
Class AbstractStateManager

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

public abstract class AbstractStateManager
extends org.jboss.system.ServiceMBeanSupport
implements StateManager, AbstractStateManagerMBean

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.

Version:
$Revision: 1.9.6.1 $
Author:
Peter Antman , Norbert Lataille , Hiram Chirino , Adrian Brock

Nested Class Summary
protected  class AbstractStateManager.DurableSubscription
          Abstracts the data between a subclass and this class.
 
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
AbstractStateManager()
          Create a new abstract state manager
 
Method Summary
 void addLoggedOnClientId(String ID)
          Ad a logged in clientID to the statemanager.
protected abstract  void checkLoggedOnClientId(String clientID)
          Check if the clientID is allowed to logg in from the particular state managers perspective.
 String checkUser(String login, String passwd)
          Check if a user has a preconfigured clientID and return it.
protected abstract  AbstractStateManager.DurableSubscription getDurableSubscription(DurableSubscriptionID sub)
          Get a DurableSubscription.
abstract  Collection getDurableSubscriptionIdsForTopic(SpyTopic topic)
          Get all configured durable subscriptions for a particular topic.
 SpyTopic getDurableTopic(DurableSubscriptionID sub)
          Get the destination a subscription is for.
protected abstract  String getPreconfClientId(String login, String passwd)
          Get preconfigured clientID for login/user, and if state manager wants do authentication.
protected abstract  void removeDurableSubscription(AbstractStateManager.DurableSubscription ds)
          Remove the subscription and save to persistent storage.
 void removeLoggedOnClientId(String ID)
          Remove the logged in clientID.
protected abstract  void saveDurableSubscription(AbstractStateManager.DurableSubscription ds)
          Add to durable subs and save the subsrcription to persistent storage.
 void setDurableSubscription(JMSDestinationManager server, DurableSubscriptionID sub, SpyTopic topic)
          Ad, change or delete a durable subsciption.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
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
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
getInstance
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Constructor Detail

AbstractStateManager

public AbstractStateManager()
Create a new abstract state manager

Method Detail

setDurableSubscription

public void setDurableSubscription(JMSDestinationManager server,
                                   DurableSubscriptionID sub,
                                   SpyTopic topic)
                            throws javax.jms.JMSException
Description copied from interface: StateManager
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
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:
javax.jms.JMSException - Description of Exception

getDurableTopic

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

Specified by:
getDurableTopic in interface StateManager
Throws:
javax.jms.JMSException

checkUser

public String checkUser(String login,
                        String passwd)
                 throws javax.jms.JMSException
Description copied from interface: StateManager
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
Parameters:
login - user name
passwd - password
Returns:
a preconfigured clientID.
Throws:
javax.jms.JMSException - if the user

addLoggedOnClientId

public void addLoggedOnClientId(String ID)
                         throws javax.jms.JMSException
Description copied from interface: StateManager
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
Parameters:
ID - a clientID
Throws:
javax.jms.JMSException - Description of Exception

removeLoggedOnClientId

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

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

getDurableSubscriptionIdsForTopic

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

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

getPreconfClientId

protected abstract String getPreconfClientId(String login,
                                             String passwd)
                                      throws javax.jms.JMSException
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:
javax.jms.JMSException - for any error

checkLoggedOnClientId

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

Parameters:
clientID - the client id to check
Throws:
javax.jms.JMSException - for any error

getDurableSubscription

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

Parameters:
sub - the durable subscription id
Returns:
the durable subscription or null if not found
Throws:
javax.jms.JMSException - for any error

saveDurableSubscription

protected abstract void saveDurableSubscription(AbstractStateManager.DurableSubscription ds)
                                         throws javax.jms.JMSException
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:
javax.jms.JMSException - for any error

removeDurableSubscription

protected abstract void removeDurableSubscription(AbstractStateManager.DurableSubscription ds)
                                           throws javax.jms.JMSException
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:
javax.jms.JMSException - for any error


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.