use of org.apache.rya.accumulo.AccumuloRdfConfiguration in project incubator-rya by apache.
the class KafkaExportITBase method installRyaInstance.
private void installRyaInstance() throws Exception {
final MiniAccumuloCluster cluster = super.getMiniAccumuloCluster();
final String instanceName = cluster.getInstanceName();
final String zookeepers = cluster.getZooKeepers();
// Install the Rya instance to the mini accumulo cluster.
final RyaClient ryaClient = AccumuloRyaClientFactory.build(new AccumuloConnectionDetails(ACCUMULO_USER, ACCUMULO_PASSWORD.toCharArray(), instanceName, zookeepers), super.getAccumuloConnector());
ryaClient.getInstall().install(RYA_INSTANCE_NAME, InstallConfiguration.builder().setEnableTableHashPrefix(false).setEnableFreeTextIndex(false).setEnableEntityCentricIndex(false).setEnableGeoIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(true).setFluoPcjAppName(super.getFluoConfiguration().getApplicationName()).build());
// Connect to the Rya instance that was just installed.
final AccumuloRdfConfiguration conf = makeConfig(instanceName, zookeepers);
final Sail sail = RyaSailFactory.getInstance(conf);
dao = RyaSailFactory.getAccumuloDAOWithUpdatedConfig(conf);
ryaSailRepo = new RyaSailRepository(sail);
}
use of org.apache.rya.accumulo.AccumuloRdfConfiguration in project incubator-rya by apache.
the class PcjAdminClient method makeRyaRepository.
private static RyaSailRepository makeRyaRepository(final PcjAdminClientProperties clientProps, final Connector accumulo) throws RepositoryException {
checkNotNull(clientProps);
checkNotNull(accumulo);
// Setup Rya configuration values.
final AccumuloRdfConfiguration ryaConf = new AccumuloRdfConfiguration();
ryaConf.setTablePrefix(clientProps.getRyaTablePrefix());
// Connect to the Rya repo.
final AccumuloRyaDAO accumuloRyaDao = new AccumuloRyaDAO();
accumuloRyaDao.setConnector(accumulo);
accumuloRyaDao.setConf(ryaConf);
final RdfCloudTripleStore ryaStore = new RdfCloudTripleStore();
ryaStore.setRyaDAO(accumuloRyaDao);
final RyaSailRepository ryaRepo = new RyaSailRepository(ryaStore);
ryaRepo.initialize();
return ryaRepo;
}
use of org.apache.rya.accumulo.AccumuloRdfConfiguration in project incubator-rya by apache.
the class ConnectorFactory method connect.
/**
* Create a {@link Connector} that connects to an Accumulo instance. The {@link AccumuloRdfConfiguration#USE_MOCK_INSTANCE}
* flag must be set if the configuration information needs to connect to a mock instance of Accumulo. If this is
* the case, then the Zookeepers information should not be set.
*
* @param config - The configuration that will be used to initialize the connector. (not null)
* @return The {@link Connector} that was created by {@code config}.
* @throws AccumuloException The connector couldn't be created because of an Accumulo problem.
* @throws AccumuloSecurityException The connector couldn't be created because of an Accumulo security violation.
*/
public static Connector connect(AccumuloRdfConfiguration config) throws AccumuloException, AccumuloSecurityException {
requireNonNull(config);
// Wrap the configuration as the Accumulo configuration so that we may have access
// to Accumulo specific configuration values.
final AccumuloRdfConfiguration accConf = new AccumuloRdfConfiguration(config);
// Create the Mock or Zookeeper backed Instance depending on the configuration.
final Instance instance;
if (accConf.useMockInstance()) {
instance = new MockInstance(accConf.getInstanceName());
} else {
instance = new ZooKeeperInstance(accConf.getInstanceName(), accConf.getZookeepers());
}
// Return a connector using the configured username and password.
return instance.getConnector(accConf.getUsername(), new PasswordToken(accConf.getPassword()));
}
use of org.apache.rya.accumulo.AccumuloRdfConfiguration 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.accumulo.AccumuloRdfConfiguration in project incubator-rya by apache.
the class RdfCloudTripleStoreTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
connector = new MockInstance().getConnector("", "");
RdfCloudTripleStore sail = new RdfCloudTripleStore();
AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
conf.setTablePrefix("lubm_");
sail.setConf(conf);
AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
crdfdao.setConnector(connector);
crdfdao.setConf(conf);
sail.setRyaDAO(crdfdao);
repository = new SailRepository(sail);
repository.initialize();
connection = repository.getConnection();
loadData();
}
Aggregations