org.apache.accumulo.core.client
Class ClientConfiguration

java.lang.Object
  extended by org.apache.commons.configuration.event.EventSource
      extended by org.apache.commons.configuration.AbstractConfiguration
          extended by org.apache.commons.configuration.CompositeConfiguration
              extended by org.apache.accumulo.core.client.ClientConfiguration
All Implemented Interfaces:
Cloneable, org.apache.commons.configuration.Configuration

public class ClientConfiguration
extends org.apache.commons.configuration.CompositeConfiguration

Contains a list of property keys recognized by the Accumulo client and convenience methods for setting them.

Since:
1.6.0

Nested Class Summary
static class ClientConfiguration.ClientProperty
           
 
Field Summary
static String GLOBAL_CONF_FILENAME
           
static String USER_ACCUMULO_DIR_NAME
           
static String USER_CONF_FILENAME
           
 
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN
 
Constructor Summary
ClientConfiguration(org.apache.commons.configuration.Configuration... configs)
          Iterates through the Configuration objects, populating this object.
ClientConfiguration(List<? extends org.apache.commons.configuration.Configuration> configs)
           
 
Method Summary
static ClientConfiguration deserialize(String serializedConfig)
           
 String get(ClientConfiguration.ClientProperty prop)
          Returns the value for prop, the default value if not present.
static ClientConfiguration loadDefault()
          Attempts to load a configuration file from the system.
 String serialize()
           
 void setProperty(ClientConfiguration.ClientProperty prop, String value)
          Sets the value of property to value
 ClientConfiguration with(ClientConfiguration.ClientProperty prop, String value)
          Same as setProperty(ClientProperty, String) but returns the ClientConfiguration for chaining purposes
 ClientConfiguration withInstance(String instanceName)
          Same as with(ClientProperty, String) for ClientProperty.INSTANCE_NAME
 ClientConfiguration withInstance(UUID instanceId)
          Same as with(ClientProperty, String) for ClientProperty.INSTANCE_ID
 ClientConfiguration withKeystore(String path)
          Same as withKeystore(String, String, String) with password null and type null
 ClientConfiguration withKeystore(String path, String password, String type)
          Same as with(ClientProperty, String) for ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH, ClientProperty.RPC_SSL_KEYSTORE_PATH, ClientProperty.RPC_SSL_KEYSTORE_PASSWORD, and ClientProperty.RPC_SSL_KEYSTORE_TYPE
 ClientConfiguration withSsl(boolean sslEnabled)
          Same as withSsl(boolean, boolean) with useJsseConfig set to false
 ClientConfiguration withSsl(boolean sslEnabled, boolean useJsseConfig)
          Same as with(ClientProperty, String) for ClientProperty.INSTANCE_RPC_SSL_ENABLED and ClientProperty.RPC_USE_JSSE
 ClientConfiguration withTruststore(String path)
          Same as withTruststore(String) with password null and type null
 ClientConfiguration withTruststore(String path, String password, String type)
          Same as with(ClientProperty, String) for ClientProperty.RPC_SSL_TRUSTORE_PATH, ClientProperty.RPC_SSL_TRUSTORE_PASSWORD, and ClientProperty.RPC_SSL_TRUSTORE_TYPE
 ClientConfiguration withZkHosts(String zooKeepers)
          Same as with(ClientProperty, String) for ClientProperty.INSTANCE_ZK_HOST
 ClientConfiguration withZkTimeout(int timeout)
          Same as with(ClientProperty, String) for ClientProperty.INSTANCE_ZK_TIMEOUT
 
Methods inherited from class org.apache.commons.configuration.CompositeConfiguration
addConfiguration, addPropertyDirect, clear, clearPropertyDirect, clone, containsKey, getConfiguration, getInMemoryConfiguration, getKeys, getKeys, getList, getNumberOfConfigurations, getProperty, getSource, getStringArray, isEmpty, removeConfiguration, setDelimiterParsingDisabled, setListDelimiter
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addErrorLogListener, addProperty, append, clearProperty, copy, createInterpolator, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDefaultListDelimiter, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getList, getListDelimiter, getLogger, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getSubstitutor, interpolate, interpolate, interpolatedConfiguration, interpolateHelper, isDelimiterParsingDisabled, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setLogger, setProperty, setThrowExceptionOnMissing, subset
 
