jrun.jms.core.messagemgr
Class MessageHandleFactory

java.lang.Object
  |
  +--jrun.jms.core.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.5 $ $Date: 2001/09/24 08:40:33 $
Author:
Jim Alateras

Constructor Summary
MessageHandleFactory()
           
 
Method Summary
static MessageHandle createHandle(DurableConsumerEndpoint durable, MessageImpl message)
          Create a trasient message handle
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(DurableConsumerEndpoint durable, MessageImpl message)
          Create a persistent handle for a message belonging to a particular durable consumer
static MessageHandle createPersistentHandle(JmsDestination dest, java.lang.String name, MessageImpl message)
          Create a persistent message handle from the destination and consumer name
static MessageHandle createPersistentHandle(QueueDestinationCache queue, MessageImpl message)
          Create a persistent message handle belonging to a queue.
static MessageHandle createPersistentHandle(TransientMessageHandle handle)
          Create a PersistentMessageHandle from the specified TransientHandle.
static void destroyPersistentHandle(JmsDestination destination, java.lang.String name, MessageImpl message)
          Destroy a persistent handle associated with the follwoing information
static void destroyPersistentHandle(PersistentMessageHandle phandle)
          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 the specified message.
static void updatePersistentHandle(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 FailedToCreateHandleException
Retrieve a TransientMessageHandle given the specified message, irrespective of whether it is a persistent or non-persistent message.

It will throw FailedToCreateHandleException if it cannot create one

Parameters:
message - - the message
Returns:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

getHandle

public static MessageHandle getHandle(QueueDestinationCache queue,
                                      MessageImpl message)
                               throws FailedToCreateHandleException
Retrieve a MessageHandle from the specified QueueConsumerEndpoint and the specified message. It will create a PersistentMessageHandle if the message is persistent or a TransientMessageHandle otherwise.

It will throw FailedToCreateHandleException if it cannot create one

Parameters:
queue - - queue destination cache
message - - the message
Returns:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

getHandle

public static MessageHandle getHandle(JmsDestination dest,
                                      java.lang.String name,
                                      MessageImpl message)
                               throws FailedToCreateHandleException
Use the message, destination and optionally, the consumer name to retrieve a message handle

It will throw FailedToCreateHandleException if it cannot create a handle based on the specified information.

Parameters:
destination - - the message destination
name - - the consumer name, can be null for JmsQueue type
message - - the message
Returns:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

getHandle

public static MessageHandle getHandle(ConsumerEndpoint consumer,
                                      MessageImpl message)
                               throws FailedToCreateHandleException
Retrieve a message handle for the specified ConsumerEndpoint and message.
Parameters:
consumer - = consumer endpoint
message - - the message
Returns:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

createHandle

public static MessageHandle createHandle(QueueDestinationCache queue,
                                         MessageImpl message)
                                  throws FailedToCreateHandleException
Create a transient handle for a message belonging to a queue.

It will throw FailedToCreateHandleException if it cannot create one

Parameters:
queue - - queue destination cache
message - - the message
Returns:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

createHandle

public static MessageHandle createHandle(DurableConsumerEndpoint durable,
                                         MessageImpl message)
                                  throws FailedToCreateHandleException
Create a trasient message handle
Parameters:
durable - = durable consumer endpoint
message - - the message
Returns:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

createHandle

public static MessageHandle createHandle(JmsDestination dest,
                                         java.lang.String name,
                                         MessageImpl message)
                                  throws FailedToCreateHandleException
Create a transient message handle

It will throw FailedToCreateHandleException if it cannot create a handle based on the specified information.

Parameters:
destination - - the message destination
name - - the consumer name, can be null for JmsQueue type
message - - the message
Returns:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

createPersistentHandle

public static MessageHandle createPersistentHandle(TransientMessageHandle handle)
                                            throws FailedToCreateHandleException
Create a PersistentMessageHandle from the specified TransientHandle. It does not fill in all the fields of a persistent message handle.

It will throw FailedToCreateHandleException if it cannot create one

Parameters:
handle - - the transient message handle
Returns:
PersistentMessageHandle - the persistent message handle
Throws:
FailedToCreateHandleException -  

createPersistentHandle

public static MessageHandle createPersistentHandle(QueueDestinationCache queue,
                                                   MessageImpl message)
                                            throws FailedToCreateHandleException
Create a persistent message handle belonging to a queue.

It will throw FailedToCreateHandleException if it cannot create one

Parameters:
queue - - queue destination cache
message - - the message
Returns:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

createPersistentHandle

public static MessageHandle createPersistentHandle(DurableConsumerEndpoint durable,
                                                   MessageImpl message)
                                            throws FailedToCreateHandleException
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:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

createPersistentHandle

public static MessageHandle createPersistentHandle(JmsDestination dest,
                                                   java.lang.String name,
                                                   MessageImpl message)
                                            throws FailedToCreateHandleException
Create a persistent message handle from the destination and consumer name

It will throw FailedToCreateHandleException if it cannot create a handle based on the specified information.

Parameters:
connection - - the connection to use
destination - - the message destination
name - - the consumer name, can be null for JmsQueue type
message - - the message
Returns:
MessageHandle - the message handle
Throws:
FailedToCreateHandleException -  

destroyPersistentHandle

public static void destroyPersistentHandle(PersistentMessageHandle phandle)
                                    throws PersistenceException
Destroy the specified persistent handle.
Parameters:
phandle - - the persistent handle to destroy
Throws:
PersistenceExcetpion - - if there is a persistence-related problem

destroyPersistentHandle

public static void destroyPersistentHandle(JmsDestination destination,
                                           java.lang.String name,
                                           MessageImpl message)
                                    throws PersistenceException
Destroy a persistent handle associated with the follwoing information
Parameters:
destination - - the destination assoicated with the message
name - - the name of the consumer
message - - the message
Throws:
PersistentException - - if there is a persistence related error

updatePersistentHandle

public static void updatePersistentHandle(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 � 2002 Macromedia Corporation. All Rights Reserved.