use of org.apache.rya.api.instance.RyaDetailsRepository in project incubator-rya by apache.
the class AccumuloRyaDetailsRepositoryIT method update_outOfDate.
@Test(expected = ConcurrentUpdateException.class)
public void update_outOfDate() throws AccumuloException, AccumuloSecurityException, AlreadyInitializedException, RyaDetailsRepositoryException {
final String instanceName = getRyaInstanceName();
// Create the metadata object the repository will be initialized with.
final RyaDetails details = RyaDetails.builder().setRyaInstanceName(instanceName).setRyaVersion("1.2.3.4").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).setFluoDetails(new FluoDetails("test_instance_rya_pcj_updater")).addPCJDetails(PCJDetails.builder().setId("pcj 1").setUpdateStrategy(PCJUpdateStrategy.BATCH).setLastUpdateTime(new Date())).addPCJDetails(PCJDetails.builder().setId("pcj 2"))).setProspectorDetails(new ProspectorDetails(Optional.of(new Date()))).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.of(new Date()))).build();
// Setup the repository that will be tested using a mini instance of Accumulo.
final Connector connector = getClusterInstance().getConnector();
final RyaDetailsRepository repo = new AccumuloRyaInstanceDetailsRepository(connector, instanceName);
// Initialize the repository
repo.initialize(details);
// Create a new state for the details.
final RyaDetails updated = new RyaDetails.Builder(details).setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).build();
// Try to execute the update where the old state is not the currently stored state.
repo.update(updated, updated);
}
use of org.apache.rya.api.instance.RyaDetailsRepository in project incubator-rya by apache.
the class AccumuloRyaDetailsRepositoryIT method initialize_alreadyInitialized.
@Test(expected = AlreadyInitializedException.class)
public void initialize_alreadyInitialized() throws AlreadyInitializedException, RyaDetailsRepositoryException, AccumuloException, AccumuloSecurityException {
final String instanceName = getRyaInstanceName();
// Create the metadata object the repository will be initialized with.
final RyaDetails details = RyaDetails.builder().setRyaInstanceName(instanceName).setRyaVersion("1.2.3.4").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).setFluoDetails(new FluoDetails("test_instance_rya_pcj_updater")).addPCJDetails(PCJDetails.builder().setId("pcj 1").setUpdateStrategy(PCJUpdateStrategy.BATCH).setLastUpdateTime(new Date())).addPCJDetails(PCJDetails.builder().setId("pcj 2"))).setProspectorDetails(new ProspectorDetails(Optional.of(new Date()))).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.of(new Date()))).build();
// Setup the repository that will be tested using a mini instance of Accumulo.
final Connector connector = getClusterInstance().getConnector();
final RyaDetailsRepository repo = new AccumuloRyaInstanceDetailsRepository(connector, instanceName);
// Initialize the repository
repo.initialize(details);
// Initialize it again.
repo.initialize(details);
}
use of org.apache.rya.api.instance.RyaDetailsRepository in project incubator-rya by apache.
the class DemoDriver method setupRya.
/**
* Format a Mini Accumulo to be a Rya repository.
*
* @param accumulo - The Mini Accumulo cluster Rya will sit on top of. (not null)
* @return The Rya repository sitting on top of the Mini Accumulo.
*/
private static RyaSailRepository setupRya(final MiniAccumuloCluster accumulo) throws AccumuloException, AccumuloSecurityException, RepositoryException, AlreadyInitializedException, RyaDetailsRepositoryException {
checkNotNull(accumulo);
// Setup the Rya Repository that will be used to create Repository Connections.
final RdfCloudTripleStore ryaStore = new RdfCloudTripleStore();
final AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
crdfdao.setConnector(accumuloConn);
// Setup Rya configuration values.
final String ryaInstanceName = "demo_";
final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
conf.setTablePrefix("demo_");
conf.setDisplayQueryPlan(true);
conf.setBoolean(USE_MOCK_INSTANCE, true);
conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, RYA_TABLE_PREFIX);
conf.set(CLOUDBASE_USER, "root");
conf.set(CLOUDBASE_PASSWORD, "password");
conf.set(CLOUDBASE_INSTANCE, accumulo.getInstanceName());
crdfdao.setConf(conf);
ryaStore.setRyaDAO(crdfdao);
final RyaSailRepository ryaRepo = new RyaSailRepository(ryaStore);
ryaRepo.initialize();
// Create Rya Details for the instance name.
final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(accumuloConn, 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);
return ryaRepo;
}
use of org.apache.rya.api.instance.RyaDetailsRepository in project incubator-rya by apache.
the class AccumuloInstall method initializeRyaDetails.
/**
* Initializes the {@link RyaDetails} and stores them for the new instance.
*
* @param instanceName - The name of the instance that is being created. (not null)
* @param installConfig - The instance's install configuration. (not null)
* @param installUser - The user who is installing the instance of Rya. (not null)
* @return The {@link RyaDetails} that were stored.
* @throws AlreadyInitializedException Could not be initialized because
* a table with this instance name has already exists and is holding the details.
* @throws RyaDetailsRepositoryException Something caused the initialization
* operation to fail.
*/
private RyaDetails initializeRyaDetails(final String instanceName, final InstallConfiguration installConfig, final String installUser) throws AlreadyInitializedException, RyaDetailsRepositoryException {
requireNonNull(instanceName);
requireNonNull(installConfig);
requireNonNull(installUser);
final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(getConnector(), instanceName);
// Build the PCJ Index details.
final PCJIndexDetails.Builder pcjDetailsBuilder = PCJIndexDetails.builder().setEnabled(installConfig.isPcjIndexEnabled());
if (installConfig.getFluoPcjAppName().isPresent()) {
final String fluoPcjAppName = installConfig.getFluoPcjAppName().get();
pcjDetailsBuilder.setFluoDetails(new FluoDetails(fluoPcjAppName));
}
final RyaDetails details = RyaDetails.builder().setRyaInstanceName(instanceName).setRyaVersion(getVersion()).addUser(installUser).setTemporalIndexDetails(new TemporalIndexDetails(installConfig.isTemporalIndexEnabled())).setFreeTextDetails(new FreeTextIndexDetails(installConfig.isFreeTextIndexEnabled())).setEntityCentricIndexDetails(new EntityCentricIndexDetails(installConfig.isEntityCentrixIndexEnabled())).setPCJIndexDetails(pcjDetailsBuilder).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>absent())).build();
// Initialize the table.
detailsRepo.initialize(details);
return details;
}
use of org.apache.rya.api.instance.RyaDetailsRepository 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);
}
Aggregations