org.fao.geonet.kernel.setting
Class SettingManager
java.lang.Object
org.fao.geonet.kernel.setting.SettingManager
public class SettingManager
- extends java.lang.Object
Allows hierarchical management of application settings. The settings API
has been designed with the following goals:
- speed: all the settings tree is kept into memory
- transactional: changes follow the rules of transactions. The only issue
is that changes are not visible until commit. If a thread
changes a value and then reads it, the thread gets the old
value. Added settings will not be visible and removed ones
will still be visible until commit.
- concurrent: many thread can access the settings API at the same time. A
read/write lock is used to arbitrate threads
Multiple removes: there are no issues. If thread A removes a subtree S1 and
another thread B removes a subtree S2 inside S1, the first thread to commit
succeeds while the second always rises a 'cannot serializable exception'.
In any commit combination, the settings integrity is maintained.
Tree structure:
+ system
| + options
| + useProxy
| + host
| + port
|
+ harvesting
Constructor Summary |
SettingManager(jeeves.resources.dbms.Dbms dbms,
jeeves.server.resources.ProviderManager provMan)
|
Method Summary |
java.lang.String |
add(jeeves.resources.dbms.Dbms dbms,
java.lang.String path,
java.lang.Object name,
java.lang.Object value)
When adding to a newly created node, path must be 'id:...' |
org.jdom.Element |
get(java.lang.String path,
int level)
|
java.lang.String |
getValue(java.lang.String path)
|
boolean |
getValueAsBool(java.lang.String path)
|
boolean |
getValueAsBool(java.lang.String path,
boolean defValue)
|
java.lang.Integer |
getValueAsInt(java.lang.String path)
|
boolean |
remove(jeeves.resources.dbms.Dbms dbms,
java.lang.String path)
|
boolean |
removeChildren(jeeves.resources.dbms.Dbms dbms,
java.lang.String path)
|
boolean |
setName(jeeves.resources.dbms.Dbms dbms,
java.lang.String path,
java.lang.String name)
|
boolean |
setValue(jeeves.resources.dbms.Dbms dbms,
java.lang.String path,
java.lang.Object value)
|
boolean |
setValues(jeeves.resources.dbms.Dbms dbms,
java.util.Map<java.lang.String,java.lang.Object> values)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SettingManager
public SettingManager(jeeves.resources.dbms.Dbms dbms,
jeeves.server.resources.ProviderManager provMan)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
get
public org.jdom.Element get(java.lang.String path,
int level)
getValue
public java.lang.String getValue(java.lang.String path)
setName
public boolean setName(jeeves.resources.dbms.Dbms dbms,
java.lang.String path,
java.lang.String name)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
setValue
public boolean setValue(jeeves.resources.dbms.Dbms dbms,
java.lang.String path,
java.lang.Object value)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
setValues
public boolean setValues(jeeves.resources.dbms.Dbms dbms,
java.util.Map<java.lang.String,java.lang.Object> values)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
add
public java.lang.String add(jeeves.resources.dbms.Dbms dbms,
java.lang.String path,
java.lang.Object name,
java.lang.Object value)
throws java.sql.SQLException
- When adding to a newly created node, path must be 'id:...'
- Throws:
java.sql.SQLException
remove
public boolean remove(jeeves.resources.dbms.Dbms dbms,
java.lang.String path)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
removeChildren
public boolean removeChildren(jeeves.resources.dbms.Dbms dbms,
java.lang.String path)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
getValueAsBool
public boolean getValueAsBool(java.lang.String path,
boolean defValue)
getValueAsBool
public boolean getValueAsBool(java.lang.String path)
getValueAsInt
public java.lang.Integer getValueAsInt(java.lang.String path)