* @param cls - The class interpret the value as.
* @return - The object from storage.
*/
public BaseObject get(String key, Class<? extends BaseObject> cls)
{
BaseObject value = null;
if (memory.containsKey(key)) {
logger.debug("Cache hit: "+key);
value = memory.get(key);
}
else {
logger.debug("Cache miss: "+key);
File storageFile = getStorageFile(key);
if (storageFile != null) {
try {
if (cls == Bill.class) {
value = this.converter.readBill(storageFile);
}
else if (cls == Agenda.class) {
value = this.converter.readAgenda(storageFile);
}
else if (cls == Meeting.class) {
value = this.converter.readMeeting(storageFile);
}
else if (cls == Calendar.class) {
value = this.converter.readCalendar(storageFile);
}
else if (cls == Transcript.class) {
value = this.converter.readTranscript(storageFile);
}
else {
logger.error("Unable to read value of type "+cls.getName()+" from: "+storageFile);
return null;
}
value.setBrandNew(false);
} catch (org.codehaus.jackson.JsonParseException e) {
logger.error("could not parse json", e);
} catch (JsonMappingException e) {
logger.error("could not map json", e);
} catch (IOException e) {