Search in sources :

Example 1 with PrecomputedJoinStorageType

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);
}
Also used : PrecomputedJoinStorageType(org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinStorageType) Connector(org.apache.accumulo.core.client.Connector) Configuration(org.apache.hadoop.conf.Configuration) AccumuloPcjStorage(org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPcjStorage) PrecomputedJoinIndexerConfig(org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig)

Example 2 with PrecomputedJoinStorageType

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());
    }
}
Also used : PrecomputedJoinStorageType(org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinStorageType) Configuration(org.apache.hadoop.conf.Configuration)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)2 PrecomputedJoinStorageType (org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinStorageType)2 Connector (org.apache.accumulo.core.client.Connector)1 PrecomputedJoinIndexerConfig (org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig)1 AccumuloPcjStorage (org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPcjStorage)1