org.jboss.jms.server.plugin
Class JDBCChannelMapper

java.lang.Object
  extended byServiceMBeanSupport
      extended byorg.jboss.jms.server.plugin.JDBCChannelMapper
All Implemented Interfaces:
ChannelMapper, ServerPlugin

public class JDBCChannelMapper
extends ServiceMBeanSupport
implements ChannelMapper

JDBC Implementation of ChannelMapper

Author:
Tim Fox, Ovidiu Feodorov, Adrian Brock, Ivelin Ivanov JDBCChannelMapper.java,v 1.1 2006/03/01 09:15:09 timfox Exp
See Also:
Serialized Form

Field Summary
protected  IdManager channelIDManager
           
protected  boolean createTablesOnStartup
           
protected  java.lang.String dataSourceJNDIName
           
protected  javax.sql.DataSource ds
           
protected  java.util.Map idMap
           
protected  java.util.List populateTables
           
protected  QueuedExecutorPool queuedExecutorPool
           
protected  java.util.Map queues
           
protected  java.util.Properties sqlProperties
           
protected  java.util.Map subscriptions
           
protected  ObjectName tmObjectName
           
protected  java.util.Map topics
           
protected static char TYPE_DURABLE_SUB
           
protected static char TYPE_QUEUE
           
protected static char TYPE_TOPIC
           
 
Constructor Summary
JDBCChannelMapper()
           
JDBCChannelMapper(javax.sql.DataSource ds, TransactionManager tm)
           
 
Method Summary
 DurableSubscription createDurableSubscription(java.lang.String topicName, java.lang.String clientID, java.lang.String subscriptionName, java.lang.String selector, boolean noLocal, MessageStore ms, PersistenceManager pm, MemoryManager mm)
           
protected  DurableSubscription createDurableSubscriptionInternal(long id, java.lang.String topicName, java.lang.String clientID, java.lang.String subscriptionName, Selector selector, boolean noLocal, MessageStore ms, PersistenceManager pm, MemoryManager mm)
           
protected  void createSchema()
           
 Subscription createSubscription(java.lang.String topicName, java.lang.String selector, boolean noLocal, MessageStore ms, PersistenceManager pm, MemoryManager mm)
           
protected  boolean deleteMappingRow(long id)
           
 void deployCoreDestination(boolean isQueue, java.lang.String destName, MessageStore ms, PersistenceManager pm, MemoryManager mm, int fullSize, int pageSize, int downCacheSize)
           
 void deployTemporaryCoreDestination(boolean isQueue, java.lang.String destName, long id, MessageStore ms, PersistenceManager pm, MemoryManager mm, int fullSize, int pageSize, int downCacheSize)
           
 CoreDestination getCoreDestination(JBossDestination jbDest)
           
protected  CoreDestination getCoreDestinationInternal(boolean isQueue, java.lang.String destName)
           
 java.lang.String getDataSource()
          Managed attribute.
protected  DurableSubscription getDurableSubscription(java.lang.String clientID, java.lang.String subscriptionName)
           
 DurableSubscription getDurableSubscription(java.lang.String clientID, java.lang.String subscriptionName, MessageStore ms, PersistenceManager pm, MemoryManager mm)
           
protected  java.lang.Long getIdForDestination(boolean isQueue, java.lang.String destName)
           
 java.lang.Object getInstance()
          A server plugin will be always accessed via a hard reference, so it is essential that each implementation exposes this method.
 JBossDestination getJBossDestination(long coreDestinationId)
           
protected  long getNextId()
           
 java.lang.String getPreConfiguredClientID(java.lang.String username)
          FIXME This doesn't belong here and should be moved out to a different service
 java.lang.String getSqlProperties()
           
 java.util.Set getSubscriptions(java.lang.String clientID)
           
 ObjectName getTransactionManager()
          Managed attribute.
protected  void initSqlProperties()
           
protected  void insertMappingRow(long id, char type, java.lang.String jmsDestName, java.lang.String jmsSubName, java.lang.String clientID, java.lang.String selector, java.lang.Boolean noLocal)
           
 boolean isCreateTablesOnStartup()
          Managed attribute.
protected  java.util.List loadDurableSubscriptionsForTopic(java.lang.String topicName, MessageStore ms, PersistenceManager pm, MemoryManager mm)
           
 boolean removeDurableSubscription(java.lang.String clientID, java.lang.String subscriptionName)
           
protected  DurableSubscription removeDurableSubscriptionInMemory(java.lang.String clientID, java.lang.String subscriptionName)
           
 void setCreateTablesOnStartup(boolean b)
          Managed attribute.
 void setDataSource(java.lang.String dataSourceJNDIName)
          Managed attribute.
 void setPersistenceManager(PersistenceManager pm)
           
 void setQueuedExecutorPool(QueuedExecutorPool pool)
           
 void setSqlProperties(java.lang.String value)
           
 void setTransactionManager(ObjectName tmObjectName)
          Managed attribute.
