Search in sources :

Example 1 with PrecomputedJoinIndexerConfig

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);
}
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 PrecomputedJoinIndexerConfig

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);
}
Also used : FluoClient(org.apache.fluo.api.client.FluoClient) FluoConfiguration(org.apache.fluo.api.config.FluoConfiguration) Configuration(org.apache.hadoop.conf.Configuration) PrecomputedJoinUpdaterType(org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType) PrecomputedJoinIndexerConfig(org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig) FluoConfiguration(org.apache.fluo.api.config.FluoConfiguration)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)2 PrecomputedJoinIndexerConfig (org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig)2 Connector (org.apache.accumulo.core.client.Connector)1 FluoClient (org.apache.fluo.api.client.FluoClient)1 FluoConfiguration (org.apache.fluo.api.config.FluoConfiguration)1 PrecomputedJoinStorageType (org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinStorageType)1 PrecomputedJoinUpdaterType (org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType)1 AccumuloPcjStorage (org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPcjStorage)1