private synchronized <T extends DummyObject> void deleteObjectByName(Class<T> type, Map<String,T> map, String name) throws ObjectDoesNotExistException, ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException {
checkBlockOperations();
recordWriteOperation("delete");
breakIt(deleteBreakMode, "delete");
delayOperation();
String normalName = normalize(name);
T existingObject;
if (!enforceUniqueName) {
throw new IllegalStateException("Whoops! got into deleteObjectByName without enforceUniqueName");
}
if (map.containsKey(normalName)) {
existingObject = map.get(normalName);
map.remove(normalName);
allObjects.remove(existingObject.getId());
} else {
throw new ObjectDoesNotExistException(type.getSimpleName()+" with name '"+normalName+"' does not exist");
}
if (syncStyle != DummySyncStyle.NONE) {
int syncToken = nextSyncToken();
DummyDelta delta = new DummyDelta(syncToken, type, existingObject.getId(), name, DummyDeltaType.DELETE);
deltas.add(delta);
}
}