HashMap<String,ServiceRecordBean> serviceMap = new HashMap<String,ServiceRecordBean>();
// Get the historical service records:
ServiceRecordPersistencyRemote srp = ServiceRecordPersistencyImpl.getInstance();
for( ServiceRecordImpl sr : srp.getAllServiceRecords() ) {
log.info("Putting service record: "+sr.getServiceName()+" : '"+sr.getServiceHash()+"'");
serviceMap.put(sr.getServiceHash(), new ServiceRecordBean(sr) );
}
// Now get the active services and patch these records in:
List<ServiceDescription> serviceList = getListOfServices(null);
//log.info("Query result: "+serviceList);
if( serviceList != null ) log.info("Matched services = "+serviceList.size());
for( ServiceDescription sd : serviceList ) {
if( serviceMap.containsKey(""+sd.hashCode()) ) {
log.info("Updating bean for service: "+sd.getName()+" : '"+sd.hashCode()+"'");
serviceMap.get(""+sd.hashCode()).setServiceDescription(sd);
} else {
serviceMap.put(""+sd.hashCode(), new ServiceRecordBean(sd) );
log.info("Putting in service: "+sd.getName()+" : '"+sd.hashCode()+"'");
}
}
return new ArrayList<ServiceRecordBean>(serviceMap.values());