org.exolab.jms.messagemgr
Class MessageHandleFactory

java.lang.Object
  |
  +--org.exolab.jms.messagemgr.MessageHandleFactory

public class MessageHandleFactory
extends java.lang.Object

This class defines a number of static methods that are responsible for creatimg message handles

Version:
$Revision: 1.12 $ $Date: 2003/08/17 01:32:24 $
Author:
Jim Alateras

Constructor Summary
MessageHandleFactory()
           
 
Method Summary
static MessageHandle createHandle(DurableConsumerEndpoint durable, MessageImpl message)
          Create a transient message handle for a durable consumer
static MessageHandle createHandle(JmsDestination dest, java.lang.String name, MessageImpl message)
          Create a transient message handle.
static MessageHandle createHandle(QueueDestinationCache queue, MessageImpl message)
          Create a transient handle for a message belonging to a queue.
static MessageHandle createPersistentHandle(java.sql.Connection connection, DurableConsumerEndpoint durable, MessageImpl message)
          Create a persistent handle for a message belonging to a particular durable consumer
static MessageHandle createPersistentHandle(java.sql.Connection connection, JmsDestination dest, java.lang.String name, MessageImpl message)
          Create a persistent message handle from the destination and consumer name
static MessageHandle createPersistentHandle(java.sql.Connection connection, QueueDestinationCache queue, MessageImpl message)
          Create a persistent message handle belonging to a queue.
static MessageHandle createPersistentHandle(TransientMessageHandle handle)
          Create a PersistentMessageHandle from the specified TransientMessageHandle.
static void destroyPersistentHandle(java.sql.Connection connection, JmsDestination destination, java.lang.String name, MessageImpl message)
          Destroy a persistent handle associated with a destination, consumer name and message
static void destroyPersistentHandle(java.sql.Connection connection, PersistentMessageHandle handle)
          Destroy the specified persistent handle.
static MessageHandle getHandle(ConsumerEndpoint consumer, MessageImpl message)
          Retrieve a message handle for the specified ConsumerEndpoint and message.
static MessageHandle getHandle(JmsDestination dest, java.lang.String name, MessageImpl message)
          Use the message, destination and optionally, the consumer name to retrieve a message handle.
static MessageHandle getHandle(MessageImpl message)
          Retrieve a TransientMessageHandle given the specified message, irrespective of whether it is a persistent or non-persistent message.
static MessageHandle getHandle(QueueDestinationCache queue, MessageImpl message)
          Retrieve a MessageHandle from the specified QueueConsumerEndpoint and message.
static void updatePersistentHandle(java.sql.Connection connection, PersistentMessageHandle handle)
          Update the state of the persistent handle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageHandleFactory

public MessageHandleFactory()
Method Detail

getHandle

public static MessageHandle getHandle(MessageImpl message)
                               throws javax.jms.JMSException
Retrieve a TransientMessageHandle given the specified message, irrespective of whether it is a persistent or non-persistent message.
Parameters:
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created

getHandle

public static MessageHandle getHandle(QueueDestinationCache queue,
                                      MessageImpl message)
                               throws javax.jms.JMSException
Retrieve a MessageHandle from the specified QueueConsumerEndpoint and message. It will create a PersistentMessageHandle if the message is persistent or a TransientMessageHandle otherwise.
Parameters:
queue - the queue destination cache
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created

getHandle

public static MessageHandle getHandle(JmsDestination dest,
                                      java.lang.String name,
                                      MessageImpl message)
                               throws javax.jms.JMSException
Use the message, destination and optionally, the consumer name to retrieve a message handle.
Parameters:
destination - the message destination
name - the consumer name, can be null for JmsQueue type
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created

getHandle

public static MessageHandle getHandle(ConsumerEndpoint consumer,
                                      MessageImpl message)
                               throws javax.jms.JMSException
Retrieve a message handle for the specified ConsumerEndpoint and message.
Parameters:
consumer - the consumer endpoint
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created

createHandle

public static MessageHandle createHandle(QueueDestinationCache queue,
                                         MessageImpl message)
                                  throws javax.jms.JMSException
Create a transient handle for a message belonging to a queue.
Parameters:
queue - the queue destination cache
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created

createHandle

public static MessageHandle createHandle(DurableConsumerEndpoint durable,
                                         MessageImpl message)
                                  throws javax.jms.JMSException
Create a transient message handle for a durable consumer
Parameters:
durable - the durable consumer endpoint
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created

createHandle

public static MessageHandle createHandle(JmsDestination dest,
                                         java.lang.String name,
                                         MessageImpl message)
                                  throws javax.jms.JMSException
Create a transient message handle.
Parameters:
destination - the message destination
name - the consumer name, can be null for JmsQueue type
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created

createPersistentHandle

public static MessageHandle createPersistentHandle(TransientMessageHandle handle)
                                            throws javax.jms.JMSException
Create a PersistentMessageHandle from the specified TransientMessageHandle. It does not fill in all the fields of a persistent message handle.
Parameters:
handle - the transient message handle
Returns:
the persistent message handle
Throws:
javax.jms.JMSException - if the handle can't be created

createPersistentHandle

public static MessageHandle createPersistentHandle(java.sql.Connection connection,
                                                   QueueDestinationCache queue,
                                                   MessageImpl message)
                                            throws javax.jms.JMSException,
                                                   PersistenceException
Create a persistent message handle belonging to a queue.
Parameters:
connection - connection to the database
queue - queue destination cache
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created
PersistenceException - if the handle cannot be made persistent

createPersistentHandle

public static MessageHandle createPersistentHandle(java.sql.Connection connection,
                                                   DurableConsumerEndpoint durable,
                                                   MessageImpl message)
                                            throws javax.jms.JMSException,
                                                   PersistenceException
Create a persistent handle for a message belonging to a particular durable consumer
Parameters:
connection - the connection to use.
durable - durable consumer endpoint
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created
PersistenceException - if the handle cannot be made persistent

createPersistentHandle

public static MessageHandle createPersistentHandle(java.sql.Connection connection,
                                                   JmsDestination dest,
                                                   java.lang.String name,
                                                   MessageImpl message)
                                            throws javax.jms.JMSException,
                                                   PersistenceException
Create a persistent message handle from the destination and consumer name
Parameters:
connection - the connection to use
destination - the message destination
name - the consumer name, can be null for JmsQueue type
message - the message
Returns:
the message handle
Throws:
javax.jms.JMSException - if the handle can't be created
PersistenceException - if the handle cannot be made persistent

destroyPersistentHandle

public static void destroyPersistentHandle(java.sql.Connection connection,
                                           PersistentMessageHandle handle)
                                    throws PersistenceException
Destroy the specified persistent handle.
Parameters:
connection - the connection to use
handle - the persistent handle to destroy
Throws:
PersistenceExcetpion - if there is a persistence-related error

destroyPersistentHandle

public static void destroyPersistentHandle(java.sql.Connection connection,
                                           JmsDestination destination,
                                           java.lang.String name,
                                           MessageImpl message)
                                    throws javax.jms.JMSException,
                                           PersistenceException
Destroy a persistent handle associated with a destination, consumer name and message
Parameters:
connection - the connection to use
destination - the destination assoicated with the message
name - the name of the consumer
message - the message
Throws:
javax.jms.JMSException - if the handle can't be created
PersistentException - if there is a persistence related error

updatePersistentHandle

public static void updatePersistentHandle(java.sql.Connection connection,
                                          PersistentMessageHandle handle)
                                   throws PersistenceException
Update the state of the persistent handle
Parameters:
connection - the connection to use
handle - the handle to update
Throws:
PersistentException - if there is a persistence related error


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