org.jlab.coda.cMsg.cMsgDomain.server
Class cMsgMessageDeliverer

java.lang.Object
  extended by org.jlab.coda.cMsg.cMsgDomain.server.cMsgMessageDeliverer
All Implemented Interfaces:
cMsgDeliverMessageInterface

public class cMsgMessageDeliverer
extends java.lang.Object
implements cMsgDeliverMessageInterface

This class delivers messages from the subdomain handler objects in the cMsg domain to a particular client.

Various types of messages may be sent. These are defined to be:


Constructor Summary
cMsgMessageDeliverer(cMsgClientInfo info)
          Create a message delivering object for use with one specific client.
 
Method Summary
 void close()
          Method to close all streams and sockets.
 void createClientConnection(cMsgClientInfo info)
          Creates a socket communication channel to a client.
 void deliverMessage(cMsgMessage msg, int msgType)
          Method to deliver a message from a domain server's subdomain handler to a client.
 boolean deliverMessageAndAcknowledge(cMsgMessage msg, int msgType)
          Method to deliver a message from a domain server's subdomain handler to a client and receive acknowledgment that the message was received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

cMsgMessageDeliverer

public cMsgMessageDeliverer(cMsgClientInfo info)
                     throws java.io.IOException
Create a message delivering object for use with one specific client.

Parameters:
info - information object about client to talk to
Throws:
java.io.IOException - if cannot establish communication with client
Method Detail

close

public void close()
Method to close all streams and sockets.

Specified by:
close in interface cMsgDeliverMessageInterface

deliverMessage

public void deliverMessage(cMsgMessage msg,
                           int msgType)
                    throws java.io.IOException,
                           cMsgException
Method to deliver a message from a domain server's subdomain handler to a client.

Specified by:
deliverMessage in interface cMsgDeliverMessageInterface
Parameters:
msg - message to sent to client
msgType - type of communication with the client
Throws:
java.io.IOException - if the message cannot be sent over the channel or client returns an error
cMsgException - if connection to client has not been established

deliverMessageAndAcknowledge

public boolean deliverMessageAndAcknowledge(cMsgMessage msg,
                                            int msgType)
                                     throws java.io.IOException,
                                            cMsgException
Method to deliver a message from a domain server's subdomain handler to a client and receive acknowledgment that the message was received.

Specified by:
deliverMessageAndAcknowledge in interface cMsgDeliverMessageInterface
Parameters:
msg - message to sent to client
msgType - type of communication with the client
Returns:
true if message acknowledged by receiver or acknowledgment undesired, otherwise false
Throws:
java.io.IOException - if the message cannot be sent over the channel or client returns an error
cMsgException - if connection to client has not been established

createClientConnection

public void createClientConnection(cMsgClientInfo info)
                            throws java.io.IOException
Creates a socket communication channel to a client.

Parameters:
info - client information object
Throws:
java.io.IOException - if socket cannot be created