org.openeai.jms.producer
Class MessageProducer

java.lang.Object
  extended by org.openeai.OpenEaiObject
      extended by org.openeai.jms.producer.MessageProducer
Direct Known Subclasses:
PointToPointProducer, PubSubProducer

public abstract class MessageProducer
extends OpenEaiObject

The ancestor class for PubSub and PointToPoint producers. These are the counterparts to OpenEAI MessageConsumer. These classes (PubSub and PointToPoint Producers) produce messages to and potentially handle responses from OpenEAI MessageConsumers (PointToPoint and PubSub Producers)

Version:
3.0 - 28 January 2003
Author:
Tod Jackson (tod@openeai.org), Steve Wheat (steve@openeai.org)
See Also:
ProducerConfig, MessageConsumer

Field Summary
static java.lang.String COMMAND_NAME
           
protected  java.util.HashMap m_messages
           
static java.lang.String MESSAGE_ID
           
static java.lang.String MESSAGE_NAME
           
protected static java.lang.String NON_PERSISTENT_DELIVERY
           
protected static java.lang.String PERSISTENT_DELIVERY
           
protected static java.lang.String STARTED
           
protected static java.lang.String STOPPED
           
protected static java.lang.String STOPPING
           
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
MessageProducer()
           
 
Method Summary
 java.lang.String getAcknowledgementMode()
           
 java.lang.String getConnectionFactoryName()
          Returns the connection factory name (QueueConnectionFactory or TopicConnectionFactory) that this producer should retrieve and use to initialize its connection to the broker with.
 java.lang.String getDefaultCommandName()
           
 java.lang.String getDeliveryMode()
           
 java.lang.String getDestinationName()
          Returns the destination name (Queue or Topic) that this Producer should connect to and consume from.
protected  javax.naming.directory.DirContext getInitialContext()
          Establishes and returns an InitialContext to be used by the calling application to retrieve ConnectionFactories and Destination objects via JNDI.
 java.lang.String getInitialContextFactory()
          Returns the class name of the JNDI context factory that will be used to retrieve the JMS administered objects from a Directory Server or wherever the administered objects are stored.
 int getMessageSeq()
           
 java.lang.String getPassword()
          Sets the broker user password that should be used when establishing a connection with the broker.
 ProducerId getProducerId()
          Deprecated. as of OpenEAI 4.0 use org.openeai.transport.ProducerId instead
 ProducerId getProducerId(java.lang.String dummyParm)
          Returns the ProducerId object associated to this producer.
 java.lang.String getProducerIdUrl()
           
 java.lang.String getProducerName()
          Returns the name of this producers as specified in its configuration information.
 java.lang.String getProducerStatus()
           
 java.lang.String getProviderUrl()
          Returns the location where the administered objects can be retrieved from.
 java.lang.String getSecurityCredentials()
          Returns the LDAP security credentials (password) this producer should use when connecting to the directory server to retrieve JMS administered objects (ConnectionFactories and Destinations).
 java.lang.String getSecurityPrincipal()
          Returns the LDAP security principal this producer should use when connecting to the directory server to retrieve JMS administered objects (ConnectionFactories and Destinations).
 boolean getStartOnInitialization()
          Returns a boolean indicating whether or not this producer should be started (connected to the broker and ready to produce messages) when it is initialized.
 boolean getTransacted()
           
 java.lang.String getUserName()
          Returns the broker user name that should be used when establishing a connection with the broker.
 int incrementMessageSequence()
           
