/** Delete a particular tile */ public boolean delete(TileObject stObj) throws StorageException { File fh = getFileHandleTile(stObj, false); boolean ret = false; // we call fh.length() here to check wthether the file exists and its length in a single // operation cause lots of calls to exists() may raise the file system cache usage to the // ceiling. File.length() returns 0 if the file does not exist anyway final long length = fh.length(); final boolean exists = length > 0; if (exists) { if (!fh.delete()) { throw new StorageException("Unable to delete " + fh.getAbsolutePath()); } stObj.setBlobSize((int) padSize(length)); listeners.sendTileDeleted(stObj); ret = true; } else { log.trace("delete unexistant file " + fh.toString()); } // Look at the parent directory to prune it if empty File parentDir = fh.getParentFile(); // Try deleting the directory (will not do it if the directory contains files) parentDir.delete(); return ret; }
long x = Long.parseLong(coords[0]); long y = Long.parseLong(coords[1]); listeners.sendTileDeleted( layerName, gridSetId,
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); }
mbtiles.saveTile(gtTile); listeners.sendTileDeleted(tile); if (useCreateTime) {
mbtiles.saveTile(gtTile); listeners.sendTileDeleted(tile); if (useCreateTime) {
@Override public boolean delete(TileObject obj) throws StorageException { final String key = keyBuilder.forTile(obj); // don't bother for the extra call if there are no listeners if (listeners.isEmpty()) { return s3Ops.deleteObject(key); } ObjectMetadata oldObj = s3Ops.getObjectMetadata(key); if (oldObj == null) { return false; } s3Ops.deleteObject(key); obj.setBlobSize((int) oldObj.getContentLength()); listeners.sendTileDeleted(obj); return true; }
@Override public boolean delete(TileObject obj) throws StorageException { final String key = keyBuilder.forTile(obj); // don't bother for the extra call if there are no listeners if (listeners.isEmpty()) { return s3Ops.deleteObject(key); } ObjectMetadata oldObj = s3Ops.getObjectMetadata(key); if (oldObj == null) { return false; } s3Ops.deleteObject(key); obj.setBlobSize((int) oldObj.getContentLength()); listeners.sendTileDeleted(obj); return true; }