Search in sources :

Example 1 with ObserverSpecification

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

the class RyaExportITBase method preFluoInitHook.

@Override
protected void preFluoInitHook() throws Exception {
    // Setup the observers that will be used by the Fluo PCJ Application.
    final List<ObserverSpecification> observers = new ArrayList<>();
    observers.add(new ObserverSpecification(BatchObserver.class.getName()));
    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()));
    observers.add(new ObserverSpecification(AggregationObserver.class.getName()));
    observers.add(new ObserverSpecification(PeriodicQueryObserver.class.getName()));
    observers.add(new ObserverSpecification(ProjectionObserver.class.getName()));
    // Configure the export observer to export new PCJ results to the mini accumulo cluster.
    final HashMap<String, String> exportParams = new HashMap<>();
    final RyaExportParameters ryaParams = new RyaExportParameters(exportParams);
    ryaParams.setUseRyaBindingSetExporter(true);
    ryaParams.setUsePeriodicBindingSetExporter(true);
    ryaParams.setRyaInstanceName(getRyaInstanceName());
    ryaParams.setAccumuloInstanceName(super.getMiniAccumuloCluster().getInstanceName());
    ryaParams.setZookeeperServers(super.getMiniAccumuloCluster().getZooKeepers());
    ryaParams.setExporterUsername(getUsername());
    ryaParams.setExporterPassword(getPassword());
    final ObserverSpecification exportObserverConfig = new ObserverSpecification(QueryResultObserver.class.getName(), exportParams);
    observers.add(exportObserverConfig);
    // Add the observers to the Fluo Configuration.
    super.getFluoConfiguration().addObservers(observers);
}
Also used : ObserverSpecification(org.apache.fluo.api.config.ObserverSpecification) HashMap(java.util.HashMap) RyaExportParameters(org.apache.rya.indexing.pcj.fluo.app.export.rya.RyaExportParameters) ArrayList(java.util.ArrayList) QueryResultObserver(org.apache.rya.indexing.pcj.fluo.app.observers.QueryResultObserver)

Example 2 with ObserverSpecification

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

the class KafkaExportITBase method preFluoInitHook.

/**
 * Add info about the Kafka queue/topic to receive the export.
 */
@Override
protected void preFluoInitHook() throws Exception {
    // 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(BatchObserver.class.getName()));
    observers.add(new ObserverSpecification(StatementPatternObserver.class.getName()));
    observers.add(new ObserverSpecification(JoinObserver.class.getName()));
    observers.add(new ObserverSpecification(FilterObserver.class.getName()));
    observers.add(new ObserverSpecification(AggregationObserver.class.getName()));
    observers.add(new ObserverSpecification(ProjectionObserver.class.getName()));
    observers.add(new ObserverSpecification(ConstructQueryResultObserver.class.getName()));
    // Configure the export observer to export new PCJ results to the mini
    // accumulo cluster.
    final HashMap<String, String> exportParams = new HashMap<>();
    final KafkaBindingSetExporterParameters kafkaParams = new KafkaBindingSetExporterParameters(exportParams);
    kafkaParams.setUseKafkaBindingSetExporter(true);
    kafkaParams.setKafkaBootStrapServers(BROKERHOST + ":" + BROKERPORT);
    final KafkaSubGraphExporterParameters kafkaConstructParams = new KafkaSubGraphExporterParameters(exportParams);
    kafkaConstructParams.setUseKafkaSubgraphExporter(true);
    final ObserverSpecification exportObserverConfig = new ObserverSpecification(QueryResultObserver.class.getName(), exportParams);
    observers.add(exportObserverConfig);
    // Add the observers to the Fluo Configuration.
    super.getFluoConfiguration().addObservers(observers);
}
Also used : ObserverSpecification(org.apache.fluo.api.config.ObserverSpecification) HashMap(java.util.HashMap) KafkaBindingSetExporterParameters(org.apache.rya.indexing.pcj.fluo.app.export.kafka.KafkaBindingSetExporterParameters) ArrayList(java.util.ArrayList) QueryResultObserver(org.apache.rya.indexing.pcj.fluo.app.observers.QueryResultObserver) ConstructQueryResultObserver(org.apache.rya.indexing.pcj.fluo.app.observers.ConstructQueryResultObserver) KafkaSubGraphExporterParameters(org.apache.rya.indexing.pcj.fluo.app.export.kafka.KafkaSubGraphExporterParameters)

Example 3 with ObserverSpecification

use of org.apache.fluo.api.config.ObserverSpecification 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 4 with ObserverSpecification

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

the class KafkaRyaSubGraphExportIT method preFluoInitHook.

