Search in sources :

Example 1 with DeletedEntityDAO

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());
}
Also used : DeletedObservation(ca.nrc.cadc.caom2.DeletedObservation) ResourceNotFoundException(ca.nrc.cadc.net.ResourceNotFoundException) DeletedEntityDAO(ca.nrc.cadc.caom2.persistence.DeletedEntityDAO)

Example 2 with DeletedEntityDAO

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;
}
Also used : DeletedEntityDAO(ca.nrc.cadc.caom2.persistence.DeletedEntityDAO)

Example 3 with DeletedEntityDAO

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());
        }
    }
}
Also used : ObservationDAO(ca.nrc.cadc.caom2.persistence.ObservationDAO) RepoClient(ca.nrc.cadc.caom2.repo.client.RepoClient) DeletedEntityDAO(ca.nrc.cadc.caom2.persistence.DeletedEntityDAO)

Example 4 with DeletedEntityDAO

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);
}
Also used : ObservationDAO(ca.nrc.cadc.caom2.persistence.ObservationDAO) DeletedEntityDAO(ca.nrc.cadc.caom2.persistence.DeletedEntityDAO)

Aggregations

DeletedEntityDAO (ca.nrc.cadc.caom2.persistence.DeletedEntityDAO)4 ObservationDAO (ca.nrc.cadc.caom2.persistence.ObservationDAO)2 DeletedObservation (ca.nrc.cadc.caom2.DeletedObservation)1 RepoClient (ca.nrc.cadc.caom2.repo.client.RepoClient)1 ResourceNotFoundException (ca.nrc.cadc.net.ResourceNotFoundException)1