protected  void init(java.util.Properties props)
          Takes the Properties object contained within the ProducerConfig object passed to the constructor of this Producer and sets all the appropriate instance variables on this producer during initialization.
 boolean isStarted()
           
 void setAcknowledgementMode(java.lang.String mode)
           
 void setConnectionFactoryName(java.lang.String name)
          Sets the connection factory name (QueueConnectionFactory or TopicConnectionFactory) that this producer should retrieve and use to initialize its connection to the broker with.
 void setDefaultCommandName(java.lang.String defaultCommand)
           
 void setDeliveryMode(java.lang.String mode)
           
 void setDestinationName(java.lang.String name)
          Sets the destination name (Queue or Topic) that this Producer should connect to and consume from.
 void setInitialContextFactory(java.lang.String in)
          Sets the class name of the JNDI context factory that will be used to retrieve the JMS administered objects from a Directory Server or wherever the administered objects are stored.
 void setMessageSeq(int seq)
           
 void setPassword(java.lang.String in)
          Sets the broker user password that should be used when establishing a connection with the broker.
 void setProducerId(ProducerId producerId)
          Deprecated. as of OpenEAI 4.0 use org.openeai.transport.ProducerId instead
 void setProducerId(ProducerId producerId)
          Sets the ProducerId object associated to this producer.
 void setProducerIdUrl(java.lang.String url)
           
 void setProducerName(java.lang.String name)
          Sets the name of this producers as specified in its configuration information.
 void setProducerStatus(java.lang.String status)
           
 void setProviderUrl(java.lang.String in)
          Sets the location where the administered objects can be retrieved from.
 void setSecurityCredentials(java.lang.String credentials)
          Sets the LDAP security credentials (password) this producer should use when connecting to the directory server to retrieve JMS administered objects (ConnectionFactories and Destinations).
 void setSecurityPrincipal(java.lang.String principal)
          Sets the LDAP security principal this producer should use when connecting to the directory server to retrieve JMS administered objects (ConnectionFactories and Destinations).
 void setStartOnInitialization(boolean start)
          Sets a boolean indicating whether or not this producer should be started (connected to the broker and ready to produce messages) when it is initialized.
 void setTransacted(boolean trans)
           
 void setUserName(java.lang.String in)
          Sets the broker user name that should be used when establishing a connection with the broker.
abstract  boolean start()
           
abstract  void stop()
           
 
Methods inherited from class org.openeai.OpenEaiObject
getAppName, getDebug, getFromAddr, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_messages

protected java.util.HashMap m_messages

STOPPED

protected static java.lang.String STOPPED

STOPPING

protected static java.lang.String STOPPING

STARTED

protected static java.lang.String STARTED

PERSISTENT_DELIVERY

protected static java.lang.String PERSISTENT_DELIVERY

NON_PERSISTENT_DELIVERY

protected static java.lang.String NON_PERSISTENT_DELIVERY

MESSAGE_ID

public static java.lang.String MESSAGE_ID

COMMAND_NAME

public static java.lang.String COMMAND_NAME

MESSAGE_NAME

public static java.lang.String MESSAGE_NAME
Constructor Detail

MessageProducer

public MessageProducer()
Method Detail

setProducerName

public final void setProducerName(java.lang.String name)
Sets the name of this producers as specified in its configuration information.

Parameters:
name - String name of the producer.

getProducerName

public final java.lang.String getProducerName()
Returns the name of this producers as specified in its configuration information.

Returns:
String name of the producer.

setAcknowledgementMode

public final void setAcknowledgementMode(java.lang.String mode)

getAcknowledgementMode

public final java.lang.String getAcknowledgementMode()

setDeliveryMode

public final void setDeliveryMode(java.lang.String mode)

getDeliveryMode

public final java.lang.String getDeliveryMode()

setTransacted

public final void setTransacted(boolean trans)

getTransacted

public final boolean getTransacted()

setDefaultCommandName

public final void setDefaultCommandName(java.lang.String defaultCommand)

getDefaultCommandName

public final java.lang.String getDefaultCommandName()

setSecurityPrincipal

public final void setSecurityPrincipal(java.lang.String principal)
Sets the LDAP security principal this producer should use when connecting to the directory server to retrieve JMS administered objects (ConnectionFactories and Destinations). This is specified in the Producers's configuration element (ProducerConfig).

Parameters:
principal - String the LDAP principal
See Also:
ProducerConfig

getSecurityPrincipal

public final java.lang.String getSecurityPrincipal()
Returns the LDAP security principal this producer should use when connecting to the directory server to retrieve JMS administered objects (ConnectionFactories and Destinations). This is specified in the Producers's configuration element (ProducerConfig).

Returns:
String the LDAP principal
See Also:
ProducerConfig

setSecurityCredentials

