private static class WebHubXmlRpcHandler.WebHubActorImpl extends java.lang.Object implements WebHubActor
| Modifier and Type | Field and Description |
|---|---|
private ClientAuthorizer |
auth_ |
private java.net.URL |
baseUrl_ |
private KeyGenerator |
keyGen_ |
private ClientProfile |
profile_ |
private java.util.Map |
regMap_ |
private UrlTracker |
urlTracker_ |
private WebHubXmlRpcHandler.URLTranslationHandler |
urlTranslator_ |
| Constructor and Description |
|---|
WebHubActorImpl(ClientProfile profile,
ClientAuthorizer auth,
KeyGenerator keyGen,
java.net.URL baseUrl,
UrlTracker urlTracker)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
allowReverseCallbacks(java.lang.String clientKey,
java.lang.String allow)
Indicates that the client will or will not be calling
WebHubActor.pullCallbacks(java.lang.String, java.lang.String) to receive callable client-type
callbacks until further notice. |
java.lang.String |
call(java.lang.String clientKey,
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 clientKey,
java.lang.String msgTag,
java.util.Map msg)
Sends a message to all subscribed clients expecting responses.
|
java.util.Map |
callAndWait(java.lang.String clientKey,
java.lang.String recipientId,
java.util.Map msg,
java.lang.String timeout)
Sends a message synchronously to a client.
|
void |
declareMetadata(java.lang.String clientKey,
java.util.Map meta)
Declares metadata for the calling client.
|
void |
declareSubscriptions(java.lang.String clientKey,
java.util.Map subs)
Declares subscription information for the calling client.
|
private HubConnection |
getConnection(java.lang.String privateKey)
Returns the connection object associated with a given private key.
|
java.util.Map |
getMetadata(java.lang.String clientKey,
java.lang.String clientId)
Returns metadata for a given client.
|
java.util.List |
getRegisteredClients(java.lang.String clientKey)
Returns a list of the public-ids of all currently registered clients.
|
private WebHubXmlRpcHandler.Registration |
getRegistration(java.lang.String privateKey)
Returns the registration object associated with a given private key.
|
java.util.Map |
getSubscribedClients(java.lang.String clientKey,
java.lang.String mtype)
Returns a map of the clients subscribed to a given MType.
|
java.util.Map |
getSubscriptions(java.lang.String clientKey,
java.lang.String clientId)
Returns subscriptions for a given client.
|
HttpServer.Handler |
getUrlTranslationHandler()
Returns a handler suitable for performing URL translations on behalf
of sandboxed clients as required by the Web Profile.
|
void |
notify(java.lang.String clientKey,
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 clientKey,
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 clientKey)
Throws an exception if service is not operating.
|
java.util.List |
pullCallbacks(java.lang.String clientKey,
java.lang.String timeout)
Waits for up to a certain length of time for any callbacks to be
delivered.
|
RegInfo |
register(HttpServer.Request request,
java.util.Map securityMap)
Attempt client registration.
|
void |
reply(java.lang.String clientKey,
java.lang.String msgId,
java.util.Map response)
Responds to a previously sent message.
|
void |
unregister(java.lang.String clientKey)
Unregisters a registered client.
|
private final ClientProfile profile_
private final ClientAuthorizer auth_
private final KeyGenerator keyGen_
private final java.util.Map regMap_
private final WebHubXmlRpcHandler.URLTranslationHandler urlTranslator_
private final java.net.URL baseUrl_
private final UrlTracker urlTracker_
public WebHubActorImpl(ClientProfile profile, ClientAuthorizer auth, KeyGenerator keyGen, java.net.URL baseUrl, UrlTracker urlTracker)
profile - hub connection factoryauth - client authorizerkeyGen - key generator for private keysbaseUrl - HTTP server base URLurlTracker - controls access to translated URLs,
may be null for no controlpublic HttpServer.Handler getUrlTranslationHandler()
public RegInfo register(HttpServer.Request request, java.util.Map securityMap) throws SampException
request - HTTP request from applicantsecurityMap - map of required security information
supplied by applicantSampExceptionpublic void unregister(java.lang.String clientKey)
throws SampException
WebHubActorunregister in interface WebHubActorclientKey - calling client private keySampExceptionpublic void allowReverseCallbacks(java.lang.String clientKey,
java.lang.String allow)
throws SampException
WebHubActorWebHubActor.pullCallbacks(java.lang.String, java.lang.String) to receive callable client-type
callbacks until further notice.allowReverseCallbacks in interface WebHubActorclientKey - calling client private keyallow - flag indicating that the client will/will not
be pulling callbacks, encoded as a SAMP boolean ("1"/"0")SampExceptionpublic java.util.List pullCallbacks(java.lang.String clientKey,
java.lang.String timeout)
throws SampException
WebHubActorpullCallbacks in interface WebHubActorclientKey - calling client private keytimeout - timeout in seconds encoded as a SAMP intCallback-like maps ready for
processing by the client; may be empty if none are readySampExceptionpublic void declareMetadata(java.lang.String clientKey,
java.util.Map meta)
throws SampException
WebHubActordeclareMetadata in interface WebHubActorclientKey - calling client private keymeta - Metadata-like mapSampExceptionpublic java.util.Map getMetadata(java.lang.String clientKey,
java.lang.String clientId)
throws SampException
WebHubActorgetMetadata in interface WebHubActorclientKey - calling client private keyclientId - public ID for client whose metadata is requiredMetadata-like mapSampExceptionpublic void declareSubscriptions(java.lang.String clientKey,
java.util.Map subs)
throws SampException
WebHubActordeclareSubscriptions in interface WebHubActorclientKey - calling client private keysubs - Subscriptions-like mapSampExceptionpublic java.util.Map getSubscriptions(java.lang.String clientKey,
java.lang.String clientId)
throws SampException
WebHubActorgetSubscriptions in interface WebHubActorclientKey - calling client private keySubscriptions-like mapSampExceptionpublic java.util.List getRegisteredClients(java.lang.String clientKey)
throws SampException
WebHubActorgetRegisteredClients in interface WebHubActorclientKey - calling client private keySampExceptionpublic java.util.Map getSubscribedClients(java.lang.String clientKey,
java.lang.String mtype)
throws SampException
WebHubActorgetSubscribedClients in interface WebHubActorclientKey - calling client private keymtype - MType of interestmtypeSampExceptionpublic void notify(java.lang.String clientKey,
java.lang.String recipientId,
java.util.Map msg)
throws SampException
WebHubActornotify in interface WebHubActorclientKey - calling client private keyrecipientId - public-id of client to receive messagemsg - Message-like mapSampExceptionpublic java.util.List notifyAll(java.lang.String clientKey,
java.util.Map msg)
throws SampException
WebHubActornotifyAll in interface WebHubActorclientKey - calling client private keymsg - Message-like mapSampExceptionpublic java.lang.String call(java.lang.String clientKey,
java.lang.String recipientId,
java.lang.String msgTag,
java.util.Map msg)
throws SampException
WebHubActorcall in interface WebHubActorclientKey - 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 clientKey,
java.lang.String msgTag,
java.util.Map msg)
throws SampException
WebHubActorcallAll in interface WebHubActorclientKey - calling client private keymsgTag - arbitrary string tagging this message for caller's
benefitmsg - Message-like mapSampExceptionpublic java.util.Map callAndWait(java.lang.String clientKey,
java.lang.String recipientId,
java.util.Map msg,
java.lang.String timeout)
throws SampException
WebHubActorcallAndWait in interface WebHubActorclientKey - calling client private keyrecipientId - public-id of client to receive messagemsg - Message-like maptimeout - timeout in seconds encoded as a SAMP intResponse-like mapSampExceptionpublic void reply(java.lang.String clientKey,
java.lang.String msgId,
java.util.Map response)
throws SampException
WebHubActorreply in interface WebHubActorclientKey - calling client private keymsgId - ID associated with earlier sendresponse - Response-like mapSampExceptionpublic void ping()
WebHubActorping in interface WebHubActorpublic void ping(java.lang.String clientKey)
WebHubActorping in interface WebHubActorclientKey - ignoredprivate WebHubXmlRpcHandler.Registration getRegistration(java.lang.String privateKey) throws SampException
privateKey - private key string known by client and hub
to identify the connectionprivateKeySampException - if no client is known with that private keyprivate HubConnection getConnection(java.lang.String privateKey) throws SampException
privateKey - private key string known by client and hub
to identify the connectionprivateKeySampException - if no client is known with that private key