org.jboss.mq.server
Class JMSDestinationManager

java.lang.Object
  extended by org.jboss.mq.server.JMSServerInterceptorSupport
      extended by org.jboss.mq.server.JMSDestinationManager
All Implemented Interfaces:
Recoverable, JMSServerInterceptor

public class JMSDestinationManager
extends JMSServerInterceptorSupport

This class implements the JMS provider

Version:
$Revision: 57198 $
Author:
Norbert Lataille (Norbert.Lataille@m4x.org), Hiram Chirino (Cojonudo14@hotmail.com), David Maplesden (David.Maplesden@orion.co.nz), Peter Antman

Field Summary
 Map closingDestinations
          Destinations being closed SpyDestination -> JMSDestination
 Map destinations
          Destinations SpyDestination -> JMSDestination
static String JBOSS_VERSION
          The version
 ThreadGroup threadGroup
          Thread group
 org.jboss.util.threadpool.ThreadPool threadPool
          Thread pool
 org.jboss.util.timeout.TimeoutFactory timeoutFactory
          Timeout factory
 
Fields inherited from class org.jboss.mq.server.JMSServerInterceptorSupport
log, nextInterceptor
 
Constructor Summary
JMSDestinationManager(BasicQueueParameters parameters)
          Constructor for the JMSServer object
 
Method Summary
 void acknowledge(ConnectionToken dc, AcknowledgementRequest item)
          #Description of the Method
 void acknowledge(ConnectionToken dc, AcknowledgementRequest item, Tx txId)
           
 void addDestination(JMSDestination destination)
           
 void addMessage(ConnectionToken dc, SpyMessage val)
          Add the message to the destination.
 void addMessage(ConnectionToken dc, SpyMessage val, Tx txId)
           
 String authenticate(String id, String password)
          Check user for autentication.
 SpyMessage[] browse(ConnectionToken dc, javax.jms.Destination dest, String selector)
          #Description of the Method
 void checkID(String ID)
          Check id, must not be taken.
protected  void checkStopped()
           
 String checkUser(String userName, String password)
          Check user for autentication.
 void closeDestination(SpyDestination dest)
          Closed a destination that was opened previously
 void connectionClosing(ConnectionToken dc)
          Close connection.
 void connectionFailure(ConnectionToken dc)
           
 javax.jms.Queue createQueue(ConnectionToken dc, String name)
          Create a queue.
 javax.jms.Queue createQueue(String queueName)
           
 javax.jms.Topic createTopic(ConnectionToken dc, String name)
          Create a topic.
 javax.jms.Topic createTopic(String topicName)
           
protected  void deleteTemporaryDestination(ConnectionToken dc, JMSDestination destination)
           
 void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest)
          #Description of the Method
 void destroySubscription(ConnectionToken dc, DurableSubscriptionID id)
          Unsubscribe from the durable subscription.
 ClientConsumer getClientConsumer(ConnectionToken dc)
           
 int getClientCount()
           
 HashMap getClients()
          Obtain a copy of the current clients
 SpyTopic getDurableTopic(DurableSubscriptionID sub)
          Get the topic the durable subscription is on.
 String getID()
          Gets the ID attribute of the JMSServer object
 JMSDestination getJMSDestination(SpyDestination dest)
           
 MessageCache getMessageCache()
          Gets the messageCache
 MessageCounter[] getMessageCounter()
          Gets message counters of all configured destinations
 BasicQueueParameters getParameters()
           
 PersistenceManager getPersistenceManager()
          Gets the PersistenceManager attribute of the JMSServer object
protected  JMSDestination getPossiblyClosingJMSDestination(SpyDestination dest)
          Gets the JMSDestination attribute of the JMSServer object which might be being closed
 StateManager getStateManager()
          Gets the StateManager attribute of the JMSServer object
 Subscription getSubscription(ConnectionToken dc, int subscriberId)
          Get the subscription that match the id.
 javax.jms.TemporaryQueue getTemporaryQueue(ConnectionToken dc)
          Get a temporary queue
 javax.jms.TemporaryTopic getTemporaryTopic(ConnectionToken dc)
          Get a temporary topic.
 ThreadGroup getThreadGroup()
          Get the thread group of the server.
 org.jboss.util.threadpool.ThreadPool getThreadPool()
           
 org.jboss.util.timeout.TimeoutFactory getTimeoutFactory()
           
 boolean isStopped()
          Returns false if the JMS server is currently running and handling requests, true otherwise.
 void ping(ConnectionToken dc, long clientTime)
          Ping the server.
 SpyMessage receive(ConnectionToken dc, int subscriberId, long wait)
          #Description of the Method
 Xid[] recover(ConnectionToken dc, int flags)
          Recover
 void resetMessageCounter()
          Resets message counters of all configured destinations
 void setEnabled(ConnectionToken dc, boolean enabled)
          Sets the Enabled attribute of the JMSServer object
 void setMessageCache(MessageCache messageCache)
          Sets the messageCache
 void setPersistenceManager(PersistenceManager newPersistenceManager)
          Sets the PersistenceManager attribute of the JMSServer object
 void setStateManager(StateManager newStateManager)
          Sets the StateManager attribute of the JMSServer object
 void setThreadGroup(ThreadGroup threadGroup)
           
 void setThreadPool(org.jboss.util.threadpool.ThreadPool threadPool)
           
 void startServer()
          Start the server
 void stopServer()
          Stop the server
 void subscribe(ConnectionToken dc, Subscription sub)
           
 String toString()
           
 void transact(ConnectionToken dc, TransactionRequest t)
          #Description of the Method
 void unsubscribe(ConnectionToken dc, int subscriptionId)
          Close the server side message consumer.
 
