/** * Check the services according the the scope. * @param it The services. * @param cid The component id. * @param scope The scope. * @return The services that fit to the scope. */ // read protected <T> Collection<T> checkScope(final Iterator<T> it, final IComponentIdentifier cid, final String scope, boolean oneresult) { Collection<T> ret = new LinkedHashSet<T>(); while(it.hasNext()) { final T ser = it.next(); if(checkSearchScope(cid, (IService)ser, scope, false) && checkPublicationScope(cid, (IService)ser)) { ret.add(ser); if(oneresult) break; } } return ret; }
/** * Search for services. */ // read public <T> Collection<T> searchServices(ClassInfo type, IComponentIdentifier cid, String scope) { Set<T> ret = null; Iterator<IService> sers = getServices(type); if(sers!=null && sers.hasNext() && !RequiredServiceInfo.SCOPE_NONE.equals(scope)) { ret = new HashSet<T>(); while(sers.hasNext()) { IService ser = sers.next(); if(checkSearchScope(cid, ser, scope, false) && checkPublicationScope(cid, ser)) { ret.add((T)ser); } } } return ret; }
/** * Search for services. */ // read public <T> T searchService(ClassInfo type, IComponentIdentifier cid, String scope, boolean excluded) { // if(type!=null && type.getName().indexOf("IRegistrySer")!=-1) // System.out.println("search: "+type+" - "+cid); T ret = null; Iterator<IService> sers = getServices(type); if(sers!=null && sers.hasNext() && !RequiredServiceInfo.SCOPE_NONE.equals(scope)) { while(sers.hasNext()) { IService ser = sers.next(); if(checkSearchScope(cid, ser, scope, excluded) && checkPublicationScope(cid, ser)) { // if(ret!=null) // System.out.println("found another: "+ser.getServiceIdentifier()); ret = (T)ser; break; } } } return ret; }
if(checkSearchScope(cid, (IService)ser, scope, false) && checkPublicationScope(cid, (IService)ser))
if(checkSearchScope(cid, (IService)ser, scope, false) && checkPublicationScope(cid, (IService)ser))
String scope = queryinfo.getQuery().getScope(); IAsyncFilter<IService> filter = (IAsyncFilter)queryinfo.getQuery().getFilter(); if(!checkSearchScope(cid, service, scope, false) || !checkPublicationScope(cid, service))