use of org.apache.rya.indexing.pcj.fluo.api.DeletePeriodicQuery.QueryDeletionException in project incubator-rya by apache.
the class AccumuloDeletePeriodicPCJ method deletePeriodicPCJ.
@Override
public void deletePeriodicPCJ(final String instanceName, final String pcjId, String topic, String brokers) throws InstanceDoesNotExistException, RyaClientException {
requireNonNull(instanceName);
requireNonNull(pcjId);
final Optional<RyaDetails> originalDetails = getInstanceDetails.getDetails(instanceName);
final boolean ryaInstanceExists = originalDetails.isPresent();
if (!ryaInstanceExists) {
throw new InstanceDoesNotExistException(String.format("The '%s' instance of Rya does not exist.", instanceName));
}
final boolean pcjIndexingEnabled = originalDetails.get().getPCJIndexDetails().isEnabled();
if (!pcjIndexingEnabled) {
throw new RyaClientException(String.format("The '%s' instance of Rya does not have PCJ Indexing enabled.", instanceName));
}
// If the PCJ was being maintained by a Fluo application, then stop that process.
final PCJIndexDetails pcjIndexDetails = originalDetails.get().getPCJIndexDetails();
final Optional<FluoDetails> fluoDetailsHolder = pcjIndexDetails.getFluoDetails();
if (fluoDetailsHolder.isPresent()) {
final String fluoAppName = pcjIndexDetails.getFluoDetails().get().getUpdateAppName();
try {
stopUpdatingPCJ(instanceName, fluoAppName, pcjId, topic, brokers);
} catch (MalformedQueryException | UnsupportedQueryException | QueryDeletionException e) {
throw new RyaClientException(String.format("Unable to delete Periodic Query with id: %s", pcjId), e);
}
} else {
log.error(String.format("Could not stop the Fluo application from updating the PCJ because the Fluo Details are " + "missing for the Rya instance named '%s'.", instanceName));
}
}
Aggregations