public class CompSQLRepository extends Object implements ComponentRepository<CompRepoItem>
Repository.Meta
Modifier and Type | Field and Description |
---|---|
static String |
REPO_URI_PROP_KEY
Field description
|
static String |
TABLE_NAME
Field description
|
COMP_REPO_BIND
Constructor and Description |
---|
CompSQLRepository() |
Modifier and Type | Method and Description |
---|---|
void |
addItem(CompRepoItem item)
Method description
|
void |
addItemNoStore(CompRepoItem item)
The method adds a new or updates existing Item.
|
void |
addRepoChangeListener(RepositoryChangeListenerIfc<CompRepoItem> repoChangeListener)
Method description
|
Collection<CompRepoItem> |
allItems()
Method description
|
boolean |
contains(String key)
Method description
|
void |
destroy()
Method destroys this instance of ComponentRepository releasing resources
allocated for this instance of ComponentRepository if possible
|
void |
getDefaults(Map<String,Object> defs,
Map<String,Object> params)
Method description
|
CompRepoItem |
getItem(String key)
Method description
|
CompRepoItem |
getItemInstance()
Method description
|
void |
initRepository(String conn_str,
Map<String,String> params)
Method description
|
Iterator<CompRepoItem> |
iterator()
Method description
|
void |
reload()
Method description
|
void |
removeItem(String key)
Method description
|
void |
removeRepoChangeListener(RepositoryChangeListenerIfc<CompRepoItem> repoChangeListener)
Method description
|
void |
setAutoloadTimer(long delay)
Method description
|
void |
setProperties(Map<String,Object> properties)
Method description
|
int |
size()
Method description
|
void |
store()
Method description
|
String |
validateItem(CompRepoItem item)
Method description
|
public static final String REPO_URI_PROP_KEY
public static final String TABLE_NAME
public void addRepoChangeListener(RepositoryChangeListenerIfc<CompRepoItem> repoChangeListener)
addRepoChangeListener
in interface ComponentRepository<CompRepoItem>
repoChangeListener
- public void removeRepoChangeListener(RepositoryChangeListenerIfc<CompRepoItem> repoChangeListener)
removeRepoChangeListener
in interface ComponentRepository<CompRepoItem>
repoChangeListener
- public void addItemNoStore(CompRepoItem item)
ComponentRepository
addItemNoStore
in interface ComponentRepository<CompRepoItem>
item
- a Item
with all it's configuration parameters.public void addItem(CompRepoItem item)
addItem
in interface ComponentRepository<CompRepoItem>
item
- public Collection<CompRepoItem> allItems()
allItems
in interface ComponentRepository<CompRepoItem>
public boolean contains(String key)
contains
in interface ComponentRepository<CompRepoItem>
key
- boolean
value true
if the item exists
in the repository or false
of it does not.public void destroy()
ComponentRepository
destroy
in interface ComponentRepository<CompRepoItem>
public void getDefaults(Map<String,Object> defs, Map<String,Object> params)
getDefaults
in interface ComponentRepository<CompRepoItem>
defs
- params
- public CompRepoItem getItem(String key)
getItem
in interface ComponentRepository<CompRepoItem>
key
- Item
for a given key or null
if the
item is not in the repository.public CompRepoItem getItemInstance()
getItemInstance
in interface ComponentRepository<CompRepoItem>
public void initRepository(String conn_str, Map<String,String> params) throws DBInitException
initRepository
in interface Repository
conn_str
- params
- SQLException
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<CompRepoItem> iterator()
iterator
in interface Iterable<CompRepoItem>
public void reload()
reload
in interface ComponentRepository<CompRepoItem>
public void removeItem(String key)
removeItem
in interface ComponentRepository<CompRepoItem>
key
- public void setProperties(Map<String,Object> properties)
setProperties
in interface ComponentRepository<CompRepoItem>
properties
- public int size()
size
in interface ComponentRepository<CompRepoItem>
int
value with number of items in the repository.public void store()
store
in interface ComponentRepository<CompRepoItem>
public String validateItem(CompRepoItem item)
validateItem
in interface ComponentRepository<CompRepoItem>
item
- null
on success and an error message otherwise.public void setAutoloadTimer(long delay)
setAutoloadTimer
in interface ComponentRepository<CompRepoItem>
delay
- Copyright © 2014 "Tigase, Inc.". All rights reserved.