org.jlab.coda.cMsg.subdomains
Class SmartSockets

java.lang.Object
  extended by org.jlab.coda.cMsg.cMsgSubdomainAdapter
      extended by org.jlab.coda.cMsg.subdomains.SmartSockets
All Implemented Interfaces:
cMsgSubdomainInterface

public class SmartSockets
extends cMsgSubdomainAdapter

cMsg subdomain handler for smartsockets subdomain. Implements proxy smartsockets server. UDL: cMsg:cMsg://host:port/SmartSockets/projectName

Version:
1.0
Author:
Elliott Wolin

Constructor Summary
SmartSockets()
           
 
Method Summary
 void handleClientShutdown()
          Method to handle a client shutdown.
 void handleSendRequest(cMsgMessageFull msg)
          Forwards message to smartsockets system.
 void handleSubscribeRequest(java.lang.String subject, java.lang.String type, int receiverSubscribeId)
          Method to handle subscribe request sent by domain client.
 void handleUnsubscribeRequest(java.lang.String subject, java.lang.String type, int receiverSubscribeId)
          Method to handle sunsubscribe request sent by domain client.
 boolean hasSend()
          Method to tell if the "send" cMsg API function is implemented by this interface implementation in the handleSendRequest(org.jlab.coda.cMsg.cMsgMessageFull) method.
 boolean hasSubscribe()
          Method to tell if the "subscribe" cMsg API function is implemented by this interface implementation in the handleSubscribeRequest(java.lang.String, java.lang.String, int) method.
 boolean hasUnsubscribe()
          Method to tell if the "unsubscribe" cMsg API function is implemented by this interface implementation in the handleUnsubscribeRequest(java.lang.String, java.lang.String, int) method.
 void registerClient(cMsgClientInfo info)
          Method to register domain client.
 void setMessageDeliverer(cMsgDeliverMessageInterface deliverer)
          Method to give the subdomain handler on object able to deliver messages to the 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.
 
Methods inherited from class org.jlab.coda.cMsg.cMsgSubdomainAdapter
handleKeepAlive, handleSendAndGetRequest, handleShutdownClientsRequest, handleSubscribeAndGetRequest, handleSyncSendRequest, handleUnSendAndGetRequest, handleUnsubscribeAndGetRequest, hasSendAndGet, hasShutdown, hasSubscribeAndGet, hasSyncSend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmartSockets

public SmartSockets()
Method Detail

hasSend

public boolean hasSend()
Method to tell if the "send" cMsg API function is implemented by this interface implementation in the handleSendRequest(org.jlab.coda.cMsg.cMsgMessageFull) method.

Specified by:
hasSend in interface cMsgSubdomainInterface
Overrides:
hasSend in class cMsgSubdomainAdapter
Returns:
true if get implemented in handleSendRequest(org.jlab.coda.cMsg.cMsgMessageFull)

hasSubscribe

public boolean hasSubscribe()
Method to tell if the "subscribe" cMsg API function is implemented by this interface implementation in the handleSubscribeRequest(java.lang.String, java.lang.String, int) method.

Specified by:
hasSubscribe in interface cMsgSubdomainInterface
Overrides:
hasSubscribe in class cMsgSubdomainAdapter
Returns:
true if subscribe implemented in handleSubscribeRequest(java.lang.String, java.lang.String, int)

hasUnsubscribe

public boolean hasUnsubscribe()
Method to tell if the "unsubscribe" cMsg API function is implemented by this interface implementation in the handleUnsubscribeRequest(java.lang.String, java.lang.String, int) method.

Specified by:
hasUnsubscribe in interface cMsgSubdomainInterface
Overrides:
hasUnsubscribe in class cMsgSubdomainAdapter
Returns:
true if unsubscribe implemented in handleUnsubscribeRequest(java.lang.String, java.lang.String, int)

setUDLRemainder

public void setUDLRemainder(java.lang.String UDLRemainder)
                     throws cMsgException
Method to give the subdomain handler the appropriate part of the UDL the client used to talk to the domain server.

Specified by:
setUDLRemainder in interface cMsgSubdomainInterface
Overrides:
setUDLRemainder in class cMsgSubdomainAdapter
Parameters:
UDLRemainder - last part of the UDL appropriate to the subdomain handler
Throws:
cMsgException

setMessageDeliverer

public void setMessageDeliverer(cMsgDeliverMessageInterface deliverer)
                         throws cMsgException
Method to give the subdomain handler on object able to deliver messages to the client.

Specified by:
setMessageDeliverer in interface cMsgSubdomainInterface
Overrides:
setMessageDeliverer in class cMsgSubdomainAdapter
Parameters:
deliverer - object able to deliver messages to the client
Throws:
cMsgException

registerClient

public void registerClient(cMsgClientInfo info)
                    throws cMsgException
Method to register domain client.

Specified by:
registerClient in interface cMsgSubdomainInterface
Overrides:
registerClient in class cMsgSubdomainAdapter
Parameters:
info - contains all client info
Throws:
cMsgException - upon error

handleSendRequest

public void handleSendRequest(cMsgMessageFull msg)
                       throws cMsgException
Forwards message to smartsockets system.

Specified by:
handleSendRequest in interface cMsgSubdomainInterface
Overrides:
handleSendRequest in class cMsgSubdomainAdapter
Parameters:
msg - message from sender.
Throws:
cMsgException

handleSubscribeRequest

public void handleSubscribeRequest(java.lang.String subject,
                                   java.lang.String type,
                                   int receiverSubscribeId)
                            throws cMsgException
Method to handle subscribe request sent by domain client.

Specified by:
handleSubscribeRequest in interface cMsgSubdomainInterface
Overrides:
handleSubscribeRequest in class cMsgSubdomainAdapter
Parameters:
subject - message subject to subscribe to
type - message type to subscribe to
receiverSubscribeId - message id refering to these specific subject and type values
Throws:
cMsgException - if no client information is available or a subscription for this subject and type already exists

handleUnsubscribeRequest

public void handleUnsubscribeRequest(java.lang.String subject,
                                     java.lang.String type,
                                     int receiverSubscribeId)
Method to handle sunsubscribe request sent by domain client. This method is run after all exchanges between domain server and client.

Specified by:
handleUnsubscribeRequest in interface cMsgSubdomainInterface
Overrides:
handleUnsubscribeRequest in class cMsgSubdomainAdapter
Parameters:
subject - message subject subscribed to
type - message type subscribed to
receiverSubscribeId - receiver subscribe id

handleClientShutdown

public void handleClientShutdown()
                          throws cMsgException
Method to handle a client shutdown.

Specified by:
handleClientShutdown in interface cMsgSubdomainInterface
Overrides:
handleClientShutdown in class cMsgSubdomainAdapter
Throws:
cMsgException