@Override public void visit(Type type) { try { List<TileSet> images = tileSetDao.listByProviderAndType(currentProvider.getShortName(), type.getName()); for (TileSet tileSet : images) { if (tileSet.getTs().isBefore(limit) && tileSet.getStatus() != TileSet.Status.CONVERTING && tileSet.getStatus() != TileSet.Status.DELETING) { try { tileSet.setStatus(TileSet.Status.DELETING); tileSetDao.saveEntity(tileSet); result.deleted++; } catch (Exception e) { String msg = "Fatal error marking tile set entry " + tileSet.getName() + " as being deleted"; logger.error(msg, e); embryoLogService.error(msg, e); result.errorCount++; } } } } catch (Exception e) { String msg = "Fatal error marking tile sets as being deleted for provider " + currentProvider.getShortName() + " and type " + type.getName(); logger.error(msg, e); embryoLogService.error(msg, e); result.errorCount++; } }
@Override public void visit(Type type) { try { File directory = new File(tileDirectory); if (!directory.exists()) { return; } Map<String, TileSet> imageMap = getTileSets(type); File[] files = directory.listFiles(); logger.debug("Files: " + files); for (File file : files) { String tileSetName = file.getName().replaceAll(".mbtiles", ""); if (!imageMap.containsKey(tileSetName)) { if (FileUtils.deleteQuietly(file)) { result.deleted++; } else { String msg = "Failed deleting tiles " + file.getAbsolutePath(); logger.error(msg); embryoLogService.error(msg); result.errorCount++; } } } } catch (Exception e) { String msg = "Fatal error deleting tiles for provider " + currentProvider.getShortName() + " and type " + type.getName(); logger.error(msg, e); embryoLogService.error(msg, e); result.errorCount++; } }