ServiceQueryReplyEvent query(ServiceQueryEvent ev)
{
//String methodName = "query";
long friendly = ev.getFriendly();
String epname = ev.getEndpoint();
ServiceQueryReplyEvent reply = new ServiceQueryReplyEvent();
if (( friendly == -1) && ( epname == null )) {
ArrayList<String> keys = serviceStateHandler.getServiceNames();
for ( String k : keys ) {
ServiceSet sset = serviceStateHandler.getServiceByName(k);
if ( k == null ) continue; // the unlikely event it changed out from under us
IServiceDescription sd = sset.query();
updateServiceQuery(sd, sset);
reply.addService(sd);
}
} else {
ServiceSet sset = serviceStateHandler.getServiceForApi(friendly, epname);
if ( sset == null ) {
reply.setMessage("Unknown");
reply.setEndpoint(epname);
reply.setId(friendly);
reply.setReturnCode(false);
} else {
IServiceDescription sd = sset.query();
updateServiceQuery(sd, sset);
reply.addService(sd);
}
}
return reply;
}