Class DeveloperSettings
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.utils.developer.DeveloperSettings
-
public class DeveloperSettings extends Object
A singleton holder for the developer settings. Start with an empty settings map. The Setup class will read "developer.properties" from the "config" sub-directory of the Vitro home directory, and load its settings. If the file doesn't exist, or doesn't contain values for certain properties, those properties will keep their default values. An AJAX request can be used to update the properties. If the request has multiple values for a property, the first value will be used. If the request does not contain a value for a property, that property will keep its current value. The property names in "developer.properties" are not suitable as fields in the HTML panel, because they contain periods. For the HTML panel, we translate those periods to underscores. If the ENABLED flag is not set, then getBinary() will return false for all keys, and getString() will return the empty string. This simplifies the logic in the client code. Use getRawSettingsMap() to display the actual values in the developer panel.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDeveloperSettings.Setup
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBoolean(Key key)If developerMode is enabled, return the boolean value of the stored setting.static DeveloperSettingsgetInstance()Map<String,Object>getRawSettingsMap()Get the values of all the settings, by element ID, regardless of whether developerMode is enabled or not.StringgetString(Key key)If developerMode is enabled and the setting has a value, return that value.StringtoString()voidupdateFromProperties(Properties properties)voidupdateFromRequest(Map<String,String[]> parameterMap)
-
-
-
Method Detail
-
getInstance
public static DeveloperSettings getInstance()
-
updateFromProperties
public void updateFromProperties(Properties properties)
-
getBoolean
public boolean getBoolean(Key key)
If developerMode is enabled, return the boolean value of the stored setting.
-
getString
public String getString(Key key)
If developerMode is enabled and the setting has a value, return that value. Otherwise, return the empty string.
-
getRawSettingsMap
public Map<String,Object> getRawSettingsMap()
Get the values of all the settings, by element ID, regardless of whether developerMode is enabled or not. Boolean settings are represented as actual Booleans, so Freemarker can perform logical tests on them.
-
-