private static class HubXmlRpcHandler.HubActorImpl extends java.lang.Object implements HubActor
HubActor interface which does
the work for this class.
Apart from a few methods which have Standard-Profile-specific
aspects, the work is simply delegated to the hub connection factory.| Modifier and Type | Field and Description |
|---|---|
private java.util.Map |
clientMap_ |
private KeyGenerator |
keyGen_ |
private ClientProfile |
profile_ |
private java.lang.String |
secret_ |
private SampXmlRpcClientFactory |
xClientFactory_ |
| Constructor and Description |
|---|
HubActorImpl(SampXmlRpcClientFactory xClientFactory,
ClientProfile profile,
java.lang.String secret,
KeyGenerator keyGen)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
call(java.lang.String privateKey,
java.lang.String recipientId,
java.lang.String msgTag,
java.util.Map msg)
Sends a message to a given client expecting a response.
|
java.util.Map |
callAll(java.lang.String privateKey,
java.lang.String msgTag,
java.util.Map msg)
Sends a message to all subscribed clients expecting responses.
|
java.util.Map |
callAndWait(java.lang.String privateKey,
java.lang.String recipientId,
java.util.Map msg,
java.lang.String timeoutStr)
Sends a message synchronously to a client.
|
void |
declareMetadata(java.lang.String privateKey,
java.util.Map metadata)
Declares metadata for the calling client.
|
void |
declareSubscriptions(java.lang.String privateKey,
java.util.Map subs)
Declares subscription information for the calling client.
|
private HubConnection |
getConnection(java.lang.String privateKey)
Returns the HubConnection associated with a private key used
by this hub actor.
|
java.util.Map |
getMetadata(java.lang.String privateKey,
java.lang.String clientId)
Returns metadata for a given client.
|
java.util.List |
getRegisteredClients(java.lang.String privateKey)
Returns a list of the public-ids of all currently registered clients.
|
java.util.Map |
getSubscribedClients(java.lang.String privateKey,
java.lang.String mtype)
Returns a map of the clients subscribed to a given MType.
|
java.util.Map |
getSubscriptions(java.lang.String privateKey,
java.lang.String clientId)
Returns subscriptions for a given client.
|
void |
notify(java.lang.String privateKey,
java.lang.String recipientId,
java.util.Map msg)
Sends a message to a given client without wanting a response.
|
java.util.List |
notifyAll(java.lang.String privateKey,
java.util.Map msg)
Sends a message to all subscribed clients without wanting a response.
|
void |
ping()
Throws an exception if service is not operating.
|
void |
ping(java.lang.String privateKey)
Throws an exception if service is not operating.
|
java.util.Map |
register(java.lang.String secret)
Registers a new client and returns a map with registration information.
|
void |
reply(java.lang.String privateKey,
java.lang.String msgId,
java.util.Map response)
Responds to a previously sent message.
|
void |
setXmlrpcCallback(java.lang.String privateKey,
java.lang.String surl)
Sets the XML-RPC URL to use for callbacks for a callable client.
|
void |
unregister(java.lang.String privateKey)
Unregisters a registered client.
|
private final SampXmlRpcClientFactory xClientFactory_
private final ClientProfile profile_
private final java.lang.String secret_
private final KeyGenerator keyGen_
private final java.util.Map clientMap_
HubActorImpl(SampXmlRpcClientFactory xClientFactory, ClientProfile profile, java.lang.String secret, KeyGenerator keyGen)
xClientFactory - XML-RPC client factory implementationprofile - hub connection factorysecret - password required for client registrationkeyGen - generator for private keyspublic java.util.Map register(java.lang.String secret)
throws SampException
HubActorregister in interface HubActorsecret - registration passwordRegInfo-like map.SampExceptionpublic void unregister(java.lang.String privateKey)
throws SampException
HubActorunregister in interface HubActorprivateKey - calling client private keySampExceptionpublic void ping(java.lang.String privateKey)
throws SampException
HubActorping in interface HubActorprivateKey - ignoredSampExceptionpublic void setXmlrpcCallback(java.lang.String privateKey,
java.lang.String surl)
throws SampException
HubActorsetXmlrpcCallback in interface HubActorprivateKey - calling client private keysurl - XML-RPC endpoint for client API callbacksSampExceptionpublic void declareMetadata(java.lang.String privateKey,
java.util.Map metadata)
throws SampException
HubActordeclareMetadata in interface HubActorprivateKey - calling client private keymetadata - Metadata-like mapSampExceptionpublic java.util.Map getMetadata(java.lang.String privateKey,
java.lang.String clientId)
throws SampException
HubActorgetMetadata in interface HubActorprivateKey - calling client private keyclientId - public ID for client whose metadata is requiredMetadata-like mapSampExceptionpublic void declareSubscriptions(java.lang.String privateKey,
java.util.Map subs)
throws SampException
HubActordeclareSubscriptions in interface HubActorprivateKey - calling client private keysubs - Subscriptions-like mapSampExceptionpublic java.util.Map getSubscriptions(java.lang.String privateKey,
java.lang.String clientId)
throws SampException
HubActorgetSubscriptions in interface HubActorprivateKey - calling client private keySubscriptions-like mapSampExceptionpublic java.util.List getRegisteredClients(java.lang.String privateKey)
throws SampException
HubActorgetRegisteredClients in interface HubActorprivateKey - calling client private keySampExceptionpublic java.util.Map getSubscribedClients(java.lang.String privateKey,
java.lang.String mtype)
throws SampException
HubActorgetSubscribedClients in interface HubActorprivateKey - calling client private keymtype - MType of interestmtypeSampExceptionpublic void notify(java.lang.String privateKey,
java.lang.String recipientId,
java.util.Map msg)
throws SampException
HubActornotify in interface HubActorprivateKey - calling client private keyrecipientId - public-id of client to receive messagemsg - Message-like mapSampExceptionpublic java.util.List notifyAll(java.lang.String privateKey,
java.util.Map msg)
throws SampException
HubActornotifyAll in interface HubActorprivateKey - calling client private keymsg - Message-like mapSampExceptionpublic java.lang.String call(java.lang.String privateKey,
java.lang.String recipientId,
java.lang.String msgTag,
java.util.Map msg)
throws SampException
HubActorcall in interface HubActorprivateKey - calling client private keyrecipientId - public-id of client to receive messagemsgTag - arbitrary string tagging this message for caller's
benefitmsg - Message-like mapSampExceptionpublic java.util.Map callAll(java.lang.String privateKey,
java.lang.String msgTag,
java.util.Map msg)
throws SampException
HubActorcallAll in interface HubActorprivateKey - calling client private keymsgTag - arbitrary string tagging this message for caller's
benefitmsg - Message-like mapSampExceptionpublic java.util.Map callAndWait(java.lang.String privateKey,
java.lang.String recipientId,
java.util.Map msg,
java.lang.String timeoutStr)
throws SampException
HubActorcallAndWait in interface HubActorprivateKey - calling client private keyrecipientId - public-id of client to receive messagemsg - Message-like maptimeoutStr - timeout in seconds encoded as a SAMP intResponse-like mapSampExceptionpublic void reply(java.lang.String privateKey,
java.lang.String msgId,
java.util.Map response)
throws SampException
HubActorreply in interface HubActorprivateKey - calling client private keymsgId - ID associated with earlier sendresponse - Response-like mapSampExceptionpublic void ping()
throws SampException
HubActorping in interface HubActorSampExceptionprivate HubConnection getConnection(java.lang.String privateKey) throws SampException
privateKey - private keyprivateKeySampException