org.exolab.jmscts.core
Class MessageFactory

java.lang.Object
  |
  +--org.exolab.jmscts.core.MessageFactory
Direct Known Subclasses:
BasicMessageFactory, MessageCreator

public abstract class MessageFactory
extends java.lang.Object

A factory for creating, and optionally populating messages

Version:
$Revision: 1.2 $ $Date: 2004/01/31 13:44:24 $
Author:
Tim Anderson
See Also:
MessagePopulator

Constructor Summary
MessageFactory()
          Construct a new MessageFactory
MessageFactory(MessagePopulator populator)
          Construct a new MessageFactory
 
Method Summary
 javax.jms.Message create(java.lang.Class type)
          Create a message of the specified type.
protected abstract  javax.jms.BytesMessage createBytesMessage()
          Create a new BytesMessage
protected abstract  javax.jms.MapMessage createMapMessage()
          Create a new MapMessage
protected abstract  javax.jms.Message createMessage()
          Create a new Message
protected abstract  javax.jms.ObjectMessage createObjectMessage()
          Create a new ObjectMessage
protected abstract  javax.jms.StreamMessage createStreamMessage()
          Create a new StreamMessage
protected abstract  javax.jms.TextMessage createTextMessage()
          Create a new TextMessage
protected  void populate(javax.jms.Message message)
          Populate a message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageFactory

public MessageFactory()
Construct a new MessageFactory

MessageFactory

public MessageFactory(MessagePopulator populator)
Construct a new MessageFactory
Parameters:
populator - the message populator, or null, if messages aren't to be populated
Method Detail

create

public javax.jms.Message create(java.lang.Class type)
                         throws java.lang.Exception
Create a message of the specified type. If a populator was supplied at construction, it will be used to populate the message with data.
Parameters:
type - the JMS message class type
Returns:
the new message
Throws:
java.lang.Exception - for any error

createBytesMessage

protected abstract javax.jms.BytesMessage createBytesMessage()
                                                      throws javax.jms.JMSException
Create a new BytesMessage
Returns:
the new message
Throws:
javax.jms.JMSException - for any error

createMapMessage

protected abstract javax.jms.MapMessage createMapMessage()
                                                  throws javax.jms.JMSException
Create a new MapMessage
Returns:
the new message
Throws:
javax.jms.JMSException - for any error

createMessage

protected abstract javax.jms.Message createMessage()
                                            throws javax.jms.JMSException
Create a new Message
Returns:
the new message
Throws:
javax.jms.JMSException - for any error

createObjectMessage

protected abstract javax.jms.ObjectMessage createObjectMessage()
                                                        throws javax.jms.JMSException
Create a new ObjectMessage
Returns:
the new message
Throws:
javax.jms.JMSException - for any error

createStreamMessage

protected abstract javax.jms.StreamMessage createStreamMessage()
                                                        throws javax.jms.JMSException
Create a new StreamMessage
Returns:
the new message
Throws:
javax.jms.JMSException - for any error

createTextMessage

protected abstract javax.jms.TextMessage createTextMessage()
                                                    throws javax.jms.JMSException
Create a new TextMessage
Returns:
the new message
Throws:
javax.jms.JMSException - for any error

populate

protected void populate(javax.jms.Message message)
                 throws java.lang.Exception
Populate a message
Parameters:
message - the message to populate
Throws:
java.lang.Exception - for any error


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.