|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jlab.coda.cMsg.cMsg
public class cMsg
This class is instantiated by a client in order to connect to a cMsg server. The instantiated object will be the main means by which the client will interact with cMsg.
This class acts as a multiplexor to direct a cMsg client to the proper subdomain based on the UDL given.
Constructor Summary | |
---|---|
cMsg(java.lang.String UDL,
java.lang.String name,
java.lang.String description)
Constructor which automatically tries to connect to the name server specified. |
Method Summary | |
---|---|
void |
connect()
Method to connect to a particular domain server. |
void |
disconnect()
Method to close the connection to the domain server. |
void |
flush(int timeout)
Method to force cMsg client to send pending communications with domain server. |
java.lang.String |
getDescription()
Get the client's description. |
java.lang.String |
getDomain()
Get the name of the domain connected to. |
java.lang.String |
getHost()
Get the host the client is running on. |
java.lang.String |
getName()
Get the name of the client. |
cMsgShutdownHandlerInterface |
getShutdownHandler()
Method to get the shutdown handler of the client. |
java.lang.String |
getString()
Get a string that the implementation class wants to return up to the top (this) level API. |
java.lang.String |
getUDL()
Get the UDL of the client. |
java.lang.String |
getUDLRemainder()
Get the UDL remainder (UDL after cMsg:domain:// is stripped off) of the client. |
boolean |
isConnected()
Method to determine if this object is still connected to the domain server or not. |
boolean |
isReceiving()
Method telling whether callbacks are activated or not. |
cMsgMessage |
monitor(java.lang.String command)
This method is a synchronous call to receive a message containing monitoring data which describes the state of the cMsg domain the user is connected to. |
void |
send(cMsgMessage message)
Method to send a message to the domain server for further distribution. |
cMsgMessage |
sendAndGet(cMsgMessage message,
int timeout)
The message is sent as it would be in the send(org.jlab.coda.cMsg.cMsgMessage) method. |
void |
setShutdownHandler(cMsgShutdownHandlerInterface handler)
Method to set the shutdown handler of the client. |
void |
shutdownClients(java.lang.String client,
boolean includeMe)
Method to shutdown the given clients. |
void |
shutdownServers(java.lang.String server,
boolean includeMyServer)
Method to shutdown the given servers. |
void |
start()
Method to start or activate the subscription callbacks. |
void |
stop()
Method to stop or deactivate the subscription callbacks. |
java.lang.Object |
subscribe(java.lang.String subject,
java.lang.String type,
cMsgCallbackInterface cb,
java.lang.Object userObj)
Method to subscribe to receive messages of a subject and type from the domain server. |
cMsgMessage |
subscribeAndGet(java.lang.String subject,
java.lang.String type,
int timeout)
This method is like a one-time subscribe. |
int |
syncSend(cMsgMessage message,
int timeout)
Method to send a message to the domain server for further distribution and wait for a response from the subdomain handler that got it. |
void |
unsubscribe(java.lang.Object obj)
Method to unsubscribe a previous subscription to receive messages of a subject and type from the domain server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public cMsg(java.lang.String UDL, java.lang.String name, java.lang.String description) throws cMsgException
UDL
- semicolon separated list of Uniform Domain Locators - each of which specifies
a server to connect toname
- name of this client which must be unique in this domaindescription
- description of this client
cMsgException
- if domain in not implemented;
there are problems communicating with the name/domain server;
name contains colon;
the UDL is invalid;
the UDL contains an unreadable file;
any of the arguments are nullMethod Detail |
---|
public void connect() throws cMsgException
cMsgException
public void disconnect() throws cMsgException
cMsgException
public boolean isConnected()
public void send(cMsgMessage message) throws cMsgException
message
- message
cMsgException
public int syncSend(cMsgMessage message, int timeout) throws cMsgException
message
- messagetimeout
- time in milliseconds to wait for a response
cMsgException
public void flush(int timeout) throws cMsgException
timeout
- time in milliseconds to wait for completion
cMsgException
public cMsgMessage subscribeAndGet(java.lang.String subject, java.lang.String type, int timeout) throws cMsgException, java.util.concurrent.TimeoutException
subject
- subject of message desired from servertype
- type of message desired from servertimeout
- time in milliseconds to wait for a message
cMsgException
java.util.concurrent.TimeoutException
- if timeout occurspublic cMsgMessage sendAndGet(cMsgMessage message, int timeout) throws cMsgException, java.util.concurrent.TimeoutException
send(org.jlab.coda.cMsg.cMsgMessage)
method. The server notes
the fact that a response to it is expected, and sends it to all subscribed to its
subject and type. When a marked response is received from a client, it sends that
first response back to the original sender regardless of its subject or type.
The response may be null.
message
- message sent to servertimeout
- time in milliseconds to wait for a reponse message
cMsgException
java.util.concurrent.TimeoutException
- if timeout occurspublic java.lang.Object subscribe(java.lang.String subject, java.lang.String type, cMsgCallbackInterface cb, java.lang.Object userObj) throws cMsgException
subject
- message subjecttype
- message typecb
- callback object whose cMsgCallbackInterface.callback(cMsgMessage, Object)
method is called upon receiving a message of subject and typeuserObj
- any user-supplied object to be given to the callback method as an argument
cMsgException
public void unsubscribe(java.lang.Object obj) throws cMsgException
obj
- the object "handle" returned from a subscribe call
cMsgException
- if there are communication problems with the serverpublic cMsgMessage monitor(java.lang.String command) throws cMsgException
command
- directive for monitoring process
cMsgException
public void start()
public void stop()
public void shutdownClients(java.lang.String client, boolean includeMe) throws cMsgException
client
- client(s) to be shutdownincludeMe
- if true, it is permissible to shutdown calling client
cMsgException
public void shutdownServers(java.lang.String server, boolean includeMyServer) throws cMsgException
server
- server(s) to be shutdownincludeMyServer
- if true, it is permissible to shutdown calling client's
cMsg server
cMsgException
public void setShutdownHandler(cMsgShutdownHandlerInterface handler)
handler
- shutdown handlerpublic cMsgShutdownHandlerInterface getShutdownHandler()
public java.lang.String getDomain()
public java.lang.String getUDL()
public java.lang.String getUDLRemainder()
public java.lang.String getName()
public java.lang.String getDescription()
public java.lang.String getHost()
public java.lang.String getString()
public boolean isReceiving()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |