/** * Search for services, starting at the given service provider. * @param provider The service provider to start the search at. * @param decider The visit decider to select nodes and terminate the search. * @param selector The result selector to select matching services and produce the final result. * @param services The local services of the provider (class->list of services). */ public ITerminableIntermediateFuture<IService> searchServices(IServiceProvider provider, IVisitDecider decider, IResultSelector selector, Map<Class<?>, Collection<IService>> services) { TerminableIntermediateFuture<IService> ret = new TerminableIntermediateFuture<IService>(); // if(selector instanceof TypeResultSelector && ((TypeResultSelector)selector).getType().toString().indexOf("IIntermediateResultService")!=-1) // { // System.out.println("sefuill ksd"); // } // local search is always allowed?! // problem: first gsm searches a node, then lsm searches the same node = double visit // if(!selector.isFinished(results))// && decider.searchNode(null, provider, results)) selector.selectServices(services) .addResultListener(new DelegationResultListener<Collection<IService>>(ret)); // if(selector instanceof TypeResultSelector && results.toString().indexOf("Add")!=-1) // System.out.println("lsm: "+provider+" "+results); return ret; }