com.datastax.driver.core
Class SimpleAuthInfoProvider

java.lang.Object
  extended by com.datastax.driver.core.SimpleAuthInfoProvider
All Implemented Interfaces:
AuthInfoProvider

public class SimpleAuthInfoProvider
extends Object
implements AuthInfoProvider

A simple AuthInfoProvider implementation.

This provider allows to programmatically define authentication information that will then apply to all hosts.

Note that it is not safe to add new info to this provider once a Cluster instance has been created using this provider.


Field Summary
 
Fields inherited from interface com.datastax.driver.core.AuthInfoProvider
NONE
 
Constructor Summary
SimpleAuthInfoProvider()
          Creates a new, empty, simple authentication info provider.
SimpleAuthInfoProvider(Map<String,String> properties)
          Creates a new simple authentication info provider with the information contained in properties.
 
Method Summary
 SimpleAuthInfoProvider add(String property, String value)
          Adds a new property to the authentication info returned by this provider.
 SimpleAuthInfoProvider addAll(Map<String,String> properties)
          Adds all the key-value pair provided as new authentication information returned by this provider.
 Map<String,String> getAuthInfo(InetAddress host)
          The authentication information to use to connect to host.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAuthInfoProvider

public SimpleAuthInfoProvider()
Creates a new, empty, simple authentication info provider.


SimpleAuthInfoProvider

public SimpleAuthInfoProvider(Map<String,String> properties)
Creates a new simple authentication info provider with the information contained in properties.

Parameters:
properties - a map of authentication information to use.
Method Detail

getAuthInfo

public Map<String,String> getAuthInfo(InetAddress host)
Description copied from interface: AuthInfoProvider
The authentication information to use to connect to host. Please note that if authentication is required, this method will be called to initialize each new connection created by the driver. It is thus a good idea to make sure this method returns relatively quickly.

Specified by:
getAuthInfo in interface AuthInfoProvider
Parameters:
host - the Cassandra host for which authentication information are requested.
Returns:
The authentication information to use.

add

public SimpleAuthInfoProvider add(String property,
                                  String value)
Adds a new property to the authentication info returned by this provider.

Parameters:
property - the name of the property to add.
value - the value to add for property.
Returns:
this object.

addAll

public SimpleAuthInfoProvider addAll(Map<String,String> properties)
Adds all the key-value pair provided as new authentication information returned by this provider.

Parameters:
properties - a map of authentication information to add.
Returns:
this object.


Copyright © 2013. All Rights Reserved.