Search in sources :

Example 1 with FluoConfiguration

use of org.apache.fluo.api.config.FluoConfiguration in project incubator-rya by apache.

the class FluoClientFactory method connect.

/**
 * Create a {@link FluoClient} that uses the provided connection details.
 *
 * @param username - The username the connection will use. (not null)
 * @param password - The password the connection will use. (not null)
 * @param instanceName - The name of the Accumulo instance. (not null)
 * @param zookeeperHostnames - A comma delimited list of the Zookeeper server hostnames. (not null)
 * @param fluoAppName - The Fluo Application the client will be connected to. (not null)
 * @return A {@link FluoClient} that may be used to access the Fluo Application.
 */
public FluoClient connect(final String username, final String password, final String instanceName, final String zookeeperHostnames, final String fluoAppName) {
    requireNonNull(username);
    requireNonNull(password);
    requireNonNull(instanceName);
    requireNonNull(zookeeperHostnames);
    requireNonNull(fluoAppName);
    final FluoConfiguration fluoConfig = new FluoConfiguration();
    // Fluo configuration values.
    fluoConfig.setApplicationName(fluoAppName);
    fluoConfig.setInstanceZookeepers(zookeeperHostnames + "/fluo");
    // Accumulo Connection Stuff.
    fluoConfig.setAccumuloZookeepers(zookeeperHostnames);
    fluoConfig.setAccumuloInstance(instanceName);
    fluoConfig.setAccumuloUser(username);
    fluoConfig.setAccumuloPassword(password);
    // Connect the client.
    return FluoFactory.newClient(fluoConfig);
}
Also used : FluoConfiguration(org.apache.fluo.api.config.FluoConfiguration)

Example 2 with FluoConfiguration

use of org.apache.fluo.api.config.FluoConfiguration in project incubator-rya by apache.

the class PeriodicNotificationApplicationIT method getProps.

private Properties getProps() throws IOException {
    final Properties props = new Properties();
    try (InputStream in = new FileInputStream("src/test/resources/notification.properties")) {
        props.load(in);
    }
    final FluoConfiguration fluoConf = getFluoConfiguration();
    props.setProperty("accumulo.user", getUsername());
    props.setProperty("accumulo.password", getPassword());
    props.setProperty("accumulo.instance", getMiniAccumuloCluster().getInstanceName());
    props.setProperty("accumulo.zookeepers", getMiniAccumuloCluster().getZooKeepers());
    props.setProperty("accumulo.rya.prefix", getRyaInstanceName());
    props.setProperty(PeriodicNotificationApplicationConfiguration.FLUO_APP_NAME, fluoConf.getApplicationName());
    props.setProperty(PeriodicNotificationApplicationConfiguration.FLUO_TABLE_NAME, fluoConf.getAccumuloTable());
    return props;
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FluoConfiguration(org.apache.fluo.api.config.FluoConfiguration) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream)

Example 3 with FluoConfiguration

use of org.apache.fluo.api.config.FluoConfiguration in project incubator-rya by apache.

the class RyaSubGraphExporterFactory method build.

@Override
public Optional<IncrementalResultExporter> build(Context context) throws IncrementalExporterFactoryException, ConfigurationException {
    Preconditions.checkNotNull(context);
    RyaSubGraphExportParameters params = new RyaSubGraphExportParameters(context.getObserverConfiguration().toMap());
    if (params.getUseRyaSubGraphExporter()) {
        try {
            // Get FluoConfiguration from params
            FluoConfiguration conf = params.getFluoConfiguration();
            FluoClient fluo = FluoFactory.newClient(conf);
            // Create exporter
            RyaSubGraphExporter exporter = new RyaSubGraphExporter(fluo);
            return Optional.of(exporter);
        } catch (Exception e) {
            throw new IncrementalExporterFactoryException("Could not initialize the RyaSubGraphExporter", e);
        }
    }
    return Optional.absent();
}
Also used : FluoClient(org.apache.fluo.api.client.FluoClient) FluoConfiguration(org.apache.fluo.api.config.FluoConfiguration)

Example 4 with FluoConfiguration

use of org.apache.fluo.api.config.FluoConfiguration in project incubator-rya by apache.

the class DemoDriver method startMiniFluo.

/**
 * Setup a Mini Fluo cluster that uses a temporary directory to store its data.ll
 *
 * @return A Mini Fluo cluster.
 */
