Search in sources :

Example 16 with RyaDetailsRepository

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);
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) Connector(org.apache.accumulo.core.client.Connector) RyaDetails(org.apache.rya.api.instance.RyaDetails) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetailsRepository(org.apache.rya.api.instance.RyaDetailsRepository) FluoDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails) Test(org.junit.Test)

Example 17 with RyaDetailsRepository

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);
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) Connector(org.apache.accumulo.core.client.Connector) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetailsRepository(org.apache.rya.api.instance.RyaDetailsRepository) RyaDetails(org.apache.rya.api.instance.RyaDetails) FluoDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) Test(org.junit.Test)

Example 18 with RyaDetailsRepository

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;
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) RdfCloudTripleStore(org.apache.rya.rdftriplestore.RdfCloudTripleStore) AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) RyaDetails(org.apache.rya.api.instance.RyaDetails) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) AccumuloRyaInstanceDetailsRepository(org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) Date(java.util.Date) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetailsRepository(org.apache.rya.api.instance.RyaDetailsRepository)

Example 19 with RyaDetailsRepository

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;
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) RyaDetails(org.apache.rya.api.instance.RyaDetails) AccumuloRyaInstanceDetailsRepository(org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetailsRepository(org.apache.rya.api.instance.RyaDetailsRepository) FluoDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails) PCJIndexDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails)

Example 20 with RyaDetailsRepository

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);
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetailsRepository(org.apache.rya.api.instance.RyaDetailsRepository) RyaDetails(org.apache.rya.api.instance.RyaDetails) AccumuloRyaInstanceDetailsRepository(org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) Date(java.util.Date)

Aggregations

RyaDetailsRepository (org.apache.rya.api.instance.RyaDetailsRepository)31 RyaDetails (org.apache.rya.api.instance.RyaDetails)22 Date (java.util.Date)16 Test (org.junit.Test)16 EntityCentricIndexDetails (org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails)15 FreeTextIndexDetails (org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails)15 JoinSelectivityDetails (org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails)15 ProspectorDetails (org.apache.rya.api.instance.RyaDetails.ProspectorDetails)15 TemporalIndexDetails (org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails)15 AccumuloRyaInstanceDetailsRepository (org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository)11 FluoDetails (org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails)10 Connector (org.apache.accumulo.core.client.Connector)9 RyaDetailsRepositoryException (org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException)9 RyaClientException (org.apache.rya.api.client.RyaClientException)7 PCJDetails (org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.PCJDetails)6 InstanceDoesNotExistException (org.apache.rya.api.client.InstanceDoesNotExistException)5 MongoRyaInstanceDetailsRepository (org.apache.rya.mongodb.instance.MongoRyaInstanceDetailsRepository)5 NotInitializedException (org.apache.rya.api.instance.RyaDetailsRepository.NotInitializedException)4 RyaDetailsUpdater (org.apache.rya.api.instance.RyaDetailsUpdater)4 CouldNotApplyMutationException (org.apache.rya.api.instance.RyaDetailsUpdater.RyaDetailsMutator.CouldNotApplyMutationException)4