use of org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException in project incubator-rya by apache.
the class AccumuloUninstall method uninstall.
@Override
public void uninstall(final String ryaInstanceName) throws InstanceDoesNotExistException, RyaClientException {
requireNonNull(ryaInstanceName);
// Ensure the Rya Instance exists.
if (!instanceExists.exists(ryaInstanceName)) {
throw new InstanceDoesNotExistException(String.format("There is no Rya instance named '%s'.", ryaInstanceName));
}
try {
// Build the list of tables that are present within the Rya instance.
final List<String> tables = new RyaTableNames().getTableNames(ryaInstanceName, getConnector());
// Delete them.
final TableOperations tableOps = getConnector().tableOperations();
for (final String table : tables) {
try {
tableOps.delete(table);
} catch (final TableNotFoundException e) {
log.warn("Uninstall could not delete table named '" + LogUtils.clean(table) + "' because it does not exist. " + "Something else is also deleting tables.");
}
}
} catch (PCJStorageException | RyaDetailsRepositoryException e) {
throw new RyaClientException("Could not uninstall the Rya instance named '" + ryaInstanceName + "' because we could not determine which tables are associated with it.", e);
} catch (AccumuloException | AccumuloSecurityException e) {
throw new RyaClientException("Could not uninstall the Rya instance named '" + ryaInstanceName + "' because of a problem interacting with Accumulo..", e);
}
}
use of org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException in project incubator-rya by apache.
the class MongoBatchUpdatePCJ method verifyPCJState.
private void verifyPCJState(final String ryaInstanceName, final String pcjId, final MongoClient client) throws RyaClientException {
try {
// Fetch the Rya instance's details.
final RyaDetailsRepository detailsRepo = new MongoRyaInstanceDetailsRepository(client, ryaInstanceName);
final RyaDetails ryaDetails = detailsRepo.getRyaInstanceDetails();
// Ensure PCJs are enabled.
if (!ryaDetails.getPCJIndexDetails().isEnabled()) {
throw new RyaClientException("PCJs are not enabled for the Rya instance named '" + ryaInstanceName + "'.");
}
// Ensure the PCJ exists.
if (!ryaDetails.getPCJIndexDetails().getPCJDetails().containsKey(pcjId)) {
throw new PCJDoesNotExistException("The PCJ with id '" + pcjId + "' does not exist within Rya instance '" + ryaInstanceName + "'.");
}
} catch (final NotInitializedException e) {
throw new InstanceDoesNotExistException("No RyaDetails are initialized for the Rya instance named '" + ryaInstanceName + "'.", e);
} catch (final RyaDetailsRepositoryException e) {
throw new RyaClientException("Could not fetch the RyaDetails for the Rya instance named '" + ryaInstanceName + "'.", e);
}
}
use of org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException in project incubator-rya by apache.
the class MongoPcjStorage method listPcjs.
@Override
public List<String> listPcjs() throws PCJStorageException {
try {
final RyaDetails details = ryaDetailsRepo.getRyaInstanceDetails();
final PCJIndexDetails pcjIndexDetails = details.getPCJIndexDetails();
final List<String> pcjIds = new ArrayList<>(pcjIndexDetails.getPCJDetails().keySet());
return pcjIds;
} catch (final RyaDetailsRepositoryException e) {
throw new PCJStorageException("Could not check to see if RyaDetails exist for the instance.", e);
}
}
use of org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException in project incubator-rya by apache.
the class MongoPcjStorage method createPcj.
@Override
public String createPcj(final String sparql) throws PCJStorageException {
requireNonNull(sparql);
// Update the Rya Details for this instance to include the new PCJ
// table.
final String pcjId = pcjIdFactory.nextId();
try {
new RyaDetailsUpdater(ryaDetailsRepo).update(originalDetails -> {
// Create the new PCJ's details.
final PCJDetails.Builder newPcjDetails = PCJDetails.builder().setId(pcjId);
// Add them to the instance's details.
final RyaDetails.Builder mutated = RyaDetails.builder(originalDetails);
mutated.getPCJIndexDetails().addPCJDetails(newPcjDetails);
return mutated.build();
});
} catch (final RyaDetailsRepositoryException | CouldNotApplyMutationException e) {
throw new PCJStorageException(String.format("Could not create a new PCJ for Rya instance '%s' " + "because of a problem while updating the instance's details.", ryaInstanceName), e);
}
// Create the objectID of the document to house the PCJ results.
pcjDocs.createPcj(pcjId, sparql);
// instance of Rya.
return pcjId;
}
use of org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException in project incubator-rya by apache.
the class AccumuloPcjStorage method listPcjs.
@Override
public List<String> listPcjs() throws PCJStorageException {
try {
final RyaDetails details = ryaDetailsRepo.getRyaInstanceDetails();
final PCJIndexDetails pcjIndexDetails = details.getPCJIndexDetails();
final List<String> pcjIds = new ArrayList<>(pcjIndexDetails.getPCJDetails().keySet());
return pcjIds;
} catch (final RyaDetailsRepositoryException e) {
throw new PCJStorageException("Could not check to see if RyaDetails exist for the instance.", e);
}
}
Aggregations