public final void setSecurityCredentials(java.lang.String credentials)
Sets the LDAP security credentials (password) this producer should use when connecting to the directory server to retrieve JMS administered objects (ConnectionFactories and Destinations). This is specified in the Producers's configuration element (ProducerConfig).

Parameters:
credentials - String the LDAP credentials
See Also:
ProducerConfig

getSecurityCredentials

public final java.lang.String getSecurityCredentials()
Returns the LDAP security credentials (password) this producer should use when connecting to the directory server to retrieve JMS administered objects (ConnectionFactories and Destinations). This is specified in the Producers's configuration element (ProducerConfig).

Returns:
String the LDAP credentials
See Also:
ProducerConfig

getProducerId

public ProducerId getProducerId()
Deprecated. as of OpenEAI 4.0 use org.openeai.transport.ProducerId instead

Returns the ProducerId object associated to this producer.

Returns:
org.openeai.jms.producer.ProducerId old producer id

setProducerId

public void setProducerId(ProducerId producerId)
Deprecated. as of OpenEAI 4.0 use org.openeai.transport.ProducerId instead

Sets the ProducerId object associated to this producer.

Parameters:
org.openeai.jms.producer.ProducerId - old producer id

getProducerId

public ProducerId getProducerId(java.lang.String dummyParm)
Returns the ProducerId object associated to this producer.

NOTE: This is a temporary method that will be deprecated in the next release of the foundation. The method is being

Parameters:
dummyParm - a parameter used just to make this method declaration different than the old deprecated method. Once the old getProducerId() method is completely removed, this method will be deprecated and a new getProducerId() method will be used inplace of the old getProducerId() method. Finally, this method will be completely removed in future releases (tentatively Release 6.0).
Returns:
org.openeai.transport.ProducerId the initialized producer id object associated to this producer.

setProducerId

public void setProducerId(ProducerId producerId)
Sets the ProducerId object associated to this producer.

Parameters:
org.openeai.transport.ProducerId - old producer id

getStartOnInitialization

public final boolean getStartOnInitialization()
Returns a boolean indicating whether or not this producer should be started (connected to the broker and ready to produce messages) when it is initialized. This is specified in the ProducerConfig Element (startOnInitialization Attribute) of the deployment document for the application being started.

Returns:
boolean
See Also:
ProducerConfig

setStartOnInitialization

public final void setStartOnInitialization(boolean start)
Sets a boolean indicating whether or not this producer should be started (connected to the broker and ready to produce messages) when it is initialized. This is specified in the ProducerConfig Element (startOnInitialization Attribute) of the deployment document for the application being started.

See Also:
ProducerConfig

getProducerIdUrl

public final java.lang.String getProducerIdUrl()

setProducerIdUrl

public final void setProducerIdUrl(java.lang.String url)

incrementMessageSequence

public final int incrementMessageSequence()

setMessageSeq

public final void setMessageSeq(int seq)

getMessageSeq

public final int getMessageSeq()

getProducerStatus

public final java.lang.String getProducerStatus()

setProducerStatus

public final void setProducerStatus(java.lang.String status)

isStarted

public final boolean isStarted()

start

public abstract boolean start()
                       throws javax.jms.JMSException
Throws:
javax.jms.JMSException

stop

public abstract void stop()

getConnectionFactoryName

public final java.lang.String getConnectionFactoryName()
Returns the connection factory name (QueueConnectionFactory or TopicConnectionFactory) that this producer should retrieve and use to initialize its connection to the broker with.

See JMS Specification for a description of Connection Factories.

Returns:
String name of the Connection Factory.
See Also:
ProducerConfig

setConnectionFactoryName

public final void setConnectionFactoryName(java.lang.String name)
Sets the connection factory name (QueueConnectionFactory or TopicConnectionFactory) that this producer should retrieve and use to initialize its connection to the broker with.

See JMS Specification for a description of Connection Factories.

Parameters:
name - String name of the Connection Factory.
See Also:
ProducerConfig

getDestinationName

public final java.lang.String getDestinationName()
Returns the destination name (Queue or Topic) that this Producer should connect to and consume from.

See JMS Specification for a description of Destinations.

