public class ZooKeeperConfigurationComponent
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ZK_CONFIG_ROOT_PATH |
static java.lang.String |
ZK_CONFIG_UPDATE_ALLOWED_KEY |
Constructor and Description |
---|
ZooKeeperConfigurationComponent(CuratorComponent curatorComponent) |
Modifier and Type | Method and Description |
---|---|
ConcurrentCompositeConfiguration |
buildCompositeConfiguration(CuratorFramework curatorFramework,
ConcurrentCompositeConfiguration defaultConfig,
int index)
Create one or more Zookeeper-backed ConfigurationSources and insert them into the provided CompositeConfiguration
at the given index.
|
void |
close() |
void |
deleteProperty(java.lang.String key) |
void |
deleteProperty(java.lang.String zkRoot,
java.lang.String key) |
java.lang.String |
getProperty(java.lang.String key)
for testing.
|
int |
getZkConfigurationIndex() |
void |
init(CuratorComponent curatorComponent)
Start up our ZK ConfigurationSources.
|
void |
init(CuratorFramework curator) |
void |
setProperty(java.lang.String key,
java.lang.Object value) |
void |
setProperty(java.lang.String zkRoot,
java.lang.String key,
java.lang.Object value) |
public static final java.lang.String ZK_CONFIG_ROOT_PATH
public static final java.lang.String ZK_CONFIG_UPDATE_ALLOWED_KEY
public ZooKeeperConfigurationComponent(CuratorComponent curatorComponent)
@WhenReady public void init(CuratorComponent curatorComponent) throws java.lang.Exception
java.lang.Exception
public void init(CuratorFramework curator) throws java.lang.Exception
java.lang.Exception
@PreDestroy public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public ConcurrentCompositeConfiguration buildCompositeConfiguration(CuratorFramework curatorFramework, ConcurrentCompositeConfiguration defaultConfig, int index) throws java.lang.Exception
curatorFramework
- should be starteddefaultConfig
- the config we should insert the new ZK configurations intoindex
- the index where we should insert the ZK configurationsjava.lang.Exception
public void deleteProperty(java.lang.String key)
public void deleteProperty(java.lang.String zkRoot, java.lang.String key)
public void setProperty(java.lang.String key, java.lang.Object value)
public void setProperty(java.lang.String zkRoot, java.lang.String key, java.lang.Object value)
public java.lang.String getProperty(java.lang.String key)
ConfigurationComponent
This assumes that the value is a String, since Archaius's ZookeeperConfigurationSource makes the same assumption.key
- the property to look upSerializationException
- if the value can't be converted to a Stringpublic int getZkConfigurationIndex()