}
}
public static void delete(String key, Storage storage)
{
Change change = changeLog.get(key);
if (change != null) {
// Already a change to this key waiting to be pushed to services.
if (change.getStatus() == Status.NEW) {
// If new, just remove it.
changeLog.remove(key);
} else if (change.getStatus() == Status.MODIFIED){
// Can't process a Modification since its file has been deleted.
change.setStatus(Status.DELETED);
}
} else {
// Otherwise make sure to leave a trace of the object
Matcher keyMatcher = keyPattern.matcher(key);
if (keyMatcher.find()) {
String otype = keyMatcher.group(2);
String oid = keyMatcher.group(3);
changeLog.put(key, new Change(oid, otype, Status.DELETED, ChangeLogger.datetime));
}
else {
logger.error("Invalid changelog key: "+key);
}
}