com.ibm.db2.tools.repl.publication
Class ControlMsg

java.lang.Object
  |
  +--com.ibm.db2.tools.repl.publication.ControlMsg
Direct Known Subclasses:
ActivateSubscriptionMsg, DeactivateSubscriptionMsg, InvalidateSendQueueMsg, LoadDoneControlMsg

public abstract class ControlMsg
extends java.lang.Object

The ControlMsg class represents a message that is sent to a QCapture program. The message is a request for QCapture to perform a certain operation.


Constructor Summary
ControlMsg()
           
 
Method Summary
protected  void generateXML(java.lang.StringBuffer xmlDocument)
          Actually create the xml.
protected  java.lang.String getXML()
          This will create the xml document and return it
 void send(javax.jms.Session session, javax.jms.MessageProducer msgProducer)
          This will send the msg to the the specified messageProducer (MQ queue).
 void send(java.lang.String qMgrName, java.lang.String qName)
          This will send the msg to the specified queue manager and queue.
 java.lang.String toString()
          Override so we can print the values in a nice textual format.
protected  void validate()
          This will valiadate that everything is present for the xml document to be created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ControlMsg

public ControlMsg()
Method Detail

send

public void send(javax.jms.Session session,
                 javax.jms.MessageProducer msgProducer)
          throws java.lang.Exception
This will send the msg to the the specified messageProducer (MQ queue). Nothing is done to the MessageProducer other than sending the message. An exception is thrown if there is an error. This is the preferred way of sending a message, since it lets the caller manage the queue and session.

Parameters:
session - The session that was used to create the MessageProducer. Used to create a new text message.
msgProducer - The message is sent here.
java.lang.Exception

send

public void send(java.lang.String qMgrName,
                 java.lang.String qName)
          throws java.lang.Exception
This will send the msg to the specified queue manager and queue. A connection to the queue is created, the message sent, and the connection destroyed. This is very inefficient if there are many control messages to be sent. An exception is thrown if there is an error.

java.lang.Exception

validate

protected void validate()
                 throws java.lang.Exception
This will valiadate that everything is present for the xml document to be created. It will throw an exception if something is not valid.

java.lang.Exception

getXML

protected java.lang.String getXML()
This will create the xml document and return it

Returns:
String The xml document for the message.

generateXML

protected void generateXML(java.lang.StringBuffer xmlDocument)
Actually create the xml.

Parameters:
xmlDocument - Generate the xml here.

toString

public java.lang.String toString()
Override so we can print the values in a nice textual format.

Overrides:
toString in class java.lang.Object
Returns:
String Formatted output of all the instance variables.