Methods inherited from class org.jboss.mq.server.JMSServerInterceptorSupport
getNext, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JBOSS_VERSION

public static final String JBOSS_VERSION
The version

See Also:
Constant Field Values

destinations

public Map destinations
Destinations SpyDestination -> JMSDestination


closingDestinations

public Map closingDestinations
Destinations being closed SpyDestination -> JMSDestination


threadPool

public org.jboss.util.threadpool.ThreadPool threadPool
Thread pool


threadGroup

public ThreadGroup threadGroup
Thread group


timeoutFactory

public org.jboss.util.timeout.TimeoutFactory timeoutFactory
Timeout factory

Constructor Detail

JMSDestinationManager

public JMSDestinationManager(BasicQueueParameters parameters)
Constructor for the JMSServer object

Method Detail

setEnabled

public void setEnabled(ConnectionToken dc,
                       boolean enabled)
                throws javax.jms.JMSException
Sets the Enabled attribute of the JMSServer object

Specified by:
setEnabled in interface JMSServerInterceptor
Overrides:
setEnabled in class JMSServerInterceptorSupport
Parameters:
dc - The new Enabled value
enabled - The new Enabled value
Throws:
javax.jms.JMSException - Description of Exception

setStateManager

public void setStateManager(StateManager newStateManager)
Sets the StateManager attribute of the JMSServer object

Parameters:
newStateManager - The new StateManager value

setPersistenceManager

public void setPersistenceManager(PersistenceManager newPersistenceManager)
Sets the PersistenceManager attribute of the JMSServer object

Parameters:
newPersistenceManager - The new PersistenceManager value

isStopped

public boolean isStopped()
Returns false if the JMS server is currently running and handling requests, true otherwise.

Returns:
false if the JMS server is currently running and handling requests, true otherwise.

checkStopped

protected void checkStopped()
                     throws IllegalStateException
Throws:
IllegalStateException

getClientCount

public int getClientCount()
Returns:
the current client count

getClients

public HashMap getClients()
Obtain a copy of the current clients

Returns:
a HashMap of current clients

setThreadPool

public void setThreadPool(org.jboss.util.threadpool.ThreadPool threadPool)

getThreadPool

public org.jboss.util.threadpool.ThreadPool getThreadPool()

setThreadGroup

public void setThreadGroup(ThreadGroup threadGroup)

getThreadGroup

public ThreadGroup getThreadGroup()
Description copied from interface: JMSServerInterceptor
Get the thread group of the server.

Specified by:
getThreadGroup in interface JMSServerInterceptor
Overrides:
getThreadGroup in class JMSServerInterceptorSupport

getTimeoutFactory

public org.jboss.util.timeout.TimeoutFactory getTimeoutFactory()

getID

public String getID()
Gets the ID attribute of the JMSServer object

Specified by:
getID in interface JMSServerInterceptor
Overrides:
getID in class JMSServerInterceptorSupport
Returns:
The ID value

getTemporaryTopic

public javax.jms.TemporaryTopic getTemporaryTopic(ConnectionToken dc)
                                           throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Get a temporary topic.

Specified by:
getTemporaryTopic in interface JMSServerInterceptor
Overrides:
getTemporaryTopic in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
Returns:
The TemporaryTopic value
Throws:
javax.jms.JMSException - Description of Exception

getTemporaryQueue

public javax.jms.TemporaryQueue getTemporaryQueue(ConnectionToken dc)
                                           throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Get a temporary queue

Specified by:
getTemporaryQueue in interface JMSServerInterceptor
Overrides:
getTemporaryQueue in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
Returns:
The TemporaryQueue value
Throws:
javax.jms.JMSException - Description of Exception

getClientConsumer

