@Override public void putLayerMetadata(String layerName, String key, String value) { readAction( () -> { store(layerName).putLayerMetadata(layerName, key, value); }); }
@Override public boolean deleteByParametersId(String layerName, String parametersId) throws StorageException { return readFunctionUnsafe( () -> store(layerName).deleteByParametersId(layerName, parametersId)); }
protected void readAction(StorageAction function) { readFunction( (StorageAccessor<Void>) () -> { function.run(); return null; }); }
public void sendTileStored(final TileObject stObj) { final long[] xyz = stObj.getXYZ(); final String layerName = stObj.getLayerName(); final String gridSetId = stObj.getGridSetId(); final String blobFormat = stObj.getBlobFormat(); final String paramsId = stObj.getParametersId(); final int blobSize = stObj.getBlobSize(); sendTileStored( layerName, gridSetId, blobFormat, paramsId, xyz[0], xyz[1], (int) xyz[2], blobSize); }
public void sendTileDeleted(final TileObject stObj) { final long[] xyz = stObj.getXYZ(); final String layerName = stObj.getLayerName(); final String gridSetId = stObj.getGridSetId(); final String blobFormat = stObj.getBlobFormat(); final String paramsId = stObj.getParametersId(); final int blobSize = stObj.getBlobSize(); sendTileDeleted( layerName, gridSetId, blobFormat, paramsId, xyz[0], xyz[1], (int) xyz[2], blobSize); }
public void putTransient(TileObject tile) { String key = TransientCache.computeTransientKey(tile); synchronized (transientCache) { transientCache.put(key, tile.getBlob()); } }
@Override public void put(TileObject obj) throws StorageException { readActionUnsafe(() -> store(obj.getLayerName()).put(obj)); }
public boolean getTransient(TileObject tile) { String key = TransientCache.computeTransientKey(tile); Resource resource; synchronized (transientCache) { resource = transientCache.get(key); } tile.setBlob(resource); return resource != null; }
@Override public boolean get(TileObject obj) throws StorageException { return readFunctionUnsafe(() -> store(obj.getLayerName()).get(obj)); }
@Override public boolean delete(TileObject obj) throws StorageException { return readFunctionUnsafe(() -> store(obj.getLayerName()).delete(obj)); }
@Override public boolean delete(TileRange obj) throws StorageException { return readFunctionUnsafe(() -> store(obj.getLayerName()).delete(obj)); }
@Override public boolean deleteByGridsetId(String layerName, String gridSetId) throws StorageException { return readFunctionUnsafe(() -> store(layerName).deleteByGridsetId(layerName, gridSetId)); }
@Override public String getLayerMetadata(String layerName, String key) { return readFunction(() -> store(layerName).getLayerMetadata(layerName, key)); }
@Override public boolean delete(String layerName) throws StorageException { return readFunctionUnsafe(() -> store(layerName).delete(layerName)); }
@Override public Set<String> getParameterIds(String layerName) { return readFunction(() -> store(layerName).getParameterIds(layerName)); }
@Override public Set<Map<String, String>> getParameters(String layerName) { return readFunction(() -> store(layerName).getParameters(layerName)); }
protected void readActionUnsafe(StorageAction function) throws StorageException { readFunctionUnsafe( (StorageAccessor<Void>) () -> { function.run(); return null; }); }
@Override public void setValue(TileObject tile) { String key = TransientCache.computeTransientKey(tile); synchronized (transientCache) { transientCache.put(key, tile.getBlob()); } } }));