Search in sources :

Example 26 with RyaDetailsRepository

use of org.apache.rya.api.instance.RyaDetailsRepository 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);
    }
}
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)

Example 27 with RyaDetailsRepository

use of org.apache.rya.api.instance.RyaDetailsRepository in project incubator-rya by apache.

the class SetRyaStreamsConfigurationBase method setRyaStreamsConfiguration.

@Override
public void setRyaStreamsConfiguration(final String ryaInstance, final RyaStreamsDetails streamsDetails) throws InstanceDoesNotExistException, RyaClientException {
    requireNonNull(ryaInstance);
    requireNonNull(streamsDetails);
    // Verify the Rya Instance exists.
    if (!instanceExists.exists(ryaInstance)) {
        throw new InstanceDoesNotExistException("There is no Rya instance named '" + ryaInstance + "' in this storage.");
    }
    // Update the old details object using the provided Rya Streams details.
    final RyaDetailsRepository repo = getRyaDetailsRepo(ryaInstance);
    try {
        new RyaDetailsUpdater(repo).update(oldDetails -> {
            final RyaDetails.Builder builder = RyaDetails.builder(oldDetails);
            builder.setRyaStreamsDetails(streamsDetails);
            return builder.build();
        });
    } catch (CouldNotApplyMutationException | RyaDetailsRepositoryException e) {
        throw new RyaClientException("Unable to update which Rya Streams subsystem is used by the '" + ryaInstance + "' Rya instance.", e);
    }
}
Also used : RyaDetailsUpdater(org.apache.rya.api.instance.RyaDetailsUpdater) CouldNotApplyMutationException(org.apache.rya.api.instance.RyaDetailsUpdater.RyaDetailsMutator.CouldNotApplyMutationException) RyaDetailsRepository(org.apache.rya.api.instance.RyaDetailsRepository) RyaDetails(org.apache.rya.api.instance.RyaDetails) RyaDetailsRepositoryException(org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException)

Example 28 with RyaDetailsRepository

use of org.apache.rya.api.instance.RyaDetailsRepository 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);
    }
}
Also used : NotInitializedException(org.apache.rya.api.instance.RyaDetailsRepository.NotInitializedException) RyaClientException(org.apache.rya.api.client.RyaClientException) RyaDetailsRepository(org.apache.rya.api.instance.RyaDetailsRepository) RyaDetailsRepositoryException(org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException) InstanceDoesNotExistException(org.apache.rya.api.client.InstanceDoesNotExistException) AccumuloRyaInstanceDetailsRepository(org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository)

Example 29 with RyaDetailsRepository

use of org.apache.rya.api.instance.RyaDetailsRepository in project incubator-rya by apache.

the class AccumuloRyaDetailsRepositoryIT method update.

@Test
public void update() 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);
    // Create a new state for the details.
    final RyaDetails updated = new RyaDetails.Builder(details).setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).build();
    // Execute the update.
    repo.update(details, updated);
    // Show the new state that is stored matches the updated state.
    final RyaDetails fetched = repo.getRyaInstanceDetails();
    assertEquals(updated, fetched);
}
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 30 with RyaDetailsRepository

use of org.apache.rya.api.instance.RyaDetailsRepository in project incubator-rya by apache.

the class AccumuloRyaDetailsRepositoryIT method initializeAndGet.

@Test
public void initializeAndGet() 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);
    // Fetch the stored details.
    final RyaDetails stored = repo.getRyaInstanceDetails();
    // Ensure the fetched object is equivalent to what was stored.
    assertEquals(details, stored);
}
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)

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