public ClientConsumer getClientConsumer(ConnectionToken dc)
                                 throws javax.jms.JMSException
Throws:
javax.jms.JMSException

getJMSDestination

public JMSDestination getJMSDestination(SpyDestination dest)

getPossiblyClosingJMSDestination

protected JMSDestination getPossiblyClosingJMSDestination(SpyDestination dest)
Gets the JMSDestination attribute of the JMSServer object which might be being closed

Parameters:
dest - Description of Parameter
Returns:
The JMSDestination value

getStateManager

public StateManager getStateManager()
Gets the StateManager attribute of the JMSServer object

Returns:
The StateManager value

getPersistenceManager

public PersistenceManager getPersistenceManager()
Gets the PersistenceManager attribute of the JMSServer object

Returns:
The PersistenceManager value

startServer

public void startServer()
Start the server


stopServer

public void stopServer()
Stop the server


checkID

public void checkID(String ID)
             throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Check id, must not be taken.

Specified by:
checkID in interface JMSServerInterceptor
Overrides:
checkID in class JMSServerInterceptorSupport
Parameters:
ID - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

addMessage

public void addMessage(ConnectionToken dc,
                       SpyMessage val)
                throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Add the message to the destination.

Specified by:
addMessage in interface JMSServerInterceptor
Overrides:
addMessage in class JMSServerInterceptorSupport
Parameters:
dc - The feature to be added to the Message attribute
val - The feature to be added to the Message attribute
Throws:
javax.jms.JMSException - Description of Exception

addMessage

public void addMessage(ConnectionToken dc,
                       SpyMessage val,
                       Tx txId)
                throws javax.jms.JMSException
Throws:
javax.jms.JMSException

transact

public void transact(ConnectionToken dc,
                     TransactionRequest t)
              throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
#Description of the Method

Specified by:
transact in interface JMSServerInterceptor
Overrides:
transact in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
t - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

recover

public Xid[] recover(ConnectionToken dc,
                     int flags)
              throws Exception
Description copied from interface: Recoverable
Recover

Specified by:
recover in interface Recoverable
Overrides:
recover in class JMSServerInterceptorSupport
Parameters:
dc - the connnection token
flags - the recovery flags
Returns:
the xids
Throws:
Exception - for any error

acknowledge

public void acknowledge(ConnectionToken dc,
                        AcknowledgementRequest item)
                 throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
#Description of the Method

Specified by:
acknowledge in interface JMSServerInterceptor
Overrides:
acknowledge in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
item - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

acknowledge

public void acknowledge(ConnectionToken dc,
                        AcknowledgementRequest item,
                        Tx txId)
                 throws javax.jms.JMSException
Throws:
javax.jms.JMSException

connectionClosing

public void connectionClosing(ConnectionToken dc)
                       throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Close connection.

Specified by:
connectionClosing in interface JMSServerInterceptor
Overrides:
connectionClosing in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

connectionFailure

public void connectionFailure(ConnectionToken dc)
                       throws javax.jms.JMSException
Throws:
javax.jms.JMSException

subscribe

public void subscribe(ConnectionToken dc,
                      Subscription sub)
               throws javax.jms.JMSException
Specified by:
subscribe in interface JMSServerInterceptor
Overrides:
subscribe in class JMSServerInterceptorSupport
Parameters:
dc - org.jboss.mq.ConnectionToken
sub - org.jboss.mq.Subscription
Throws:
javax.jms.JMSException - The exception description.

unsubscribe

public void unsubscribe(ConnectionToken dc,
                        int subscriptionId)
                 throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Close the server side message consumer. Client is no longer available to receive messages.

Specified by:
unsubscribe in interface JMSServerInterceptor
Overrides:
unsubscribe in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
subscriptionId - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

destroySubscription

public void destroySubscription(ConnectionToken dc,
                                DurableSubscriptionID id)
                         throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Unsubscribe from the durable subscription.

Specified by:
destroySubscription in interface JMSServerInterceptor
Overrides:
destroySubscription in class JMSServerInterceptorSupport
id - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

browse

public SpyMessage[] browse(ConnectionToken dc,
                           javax.jms.Destination dest,
                           String selector)
                    throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
#Description of the Method

Specified by:
browse in interface JMSServerInterceptor
Overrides:
browse in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
dest - Description of Parameter
selector - Description of Parameter
Returns:
Description of the Returned Value
Throws:
javax.jms.JMSException - Description of Exception

receive

public SpyMessage receive(ConnectionToken dc,
                          int subscriberId,
                          long wait)
                   throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
#Description of the Method

Specified by:
receive in interface JMSServerInterceptor
Overrides:
receive in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
subscriberId - Description of Parameter
wait - Description of Parameter
Returns:
Description of the Returned Value
Throws:
javax.jms.JMSException - Description of Exception

