Item - public abstract class ConfigRepository<Item extends RepositoryItem> extends Object implements ComponentRepository<Item>
Repository.Meta| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Item> |
items
Field description
|
protected int |
itemsHash |
COMP_REPO_BIND| Constructor and Description |
|---|
ConfigRepository() |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(Item item)
The method adds a new or updates existing Item in the repository.
|
void |
addItemNoStore(Item item)
The method adds a new or updates existing Item.
|
void |
addRepoChangeListener(RepositoryChangeListenerIfc<Item> repoChangeListener)
Adds a listener for repository Item change.
|
Collection<Item> |
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.
|
abstract String |
getConfigKey()
Method description
|
abstract String[] |
getDefaultPropetyItems()
Method description
|
void |
getDefaults(Map<String,Object> defs,
Map<String,Object> params)
The method is called to obtain default configuration settings if there are
any for this repository implementation The configuration settings are
implementation dependent and there are no defaults set by the server.
|
Item |
getItem(String key)
The method returns all item configuration parameters for a key or
null if the item does not exist in the repository. |
abstract String |
getPropertyKey()
Method description
|
protected void |
initItemsMap()
Method create instance of items Map.
|
boolean |
itemChanged(Item oldItem,
Item newItem)
Method description
|
Iterator<Item> |
iterator() |
void |
reload()
This method is called to reload items from the database or other permanent
storage.
|
void |
removeItem(String key)
The method is called to remove given Item from the memory cache and
permanent storage.
|
void |
removeRepoChangeListener(RepositoryChangeListenerIfc<Item> repoChangeListener)
Removes a listener for repository Item change.
|
void |
setAutoloadTimer(long delay)
Sets autoload task to periodically reload data from database.
|
void |
setProperties(Map<String,Object> properties)
The method is called to set configuration for this repository
implementation.
|
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 |
toString() |
String |
validateItem(Item item)
Performs Item validation to check whether it meets the repository policy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdestroy, getItemInstanceforEach, spliteratorinitRepositoryprotected Map<String,Item extends RepositoryItem> items
protected int itemsHash
public void setAutoloadTimer(long delay)
ComponentRepositorysetAutoloadTimer in interface ComponentRepository<Item extends RepositoryItem>delay - in seconds between each database reload.public void addRepoChangeListener(RepositoryChangeListenerIfc<Item> repoChangeListener)
ComponentRepositoryaddRepoChangeListener in interface ComponentRepository<Item extends RepositoryItem>public void removeRepoChangeListener(RepositoryChangeListenerIfc<Item> repoChangeListener)
ComponentRepositoryremoveRepoChangeListener in interface ComponentRepository<Item extends RepositoryItem>public abstract String getConfigKey()
public abstract String[] getDefaultPropetyItems()
public abstract String getPropertyKey()
public void addItem(Item item)
ComponentRepositoryaddItem in interface ComponentRepository<Item extends RepositoryItem>item - a Item with all it's configuration parameters.public void addItemNoStore(Item item)
ComponentRepositoryaddItemNoStore in interface ComponentRepository<Item extends RepositoryItem>item - a Item with all it's configuration parameters.protected void initItemsMap()
public boolean itemChanged(Item oldItem, Item newItem)
oldItem - newItem - public Collection<Item> allItems()
ComponentRepositoryallItems in interface ComponentRepository<Item extends RepositoryItem>public boolean contains(String key)
ComponentRepositorycontains in interface ComponentRepository<Item extends RepositoryItem>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 getDefaults(Map<String,Object> defs, Map<String,Object> params)
ComponentRepositorygetDefaults in interface ComponentRepository<Item extends RepositoryItem>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 Item getItem(String key)
ComponentRepositorynull if the item does not exist in the repository.getItem in interface ComponentRepository<Item extends RepositoryItem>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 Iterator<Item> iterator()
iterator in interface Iterable<Item extends RepositoryItem>public void reload()
ComponentRepositoryreload in interface ComponentRepository<Item extends RepositoryItem>public void removeItem(String key)
ComponentRepositoryremoveItem in interface ComponentRepository<Item extends RepositoryItem>key - a String with domain name to remove.public void setProperties(Map<String,Object> properties)
ComponentRepositorysetProperties in interface ComponentRepository<Item extends RepositoryItem>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<Item extends RepositoryItem>int value with number of items in the repository.public void store()
ComponentRepositorystore in interface ComponentRepository<Item extends RepositoryItem>public String validateItem(Item item)
ComponentRepositorynull, otherwise
it returns an error description.validateItem in interface ComponentRepository<Item extends RepositoryItem>item - is an Item object to perform validation checking
upon.null on success and an error message otherwise.Copyright © 2022 "Tigase, Inc.". All rights reserved.