private static MiniFluo startMiniFluo() {
    final File miniDataDir = Files.createTempDir();
    // Setup the observers that will be used by the Fluo PCJ Application.
    final List<ObserverSpecification> observers = new ArrayList<>();
    observers.add(new ObserverSpecification(TripleObserver.class.getName()));
    observers.add(new ObserverSpecification(StatementPatternObserver.class.getName()));
    observers.add(new ObserverSpecification(JoinObserver.class.getName()));
    observers.add(new ObserverSpecification(FilterObserver.class.getName()));
    // Provide export parameters child test classes may provide to the export observer.
    final HashMap<String, String> exportParams = new HashMap<>();
    final RyaExportParameters ryaParams = new RyaExportParameters(exportParams);
    ryaParams.setUseRyaBindingSetExporter(true);
    ryaParams.setAccumuloInstanceName(accumulo.getInstanceName());
    ryaParams.setZookeeperServers(accumulo.getZooKeepers());
    ryaParams.setExporterUsername("root");
    ryaParams.setExporterPassword("password");
    ryaParams.setRyaInstanceName("demo_");
    final ObserverSpecification exportObserverConfig = new ObserverSpecification(QueryResultObserver.class.getName(), exportParams);
    observers.add(exportObserverConfig);
    // Configure how the mini fluo will run.
    final FluoConfiguration config = new FluoConfiguration();
    config.setApplicationName("IntegrationTests");
    config.setMiniDataDir(miniDataDir.getAbsolutePath());
    config.addObservers(observers);
    final MiniFluo miniFluo = FluoFactory.newMiniFluo(config);
    return miniFluo;
}
Also used : MiniFluo(org.apache.fluo.api.mini.MiniFluo) ObserverSpecification(org.apache.fluo.api.config.ObserverSpecification) HashMap(java.util.HashMap) RyaExportParameters(org.apache.rya.indexing.pcj.fluo.app.export.rya.RyaExportParameters) FluoConfiguration(org.apache.fluo.api.config.FluoConfiguration) ArrayList(java.util.ArrayList) QueryResultObserver(org.apache.rya.indexing.pcj.fluo.app.observers.QueryResultObserver) File(java.io.File)

Example 5 with FluoConfiguration

use of org.apache.fluo.api.config.FluoConfiguration in project incubator-rya by apache.

the class PcjAdminClient method createFluoClient.

private static FluoClient createFluoClient(final PcjAdminClientProperties clientProps) {
    checkNotNull(clientProps);
    final FluoConfiguration fluoConfig = new FluoConfiguration();
    // Fluo configuration values.
    fluoConfig.setApplicationName(clientProps.getFluoAppName());
    fluoConfig.setInstanceZookeepers(clientProps.getAccumuloZookeepers() + "/fluo");
    // Accumulo Connection Stuff.
    fluoConfig.setAccumuloZookeepers(clientProps.getAccumuloZookeepers());
    fluoConfig.setAccumuloInstance(clientProps.getAccumuloInstance());
    fluoConfig.setAccumuloUser(clientProps.getAccumuloUsername());
    fluoConfig.setAccumuloPassword(clientProps.getAccumuloPassword());
    // Connect the client.
    return FluoFactory.newClient(fluoConfig);
}
Also used : FluoConfiguration(org.apache.fluo.api.config.FluoConfiguration)

Aggregations

FluoConfiguration (org.apache.fluo.api.config.FluoConfiguration)11 ArrayList (java.util.ArrayList)3 ObserverSpecification (org.apache.fluo.api.config.ObserverSpecification)3 QueryResultObserver (org.apache.rya.indexing.pcj.fluo.app.observers.QueryResultObserver)3 HashMap (java.util.HashMap)2 FluoAdmin (org.apache.fluo.api.client.FluoAdmin)2 FluoClient (org.apache.fluo.api.client.FluoClient)2 RyaExportParameters (org.apache.rya.indexing.pcj.fluo.app.export.rya.RyaExportParameters)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 Properties (java.util.Properties)1 MiniFluo (org.apache.fluo.api.mini.MiniFluo)1 Configuration (org.apache.hadoop.conf.Configuration)1 PrecomputedJoinIndexerConfig (org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig)1 PrecomputedJoinUpdaterType (org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType)1 ConstructQueryResultObserver (org.apache.rya.indexing.pcj.fluo.app.observers.ConstructQueryResultObserver)1