Search in sources :

Example 6 with InternalIngestException

use of ddf.catalog.source.InternalIngestException in project ddf by codice.

the class DeleteOperations method performLocalDelete.

private DeleteResponse performLocalDelete(DeleteRequest deleteRequest, DeleteStorageRequest deleteStorageRequest) throws IngestException {
    if (!Requests.isLocal(deleteRequest)) {
        return null;
    }
    try {
        sourceOperations.getStorage().delete(deleteStorageRequest);
    } catch (StorageException e) {
        LOGGER.info("Unable to delete stored content items. Not removing stored metacards", e);
        throw new InternalIngestException("Unable to delete stored content items. Not removing stored metacards.", e);
    }
    DeleteResponse deleteResponse = sourceOperations.getCatalog().delete(deleteRequest);
    deleteResponse = injectAttributes(deleteResponse);
    try {
        historian.version(deleteResponse);
    } catch (SourceUnavailableException e) {
        LOGGER.debug("Could not version deleted item!", e);
        throw new IngestException("Could not version deleted Item!");
    }
    return deleteResponse;
}
Also used : SourceUnavailableException(ddf.catalog.source.SourceUnavailableException) DeleteResponse(ddf.catalog.operation.DeleteResponse) InternalIngestException(ddf.catalog.source.InternalIngestException) InternalIngestException(ddf.catalog.source.InternalIngestException) IngestException(ddf.catalog.source.IngestException) StorageException(ddf.catalog.content.StorageException)

Example 7 with InternalIngestException

use of ddf.catalog.source.InternalIngestException in project ddf by codice.

the class DeleteOperations method doDelete.

//
// Private helper methods
//
public DeleteResponse doDelete(DeleteRequest deleteRequest, List<String> fanoutTagBlacklist) throws IngestException, SourceUnavailableException {
    DeleteStorageRequest deleteStorageRequest = null;
    DeleteResponse deleteResponse = null;
    deleteRequest = queryOperations.setFlagsOnRequest(deleteRequest);
    deleteRequest = validateDeleteRequest(deleteRequest);
    deleteRequest = validateLocalSource(deleteRequest);
    try {
        deleteRequest = populateMetacards(deleteRequest, fanoutTagBlacklist);
        deleteRequest = preProcessPreAuthorizationPlugins(deleteRequest);
        deleteStorageRequest = new DeleteStorageRequestImpl(getDeleteMetacards(deleteRequest), deleteRequest.getProperties());
        deleteRequest = processPreDeletePolicyPlugins(deleteRequest);
        deleteRequest = processPreDeleteAccessPlugins(deleteRequest);
        deleteRequest = processPreIngestPlugins(deleteRequest);
        deleteRequest = validateDeleteRequest(deleteRequest);
        // Call the Provider delete method
        LOGGER.debug("Calling catalog.delete() with {} entries.", deleteRequest.getAttributeValues().size());
        deleteResponse = performLocalDelete(deleteRequest, deleteStorageRequest);
        deleteResponse = remoteDeleteOperations.performRemoteDelete(deleteRequest, deleteResponse);
        deleteResponse = postProcessPreAuthorizationPlugins(deleteResponse);
        deleteRequest = populateDeleteRequestPolicyMap(deleteRequest, deleteResponse);
        deleteResponse = processPostDeleteAccessPlugins(deleteResponse);
        // Post results to be available for pubsub
        deleteResponse = validateFixDeleteResponse(deleteResponse, deleteRequest);
    } catch (StopProcessingException see) {
        LOGGER.debug(PRE_INGEST_ERROR + see.getMessage(), see);
        throw new IngestException(PRE_INGEST_ERROR + see.getMessage());
    } catch (RuntimeException re) {
        LOGGER.info("Exception during runtime while performing delete", re);
        throw new InternalIngestException("Exception during runtime while performing delete");
    } finally {
        if (deleteStorageRequest != null) {
            try {
                sourceOperations.getStorage().commit(deleteStorageRequest);
            } catch (StorageException e) {
                LOGGER.info("Unable to remove stored content items.", e);
            }
        }
    }
    deleteResponse = doPostIngest(deleteResponse);
    return deleteResponse;
}
Also used : DeleteStorageRequest(ddf.catalog.content.operation.DeleteStorageRequest) DeleteStorageRequestImpl(ddf.catalog.content.operation.impl.DeleteStorageRequestImpl) DeleteResponse(ddf.catalog.operation.DeleteResponse) InternalIngestException(ddf.catalog.source.InternalIngestException) InternalIngestException(ddf.catalog.source.InternalIngestException) IngestException(ddf.catalog.source.IngestException) StopProcessingException(ddf.catalog.plugin.StopProcessingException) StorageException(ddf.catalog.content.StorageException)

Aggregations

IngestException (ddf.catalog.source.IngestException)7 InternalIngestException (ddf.catalog.source.InternalIngestException)7 SourceUnavailableException (ddf.catalog.source.SourceUnavailableException)5 CreateResponse (ddf.catalog.operation.CreateResponse)4 StorageException (ddf.catalog.content.StorageException)3 QueryResponse (ddf.catalog.operation.QueryResponse)3 SourceInfoResponse (ddf.catalog.operation.SourceInfoResponse)3 StopProcessingException (ddf.catalog.plugin.StopProcessingException)3 Response (javax.ws.rs.core.Response)3 MetacardCreationException (ddf.catalog.data.MetacardCreationException)2 DeleteResponse (ddf.catalog.operation.DeleteResponse)2 MimeType (javax.activation.MimeType)2 Consumes (javax.ws.rs.Consumes)2 Path (javax.ws.rs.Path)2 Attachment (org.apache.cxf.jaxrs.ext.multipart.Attachment)2 CreateStorageRequest (ddf.catalog.content.operation.CreateStorageRequest)1 DeleteStorageRequest (ddf.catalog.content.operation.DeleteStorageRequest)1 UpdateStorageRequest (ddf.catalog.content.operation.UpdateStorageRequest)1 CreateStorageRequestImpl (ddf.catalog.content.operation.impl.CreateStorageRequestImpl)1 DeleteStorageRequestImpl (ddf.catalog.content.operation.impl.DeleteStorageRequestImpl)1