/** * Empty repository directory, record count and specific Data Source temporary files and * directories. * * @throws Exception */ public void cleanUp() throws IOException { // Delete records indexes for (AccessPoint accessPoint : getAccessPoints().values()) { try { RepoxContextUtil.getRepoxManager().getAccessPointsManager().emptyIndex(this, accessPoint); log.info("Emptied AccessPoint with id " + accessPoint.getId()); } catch (Exception e) { log.error("Unable to empty Table from Database: " + accessPoint.getId(), e); } } File dataSourceDir = getDataSourceDir(); boolean deletedDir = true; if (dataSourceDir.exists()) { deletedDir = FileUtil.deleteDir(dataSourceDir); dataSourceDir.mkdir(); } if (!deletedDir) { log.error("Unable to delete Data Source dir from Data Source with id " + id); } else { log.info("Deleted Data Source dir with success from Data Source with id " + id); } RepoxContextUtil.getRepoxManager().getRecordCountManager().removeDataSourceCounts(id); }
private File getLogFile(String taskId) { String yearMonthString = Calendar.getInstance().get(Calendar.YEAR) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1); File logsMonthDir = new File(getLogsDir(), yearMonthString); logsMonthDir.mkdir(); File logFile = new File( logsMonthDir, taskId + "_" + DateFormatUtils.format(new Date(), TimeUtil.LONG_DATE_FORMAT_COMPACT) + ".log"); return logFile; }
public File getDataSourceLogsDir(String dataSourceId) { File logDir = new File(getDataSourceDir(dataSourceId), "logs"); logDir.mkdir(); return logDir; }
public File getDataSourceDir(String dataSourceId) { RepoxConfiguration configuration = RepoxContextUtil.getRepoxManager().getConfiguration(); File dataSourceDir = new File(configuration.getRepositoryPath(), dataSourceId); dataSourceDir.mkdir(); return dataSourceDir; }
public File getTasksDir() { File tasksDir = new File(getOutputDir(), "tasks"); tasksDir.mkdir(); return tasksDir; }
public File getLogsDir() { File logDir = new File(getOutputDir(), "logs"); logDir.mkdir(); return logDir; }
public File getOutputDir() { File outputDir = new File(RepoxContextUtil.getRepoxManager().getConfiguration().getRepositoryPath(), id); outputDir.mkdir(); return outputDir; }