protected <T> T readFunction(StorageAccessor<T> function) { try { return readFunctionUnsafe(function); } catch (StorageException e) { throw Throwables.propagate(e); } }
protected void readActionUnsafe(StorageAction function) throws StorageException { readFunctionUnsafe( (StorageAccessor<Void>) () -> { function.run(); return null; }); }
@Override public boolean rename(String oldLayerName, String newLayerName) throws StorageException { return readFunctionUnsafe( () -> { for (LiveStore bs : blobStores.values()) { BlobStoreInfo config = bs.config; if (config.isEnabled()) { if (bs.liveInstance.rename(oldLayerName, newLayerName)) { return true; } } } return false; }); }
@Override public boolean deleteByParametersId(String layerName, String parametersId) throws StorageException { return readFunctionUnsafe( () -> store(layerName).deleteByParametersId(layerName, parametersId)); }
@Override public boolean deleteByGridsetId(String layerName, String gridSetId) throws StorageException { return readFunctionUnsafe(() -> store(layerName).deleteByGridsetId(layerName, gridSetId)); }
@Override public boolean delete(String layerName) throws StorageException { return readFunctionUnsafe(() -> store(layerName).delete(layerName)); }
@Override public boolean delete(TileRange obj) throws StorageException { return readFunctionUnsafe(() -> store(obj.getLayerName()).delete(obj)); }
@Override public boolean delete(TileObject obj) throws StorageException { return readFunctionUnsafe(() -> store(obj.getLayerName()).delete(obj)); }
@Override public boolean get(TileObject obj) throws StorageException { return readFunctionUnsafe(() -> store(obj.getLayerName()).get(obj)); }