| org.cougaar.core.plugin.ComponentPlugin org.cougaar.servicediscovery.plugin.SimpleMatchmakerPlugin
All known Subclasses: org.cougaar.pizza.plugin.MatchmakerPlugin,
SimpleMatchmakerPlugin | public class SimpleMatchmakerPlugin extends ComponentPlugin (Code) | | The Matchmaker is responsible for taking service discovery requests (MMQueryRequests)
from the SDClient, and issuing asynchronous queries to the YP
to find matching providers. When one (or more) is found, send the scored
results back the SDClient on the MMQueryRequest.
This version assumes the Role requested will be in the CommercialServiceScheme, and allows the YP
to handle walking up YP communities as necessary. It does not handle quiescence,
is not guaranteed to work with kills/restarts (persistence), only works
with a distributed YP (using communities, not a single static instance), etc.
|
Inner Class :public class QueryAlarm implements Alarm | |
Method Summary | |
protected void | execute() Loop through new MMQueryRequests, posting a new asynchronous YP query for each. | protected void | findServiceWithDistributedYP(RQ r) This is the workhourse: ask the YP to find a service that matches the given request,
and to tell us when it is done with a callback we supply. | protected String | getServiceSchemeForRoles() Return the UDDI Service Scheme that contains the Roles we will look for. | protected long | getWarningCutoffTime() Get the real time after which DEBUG level problems become ERROR: This is
the parametrized warning cut-off interval (in minutes, default of 2), plus
the time of the first error. | protected void | handleException(RQ r) Handle an exception from a YP query callback by logging something, waiting a while, and trying again. | protected void | handleResponse(RQ r) Process a real response from the YP for a lookup. | public void | load() Over-ride parent load to get non-essential services (the log service here). | public void | setRegistryQueryService(RegistryQueryService rqs) Reflection sets the RegistryQueryService at startup - plugin will not load if not found. | protected void | setupSubscriptions() Subscribe to MMQueryRequests from the SDClientPlugin. | public void | unload() Every load() should have an unload(), to unload() the manually loaded service. |
execute | protected void execute()(Code) | | Loop through new MMQueryRequests, posting a new asynchronous YP query for each. Also
runs when the YP query callbacks signal that the plugin should run. So loop through the pending
requests, posting alarms to retry those with errors later, and sending back the answer
to the SDClient for those that have a list of providers.
Note that you must specify the service scheme in which Roles will be found in the YP,
through the helper getServiceSchemeForRoles() method.
|
findServiceWithDistributedYP | protected void findServiceWithDistributedYP(RQ r)(Code) | | This is the workhourse: ask the YP to find a service that matches the given request,
and to tell us when it is done with a callback we supply. It asks the YP to
walk up the hierarchy of YP communities to find ever broader YP servers if that is necessary.
|
getServiceSchemeForRoles | protected String getServiceSchemeForRoles()(Code) | | Return the UDDI Service Scheme that contains the Roles we will look for.
This is typically the COMMERCIAL_SERVICE_SCHEME or MILITARY_SERVICE_SCHEME.
This method may be the only one an extender of this plugin needs to over-ride.
UDDI Service Scheme to find Roles in |
getWarningCutoffTime | protected long getWarningCutoffTime()(Code) | | Get the real time after which DEBUG level problems become ERROR: This is
the parametrized warning cut-off interval (in minutes, default of 2), plus
the time of the first error.
time in millis |
handleException | protected void handleException(RQ r)(Code) | | Handle an exception from a YP query callback by logging something, waiting a while, and trying again.
Parameters: r - YP query that had error. |
handleResponse | protected void handleResponse(RQ r)(Code) | | Process a real response from the YP for a lookup. Score it using the
scoring function on the original query. If it scores well,
then put this service provider on the response back to the SDClient.
If we don't have a good provider to send the SDClient, then check to
see if the YP said there was another higher (parent) YP server to check.
If there is, then post the query to that server. Otherwise, we've failed.
|
load | public void load()(Code) | | Over-ride parent load to get non-essential services (the log service here).
|
setRegistryQueryService | public void setRegistryQueryService(RegistryQueryService rqs)(Code) | | Reflection sets the RegistryQueryService at startup - plugin will not load if not found.
|
setupSubscriptions | protected void setupSubscriptions()(Code) | | Subscribe to MMQueryRequests from the SDClientPlugin.
|
unload | public void unload()(Code) | | Every load() should have an unload(), to unload() the manually loaded service.
|
|
|