com.couchbase.client.vbucket
Class ConfigurationProviderHTTP

java.lang.Object
  extended by net.spy.memcached.compat.SpyObject
      extended by com.couchbase.client.vbucket.ConfigurationProviderHTTP
All Implemented Interfaces:
ConfigurationProvider

public class ConfigurationProviderHTTP
extends net.spy.memcached.compat.SpyObject
implements ConfigurationProvider

A configuration provider.


Field Summary
static java.lang.String CLIENT_SPEC_VER
          The specification version which this client meets.
 
Constructor Summary
ConfigurationProviderHTTP(java.util.List<java.net.URI> baseList)
          Constructs a configuration provider with disabled authentication for the REST service.
ConfigurationProviderHTTP(java.util.List<java.net.URI> baseList, java.lang.String restUsr, java.lang.String restPwd)
          Constructs a configuration provider with a given credentials for the REST service.
 
Method Summary
 void finishResubscribe()
           
 java.lang.String getAnonymousAuthBucket()
          Retrieves a default bucket name i.e.
 java.lang.String getBucket()
          Returns the current bucket name.
 Bucket getBucketConfiguration(java.lang.String bucketname)
          Connects to the REST service and retrieves the bucket configuration from the first pool available.
 Config getLatestConfig(java.lang.String bucketname)
           
 Reconfigurable getReconfigurable()
          Returns the current Reconfigurable object.
 java.util.List<java.net.InetSocketAddress> getServerList(java.lang.String bucketname)
           
 void markForResubscribe(java.lang.String bucketName, Reconfigurable rec)
           
 void shutdown()
          Shutdowns a monitor connections to the REST service.
 void subscribe(java.lang.String bucketName, Reconfigurable rec)
          Subscribes for configuration updates.
 java.lang.String toString()
           
 void unsubscribe(java.lang.String vbucketName, Reconfigurable rec)
          Unsubscribe from updates on a given bucket and given reconfigurable.
 void updateBucket(java.lang.String bucketname, Bucket newBucket)
          Update the configuration provider with a new bucket.
 
Methods inherited from class net.spy.memcached.compat.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLIENT_SPEC_VER

public static final java.lang.String CLIENT_SPEC_VER
The specification version which this client meets. This will be included in requests to the server.

See Also:
Constant Field Values
Constructor Detail

ConfigurationProviderHTTP

public ConfigurationProviderHTTP(java.util.List<java.net.URI> baseList)
                          throws java.io.IOException
Constructs a configuration provider with disabled authentication for the REST service.

Parameters:
baseList - list of urls to treat as base
Throws:
java.io.IOException

ConfigurationProviderHTTP

public ConfigurationProviderHTTP(java.util.List<java.net.URI> baseList,
                                 java.lang.String restUsr,
                                 java.lang.String restPwd)
Constructs a configuration provider with a given credentials for the REST service.

Parameters:
baseList - list of urls to treat as base
restUsr - username
restPwd - password
Method Detail

getReconfigurable

public Reconfigurable getReconfigurable()
Returns the current Reconfigurable object.

Specified by:
getReconfigurable in interface ConfigurationProvider

getBucket

public java.lang.String getBucket()
Returns the current bucket name.

Specified by:
getBucket in interface ConfigurationProvider

getBucketConfiguration

public Bucket getBucketConfiguration(java.lang.String bucketname)
Connects to the REST service and retrieves the bucket configuration from the first pool available.

Specified by:
getBucketConfiguration in interface ConfigurationProvider
Parameters:
bucketname - bucketname
Returns:
vbucket configuration

updateBucket

public void updateBucket(java.lang.String bucketname,
                         Bucket newBucket)
Update the configuration provider with a new bucket. This method is usually called from the CouchbaseClient class during reconfiguration to make sure the configuration provider has the most recent bucket available (including the enclosed config).

Specified by:
updateBucket in interface ConfigurationProvider
Parameters:
bucketname - the name of the bucket.
newBucket - the new bucket to update.

getServerList

public java.util.List<java.net.InetSocketAddress> getServerList(java.lang.String bucketname)

finishResubscribe

public void finishResubscribe()
Specified by:
finishResubscribe in interface ConfigurationProvider

markForResubscribe

public void markForResubscribe(java.lang.String bucketName,
                               Reconfigurable rec)
Specified by:
markForResubscribe in interface ConfigurationProvider

subscribe

public void subscribe(java.lang.String bucketName,
                      Reconfigurable rec)
Subscribes for configuration updates.

Specified by:
subscribe in interface ConfigurationProvider
Parameters:
bucketName - bucket name to receive configuration for
rec - reconfigurable that will receive updates

unsubscribe

public void unsubscribe(java.lang.String vbucketName,
                        Reconfigurable rec)
Unsubscribe from updates on a given bucket and given reconfigurable.

Specified by:
unsubscribe in interface ConfigurationProvider
Parameters:
vbucketName - bucket name
rec - reconfigurable

getLatestConfig

public Config getLatestConfig(java.lang.String bucketname)

getAnonymousAuthBucket

public java.lang.String getAnonymousAuthBucket()
Description copied from interface: ConfigurationProvider
Retrieves a default bucket name i.e. 'default'.

Specified by:
getAnonymousAuthBucket in interface ConfigurationProvider
Returns:
the anonymous bucket's name i.e. 'default'

shutdown

public void shutdown()
Shutdowns a monitor connections to the REST service.

Specified by:
shutdown in interface ConfigurationProvider

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.