use of org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinStorageType 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.PrecomputedJoinStorageType in project incubator-rya by apache.
the class PrecomputedJoinStorageSupplier method get.
@Override
public PrecomputedJoinStorage get() {
// Ensure a configuration has been set.
final Configuration config = configSupplier.get();
checkNotNull(config, "Could not build the PrecomputedJoinStorage until the PrecomputedJoinIndexer has been configured.");
final PrecomputedJoinIndexerConfig indexerConfig = new PrecomputedJoinIndexerConfig(config);
// Ensure the storage type has been set.
final Optional<PrecomputedJoinStorageType> storageType = indexerConfig.getPcjStorageType();
checkArgument(storageType.isPresent(), "The '" + PrecomputedJoinIndexerConfig.PCJ_STORAGE_TYPE + "' property must have one of the following values: " + Arrays.toString(PrecomputedJoinStorageType.values()));
// Create and return the configured storage.
switch(storageType.get()) {
case ACCUMULO:
return accumuloSupplier.get();
default:
throw new IllegalArgumentException("Unsupported PrecomputedJoinStorageType: " + storageType.get());
}
}
Aggregations