/** * 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); }
protected boolean emptyRecords() throws IOException { boolean successfulDeletion = true; // Delete records indexes for (AccessPoint accessPoint : this.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); successfulDeletion = false; } } // Remove from Record Counts cache RepoxContextUtil.getRepoxManager().getRecordCountManager().removeDataSourceCounts(id); return successfulDeletion; }
public void initAccessPoints() { // initialization of the default AccessPoints used internally by REPOX AccessPoint defaultTimestampAP = new AccessPointTimestamp(id + "_timestamp"); defaultTimestampAP.setIndexDeletedRecords(false); defaultTimestampAP.setRepoxInternal(true); this.accessPoints.put(defaultTimestampAP.getId(), defaultTimestampAP); /* AccessPoint deletedTimestampAP = new AccessPointTimestamp(id + "_timestamp_deleted"); deletedTimestampAP.setIndexDeletedRecords(true); deletedTimestampAP.setRepoxInternal(true); this.accessPoints.put(deletedTimestampAP.getId(), deletedTimestampAP); */ AccessPoint defaultRecordAP = new AccessPointRecordRepoxFull(id + "_record"); defaultRecordAP.setRepoxInternal(true); this.accessPoints.put(defaultRecordAP.getId(), defaultRecordAP); }