public abstract class ConfigRepository<Item extends RepositoryItem> extends Object implements ComponentRepository<Item>, Initializable, UnregisterAware
Repository.Meta, Repository.SchemaId| Modifier and Type | Field and Description |
|---|---|
protected long |
autoReloadInterval |
protected Map<String,Item> |
items |
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.
|
void |
beforeUnregister()
Method called before bean unregister.
|
boolean |
contains(String key)
The method checks whether the item is stored in the repository.
|
abstract String |
getConfigKey() |
Item[] |
getDefaultItems() |
String[] |
getDefaultPropetyItems()
Deprecated.
|
void |
getDefaults(Map<String,Object> defs,
Map<String,Object> params)
Deprecated.
|
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. |
String[] |
getItemsOld()
Deprecated.
|
abstract String |
getPropertyKey()
Deprecated.
|
void |
initialize()
Method will be called, when bean will be created, configured and ready to use.
|
protected void |
initItemsMap()
Method create instance of items Map.
|
protected boolean |
isInitialized() |
boolean |
itemChanged(Item oldItem,
Item newItem) |
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 |
removeItemNoStore(String key) |
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 |
setAutoReloadInterval(long autoLoadInterval) |
void |
setItemsOld(String[] items_arr)
Deprecated.
|
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 |
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, spliteratorinitRepository@ConfigField(desc="Automatic items load interval", alias="repo-autoreload-interval") protected long autoReloadInterval
protected 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 setAutoReloadInterval(long autoLoadInterval)
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 Item[] getDefaultItems()
@Deprecated public String[] getDefaultPropetyItems()
@Deprecated 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.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.@Deprecated 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.@Deprecated public String[] getItemsOld()
@Deprecated public void setItemsOld(String[] items_arr)
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 removeItemNoStore(String key)
removeItemNoStore in interface ComponentRepository<Item extends RepositoryItem>@Deprecated 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.public void beforeUnregister()
UnregisterAwarebeforeUnregister in interface UnregisterAwarepublic void initialize()
Initializableinitialize in interface Initializableprotected void initItemsMap()
protected boolean isInitialized()
Copyright © 2004–2020 "Tigase, Inc.". All rights reserved.