protected  void startService()
           
protected  void stopService()
           
 java.lang.String toString()
           
 CoreDestination undeployCoreDestination(boolean isQueue, java.lang.String destName)
           
 CoreDestination undeployTemporaryCoreDestination(boolean isQueue, java.lang.String destName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_QUEUE

protected static final char TYPE_QUEUE
See Also:
Constant Field Values

TYPE_TOPIC

protected static final char TYPE_TOPIC
See Also:
Constant Field Values

TYPE_DURABLE_SUB

protected static final char TYPE_DURABLE_SUB
See Also:
Constant Field Values

subscriptions

protected java.util.Map subscriptions

queues

protected java.util.Map queues

topics

protected java.util.Map topics

idMap

protected java.util.Map idMap

dataSourceJNDIName

protected java.lang.String dataSourceJNDIName

ds

protected javax.sql.DataSource ds

tmObjectName

protected ObjectName tmObjectName

channelIDManager

protected IdManager channelIDManager

createTablesOnStartup

protected boolean createTablesOnStartup

sqlProperties

protected java.util.Properties sqlProperties

populateTables

protected java.util.List populateTables

queuedExecutorPool

protected QueuedExecutorPool queuedExecutorPool
Constructor Detail

JDBCChannelMapper

public JDBCChannelMapper()

JDBCChannelMapper

public JDBCChannelMapper(javax.sql.DataSource ds,
                         TransactionManager tm)
Method Detail

setPersistenceManager

public void setPersistenceManager(PersistenceManager pm)
                           throws java.lang.Exception
Specified by:
setPersistenceManager in interface ChannelMapper
Throws:
java.lang.Exception

setQueuedExecutorPool

public void setQueuedExecutorPool(QueuedExecutorPool pool)
                           throws java.lang.Exception
Specified by:
setQueuedExecutorPool in interface ChannelMapper
Throws:
java.lang.Exception

startService

protected void startService()
                     throws java.lang.Exception
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Throws:
java.lang.Exception

getInstance

public java.lang.Object getInstance()
Description copied from interface: ServerPlugin
A server plugin will be always accessed via a hard reference, so it is essential that each implementation exposes this method.

Specified by:
getInstance in interface ServerPlugin

getCoreDestination

public CoreDestination getCoreDestination(JBossDestination jbDest)
Specified by:
getCoreDestination in interface ChannelMapper

getJBossDestination

public JBossDestination getJBossDestination(long coreDestinationId)
Specified by:
getJBossDestination in interface ChannelMapper

deployCoreDestination

public void deployCoreDestination(boolean isQueue,
                                  java.lang.String destName,
                                  MessageStore ms,
                                  PersistenceManager pm,
                                  MemoryManager mm,
                                  int fullSize,
                                  int pageSize,
                                  int downCacheSize)
                           throws java.lang.Exception
Specified by:
deployCoreDestination in interface ChannelMapper
Throws:
java.lang.Exception

undeployCoreDestination

public CoreDestination undeployCoreDestination(boolean isQueue,
                                               java.lang.String destName)
                                        throws java.lang.Exception
Specified by:
undeployCoreDestination in interface ChannelMapper
Throws:
java.lang.Exception

deployTemporaryCoreDestination

public void deployTemporaryCoreDestination(boolean isQueue,
                                           java.lang.String destName,
                                           long id,
                                           MessageStore ms,
                                           PersistenceManager pm,
                                           MemoryManager mm,
                                           int fullSize,
                                           int pageSize,
                                           int downCacheSize)
                                    throws java.lang.Exception
Specified by:
deployTemporaryCoreDestination in interface ChannelMapper
Throws:
java.lang.Exception

undeployTemporaryCoreDestination

public CoreDestination undeployTemporaryCoreDestination(boolean isQueue,
                                                        java.lang.String destName)
                                                 throws java.lang.Exception
Specified by:
undeployTemporaryCoreDestination in interface ChannelMapper
Throws:
java.lang.Exception

getDurableSubscription

public DurableSubscription getDurableSubscription(java.lang.String clientID,
                                                  java.lang.String subscriptionName,
                                                  MessageStore ms,
                                                  PersistenceManager pm,
                                                  MemoryManager mm)
                                           throws java.lang.Exception
Specified by:
getDurableSubscription in interface ChannelMapper
Throws:
java.lang.Exception

createDurableSubscription

public DurableSubscription createDurableSubscription(java.lang.String topicName,
                                                     java.lang.String clientID,
                                                     java.lang.String subscriptionName,
                                                     java.lang.String selector,
                                                     boolean noLocal,
                                                     MessageStore ms,
                                                     PersistenceManager pm,
                                                     MemoryManager mm)
                                              throws java.lang.Exception
Specified by:
createDurableSubscription in interface ChannelMapper
Throws:
java.lang.Exception

createSubscription

public Subscription createSubscription(java.lang.String topicName,
                                       java.lang.String selector,
                                       boolean noLocal,
                                       MessageStore ms,
                                       PersistenceManager pm,
                                       MemoryManager mm)
                                throws java.lang.Exception
Specified by:
createSubscription in interface ChannelMapper
Throws:
java.lang.Exception

removeDurableSubscription

public boolean removeDurableSubscription(java.lang.String clientID,
                                         java.lang.String subscriptionName)
                                  throws java.lang.Exception
Specified by:
removeDurableSubscription in interface ChannelMapper
Throws:
java.lang.Exception

getPreConfiguredClientID

public java.lang.String getPreConfiguredClientID(java.lang.String username)
                                          throws java.lang.Exception
Description copied from interface: ChannelMapper
FIXME This doesn't belong here and should be moved out to a different service

Specified by:
getPreConfiguredClientID in interface ChannelMapper
Parameters:
username -
Returns:
Throws:
java.lang.Exception

getSqlProperties

public java.lang.String getSqlProperties()

setSqlProperties

public void setSqlProperties(java.lang.String value)

setDataSource

public void setDataSource(java.lang.String dataSourceJNDIName)
                   throws java.lang.Exception
Managed attribute.

Throws:
java.lang.Exception

getDataSource

public java.lang.String getDataSource()
Managed attribute.


setTransactionManager

public void setTransactionManager(ObjectName tmObjectName)
                           throws java.lang.Exception
Managed attribute.

Throws:
java.lang.Exception

getTransactionManager

public ObjectName getTransactionManager()
Managed attribute.


isCreateTablesOnStartup

public boolean isCreateTablesOnStartup()
                                throws java.lang.Exception
Managed attribute.

Throws:
java.lang.Exception

setCreateTablesOnStartup

public void setCreateTablesOnStartup(boolean b)
                              throws java.lang.Exception
Managed attribute.

Throws:
java.lang.Exception

getSubscriptions

public java.util.Set getSubscriptions(java.lang.String clientID)
Specified by:
getSubscriptions in interface ChannelMapper
Returns:
a Set. It may return an empty Set, but never null.

toString

public java.lang.String toString()

removeDurableSubscriptionInMemory

protected DurableSubscription removeDurableSubscriptionInMemory(java.lang.String clientID,
                                                                java.lang.String subscriptionName)
                                                         throws JMSException
Throws:
JMSException

loadDurableSubscriptionsForTopic

protected java.util.List loadDurableSubscriptionsForTopic(java.lang.String topicName,
                                                          MessageStore ms,
                                                          PersistenceManager pm,
                                                          MemoryManager mm)
                                                   throws java.lang.Exception
Throws:
java.lang.Exception

insertMappingRow

protected void insertMappingRow(long id,
                                char type,
                                java.lang.String jmsDestName,
                                java.lang.String jmsSubName,
                                java.lang.String clientID,
                                java.lang.String selector,
                                java.lang.Boolean noLocal)
                         throws java.lang.Exception
Throws:
java.lang.Exception

getIdForDestination

protected java.lang.Long getIdForDestination(boolean isQueue,
                                             java.lang.String destName)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

deleteMappingRow

protected boolean deleteMappingRow(long id)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getDurableSubscription

protected DurableSubscription getDurableSubscription(java.lang.String clientID,
                                                     java.lang.String subscriptionName)
                                              throws JMSException
Throws:
JMSException

createDurableSubscriptionInternal

protected DurableSubscription createDurableSubscriptionInternal(long id,
                                                                java.lang.String topicName,
                                                                java.lang.String clientID,
                                                                java.lang.String subscriptionName,
                                                                Selector selector,
                                                                boolean noLocal,
                                                                MessageStore ms,
                                                                PersistenceManager pm,
                                                                MemoryManager mm)
                                                         throws JMSException
Throws:
JMSException

getCoreDestinationInternal

protected CoreDestination getCoreDestinationInternal(boolean isQueue,
                                                     java.lang.String destName)

initSqlProperties

protected void initSqlProperties()

createSchema

protected void createSchema()
                     throws java.lang.Exception
Throws:
java.lang.Exception

getNextId

protected long getNextId()
                  throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2006 JBoss Inc. All Rights Reserved.