org.jlab.coda.cMsg.FileDomain
Class File

java.lang.Object
  extended by org.jlab.coda.cMsg.cMsgDomainAdapter
      extended by org.jlab.coda.cMsg.FileDomain.File
All Implemented Interfaces:
cMsgDomainInterface

public class File
extends cMsgDomainAdapter

This class implements a client in the cMsg File domain.

Version:
1.0
Author:
Elliott Wolin

Field Summary
 
Fields inherited from class org.jlab.coda.cMsg.cMsgDomainAdapter
connected, description, domain, host, name, receiving, shutdownHandler, UDL, UDLremainder
 
Constructor Summary
File()
          Constructor for File domain.
 
Method Summary
 void connect()
          Opens file.
 void disconnect()
          Closes file.
 void flush(int timeout)
          Flushes output.
 void send(cMsgMessage msg)
          Writes to file.
 int syncSend(cMsgMessage message, int timeout)
          Calls send to write to file.
 
Methods inherited from class org.jlab.coda.cMsg.cMsgDomainAdapter
getDescription, getDomain, getHost, getName, getShutdownHandler, getString, getUDL, getUDLRemainder, isConnected, isReceiving, monitor, sendAndGet, setDescription, setName, setShutdownHandler, setUDL, setUDLRemainder, shutdownClients, shutdownServers, start, stop, subscribe, subscribeAndGet, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

File

public File()
     throws cMsgException
Constructor for File domain.

UDL: cMsg:cMsg://fileName?textOnly=value. Default is to print entire message to file. If textOnly=true then only print timestamp and message text to file.

Throws:
cMsgException - if domain in not implemented or there are problems
Method Detail

connect

public void connect()
             throws cMsgException
Opens file.

Specified by:
connect in interface cMsgDomainInterface
Overrides:
connect in class cMsgDomainAdapter
Throws:
cMsgException - if there are communication problems

disconnect

public void disconnect()
Closes file.

Specified by:
disconnect in interface cMsgDomainInterface
Overrides:
disconnect in class cMsgDomainAdapter

send

public void send(cMsgMessage msg)
          throws cMsgException
Writes to file.

Specified by:
send in interface cMsgDomainInterface
Overrides:
send in class cMsgDomainAdapter
Parameters:
msg - message to send
Throws:
cMsgException - if file is closed (connect was not called, or disconnect was called)

syncSend

public int syncSend(cMsgMessage message,
                    int timeout)
             throws cMsgException
Calls send to write to file.

Specified by:
syncSend in interface cMsgDomainInterface
Overrides:
syncSend in class cMsgDomainAdapter
Parameters:
message - message
timeout - time in milliseconds to wait for a response
Returns:
response from subdomain handler
Throws:
cMsgException - if file is closed (connect was not called, or disconnect was called)

flush

public void flush(int timeout)
           throws cMsgException
Flushes output.

Specified by:
flush in interface cMsgDomainInterface
Overrides:
flush in class cMsgDomainAdapter
Parameters:
timeout - time in milliseconds to wait for completion
Throws:
cMsgException - if file is closed (connect was not called, or disconnect was called)