public class ConfigurationCache extends Object implements ConfigRepositoryIfc
Repository.Meta, Repository.SchemaId| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_DUMP_FILE_PROP_DEF |
static String |
CONFIG_DUMP_FILE_PROP_KEY |
RELOAD_DELAY, RESOURCE_URICOMP_REPO_BIND| Constructor and Description |
|---|
ConfigurationCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(ConfigItem item)
The method adds a new or updates existing Item in the repository.
|
void |
addItem(String compName,
ConfigItem item) |
void |
addItem(String key,
Object value)
Method adds an Item to the configuration repository where the key is the item key constructed of component name,
node name and property key name.
|
void |
addItemNoStore(ConfigItem item)
The method adds a new or updates existing Item.
|
void |
addRepoChangeListener(RepositoryChangeListenerIfc<ConfigItem> repoChangeListener)
Adds a listener for repository Item change.
|
Collection<ConfigItem> |
allItems()
Returns a collection with all items stored in the repository.
|
boolean |
contains(String key)
The method checks whether the item is stored in the repository.
|
void |
destroy()
Method destroys this instance of ComponentRepository releasing resources allocated for this instance of
ComponentRepository if possible
|
Object |
get(String compName,
String node,
String key,
Object def)
Returns a configuration setting for a given component, node and key.
|
String[] |
getCompNames()
Returns all component names for which there are some configuration settings available.
|
void |
getDefaults(Map<String,Object> defs,
Map<String,Object> params)
Deprecated.
|
String |
getDefHostname() |
Map<String,Object> |
getInitProperties() |
ConfigItem |
getItem(String key)
The method returns all item configuration parameters for a key or
null if the item does not exist in
the repository. |
ConfigItem |
getItem(String compName,
String node,
String key) |
ConfigItem |
getItemInstance()
Creates a new, uninitialized instance of the repository Item.
|
Set<ConfigItem> |
getItemsForComponent(String compName)
Get set of config items stored for component
|
String[] |
getKeys(String compName,
String node)
Returns an array of all configuration keys for a given component and configuration node.
|
Map<String,Object> |
getProperties(String compName)
Deprecated.
|
void |
initRepository(String resource_uri,
Map<String,String> params)
Deprecated.
|
Iterator<ConfigItem> |
iterator() |
void |
putProperties(String compName,
Map<String,Object> props)
Sets/adds properties for the given component name.
|
void |
reload()
This method is called to reload items from the database or other permanent storage.
|
void |
remove(String compName,
String node,
String key)
Removes a configuration setting from the configuration repository.
|
void |
removeItem(String key)
The method is called to remove given Item from the memory cache and permanent storage.
|
void |
removeItem(String compName,
ConfigItem item) |
void |
removeItemNoStore(String key) |
void |
removeRepoChangeListener(RepositoryChangeListenerIfc<ConfigItem> repoChangeListener)
Removes a listener for repository Item change.
|
void |
set(String compName,
String node,
String key,
Object value)
Puts/sets/adds/updates a configuration setting to the configuration repository.
|
void |
setAutoloadTimer(long delay)
Sets autoload task to periodically reload data from database.
|
void |
setDefHostname(String hostname)
This is used to load a configuration for a selected cluster node.
|
void |
setProperties(Map<String,Object> properties)
Deprecated.
|
int |
size()
The method returns number of items in the repository.
|
void |
store()
The method is called to store all data in the database.
|
String |
validateItem(ConfigItem item)
Performs Item validation to check whether it meets the repository policy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic static final String CONFIG_DUMP_FILE_PROP_DEF
public static final String CONFIG_DUMP_FILE_PROP_KEY
public void addRepoChangeListener(RepositoryChangeListenerIfc<ConfigItem> repoChangeListener)
ComponentRepositoryaddRepoChangeListener in interface ComponentRepository<ConfigItem>public void removeRepoChangeListener(RepositoryChangeListenerIfc<ConfigItem> repoChangeListener)
ComponentRepositoryremoveRepoChangeListener in interface ComponentRepository<ConfigItem>public void addItem(String compName, ConfigItem item)
public void addItemNoStore(ConfigItem item)
ComponentRepositoryaddItemNoStore in interface ComponentRepository<ConfigItem>item - a Item with all it's configuration parameters.public void addItem(ConfigItem item) throws TigaseDBException
ComponentRepositoryaddItem in interface ComponentRepository<ConfigItem>item - a Item with all it's configuration parameters.TigaseDBExceptionpublic void addItem(String key, Object value) throws ConfigurationException
ConfigRepositoryIfcaddItem in interface ConfigRepositoryIfcConfigurationExceptionpublic Collection<ConfigItem> allItems() throws TigaseDBException
ComponentRepositoryallItems in interface ComponentRepository<ConfigItem>TigaseDBExceptionpublic boolean contains(String key)
ComponentRepositorycontains in interface ComponentRepository<ConfigItem>key - a String with key to search for.boolean value true if the item exists in the repository or false
of it does not.public void destroy()
ComponentRepositorydestroy in interface ComponentRepository<ConfigItem>public Object get(String compName, String node, String key, Object def)
ConfigRepositoryIfcget in interface ConfigRepositoryIfcpublic String[] getCompNames()
ConfigRepositoryIfcgetCompNames in interface ConfigRepositoryIfcpublic String getDefHostname()
public void setDefHostname(String hostname)
ConfigRepositoryIfcsetDefHostname in interface ConfigRepositoryIfc@Deprecated public void getDefaults(Map<String,Object> defs, Map<String,Object> params)
ComponentRepositorygetDefaults in interface ComponentRepository<ConfigItem>defs - is a Map collection where all repository configuration defaults must be put.params - is a Map collection with some preset properties for the server. These settings can be
used to adjust repository defaults, for example they can contain database connection URL or initial list of
virtual domains.public Map<String,Object> getInitProperties()
getInitProperties in interface ConfigRepositoryIfcpublic ConfigItem getItem(String compName, String node, String key)
public ConfigItem getItem(String key)
ComponentRepositorynull if the item does not exist in
the repository.getItem in interface ComponentRepository<ConfigItem>key - a String with item identifier to search for.Item for a given key or null if the item is not in the repository.public ConfigItem getItemInstance()
ComponentRepositorygetItemInstance in interface ComponentRepository<ConfigItem>public Set<ConfigItem> getItemsForComponent(String compName)
ConfigRepositoryIfcgetItemsForComponent in interface ConfigRepositoryIfcpublic String[] getKeys(String compName, String node)
ConfigRepositoryIfcgetKeys in interface ConfigRepositoryIfc@Deprecated public Map<String,Object> getProperties(String compName) throws ConfigurationException
ConfigRepositoryIfcgetProperties in interface ConfigRepositoryIfcConfigurationException@Deprecated public void initRepository(String resource_uri, Map<String,String> params) throws DBInitException
Repositoryresource_uri parameter as the database connection string or via
params map if the required repository parameters are more complex or both.initRepository in interface Repositoryresource_uri - value in most cases representing the database connection string.params - is a Map with repository properties necessary to initialize and perform all the
functions. The initialization parameters are implementation dependent.DBInitException - if there was an error during repository initialization. Some implementations,
though, perform so called lazy initialization so even though there is a problem with the underlying repository it
may not be signaled through this method call.public Iterator<ConfigItem> iterator()
iterator in interface Iterable<ConfigItem>public void putProperties(String compName, Map<String,Object> props) throws ConfigurationException
ConfigRepositoryIfcputProperties in interface ConfigRepositoryIfcConfigurationExceptionpublic void reload()
throws TigaseDBException
ComponentRepositoryreload in interface ComponentRepository<ConfigItem>TigaseDBExceptionpublic void remove(String compName, String node, String key)
ConfigRepositoryIfcremove in interface ConfigRepositoryIfcpublic void removeItem(String compName, ConfigItem item)
public void removeItem(String key) throws TigaseDBException
ComponentRepositoryremoveItem in interface ComponentRepository<ConfigItem>key - a String with domain name to remove.TigaseDBExceptionpublic void removeItemNoStore(String key)
removeItemNoStore in interface ComponentRepository<ConfigItem>public void set(String compName, String node, String key, Object value)
ConfigRepositoryIfcset in interface ConfigRepositoryIfc@Deprecated public void setProperties(Map<String,Object> properties)
ComponentRepositorysetProperties in interface ComponentRepository<ConfigItem>properties - a Map with configuration settings. Content of this Map must not be
modified. This read-only collection.public int size()
ComponentRepositorysize in interface ComponentRepository<ConfigItem>int value with number of items in the repository.public void store()
throws TigaseDBException
ComponentRepositorystore in interface ComponentRepository<ConfigItem>TigaseDBExceptionpublic String validateItem(ConfigItem item)
ComponentRepositorynull, otherwise it returns an error description.validateItem in interface ComponentRepository<ConfigItem>item - is an Item object to perform validation checking upon.null on success and an error message otherwise.public void setAutoloadTimer(long delay)
ComponentRepositorysetAutoloadTimer in interface ComponentRepository<ConfigItem>delay - in seconds between each database reload.Copyright © 2004–2020 "Tigase, Inc.". All rights reserved.