org.exolab.jms.server
Class JmsServerConnectionManager

java.lang.Object
  |
  +--org.exolab.jms.server.JmsServerConnectionManager
All Implemented Interfaces:
EventHandler, java.io.Serializable

public class JmsServerConnectionManager
extends java.lang.Object
implements EventHandler

The connection manager is responsible for managing all connections to the JmsServer. The connection manager is a singleton (at this point anyway) that is accessible through the instance class method. It is also responsible for holding a list of connections.

A client uses a client identifier to create a connection and a connection type to identify the connection type- queue or topic.

TODO: Look at leasing connections and timing them out.

Version:
$Revision: 1.10 $ $Date: 2003/08/17 01:32:26 $
Author:
Jim Alateras
See Also:
JmsServerConnection, Serialized Form

Method Summary
 void closeConnection(java.lang.String id)
          Close the connection associated with a particular client identity.
 JmsServerConnection createConnection(java.lang.String id, java.lang.String username, java.lang.String password)
          Create a connection with the specified client id.
 JmsServerConnection getConnection(java.lang.String id)
          Return the connection associated with a particular client identity.
 java.util.Iterator getConnections()
          Return an Enumeration of all the connections currently registered with the connection manager
 org.exolab.core.foundation.HandleIfc getHandle()
          Return a handle to this event handler for the purpose of storing and restoring it.
 void handleEvent(int event, java.lang.Object callback, long time)
          Handle the specified event, generated by the EventManager.
static JmsServerConnectionManager instance()
          The static method returns the singleton instance of the JmsConnectionManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static JmsServerConnectionManager instance()
The static method returns the singleton instance of the JmsConnectionManager. If one does not exist it is created prior to returning.
Returns:
JmsConnectionManager

createConnection

public JmsServerConnection createConnection(java.lang.String id,
                                            java.lang.String username,
                                            java.lang.String password)
                                     throws javax.jms.JMSSecurityException,
                                            javax.jms.JMSException
Create a connection with the specified client id. If the client already has an open connection then simply return a reference to this connection If a connection already exists for the specified client identity then simply return the exisiting connection
Parameters:
id - the client identity
username - the client's username
password - the client's password
Returns:
a new connection
Throws:
javax.jms.JMSSecurityException - if the client cannot be authenticated
javax.jms.JMSException - if the connection cannot be created

getConnections

public java.util.Iterator getConnections()
Return an Enumeration of all the connections currently registered with the connection manager
Returns:
Iterator

getConnection

public JmsServerConnection getConnection(java.lang.String id)
Return the connection associated with a particular client identity. If such a connection does not exist then return null
Parameters:
id - identity of the client
Returns:
JmsConnection associated connection or null

closeConnection

public void closeConnection(java.lang.String id)
Close the connection associated with a particular client identity. If a connection for the client does not exist then do nothing.
Parameters:
id - identity of the client

handleEvent

public void handleEvent(int event,
                        java.lang.Object callback,
                        long time)
Description copied from interface: EventHandler
Handle the specified event, generated by the EventManager. The event handler pressumably knows how to handle the callback object and should cast it appropriately before using it.

This methodshould not throw any exceptions

Specified by:
handleEvent in interface EventHandler
Following copied from interface: org.exolab.jms.events.EventHandler
Parameters:
event - the event to handle
callback - the callback object
time - the absolute time, in ms, that the event fired.

getHandle

public org.exolab.core.foundation.HandleIfc getHandle()
Description copied from interface: EventHandler
Return a handle to this event handler for the purpose of storing and restoring it. If you want event handlers to persist across subsequent invocations of the EventManager then you must support this method, otherwise this method can simply return null.
Specified by:
getHandle in interface EventHandler
Following copied from interface: org.exolab.jms.events.EventHandler
Returns:
HandleIfc return a reference to the handle.


Copyright © 1999-2004 The OpenJMS Group. All Rights Reserved.