public class SingleJsonFileConfigurationStorage extends Object implements Configuration
Configuration.ConfigStorageType, Configuration.NodeFactory
BatchRunner.Batch
Modifier and Type | Field and Description |
---|---|
static String |
CONF_FILENAME_SYSPROP |
private String |
fileName |
private static Logger |
log |
private org.codehaus.jackson.map.ObjectMapper |
objectMapper |
static String |
USE_GIT_SYSPROP
Experimental
|
CONF_STORAGE_SYSTEM_PROP, OLOCK_HASH_KEY, REFERENCE_BY_UUID_PATTERN, REFERENCE_KEY, UUID_KEY, WEAK_REFERENCE_KEY
Constructor and Description |
---|
SingleJsonFileConfigurationStorage() |
SingleJsonFileConfigurationStorage(String fileName) |
Modifier and Type | Method and Description |
---|---|
void |
configure(Hashtable<?,?> props) |
Object |
getConfigurationNode(Path path,
Class configurableClass)
Loads a configuration node under the specified path.
|
Map<String,Object> |
getConfigurationRoot()
Return the root of the configuration tree.
|
Path |
getPathByUUID(String uuid) |
void |
lock()
Aquire a global pessimistic lock (cluster-aware implementations should ensure that only a single node can aquire the lock at a time)
Subsequent calls from the same transaction should not block.
|
boolean |
nodeExists(Path path)
Tests if a node under the specified path exists.
|
void |
persistNode(Path path,
Map<String,Object> configNode,
Class configurableClass)
Persists the configuration node to the specified path.
|
void |
refreshNode(Path path)
Invalidates any present cached state for the node
It is imperative that some other nodes might also be refreshed during the operation.
|
void |
removeNode(Path path)
Removes a configuration node under the specified path with all its children permanently
|
static String |
resolveConfigFileNameSetting(Hashtable<?,?> props) |
void |
runBatch(BatchRunner.Batch batch)
Provides support for batching configuration changes.
|
Iterator |
search(String liteXPathExpression)
Performs a search on the configuration tree and returns an iterator to configuration nodes that satisfy the search criteria.
|
public static final String CONF_FILENAME_SYSPROP
public static final String USE_GIT_SYSPROP
private org.codehaus.jackson.map.ObjectMapper objectMapper
public SingleJsonFileConfigurationStorage()
public SingleJsonFileConfigurationStorage(String fileName)
public static String resolveConfigFileNameSetting(Hashtable<?,?> props)
public boolean nodeExists(Path path) throws ConfigurationException
Configuration
nodeExists
in interface Configuration
ConfigurationException
public Map<String,Object> getConfigurationRoot() throws ConfigurationException
Configuration
getConfigurationRoot
in interface Configuration
ConfigurationException
public Object getConfigurationNode(Path path, Class configurableClass) throws ConfigurationException
Configuration
getConfigurationNode
in interface Configuration
path
- A reference to a nodeConfigurationException
public void persistNode(Path path, Map<String,Object> configNode, Class configurableClass) throws ConfigurationException
Configuration
persistNode
in interface Configuration
path
- path to the nodeconfigNode
- configuration node to persistconfigurableClass
- class annotated with ConfigurableClass, ConfigurableProperty annotations that corresponds to this node.ConfigurationException
public void refreshNode(Path path)
Configuration
refreshNode
in interface Configuration
public void removeNode(Path path) throws ConfigurationException
Configuration
removeNode
in interface Configuration
ConfigurationException
public Path getPathByUUID(String uuid)
getPathByUUID
in interface Configuration
public Iterator search(String liteXPathExpression) throws IllegalArgumentException, ConfigurationException
Configuration
search
in interface Configuration
liteXPathExpression
- Must be absolute path, no double slashes, no @attributes (only [attr=val] or [attr<>val])IllegalArgumentException
ConfigurationException
public void lock()
Configuration
lock
in interface Configuration
public void runBatch(BatchRunner.Batch batch)
BatchRunner
runBatch
in interface BatchRunner
batch
- Configuration batch change to executeCopyright © 2017 dcm4che.org. All rights reserved.