org.fao.geonet.kernel.setting
Class SettingManager

java.lang.Object
  extended by org.fao.geonet.kernel.setting.SettingManager

public class SettingManager
extends 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(Dbms dbms, ProviderManager provMan)
           
 
Method Summary
 String add(Dbms dbms, String path, Object name, Object value)
          When adding to a newly created node, path must be 'id:...'.
 org.jdom.Element get(String path, int level)
           
 String getValue(String path)
           
 boolean getValueAsBool(String path)
           
 boolean getValueAsBool(String path, boolean defValue)
           
 Integer getValueAsInt(String path)
           
 boolean refresh(Dbms dbms)
          Refreshes current settings manager.
 boolean remove(Dbms dbms, String path)
          TODO javadoc.
 boolean removeChildren(Dbms dbms, String path)
          TODO javadoc.
 boolean setName(Dbms dbms, String path, String name)
          TODO javadoc.
 boolean setValue(Dbms dbms, String path, Object value)
          TODO javadoc.
 boolean setValues(Dbms dbms, Map<String,Object> values)
          TODO javadoc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SettingManager

public SettingManager(Dbms dbms,
                      ProviderManager provMan)
               throws SQLException
Throws:
SQLException
Method Detail

get

public org.jdom.Element get(String path,
                            int level)

getValue

public String getValue(String path)

setName

public boolean setName(Dbms dbms,
                       String path,
                       String name)
                throws SQLException
TODO javadoc.

Parameters:
dbms -
path -
name -
Returns:
Throws:
SQLException

setValue

public boolean setValue(Dbms dbms,
                        String path,
                        Object value)
                 throws SQLException
TODO javadoc.

Parameters:
dbms -
path -
value -
Returns:
Throws:
SQLException

setValues

public boolean setValues(Dbms dbms,
                         Map<String,Object> values)
                  throws SQLException
TODO javadoc.

Parameters:
dbms -
values -
Returns:
Throws:
SQLException

add

public String add(Dbms dbms,
                  String path,
                  Object name,
                  Object value)
           throws SQLException
When adding to a newly created node, path must be 'id:...'.

Parameters:
dbms -
path -
name -
value -
Returns:
Throws:
SQLException

remove

public boolean remove(Dbms dbms,
                      String path)
               throws SQLException
TODO javadoc.

Parameters:
dbms -
path -
Returns:
Throws:
SQLException

removeChildren

public boolean removeChildren(Dbms dbms,
                              String path)
                       throws SQLException
TODO javadoc.

Parameters:
dbms -
path -
Returns:
Throws:
SQLException

refresh

public boolean refresh(Dbms dbms)
                throws SQLException
Refreshes current settings manager. This has to be used when updating the Settings table without using this class. For example when using an SQL script.

Throws:
SQLException

getValueAsBool

public boolean getValueAsBool(String path,
                              boolean defValue)

getValueAsBool

public boolean getValueAsBool(String path)

getValueAsInt

public Integer getValueAsInt(String path)


Copyright © 2003-2013. All Rights Reserved.