Search in sources :

Example 1 with PrecomputedJoinUpdaterType

use of org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType in project incubator-rya by apache.

the class AccumuloInstall method makeRyaConfig.

/**
 * Builds a {@link AccumuloRdfConfiguration} object that will be used by the
 * Rya DAO to initialize all of the tables it will need.
 *
 * @param connectionDetails - Indicates how to connect to Accumulo. (not null)
 * @param details - Indicates what needs to be installed. (not null)
 * @return A Rya Configuration object that can be used to perform the install.
 */
private static AccumuloRdfConfiguration makeRyaConfig(final AccumuloConnectionDetails connectionDetails, final RyaDetails details) {
    final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    // The Rya Instance Name is used as a prefix for the index tables in Accumulo.
    conf.setTablePrefix(details.getRyaInstanceName());
    // Enable the indexers that the instance is configured to use.
    /**
     * RYA-215
     * conf.set(ConfigUtils.USE_GEO, "" + details.getGeoIndexDetails().isEnabled() );
     */
    /**
     * RYA-322
     * conf.setPrefixRowsWithHash(details.getPrefixRowsWithHashDetails().isEnabled());
     */
    conf.set(ConfigUtils.USE_FREETEXT, "" + details.getFreeTextIndexDetails().isEnabled());
    conf.set(ConfigUtils.USE_TEMPORAL, "" + details.getTemporalIndexDetails().isEnabled());
    conf.set(ConfigUtils.USE_ENTITY, "" + details.getEntityCentricIndexDetails().isEnabled());
    conf.set(ConfigUtils.USE_PCJ, "" + details.getPCJIndexDetails().isEnabled());
    conf.set(ConfigUtils.PCJ_STORAGE_TYPE, PrecomputedJoinStorageType.ACCUMULO.toString());
    final Optional<FluoDetails> fluoHolder = details.getPCJIndexDetails().getFluoDetails();
    final PrecomputedJoinUpdaterType updaterType = fluoHolder.isPresent() ? PrecomputedJoinUpdaterType.FLUO : PrecomputedJoinUpdaterType.NO_UPDATE;
    conf.set(ConfigUtils.PCJ_UPDATER_TYPE, updaterType.toString());
    // XXX The Accumulo implementation of the secondary indices make need all
    // of the accumulo connector's parameters to initialize themselves, so
    // we need to include them here. It would be nice if the secondary
    // indexers used the connector that is provided to them instead of
    // building a new one.
    conf.set(ConfigUtils.CLOUDBASE_USER, connectionDetails.getUsername());
    conf.set(ConfigUtils.CLOUDBASE_PASSWORD, new String(connectionDetails.getUserPass()));
    conf.set(ConfigUtils.CLOUDBASE_INSTANCE, connectionDetails.getInstanceName());
    conf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, connectionDetails.getZookeepers());
    // This initializes the living indexers that will be used by the application and
    // caches them within the configuration object so that they may be used later.
    ConfigUtils.setIndexers(conf);
    return conf;
}
Also used : PrecomputedJoinUpdaterType(org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) FluoDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails)

Example 2 with PrecomputedJoinUpdaterType

use of org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType in project incubator-rya by apache.

the class PrecomputedJoinUpdaterSupplier method get.

@Override
public PrecomputedJoinUpdater get() {
    // Ensure a configuration has been set.
    final Configuration config = configSupplier.get();
    checkNotNull(config, "Can not build the PrecomputedJoinUpdater until the PrecomputedJoinIndexer has been configured.");
    final PrecomputedJoinIndexerConfig indexerConfig = new PrecomputedJoinIndexerConfig(config);
    // Ensure an updater type has been set.
    final Optional<PrecomputedJoinUpdaterType> updaterType = indexerConfig.getPcjUpdaterType();
    checkArgument(updaterType.isPresent(), "The '" + PrecomputedJoinIndexerConfig.PCJ_UPDATER_TYPE + "' property must have one of the following values: " + PrecomputedJoinUpdaterType.values());
    // Create and return the configured updater.
    switch(updaterType.get()) {
        case FLUO:
            return fluoSupplier.get();
        default:
            throw new IllegalArgumentException("Unsupported PrecomputedJoinUpdaterType: " + updaterType.get());
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) PrecomputedJoinUpdaterType(org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType)

Example 3 with PrecomputedJoinUpdaterType

use of org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType 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

PrecomputedJoinUpdaterType (org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType)3 Configuration (org.apache.hadoop.conf.Configuration)2 FluoClient (org.apache.fluo.api.client.FluoClient)1 FluoConfiguration (org.apache.fluo.api.config.FluoConfiguration)1 AccumuloRdfConfiguration (org.apache.rya.accumulo.AccumuloRdfConfiguration)1 FluoDetails (org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails)1 PrecomputedJoinIndexerConfig (org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig)1