org.jboss.mq.sm.jdbc
Class JDBCStateManager

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.mq.sm.AbstractStateManager
              extended by org.jboss.mq.sm.jdbc.JDBCStateManager
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, AbstractStateManagerMBean, JDBCStateManagerMBean, StateManager, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class JDBCStateManager
extends AbstractStateManager
implements JDBCStateManagerMBean

A state manager that stores state in the database.

Version:
$Revision: 1.6.2.4 $
Author:
Adrian Brock (Adrian@jboss.org), Ivelin Ivanov (ivelin@jboss.org)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.mq.sm.AbstractStateManager
AbstractStateManager.DurableSubscription
 
Field Summary
protected  DataSource dataSource
          The data source
protected  TransactionManager tm
          The transaction manager
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
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
JDBCStateManager()
           
 
Method Summary
protected  void checkLoggedOnClientId(String clientID)
          Check if the clientID is allowed to logg in from the particular state managers perspective.
 javax.management.ObjectName getConnectionManager()
          Get the connection manager name
protected  AbstractStateManager.DurableSubscription getDurableSubscription(DurableSubscriptionID sub)
          Get a DurableSubscription.
 Collection getDurableSubscriptionIdsForTopic(SpyTopic topic)
          Get all configured durable subscriptions for a particular topic.
 StateManager getInstance()
          Get an instance if the StateManager (Singleton).
protected  String getPreconfClientId(String logon, String passwd)
          Get preconfigured clientID for login/user, and if state manager wants do authentication.
 String getSqlProperties()
          Gets the sqlProperties.
 boolean hasSecurityManager()
          Whether we have a security manager
protected  void initDB()
           
protected  void removeDurableSubscription(AbstractStateManager.DurableSubscription ds)
          Remove the subscription and save to persistent storage.
protected  void saveDurableSubscription(AbstractStateManager.DurableSubscription ds)
          Add to durable subs and save the subsrcription to persistent storage.
 void setConnectionManager(javax.management.ObjectName connectionManagerName)
          Set the connection manager name
 void setHasSecurityManager(boolean hasSecurityManager)
          Set whether we have a security manager
 void setSqlProperties(String value)
          Sets the sqlProperties.
protected  void startService()
           
 
Methods inherited from class org.jboss.mq.sm.AbstractStateManager
addLoggedOnClientId, checkUser, getDurableTopic, removeLoggedOnClientId, setDurableSubscription
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop, stopService
 
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.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

dataSource

protected DataSource dataSource
The data source


tm

protected TransactionManager tm
The transaction manager

Constructor Detail

JDBCStateManager

public JDBCStateManager()
Method Detail

getConnectionManager

public javax.management.ObjectName getConnectionManager()
Description copied from interface: JDBCStateManagerMBean
Get the connection manager name

Specified by:
getConnectionManager in interface JDBCStateManagerMBean
Returns:
the connection manager

setConnectionManager

public void setConnectionManager(javax.management.ObjectName connectionManagerName)
Description copied from interface: JDBCStateManagerMBean
Set the connection manager name

Specified by:
setConnectionManager in interface JDBCStateManagerMBean
Parameters:
connectionManagerName - the name

hasSecurityManager

public boolean hasSecurityManager()
Description copied from interface: JDBCStateManagerMBean
Whether we have a security manager

Specified by:
hasSecurityManager in interface JDBCStateManagerMBean
Returns:
true when using a security manager

setHasSecurityManager

public void setHasSecurityManager(boolean hasSecurityManager)
Description copied from interface: JDBCStateManagerMBean
Set whether we have a security manager

Specified by:
setHasSecurityManager in interface JDBCStateManagerMBean
Parameters:
hasSecurityManager - true when there is a security manager

getSqlProperties

public String getSqlProperties()
Description copied from interface: JDBCStateManagerMBean
Gets the sqlProperties.

Specified by:
getSqlProperties in interface JDBCStateManagerMBean
Returns:
the Properties

setSqlProperties

public void setSqlProperties(String value)
Description copied from interface: JDBCStateManagerMBean
Sets the sqlProperties.

Specified by:
setSqlProperties in interface JDBCStateManagerMBean

getDurableSubscription

protected AbstractStateManager.DurableSubscription getDurableSubscription(DurableSubscriptionID sub)
                                                                   throws javax.jms.JMSException
Description copied from class: AbstractStateManager
Get a DurableSubscription.

Specified by:
getDurableSubscription in class AbstractStateManager
Parameters:
sub - the durable subscription id
Returns:
the durable subscription or null if not found
Throws:
javax.jms.JMSException - for any error

saveDurableSubscription

protected void saveDurableSubscription(AbstractStateManager.DurableSubscription ds)
                                throws javax.jms.JMSException
Description copied from class: AbstractStateManager
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.

Specified by:
saveDurableSubscription in class AbstractStateManager
Parameters:
ds - the durable subscription to save
Throws:
javax.jms.JMSException - for any error

removeDurableSubscription

protected void removeDurableSubscription(AbstractStateManager.DurableSubscription ds)
                                  throws javax.jms.JMSException
Description copied from class: AbstractStateManager
Remove the subscription and save to persistent storage.

Called by this class so the sublclass can remove.

Specified by:
removeDurableSubscription in class AbstractStateManager
Parameters:
ds - the durable subscription to save
Throws:
javax.jms.JMSException - for any error

getDurableSubscriptionIdsForTopic

public 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
Specified by:
getDurableSubscriptionIdsForTopic in class AbstractStateManager
Parameters:
topic - the topic.
Returns:
a collection of DurableSubscriptionID
Throws:
javax.jms.JMSException - Description of Exception

checkLoggedOnClientId

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

Specified by:
checkLoggedOnClientId in class AbstractStateManager
Parameters:
clientID - the client id to check
Throws:
javax.jms.JMSException - for any error

getPreconfClientId

protected String getPreconfClientId(String logon,
                                    String passwd)
                             throws javax.jms.JMSException
Description copied from class: AbstractStateManager
Get preconfigured clientID for login/user, and if state manager wants do authentication. This is NOT recomended when using a SecurityManager.

Specified by:
getPreconfClientId in class AbstractStateManager
Parameters:
logon - the user name
passwd - the password
Returns:
any preconfigured client id
Throws:
javax.jms.JMSException - for any error

getInstance

public StateManager getInstance()
Description copied from interface: AbstractStateManagerMBean
Get an instance if the StateManager (Singleton).

Specified by:
getInstance in interface AbstractStateManagerMBean

startService

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

initDB

protected void initDB()
               throws Exception
Throws:
Exception


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