public void setProperty(ClientProperty property, Long value) { setProperty(property, Long.toString(value)); }
/** * Fluent entry point for creating an {@link AccumuloClient}. For example: * * <pre> * <code> * try (AccumuloClient client = Accumulo.newClient() * .to(instanceName, zookeepers) * .as(user, password).build()) * { * // use the client * } * </code> * </pre> * * @return a builder object for Accumulo clients */ public static AccumuloClient.PropertyOptions<AccumuloClient> newClient() { return new ClientContext.ClientBuilderImpl<>(ClientContext.ClientBuilderImpl::buildClient); }
/** * Fluent entry point for creating client {@link Properties}. For example: * * <pre> * <code> * Properties clientProperties = Accumulo.newClientProperties() * .to(instanceName, zookeepers) * .as(user, password).build()) * </code> * </pre> * * @return a builder object for client Properties */ public static AccumuloClient.PropertyOptions<Properties> newClientProperties() { return new ClientContext.ClientBuilderImpl<>(ClientContext.ClientBuilderImpl::buildProps); } }
public void setProperty(ClientProperty property, Integer value) { setProperty(property, Integer.toString(value)); } }
@Override public FromOptions<T> from(String propertiesFilePath) { return from(ClientInfoImpl.toProperties(propertiesFilePath)); }
@Override public FromOptions<T> from(Path propertiesFile) { return from(ClientInfoImpl.toProperties(propertiesFile)); }
@Override public ConnectionOptions<T> as(CharSequence username, CharSequence password) { setProperty(ClientProperty.AUTH_PRINCIPAL, username); ClientProperty.setPassword(properties, password); return this; }
@Override public ConnectionOptions<T> batchWriterConfig(BatchWriterConfig batchWriterConfig) { ClientProperty.BATCH_WRITER_MEMORY_MAX.setBytes(properties, batchWriterConfig.getMaxMemory()); ClientProperty.BATCH_WRITER_LATENCY_MAX.setTimeInMillis(properties, batchWriterConfig.getMaxLatency(TimeUnit.MILLISECONDS)); ClientProperty.BATCH_WRITER_TIMEOUT_MAX.setTimeInMillis(properties, batchWriterConfig.getTimeout(TimeUnit.MILLISECONDS)); setProperty(ClientProperty.BATCH_WRITER_THREADS_MAX, batchWriterConfig.getMaxWriteThreads()); setProperty(ClientProperty.BATCH_WRITER_DURABILITY, batchWriterConfig.getDurability().toString()); return this; }
@Override public SslOptions<T> useJsse() { setProperty(ClientProperty.SSL_USE_JSSE, "true"); return this; }
@Override public ConnectionOptions<T> as(CharSequence principal, Path keyTabFile) { setProperty(ClientProperty.AUTH_PRINCIPAL, principal); ClientProperty.setKerberosKeytab(properties, keyTabFile.toString()); return this; }
@Override public SaslOptions<T> primary(CharSequence kerberosServerPrimary) { setProperty(ClientProperty.SASL_KERBEROS_SERVER_PRIMARY, kerberosServerPrimary); return this; }
@Override public SaslOptions<T> useSasl() { setProperty(ClientProperty.SASL_ENABLED, "true"); return this; }
@Override public SslOptions<T> useSsl() { setProperty(ClientProperty.SSL_ENABLED, "true"); return this; }
@Override public SaslOptions<T> qop(CharSequence qualityOfProtection) { setProperty(ClientProperty.SASL_QOP, qualityOfProtection); return this; }
@Override public ConnectionOptions<T> batchScannerQueryThreads(int numQueryThreads) { setProperty(ClientProperty.BATCH_SCANNER_NUM_QUERY_THREADS, numQueryThreads); return this; }
@Override public SslOptions<T> keystore(CharSequence path) { setProperty(ClientProperty.SSL_KEYSTORE_PATH, path); return this; }
@Override public ConnectionOptions<T> scannerBatchSize(int batchSize) { setProperty(ClientProperty.SCANNER_BATCH_SIZE, batchSize); return this; }
@Override public SslOptions<T> truststore(CharSequence path, CharSequence password, CharSequence type) { setProperty(ClientProperty.SSL_TRUSTSTORE_PATH, path); setProperty(ClientProperty.SSL_TRUSTSTORE_PASSWORD, password); setProperty(ClientProperty.SSL_TRUSTSTORE_TYPE, type); return this; }
@Override public AuthenticationArgs<T> to(CharSequence instanceName, CharSequence zookeepers) { setProperty(ClientProperty.INSTANCE_NAME, instanceName); setProperty(ClientProperty.INSTANCE_ZOOKEEPERS, zookeepers); return this; }
public static AccumuloClient buildClient(ClientBuilderImpl<AccumuloClient> cbi) { SingletonReservation reservation = SingletonManager.getClientReservation(); try { // ClientContext closes reservation unless a RuntimeException is thrown return new ClientContext(reservation, cbi.getClientInfo()); } catch (RuntimeException e) { reservation.close(); throw e; } }