use of org.apache.rya.indexing.pcj.fluo.app.export.IncrementalBindingSetExporter in project incubator-rya by apache.
the class KafkaBindingSetExporterFactory method build.
@Override
public Optional<IncrementalResultExporter> build(final Context context) throws IncrementalExporterFactoryException, ConfigurationException {
final KafkaBindingSetExporterParameters exportParams = new KafkaBindingSetExporterParameters(context.getObserverConfiguration().toMap());
if (exportParams.getUseKafkaBindingSetExporter()) {
log.info("Exporter is enabled.");
// Setup Kafka connection
final KafkaProducer<String, VisibilityBindingSet> producer = new KafkaProducer<>(exportParams.listAllConfig());
// Create the exporter
final IncrementalBindingSetExporter exporter = new KafkaBindingSetExporter(producer);
return Optional.of(exporter);
} else {
return Optional.absent();
}
}
use of org.apache.rya.indexing.pcj.fluo.app.export.IncrementalBindingSetExporter in project incubator-rya by apache.
the class PeriodicBindingSetExporterFactory method build.
@Override
public Optional<IncrementalResultExporter> build(Context context) throws IncrementalExporterFactoryException, ConfigurationException {
checkNotNull(context);
// Wrap the context's parameters for parsing.
final RyaExportParameters params = new RyaExportParameters(context.getObserverConfiguration().toMap());
if (params.getUsePeriodicBindingSetExporter()) {
// Setup Zookeeper connection info.
final String accumuloInstance = params.getAccumuloInstanceName().get();
final String zookeeperServers = params.getZookeeperServers().get().replaceAll(";", ",");
final Instance inst = new ZooKeeperInstance(accumuloInstance, zookeeperServers);
try {
// Setup Accumulo connection info.
final String exporterUsername = params.getExporterUsername().get();
final String exporterPassword = params.getExporterPassword().get();
final Connector accumuloConn = inst.getConnector(exporterUsername, new PasswordToken(exporterPassword));
// Setup Rya PCJ Storage.
final String ryaInstanceName = params.getRyaInstanceName().get();
final PeriodicQueryResultStorage periodicStorage = new AccumuloPeriodicQueryResultStorage(accumuloConn, ryaInstanceName);
// Make the exporter.
final IncrementalBindingSetExporter exporter = new PeriodicBindingSetExporter(periodicStorage);
return Optional.of(exporter);
} catch (final AccumuloException | AccumuloSecurityException e) {
throw new IncrementalExporterFactoryException("Could not initialize the Accumulo connector using the provided configuration.", e);
}
} else {
return Optional.absent();
}
}
use of org.apache.rya.indexing.pcj.fluo.app.export.IncrementalBindingSetExporter in project incubator-rya by apache.
the class RyaBindingSetExporterFactory method build.
@Override
public Optional<IncrementalResultExporter> build(final Context context) throws IncrementalExporterFactoryException, ConfigurationException {
checkNotNull(context);
// Wrap the context's parameters for parsing.
final RyaExportParameters params = new RyaExportParameters(context.getObserverConfiguration().toMap());
if (params.getUseRyaBindingSetExporter()) {
// Setup Zookeeper connection info.
final String accumuloInstance = params.getAccumuloInstanceName().get();
final String zookeeperServers = params.getZookeeperServers().get().replaceAll(";", ",");
final Instance inst = new ZooKeeperInstance(accumuloInstance, zookeeperServers);
try {
// Setup Accumulo connection info.
final String exporterUsername = params.getExporterUsername().get();
final String exporterPassword = params.getExporterPassword().get();
final Connector accumuloConn = inst.getConnector(exporterUsername, new PasswordToken(exporterPassword));
// Setup Rya PCJ Storage.
final String ryaInstanceName = params.getRyaInstanceName().get();
final PrecomputedJoinStorage pcjStorage = new AccumuloPcjStorage(accumuloConn, ryaInstanceName);
// Make the exporter.
final IncrementalBindingSetExporter exporter = new RyaBindingSetExporter(pcjStorage);
return Optional.of(exporter);
} catch (final AccumuloException | AccumuloSecurityException e) {
throw new IncrementalExporterFactoryException("Could not initialize the Accumulo connector using the provided configuration.", e);
}
} else {
return Optional.absent();
}
}
Aggregations