use of org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository in project incubator-rya by apache.
the class AccumuloIndexSetColumnVisibilityTest method initRyaDetails.
private static void initRyaDetails() throws AlreadyInitializedException, RyaDetailsRepositoryException {
// Initialize the Rya Details for the instance.
final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(accCon, ryaInstanceName);
final RyaDetails details = RyaDetails.builder().setRyaInstanceName(ryaInstanceName).setRyaVersion("0.0.0.0").setFreeTextDetails(new FreeTextIndexDetails(true)).setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>absent())).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).build();
detailsRepo.initialize(details);
}
use of org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository in project incubator-rya by apache.
the class RyaTableNames method getTableNames.
/**
* Get the the Accumulo table names that are used by an instance of Rya.
*
* @param ryaInstanceName - The name of the Rya instance. (not null)
* @param conn - A connector to the host Accumulo instance. (not null)
* @return The Accumulo table names that are used by the Rya instance.
* @throws NotInitializedException The instance's Rya Details have not been initialized.
* @throws RyaDetailsRepositoryException General problem with the Rya Details repository.
* @throws PCJStorageException General problem with the PCJ storage.
*/
public List<String> getTableNames(final String ryaInstanceName, final Connector conn) throws NotInitializedException, RyaDetailsRepositoryException, PCJStorageException {
// Build the list of tables that may be present within the Rya instance.
final List<String> tables = new ArrayList<>();
// Core Rya tables.
final TableLayoutStrategy coreTableNames = new TablePrefixLayoutStrategy(ryaInstanceName);
tables.add(coreTableNames.getSpo());
tables.add(coreTableNames.getPo());
tables.add(coreTableNames.getOsp());
tables.add(coreTableNames.getEval());
tables.add(coreTableNames.getNs());
tables.add(coreTableNames.getProspects());
tables.add(coreTableNames.getSelectivity());
// Rya Details table.
tables.add(AccumuloRyaInstanceDetailsRepository.makeTableName(ryaInstanceName));
// Secondary Indexer Tables.
final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(conn, ryaInstanceName);
final RyaDetails details = detailsRepo.getRyaInstanceDetails();
if (details.getEntityCentricIndexDetails().isEnabled()) {
tables.add(EntityCentricIndex.makeTableName(ryaInstanceName));
}
if (details.getFreeTextIndexDetails().isEnabled()) {
tables.addAll(AccumuloFreeTextIndexer.makeTableNames(ryaInstanceName));
}
if (details.getTemporalIndexDetails().isEnabled()) {
tables.add(AccumuloTemporalIndexer.makeTableName(ryaInstanceName));
}
if (details.getPCJIndexDetails().isEnabled()) {
try (final PrecomputedJoinStorage pcjStorage = new AccumuloPcjStorage(conn, ryaInstanceName)) {
final List<String> pcjIds = pcjStorage.listPcjs();
final PcjTableNameFactory tableNameFactory = new PcjTableNameFactory();
for (final String pcjId : pcjIds) {
tables.add(tableNameFactory.makeTableName(ryaInstanceName, pcjId));
}
}
}
// Verify they actually exist. If any don't, remove them from the list.
final TableOperations tableOps = conn.tableOperations();
final Iterator<String> tablesIt = tables.iterator();
while (tablesIt.hasNext()) {
final String table = tablesIt.next();
if (!tableOps.exists(table)) {
tablesIt.remove();
}
}
return tables;
}
use of org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository in project incubator-rya by apache.
the class RyaTestInstanceRule method before.
@Override
protected void before() throws Throwable {
// Get the next Rya instance name.
ryaInstanceName = "testInstance_" + ryaInstanceNameCounter.getAndIncrement();
if (install) {
// Create Rya Details for the instance name.
final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(cluster.getConnector(), ryaInstanceName);
final RyaDetails details = RyaDetails.builder().setRyaInstanceName(ryaInstanceName).setRyaVersion("0.0.0.0").setFreeTextDetails(new FreeTextIndexDetails(true)).setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.absent())).setProspectorDetails(new ProspectorDetails(Optional.absent())).build();
detailsRepo.initialize(details);
}
}
use of org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository in project incubator-rya by apache.
the class AccumuloGetInstanceDetails method getDetails.
@Override
public Optional<RyaDetails> getDetails(final String instanceName) throws InstanceDoesNotExistException, RyaClientException {
requireNonNull(instanceName);
// Ensure the Rya instance exists.
if (!instanceExists.exists(instanceName)) {
throw new InstanceDoesNotExistException(String.format("There is no Rya instance named '%s'.", instanceName));
}
// If the instance has details, then return them.
final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(getConnector(), instanceName);
try {
return Optional.of(detailsRepo.getRyaInstanceDetails());
} catch (final NotInitializedException e) {
return Optional.absent();
} catch (final RyaDetailsRepositoryException e) {
throw new RyaClientException("Could not fetch the Rya instance's details.", e);
}
}
Aggregations