public class cMsgSubdomainAdapter extends java.lang.Object implements cMsgSubdomainInterface
This class provides a very basic (non-functional/dummy) implementation of the cMsgSubdomainInterface interface. This class is used by a cMsg domain server to respond to client demands. It contains some methods that hide the details of communication with the client. A fully implementated subclass of this class must handle all communication with a particular subdomain (such as SmartSockets or JADE agents).
Understand that each client using cMsg will have its own handler object from either an implemenation of the cMsgSubdomainInterface interface or a subclass of this class. One client may concurrently use the same cMsgHandleRequest object; thus, implementations must be thread-safe. Furthermore, when the name server shuts dowm, the method handleServerShutdown may be executed more than once for the same reason.Constructor and Description |
---|
cMsgSubdomainAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
handleClientShutdown()
Method to handle a client or domain server (and therefore subdomain handler) shutdown.
|
void |
handleSendAndGetRequest(cMsgMessageFull message)
Method to synchronously get a single message by sending out a
message which is responded to by its receiver(s).
|
void |
handleSendRequest(cMsgMessageFull message)
Method to handle a message sent by a domain client.
|
void |
handleShutdownClientsRequest(java.lang.String client,
boolean includeMe)
Method to handle a request to shutdown clients sent by a domain client.
|
void |
handleSubscribeAndGetRequest(java.lang.String subject,
java.lang.String type,
int id)
Method to synchronously get a single message from the server for a one-time
subscription of a subject and type.
|
void |
handleSubscribeRequest(java.lang.String subject,
java.lang.String type,
int id)
Method to handle a subscribe request sent by a domain client.
|
int |
handleSyncSendRequest(cMsgMessageFull message)
Method to handle a message sent by a domain client in synchronous mode.
|
void |
handleUnSendAndGetRequest(int id)
Method to remove a sendAndGet request previously sent by a domain client.
|
void |
handleUnsubscribeAndGetRequest(java.lang.String subject,
java.lang.String type,
int id)
Method to remove a subscribeAndGet request previously sent by a domain client.
|
void |
handleUnsubscribeRequest(java.lang.String subject,
java.lang.String type,
int id)
Method to handle an unsubscribe request sent by a domain client.
|
boolean |
hasSend()
Method to tell if the "send" cMsg API function is implemented
by this interface implementation in the "handleSendRequest"
method.
|
boolean |
hasSendAndGet()
Method to tell if the "sendAndGet" cMsg API function is implemented
by this interface implementation in the "handleSendAndGetRequest"
method.
|
boolean |
hasShutdown()
Method to tell if the "shutdown" cMsg API function is implemented
by this interface implementation in the "handleShutdownClientsRequest"
method.
|
boolean |
hasSubscribe()
Method to tell if the "subscribe" cMsg API function is implemented
by this interface implementation in the "handleSubscribeRequest"
method.
|
boolean |
hasSubscribeAndGet()
Method to tell if the "subscribeAndGet" cMsg API function is implemented
by this interface implementation in the "handleSubscribeAndGetRequest"
method.
|
boolean |
hasSyncSend()
Method to tell if the "syncSend" cMsg API function is implemented
by this interface implementation in the "handleSyncSendRequest"
method.
|
boolean |
hasUnsubscribe()
Method to tell if the "unsubscribe" cMsg API function is implemented
by this interface implementation in the "handleUnsubscribeRequest"
method.
|
void |
registerClient(cMsgClientInfo info)
Method to register a domain client.
|
void |
setUDLRemainder(java.lang.String UDLRemainder)
Method to give the subdomain handler the appropriate part
of the UDL the client used to talk to the domain server.
|
public void setUDLRemainder(java.lang.String UDLRemainder) throws cMsgException
setUDLRemainder
in interface cMsgSubdomainInterface
UDLRemainder
- last part of the UDL appropriate to the subdomain handlercMsgException
- always throws an exception since this is a dummy implementationpublic void registerClient(cMsgClientInfo info) throws cMsgException
registerClient
in interface cMsgSubdomainInterface
info
- information about clientcMsgException
- always throws an exception since this is a dummy implementationpublic void handleSendRequest(cMsgMessageFull message) throws cMsgException
handleSendRequest
in interface cMsgSubdomainInterface
message
- message from sendercMsgException
- always throws an exception since this is a dummy implementationpublic int handleSyncSendRequest(cMsgMessageFull message) throws cMsgException
handleSyncSendRequest
in interface cMsgSubdomainInterface
message
- message from sendercMsgException
- always throws an exception since this is a dummy implementationpublic void handleSubscribeAndGetRequest(java.lang.String subject, java.lang.String type, int id) throws cMsgException
handleSubscribeAndGetRequest
in interface cMsgSubdomainInterface
subject
- subject subscribed totype
- type subscribed toid
- unique idcMsgException
- always throws an exception since this is a dummy implementationpublic void handleSendAndGetRequest(cMsgMessageFull message) throws cMsgException
handleSendAndGetRequest
in interface cMsgSubdomainInterface
message
- message requesting a response messagecMsgException
- always throws an exception since this is a dummy implementationpublic void handleUnSendAndGetRequest(int id) throws cMsgException
handleUnSendAndGetRequest
in interface cMsgSubdomainInterface
id
- unique (senderToken) id refering to specific sendAndGetcMsgException
- always throws an exception since this is a dummy implementationpublic void handleUnsubscribeAndGetRequest(java.lang.String subject, java.lang.String type, int id) throws cMsgException
handleUnsubscribeAndGetRequest
in interface cMsgSubdomainInterface
subject
- subject subscribed totype
- type subscribed toid
- unique idcMsgException
- always throws an exception since this is a dummy implementationpublic void handleSubscribeRequest(java.lang.String subject, java.lang.String type, int id) throws cMsgException
handleSubscribeRequest
in interface cMsgSubdomainInterface
subject
- subject subscribed totype
- type subscribed toid
- unique idcMsgException
- always throws an exception since this is a dummy implementationpublic void handleUnsubscribeRequest(java.lang.String subject, java.lang.String type, int id) throws cMsgException
handleUnsubscribeRequest
in interface cMsgSubdomainInterface
subject
- subject of subscriptiontype
- type of subscriptionid
- unique idcMsgException
- always throws an exception since this is a dummy implementationpublic void handleShutdownClientsRequest(java.lang.String client, boolean includeMe) throws cMsgException
handleShutdownClientsRequest
in interface cMsgSubdomainInterface
client
- client(s) to be shutdownincludeMe
- if true, this client may be shutdown toocMsgException
- always throws an exception since this is a dummy implementationpublic void handleClientShutdown() throws cMsgException
handleClientShutdown
in interface cMsgSubdomainInterface
cMsgException
- always throws an exception since this is a dummy implementationpublic boolean hasSend()
hasSend
in interface cMsgSubdomainInterface
public boolean hasSyncSend()
hasSyncSend
in interface cMsgSubdomainInterface
public boolean hasSubscribeAndGet()
hasSubscribeAndGet
in interface cMsgSubdomainInterface
public boolean hasSendAndGet()
hasSendAndGet
in interface cMsgSubdomainInterface
public boolean hasSubscribe()
hasSubscribe
in interface cMsgSubdomainInterface
public boolean hasUnsubscribe()
hasUnsubscribe
in interface cMsgSubdomainInterface
public boolean hasShutdown()
hasShutdown
in interface cMsgSubdomainInterface