public class MinimalHub extends Object implements PlasticHubListener, org.apache.xmlrpc.XmlRpcHandler
PlasticHub for a more user-friendly
implementation. This class is provided mainly to make it
as clear as possible what the implementation of a hub involves.PLASTIC_CONFIG_FILENAME, PLASTIC_RMI_PORT_KEY, PLASTIC_VERSION_KEY, PLASTIC_XMLRPC_URL_KEY| Constructor and Description |
|---|
MinimalHub(ServerSet servers)
Constructs a new hub, given running server objects.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
execute(String method,
Vector params)
This method implements all the XML-RPC services offered by the hub.
|
void |
finalize() |
URI |
getHubId()
Get this hub's ID.
|
List |
getMessageRegisteredIds(URI message)
Get all the applications that support a particular message
|
String |
getName(URI id)
Get the name of this application, as used at registration.
|
List |
getRegisteredIds()
Get all the IDs of the currently registered applications.
|
List |
getUnderstoodMessages(URI id)
Get the messages understood by this application.
|
static void |
main(String[] args)
Main method.
|
List |
pollForMessages(URI id)
Not supported.
|
URI |
registerNoCallBack(String name)
Register this application with the hub, but don't send it any messages in return.
|
URI |
registerPolling(String name,
List supportedMessages)
Not supported.
|
URI |
registerRMI(String name,
List supportedMessages,
PlasticListener caller)
A java-rmi version of
registerXMLRPC |
URI |
registerXMLRPC(String name,
List supportedMessages,
URL callbackURL)
Register an application with the hub.
|
Map |
request(URI sender,
URI message,
List args)
Send a message to all registered Plastic applications.
|
void |
requestAsynch(URI sender,
URI message,
List args)
Send a request to all registered Plastic apps, but don't wait for a response.
|
Map |
requestToSubset(URI sender,
URI message,
List args,
List recipientIds)
Send a request to listed registered Plastic apps.
|
void |
requestToSubsetAsynch(URI sender,
URI message,
List args,
List recipientIds)
Send a request to listed registered Plastic apps, but don't wait for a response.
|
void |
stop()
Shuts down this hub and tidies up.
|
void |
unregister(URI id)
Unregister the application from the hub.
|
public MinimalHub(ServerSet servers) throws RemoteException
servers - object encapsulating listening serversRemoteExceptionpublic URI getHubId()
PlasticHubListenergetHubId in interface PlasticHubListenerpublic URI registerRMI(String name, List supportedMessages, PlasticListener caller)
PlasticHubListenerregisterXMLRPCregisterRMI in interface PlasticHubListenername - see registerRMIcaller - the PlasticListener that wishes to registerfor other parameterspublic URI registerXMLRPC(String name, List supportedMessages, URL callbackURL)
PlasticHubListenerregisterXMLRPC in interface PlasticHubListenername - An optional string with a short name describing the application. This may be added to the hub
assigned ID, making it more human friendly.supportedMessages - an array of messages (as URIs) the application is interested in. An empty List signifies
"all".callbackURL - the application's internal xmlrpc server URL. Used by the hub to send messages to the
application.PlasticHubListener.registerRMI(String, List, PlasticListener),
PlasticHubListener.registerNoCallBack(String)public URI registerNoCallBack(String name)
PlasticHubListenerregisterNoCallBack in interface PlasticHubListenerfor parameterspublic void unregister(URI id)
PlasticHubListenerunregister in interface PlasticHubListenerid - the application to unregisterpublic List getRegisteredIds()
PlasticHubListenergetRegisteredIds in interface PlasticHubListenerpublic String getName(URI id)
PlasticHubListenergetName in interface PlasticHubListenerid - the plastic ID returned at registrationpublic List getUnderstoodMessages(URI id)
PlasticHubListenergetUnderstoodMessages in interface PlasticHubListenerid - the plastic ID returned at registrationpublic List getMessageRegisteredIds(URI message)
PlasticHubListenergetMessageRegisteredIds in interface PlasticHubListenermessage - the messageId you're interested inpublic Object execute(String method, Vector params) throws IOException, URISyntaxException
execute in interface org.apache.xmlrpc.XmlRpcHandlermethod - XML-RPC method name, including the "plastic.hub"
prefixparams - list of method argumentsIOExceptionURISyntaxExceptionpublic Map request(URI sender, URI message, List args)
PlasticHubListenerrequest in interface PlasticHubListenersender - the id of the originating tool - provided by the hub on
registration. Note that the hub is at liberty to refused to forward requests that
don't come from an ID that it has registered.message - the message to send.args - any arguments to pass with the messagepublic Map requestToSubset(URI sender, URI message, List args, List recipientIds)
PlasticHubListenerrequest for
details of the other parameters.requestToSubset in interface PlasticHubListenerrecipientIds - a list of target application ids (as URIs)public void requestAsynch(URI sender, URI message, List args)
PlasticHubListenerrequest for details of parameters.requestAsynch in interface PlasticHubListenerpublic void requestToSubsetAsynch(URI sender, URI message, List args, List recipientIds)
PlasticHubListenerrequestToSubsetAsynch in interface PlasticHubListenerrecipientIds - a List of target application ids (as URIs). See request for
details of the other parameters.public URI registerPolling(String name, List supportedMessages)
UnsupportedOperationException - alwayspublic List pollForMessages(URI id)
UnsupportedOperationException - alwayspublic void stop()
public void finalize()
throws Throwable
public static void main(String[] args) throws IOException, RemoteException
PlasticHub.main(java.lang.String[]).IOExceptionRemoteExceptionCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.