use of org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig in project incubator-rya by apache.
the class AccumuloPcjStorageSupplier method get.
@Override
public AccumuloPcjStorage get() {
// Ensure a configuration has been set.
final Configuration config = configSupplier.get();
checkNotNull(config, "Could not create a AccumuloPcjStorage because the application's configuration has not been provided yet.");
// Ensure the correct storage type has been set.
final PrecomputedJoinIndexerConfig indexerConfig = new PrecomputedJoinIndexerConfig(config);
final Optional<PrecomputedJoinStorageType> storageType = indexerConfig.getPcjStorageType();
checkArgument(storageType.isPresent() && (storageType.get() == PrecomputedJoinStorageType.ACCUMULO), "This supplier requires the '" + PrecomputedJoinIndexerConfig.PCJ_STORAGE_TYPE + "' value be set to '" + PrecomputedJoinStorageType.ACCUMULO + "'.");
// Ensure the Accumulo connector has been set.
final Connector accumuloConn = accumuloSupplier.get();
checkNotNull(accumuloConn, "The Accumulo Connector must be set before initializing the AccumuloPcjStorage.");
final String ryaInstanceName = new AccumuloPcjStorageConfig(config).getRyaInstanceName();
return new AccumuloPcjStorage(accumuloConn, ryaInstanceName);
}
use of org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig in project incubator-rya by apache.
the class FluoPcjUpdaterSupplier method get.
@Override
public FluoPcjUpdater get() {
final Configuration config = configSupplier.get();
checkNotNull(config, "Could not create a FluoPcjUpdater because the application's configuration has not been provided yet.");
// Ensure the correct updater type has been set.
final PrecomputedJoinIndexerConfig indexerConfig = new PrecomputedJoinIndexerConfig(config);
final Optional<PrecomputedJoinUpdaterType> updaterType = indexerConfig.getPcjUpdaterType();
checkArgument(updaterType.isPresent() && updaterType.get() == PrecomputedJoinUpdaterType.FLUO, "This supplier requires the '" + PrecomputedJoinIndexerConfig.PCJ_UPDATER_TYPE + "' value be set to '" + PrecomputedJoinUpdaterType.FLUO + "'.");
final FluoPcjUpdaterConfig fluoUpdaterConfig = new FluoPcjUpdaterConfig(indexerConfig.getConfig());
// Make sure the required values are present.
checkArgument(fluoUpdaterConfig.getFluoAppName().isPresent(), "Missing configuration: " + FLUO_APP_NAME);
checkArgument(fluoUpdaterConfig.getFluoZookeepers().isPresent(), "Missing configuration: " + ACCUMULO_ZOOKEEPERS);
checkArgument(fluoUpdaterConfig.getAccumuloZookeepers().isPresent(), "Missing configuration: " + ACCUMULO_ZOOKEEPERS);
checkArgument(fluoUpdaterConfig.getAccumuloInstance().isPresent(), "Missing configuration: " + ACCUMULO_INSTANCE);
checkArgument(fluoUpdaterConfig.getAccumuloUsername().isPresent(), "Missing configuration: " + ACCUMULO_USERNAME);
checkArgument(fluoUpdaterConfig.getAccumuloPassword().isPresent(), "Missing configuration: " + ACCUMULO_PASSWORD);
// Fluo configuration values.
final FluoConfiguration fluoClientConfig = new FluoConfiguration();
fluoClientConfig.setApplicationName(fluoUpdaterConfig.getFluoAppName().get());
fluoClientConfig.setInstanceZookeepers(fluoUpdaterConfig.getFluoZookeepers().get());
// Accumulo Fluo Table configuration values.
fluoClientConfig.setAccumuloZookeepers(fluoUpdaterConfig.getAccumuloZookeepers().get());
fluoClientConfig.setAccumuloInstance(fluoUpdaterConfig.getAccumuloInstance().get());
fluoClientConfig.setAccumuloUser(fluoUpdaterConfig.getAccumuloUsername().get());
fluoClientConfig.setAccumuloPassword(fluoUpdaterConfig.getAccumuloPassword().get());
final FluoClient fluoClient = FluoFactory.newClient(fluoClientConfig);
return new FluoPcjUpdater(fluoClient);
}
Aggregations