createQueue

public javax.jms.Queue createQueue(ConnectionToken dc,
                                   String name)
                            throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Create a queue. The destination name must be the name of an already existing destination. This method should only be used to skip looking up a destination through JNDI, not to actually create a new destination.

Specified by:
createQueue in interface JMSServerInterceptor
Overrides:
createQueue in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
name - Description of Parameter
Returns:
Description of the Returned Value
Throws:
javax.jms.JMSException - Description of Exception

createTopic

public javax.jms.Topic createTopic(ConnectionToken dc,
                                   String name)
                            throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Create a topic. The destination name must be the name of an already existing destination. This method should only be used to skip looking up a destination through JNDI, not to actually create a new destination.

Specified by:
createTopic in interface JMSServerInterceptor
Overrides:
createTopic in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
name - Description of Parameter
Returns:
Description of the Returned Value
Throws:
javax.jms.JMSException - Description of Exception

createQueue

public javax.jms.Queue createQueue(String queueName)
                            throws javax.jms.JMSException
Throws:
javax.jms.JMSException

createTopic

public javax.jms.Topic createTopic(String topicName)
                            throws javax.jms.JMSException
Throws:
javax.jms.JMSException

deleteTemporaryDestination

public void deleteTemporaryDestination(ConnectionToken dc,
                                       SpyDestination dest)
                                throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
#Description of the Method

Specified by:
deleteTemporaryDestination in interface JMSServerInterceptor
Overrides:
deleteTemporaryDestination in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
dest - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

deleteTemporaryDestination

protected void deleteTemporaryDestination(ConnectionToken dc,
                                          JMSDestination destination)
                                   throws javax.jms.JMSException
Throws:
javax.jms.JMSException

checkUser

public String checkUser(String userName,
                        String password)
                 throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Check user for autentication.

Specified by:
checkUser in interface JMSServerInterceptor
Overrides:
checkUser in class JMSServerInterceptorSupport
Parameters:
userName - Description of Parameter
password - Description of Parameter
Returns:
a preconfigured clientId.
Throws:
javax.jms.JMSException - if user was not allowed to login

authenticate

public String authenticate(String id,
                           String password)
                    throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Check user for autentication.

Specified by:
authenticate in interface JMSServerInterceptor
Overrides:
authenticate in class JMSServerInterceptorSupport
Parameters:
id - Description of Parameter
password - Description of Parameter
Returns:
a sessionId.
Throws:
javax.jms.JMSException - if user was not allowed to login

addDestination

public void addDestination(JMSDestination destination)
                    throws javax.jms.JMSException
Throws:
javax.jms.JMSException

closeDestination

public void closeDestination(SpyDestination dest)
                      throws javax.jms.JMSException
Closed a destination that was opened previously

Parameters:
dest - the destionation to close
Throws:
javax.jms.JMSException - Description of Exception

toString

public String toString()
Overrides:
toString in class Object

ping

public void ping(ConnectionToken dc,
                 long clientTime)
          throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Ping the server.

Specified by:
ping in interface JMSServerInterceptor
Overrides:
ping in class JMSServerInterceptorSupport
Parameters:
dc - Description of Parameter
clientTime - Description of Parameter
Throws:
javax.jms.JMSException - Description of Exception

getMessageCache

public MessageCache getMessageCache()
Gets the messageCache

Returns:
Returns a MessageCache

setMessageCache

public void setMessageCache(MessageCache messageCache)
Sets the messageCache

Parameters:
messageCache - The messageCache to set

getDurableTopic

public SpyTopic getDurableTopic(DurableSubscriptionID sub)
                         throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Get the topic the durable subscription is on. Primary for internal use in the server, and not for the IL's.

Specified by:
getDurableTopic in interface JMSServerInterceptor
Overrides:
getDurableTopic in class JMSServerInterceptorSupport
Throws:
javax.jms.JMSException

getSubscription

public Subscription getSubscription(ConnectionToken dc,
                                    int subscriberId)
                             throws javax.jms.JMSException
Description copied from interface: JMSServerInterceptor
Get the subscription that match the id.

Specified by:
getSubscription in interface JMSServerInterceptor
Overrides:
getSubscription in class JMSServerInterceptorSupport
Throws:
javax.jms.JMSException - if it can not find the subscription.

getMessageCounter

public MessageCounter[] getMessageCounter()
Gets message counters of all configured destinations

Returns:
MessageCounter[] message counter array sorted by name

resetMessageCounter

public void resetMessageCounter()
Resets message counters of all configured destinations


getParameters

public BasicQueueParameters getParameters()


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