Returns:
String the destination (Queue or Topic) name.
See Also:
ProducerConfig

setDestinationName

public final void setDestinationName(java.lang.String name)
Sets the destination name (Queue or Topic) that this Producer should connect to and consume from.

See JMS Specification for a description of Destinations.

Parameters:
name - String the destination (Queue or Topic) name.
See Also:
ProducerConfig

setUserName

public final void setUserName(java.lang.String in)
Sets the broker user name that should be used when establishing a connection with the broker. Typically, this is specified in the ConnectionFactory used by this Producers and it is not needed here. However, if you don't want to use the ConnectionFactory for this you can do it here by specifying it in the ProducerConfig Element in the deployment document.

Parameters:
in - String broker user name
See Also:
ProducerConfig

getUserName

public final java.lang.String getUserName()
Returns the broker user name that should be used when establishing a connection with the broker. Typically, this is specified in the ConnectionFactory used by this Producers and it is not needed here. However, if you don't want to use the ConnectionFactory for this you can do it here by specifying it in the ProducerConfig Element in the deployment document.

Returns:
String broker user name
See Also:
ProducerConfig

setPassword

public final void setPassword(java.lang.String in)
Sets the broker user password that should be used when establishing a connection with the broker. Typically, this is specified in the ConnectionFactory used by this Producer and it is not needed here. However, if you don't want to use the ConnectionFactory for this you can do it here by specifying it in the ProducerConfig Element in the deployment document.

Parameters:
in - String broker user name
See Also:
ProducerConfig

getPassword

public final java.lang.String getPassword()
Sets the broker user password that should be used when establishing a connection with the broker. Typically, this is specified in the ConnectionFactory used by this Producer and it is not needed here. However, if you don't want to use the ConnectionFactory for this you can do it here by specifying it in the ProducerConfig Element in the deployment document.

Returns:
String broker user name
See Also:
ProducerConfig

setProviderUrl

public final void setProviderUrl(java.lang.String in)
Sets the location where the administered objects can be retrieved from. To maintain broker independance, this should reference a location in a Directory server or some other JNDI resource.

Parameters:
in - String the URL that resolves to the location of the JMS Administered Objects (ConnectionFactories and Destinations).
See Also:
ProducerConfig

getProviderUrl

public final java.lang.String getProviderUrl()
Returns the location where the administered objects can be retrieved from. To maintain broker independance, this should reference a location in a Directory server or some other JNDI resource.

Returns:
String the URL that resolves to the location of the JMS Administered Objects (ConnectionFactories and Destinations).
See Also:
ProducerConfig

setInitialContextFactory

public final void setInitialContextFactory(java.lang.String in)
Sets the class name of the JNDI context factory that will be used to retrieve the JMS administered objects from a Directory Server or wherever the administered objects are stored.

Typically, this is com.sun.jndi.ldap.LdapCtxFactory.

Parameters:
in - String initial context factory class name.
See Also:
ConsumerConfig

getInitialContextFactory

public final java.lang.String getInitialContextFactory()
Returns the class name of the JNDI context factory that will be used to retrieve the JMS administered objects from a Directory Server or wherever the administered objects are stored.

Typically, this is com.sun.jndi.ldap.LdapCtxFactory.

Returns:
String initial context factory class name.
See Also:
ProducerConfig

getInitialContext

protected javax.naming.directory.DirContext getInitialContext()
                                                       throws javax.naming.NamingException
Establishes and returns an InitialContext to be used by the calling application to retrieve ConnectionFactories and Destination objects via JNDI.

Returns:
DirContext the InitialContext object established
Throws:
javax.naming.NamingException

init

protected void init(java.util.Properties props)
             throws java.io.IOException
Takes the Properties object contained within the ProducerConfig object passed to the constructor of this Producer and sets all the appropriate instance variables on this producer during initialization.

Parameters:
props - Properties the Java properties object retrieved from the ProducerConfig object built from the ProducerConfig Element in the gateway's deployment document.
Throws:
java.io.IOException - if errors occur populating the instance variables from the Properties object.


Copyright © 2002,2003 OpenEAI Software Foundation