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);
}
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;
}
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();
}
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;
}
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);
}
Aggregations