use of ca.nrc.cadc.caom2.persistence.DeletedEntityDAO in project caom2db by opencadc.
the class GetDeletedAction method doList.
protected void doList(int maxRec, Date start, Date end, boolean isAscending) throws Exception {
log.debug("START: " + getCollection());
checkReadPermission();
DeletedEntityDAO dao = getDeletedDAO();
List<DeletedObservation> dels = dao.getList(getCollection(), start, end, maxRec);
if (dels == null) {
throw new ResourceNotFoundException("Collection not found: " + getCollection());
}
long byteCount = writeDeleted(dels);
logInfo.setBytes(byteCount);
log.debug("DONE: " + getCollection());
}
use of ca.nrc.cadc.caom2.persistence.DeletedEntityDAO in project caom2db by opencadc.
the class RepoAction method getDeletedDAO.
protected DeletedEntityDAO getDeletedDAO() throws IOException {
if (deletedDAO == null) {
this.deletedDAO = new DeletedEntityDAO();
deletedDAO.setConfig(getDAOConfig(collection));
}
return deletedDAO;
}
use of ca.nrc.cadc.caom2.persistence.DeletedEntityDAO in project caom2db by opencadc.
the class DeletionHarvester method init.
/**
* initialize of the harvester
*
* @param uri
* uri to be used
* @param collection
* collection to work on
* @param threads
* number of threads to be used
* @throws IOException
* IOException
*/
private void init() throws IOException {
// source
if (src.getResourceType() == HarvestResource.SOURCE_DB && src.getDatabaseServer() != null) {
Map<String, Object> config1 = getConfigDAO(src);
this.deletedDAO = new DeletedEntityDAO();
deletedDAO.setConfig(config1);
ready = true;
} else if (src.getResourceType() == HarvestResource.SOURCE_URI) {
this.repoClient = new RepoClient(src.getResourceID(), 1);
} else {
this.repoClient = new RepoClient(src.getCapabilitiesURL(), 1);
}
// destination
Map<String, Object> config2 = getConfigDAO(dest);
this.obsDAO = new ObservationDAO();
obsDAO.setConfig(config2);
this.txnManager = obsDAO.getTransactionManager();
initHarvestState(obsDAO.getDataSource(), entityClass);
if (repoClient != null) {
if (repoClient.isDelAvailable()) {
ready = true;
} else {
log.warn("Not available deletion endpoint in " + repoClient.toString());
}
}
}
use of ca.nrc.cadc.caom2.persistence.DeletedEntityDAO in project caom2db by opencadc.
the class ObservationRemover method init.
private void init() throws IOException, URISyntaxException {
Map<String, Object> config2 = getConfigDAO(target);
this.obsDAO = new ObservationDAO();
obsDAO.setConfig(config2);
// copy as-is
obsDAO.setOrigin(false);
this.deletedDAO = new DeletedEntityDAO();
deletedDAO.setConfig(config2);
}
Aggregations