return services;
}
Service findService(String id, String ver) throws ServiceException {
Version version = (ver != null) ? new Version(ver) : null;
Collection services = loadServices();
// the id is actually the pathinfo, in case workspace specific services
// are active we want to skip the workspace part in the path and go directly to the
// servlet, which normally, if we ended up here, is a reflector (wms/kml)
if(id.contains("/")) {
id = id.substring(id.indexOf("/") + 1);
}
//first just match on service,request
List matches = new ArrayList();
for (Iterator itr = services.iterator(); itr.hasNext();) {
Service sBean = (Service) itr.next();
if (sBean.getId().equalsIgnoreCase(id)) {
matches.add(sBean);
}
}
if (matches.isEmpty()) {
return null;
}
Service sBean = null;
//if multiple, use version to filter match
if (matches.size() > 1) {
List vmatches = new ArrayList(matches);
//match up the version
if (version != null) {
//version specified, look for a match
for (Iterator itr = vmatches.iterator(); itr.hasNext();) {
Service s = (Service) itr.next();
if (version.equals(s.getVersion())) {
continue;
}
itr.remove();
}