org.exolab.jms.client
Class JmsConnectionFactory

java.lang.Object
  |
  +--org.exolab.jms.client.JmsConnectionFactory
All Implemented Interfaces:
javax.jms.ConnectionFactory, javax.jms.ExceptionListener, java.io.Externalizable, javax.jms.QueueConnectionFactory, javax.naming.Referenceable, java.io.Serializable, javax.jms.TopicConnectionFactory
Direct Known Subclasses:
JmsXAConnectionFactory

public class JmsConnectionFactory
extends java.lang.Object
implements javax.jms.ConnectionFactory, javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory, javax.jms.ExceptionListener, java.io.Externalizable, javax.naming.Referenceable

Client implementation of the javax.jms.ConnectionFactory interface.

Version:
$Revision: 1.2 $ $Date: 2005/03/18 03:36:37 $
Author:
Jim Alateras, Tim Anderson
See Also:
Serialized Form

Constructor Summary
JmsConnectionFactory()
          Default constructor required for serialization
JmsConnectionFactory(java.lang.String className, java.util.Map properties, java.util.Map environment)
          Construct a new JmsConnectionFactory
 
Method Summary
protected  void addConnection(org.exolab.jms.client.JmsConnection connection)
          Add a connection.
 javax.jms.Connection createConnection()
          Creates a connection with the default user identity.
 javax.jms.Connection createConnection(java.lang.String userName, java.lang.String password)
          Creates a connection with the specified user identity.
 javax.jms.QueueConnection createQueueConnection()
          Create a queue connection with the default user identity.
 javax.jms.QueueConnection createQueueConnection(java.lang.String userName, java.lang.String password)
          Create a queue connection with the specified user identity.
 javax.jms.TopicConnection createTopicConnection()
          Create a topic connection with the default user identity.
 javax.jms.TopicConnection createTopicConnection(java.lang.String userName, java.lang.String password)
          Create a topic connection with the specified user identity.
protected  org.exolab.jms.client.JmsConnection[] getConnections()
          Returns the set of active connections.
 JmsServerStubIfc getProxy()
          Returns the server proxy
 javax.naming.Reference getReference()
          Retrieves the reference of this object.
 void onException(javax.jms.JMSException exception)
          Notifies user of a JMS exception.
 void readExternal(java.io.ObjectInput stream)
          Reads the object state from a stream.
protected  void removeConnection(org.exolab.jms.client.JmsConnection connection)
          Remove a connection.
 void writeExternal(java.io.ObjectOutput stream)
          Writes the object state to a stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsConnectionFactory

public JmsConnectionFactory()
Default constructor required for serialization

JmsConnectionFactory

public JmsConnectionFactory(java.lang.String className,
                            java.util.Map properties,
                            java.util.Map environment)
Construct a new JmsConnectionFactory
Parameters:
className - the class name of the server proxy
properties - properties to initialise the server proxy with
environment - the environment to use when creating the server proxy. May be null
Method Detail

getProxy

public JmsServerStubIfc getProxy()
                          throws javax.jms.JMSException
Returns the server proxy
Returns:
the server proxy
Throws:
javax.jms.JMSException - if the proxy cannot be created

onException

public void onException(javax.jms.JMSException exception)
Notifies user of a JMS exception.
Specified by:
onException in interface javax.jms.ExceptionListener
Parameters:
exception - the JMS exception

getReference

public javax.naming.Reference getReference()
Retrieves the reference of this object.
Specified by:
getReference in interface javax.naming.Referenceable
Returns:
the reference of this object

writeExternal

public void writeExternal(java.io.ObjectOutput stream)
                   throws java.io.IOException
Writes the object state to a stream.
Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
stream - the stream to write the state to
Throws:
java.io.IOException - for any I/O error

readExternal

public void readExternal(java.io.ObjectInput stream)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the object state from a stream.
Specified by:
readExternal in interface java.io.Externalizable
Parameters:
stream - the stream to read the state from
Throws:
java.io.IOException - for any I/O error
java.lang.ClassNotFoundException - if the class for an object being restored cannot be found

createConnection

public javax.jms.Connection createConnection()
                                      throws javax.jms.JMSException
Creates a connection with the default user identity. The connection is created in stopped mode. No messages will be delivered until the Connection.start method is explicitly called.
Specified by:
createConnection in interface javax.jms.ConnectionFactory
Returns:
a newly created connection
Throws:
javax.jms.JMSException - if the JMS provider fails to create the connection due to some internal error.
javax.jms.JMSSecurityException - if client authentication fails due to an invalid user name or password.

createConnection

public javax.jms.Connection createConnection(java.lang.String userName,
                                             java.lang.String password)
                                      throws javax.jms.JMSException
Creates a connection with the specified user identity. The connection is created in stopped mode. No messages will be delivered until the Connection.start method is explicitly called.
Specified by:
createConnection in interface javax.jms.ConnectionFactory
Parameters:
userName - the caller's user name
password - the caller's password
Returns:
a newly created connection
Throws:
javax.jms.JMSException - if the JMS provider fails to create the connection due to some internal error.
javax.jms.JMSSecurityException - if client authentication fails due to an invalid user name or password.

createQueueConnection

public javax.jms.QueueConnection createQueueConnection()
                                                throws javax.jms.JMSException
Create a queue connection with the default user identity.
Specified by:
createQueueConnection in interface javax.jms.QueueConnectionFactory
Returns:
a newly created queue connection
Throws:
javax.jms.JMSException - if the connection can't be created due to some internal error
javax.jms.JMSSecurityException - if client authentication fails due to invalid user name or password

createQueueConnection

public javax.jms.QueueConnection createQueueConnection(java.lang.String userName,
                                                       java.lang.String password)
                                                throws javax.jms.JMSException
Create a queue connection with the specified user identity.
Specified by:
createQueueConnection in interface javax.jms.QueueConnectionFactory
Parameters:
userName - the caller's user name
password - tghe caller's password
Returns:
a newly created queue connection
Throws:
javax.jms.JMSException - if the connection can't be created due to some internal error
javax.jms.JMSSecurityException - if client authentication fails due to invalid user name or password

createTopicConnection

public javax.jms.TopicConnection createTopicConnection()
                                                throws javax.jms.JMSException
Create a topic connection with the default user identity.
Specified by:
createTopicConnection in interface javax.jms.TopicConnectionFactory
Returns:
a newly created topic connection
Throws:
javax.jms.JMSException - if the connection can't be created due to some internal error
javax.jms.JMSSecurityException - if client authentication fails due to invalid user name or password

createTopicConnection

public javax.jms.TopicConnection createTopicConnection(java.lang.String userName,
                                                       java.lang.String password)
                                                throws javax.jms.JMSException
Create a topic connection with the specified user identity.
Specified by:
createTopicConnection in interface javax.jms.TopicConnectionFactory
Parameters:
userName - the caller's user name
password - tghe caller's password
Returns:
a newly created topic connection
Throws:
javax.jms.JMSException - if the connection can't be created due to some internal error
javax.jms.JMSSecurityException - if client authentication fails due to invalid user name or password

addConnection

protected void addConnection(org.exolab.jms.client.JmsConnection connection)
Add a connection.
Parameters:
connection - the connection to add

removeConnection

protected void removeConnection(org.exolab.jms.client.JmsConnection connection)
Remove a connection.
Parameters:
connection - the connection to remove

getConnections

protected org.exolab.jms.client.JmsConnection[] getConnections()
Returns the set of active connections.
Returns:
the set of active connections


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