Methods inherited from class org.apache.commons.configuration.event.EventSource
addConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, createErrorEvent, createEvent, fireError, fireEvent, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEvents
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_ACCUMULO_DIR_NAME

public static final String USER_ACCUMULO_DIR_NAME
See Also:
Constant Field Values

USER_CONF_FILENAME

public static final String USER_CONF_FILENAME
See Also:
Constant Field Values

GLOBAL_CONF_FILENAME

public static final String GLOBAL_CONF_FILENAME
See Also:
Constant Field Values
Constructor Detail

ClientConfiguration

public ClientConfiguration(List<? extends org.apache.commons.configuration.Configuration> configs)

ClientConfiguration

public ClientConfiguration(org.apache.commons.configuration.Configuration... configs)
Iterates through the Configuration objects, populating this object.

See Also:
PropertiesConfiguration, loadDefault()
Method Detail

loadDefault

public static ClientConfiguration loadDefault()
Attempts to load a configuration file from the system. Uses the "ACCUMULO_CLIENT_CONF_PATH" environment variable, split on File.pathSeparator, for a list of target files. If not set, uses the following in this order- ~/.accumulo/config $ACCUMULO_CONF_DIR/client.conf -OR- $ACCUMULO_HOME/conf/client.conf (depending on whether $ACCUMULO_CONF_DIR is set) /etc/accumulo/client.conf A client configuration will then be read from each location using PropertiesConfiguration to construct a configuration. That means the latest item will be the one in the configuration.

See Also:
PropertiesConfiguration, File.pathSeparator

deserialize

public static ClientConfiguration deserialize(String serializedConfig)

serialize

public String serialize()

get

public String get(ClientConfiguration.ClientProperty prop)
Returns the value for prop, the default value if not present.


setProperty

public void setProperty(ClientConfiguration.ClientProperty prop,
                        String value)
Sets the value of property to value


with

public ClientConfiguration with(ClientConfiguration.ClientProperty prop,
                                String value)
Same as setProperty(ClientProperty, String) but returns the ClientConfiguration for chaining purposes


withInstance

public ClientConfiguration withInstance(String instanceName)
Same as with(ClientProperty, String) for ClientProperty.INSTANCE_NAME


withInstance

public ClientConfiguration withInstance(UUID instanceId)
Same as with(ClientProperty, String) for ClientProperty.INSTANCE_ID


withZkHosts

public ClientConfiguration withZkHosts(String zooKeepers)
Same as with(ClientProperty, String) for ClientProperty.INSTANCE_ZK_HOST


withZkTimeout

public ClientConfiguration withZkTimeout(int timeout)
Same as with(ClientProperty, String) for ClientProperty.INSTANCE_ZK_TIMEOUT


withSsl

public ClientConfiguration withSsl(boolean sslEnabled)
Same as withSsl(boolean, boolean) with useJsseConfig set to false


withSsl

public ClientConfiguration withSsl(boolean sslEnabled,
                                   boolean useJsseConfig)
Same as with(ClientProperty, String) for ClientProperty.INSTANCE_RPC_SSL_ENABLED and ClientProperty.RPC_USE_JSSE


withTruststore

public ClientConfiguration withTruststore(String path)
Same as withTruststore(String) with password null and type null


withTruststore

public ClientConfiguration withTruststore(String path,
                                          String password,
                                          String type)
Same as with(ClientProperty, String) for ClientProperty.RPC_SSL_TRUSTORE_PATH, ClientProperty.RPC_SSL_TRUSTORE_PASSWORD, and ClientProperty.RPC_SSL_TRUSTORE_TYPE


withKeystore

public ClientConfiguration withKeystore(String path)
Same as withKeystore(String, String, String) with password null and type null


withKeystore

public ClientConfiguration withKeystore(String path,
                                        String password,
                                        String type)
Same as with(ClientProperty, String) for ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH, ClientProperty.RPC_SSL_KEYSTORE_PATH, ClientProperty.RPC_SSL_KEYSTORE_PASSWORD, and ClientProperty.RPC_SSL_KEYSTORE_TYPE



Copyright © 2015 Apache Accumulo Project. All rights reserved.