/**
 * Add info about the Kafka queue/topic to receive the export.
 *
 * @see org.apache.rya.indexing.pcj.fluo.ITBase#setExportParameters(java.util.HashMap)
 */
@Override
protected void preFluoInitHook() throws Exception {
    // 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()));
    observers.add(new ObserverSpecification(AggregationObserver.class.getName()));
    observers.add(new ObserverSpecification(ProjectionObserver.class.getName()));
    observers.add(new ObserverSpecification(ConstructQueryResultObserver.class.getName()));
    // Configure the export observer to export new PCJ results to the mini
    // accumulo cluster.
    final HashMap<String, String> exportParams = new HashMap<>();
    final KafkaSubGraphExporterParameters kafkaParams = new KafkaSubGraphExporterParameters(exportParams);
    kafkaParams.setUseKafkaSubgraphExporter(true);
    kafkaParams.setKafkaBootStrapServers(BROKERHOST + ":" + BROKERPORT);
    final ObserverSpecification exportObserverConfig = new ObserverSpecification(QueryResultObserver.class.getName(), exportParams);
    observers.add(exportObserverConfig);
    // Add the observers to the Fluo Configuration.
    super.getFluoConfiguration().addObservers(observers);
}
Also used : ObserverSpecification(org.apache.fluo.api.config.ObserverSpecification) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) QueryResultObserver(org.apache.rya.indexing.pcj.fluo.app.observers.QueryResultObserver) ConstructQueryResultObserver(org.apache.rya.indexing.pcj.fluo.app.observers.ConstructQueryResultObserver) KafkaSubGraphExporterParameters(org.apache.rya.indexing.pcj.fluo.app.export.kafka.KafkaSubGraphExporterParameters)

Example 5 with ObserverSpecification

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

the class RyaClientExample method makeMiniFluo.

private static MiniFluo makeMiniFluo(final String username, final String password, final String instanceName, final String zookeepers, final String fluoAppName) throws AlreadyInitializedException, TableExistsException {
    // 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(BatchObserver.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> params = new HashMap<>();
    final RyaExportParameters ryaParams = new RyaExportParameters(params);
    ryaParams.setUseRyaBindingSetExporter(true);
    ryaParams.setAccumuloInstanceName(instanceName);
    ryaParams.setZookeeperServers(zookeepers);
    ryaParams.setExporterUsername(username);
    ryaParams.setExporterPassword(password);
    ryaParams.setRyaInstanceName(fluoAppName);
    final ObserverSpecification exportObserverConfig = new ObserverSpecification(QueryResultObserver.class.getName(), params);
    observers.add(exportObserverConfig);
    // Configure how the mini fluo will run.
    final FluoConfiguration config = new FluoConfiguration();
    config.setMiniStartAccumulo(false);
    config.setAccumuloInstance(instanceName);
    config.setAccumuloUser(username);
    config.setAccumuloPassword(password);
    config.setInstanceZookeepers(zookeepers + "/fluo");
    config.setAccumuloZookeepers(zookeepers);
    config.setApplicationName(fluoAppName);
    config.setAccumuloTable("fluo" + fluoAppName);
    config.addObservers(observers);
    FluoFactory.newAdmin(config).initialize(new FluoAdmin.InitializationOptions().setClearTable(true).setClearZookeeper(true));
    return FluoFactory.newMiniFluo(config);
}
Also used : ObserverSpecification(org.apache.fluo.api.config.ObserverSpecification) FluoAdmin(org.apache.fluo.api.client.FluoAdmin) 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)

Aggregations

ArrayList (java.util.ArrayList)6 ObserverSpecification (org.apache.fluo.api.config.ObserverSpecification)6 QueryResultObserver (org.apache.rya.indexing.pcj.fluo.app.observers.QueryResultObserver)6 HashMap (java.util.HashMap)5 FluoConfiguration (org.apache.fluo.api.config.FluoConfiguration)3 RyaExportParameters (org.apache.rya.indexing.pcj.fluo.app.export.rya.RyaExportParameters)3 ConstructQueryResultObserver (org.apache.rya.indexing.pcj.fluo.app.observers.ConstructQueryResultObserver)3 FluoAdmin (org.apache.fluo.api.client.FluoAdmin)2 KafkaSubGraphExporterParameters (org.apache.rya.indexing.pcj.fluo.app.export.kafka.KafkaSubGraphExporterParameters)2 File (java.io.File)1 MiniFluo (org.apache.fluo.api.mini.MiniFluo)1 KafkaBindingSetExporterParameters (org.apache.rya.indexing.pcj.fluo.app.export.kafka.KafkaBindingSetExporterParameters)1