Beispiel #1
0
  /**
   * 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);
  }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 public File getDataSourceLogsDir(String dataSourceId) {
   File logDir = new File(getDataSourceDir(dataSourceId), "logs");
   logDir.mkdir();
   return logDir;
 }
Beispiel #4
0
 public File getDataSourceDir(String dataSourceId) {
   RepoxConfiguration configuration = RepoxContextUtil.getRepoxManager().getConfiguration();
   File dataSourceDir = new File(configuration.getRepositoryPath(), dataSourceId);
   dataSourceDir.mkdir();
   return dataSourceDir;
 }
Beispiel #5
0
 public File getTasksDir() {
   File tasksDir = new File(getOutputDir(), "tasks");
   tasksDir.mkdir();
   return tasksDir;
 }
Beispiel #6
0
 public File getLogsDir() {
   File logDir = new File(getOutputDir(), "logs");
   logDir.mkdir();
   return logDir;
 }
Beispiel #7
0
 public File getOutputDir() {
   File outputDir =
       new File(RepoxContextUtil.getRepoxManager().getConfiguration().getRepositoryPath(), id);
   outputDir.mkdir();
   return outputDir;
 }