@Component(value="cuba_ConfigStorage") public class ConfigStorage extends java.lang.Object implements ConfigStorageAPI
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
cache |
protected ClusterManagerAPI |
clusterManager |
protected java.util.concurrent.locks.ReadWriteLock |
lock |
protected Persistence |
persistence |
protected java.util.concurrent.locks.Lock |
readLock |
protected java.util.concurrent.locks.Lock |
writeLock |
NAME
Constructor and Description |
---|
ConfigStorage() |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clear properties cache.
|
java.util.Map<java.lang.String,java.lang.String> |
getDbProperties()
Loads all properties stored in the database.
|
java.lang.String |
getDbProperty(java.lang.String name)
Loads a property from the database.
|
protected void |
loadCache() |
void |
setClusterManager(ClusterManagerAPI clusterManager) |
void |
setDbProperty(java.lang.String name,
java.lang.String value)
Saves a property into the database.
|
@Inject protected Persistence persistence
protected ClusterManagerAPI clusterManager
protected java.util.Map<java.lang.String,java.lang.String> cache
protected java.util.concurrent.locks.ReadWriteLock lock
protected java.util.concurrent.locks.Lock readLock
protected java.util.concurrent.locks.Lock writeLock
@Inject public void setClusterManager(ClusterManagerAPI clusterManager)
public void clearCache()
ConfigStorageAPI
clearCache
in interface ConfigStorageAPI
public java.util.Map<java.lang.String,java.lang.String> getDbProperties()
ConfigStorageAPI
getDbProperties
in interface ConfigStorageAPI
public java.lang.String getDbProperty(java.lang.String name)
ConfigStorageAPI
getDbProperty
in interface ConfigStorageAPI
name
- property nameprotected void loadCache()
public void setDbProperty(java.lang.String name, java.lang.String value)
ConfigStorageAPI
If an active transaction exists, it will be used without creating a new one. This allows you to include saving properties into your business logic. If you want to separate the property saving, just start a new transaction prior to calling this method.
setDbProperty
in interface ConfigStorageAPI
name
- property namevalue
- property value