Package io.goobi.viewer.controller
Class AbstractConfiguration
java.lang.Object
io.goobi.viewer.controller.AbstractConfiguration
- Direct Known Subclasses:
Configuration
Abstract configuration with base getters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder<org.apache.commons.configuration2.XMLConfiguration> protected org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder<org.apache.commons.configuration2.XMLConfiguration> protected booleanprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode>> getAllConfigurationsAt(String inPath) Gathers all configuration nodes from both the local and global config, local first.protected org.apache.commons.configuration2.XMLConfigurationprotected org.apache.commons.configuration2.XMLConfigurationprotected booleangetLocalBoolean(String inPath, boolean inDefault) getLocalBoolean.protected org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> getLocalConfigurationAt(String inPath) getLocalConfigurationAt.protected List<org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode>> getLocalConfigurationsAt(String inPath) getLocalConfigurationsAt.protected static List<org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode>> getLocalConfigurationsAt(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> altConfig, String inPath) protected floatgetLocalFloat(String inPath) getLocalFloat.protected floatgetLocalFloat(String inPath, float inDefault) getLocalFloat.protected intgetLocalInt(String inPath, int inDefault) getLocalInt.getLocalList(String inPath) getLocalList.getLocalList(String inPath, List<String> defaultList) getLocalList.getLocalList(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> altConfig, String inPath, List<String> defaultList) getLocalList.getLocalNodeList(String inPath) getLocalNodeList.protected StringgetLocalString(String inPath) getLocalString.protected StringgetLocalString(String inPath, String inDefault) getLocalString.voidoverrideValue(String property, Object value) Overrides values in the config file (for unit test purposes).
-
Field Details
-
builder
protected org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder<org.apache.commons.configuration2.XMLConfiguration> builder -
builderLocal
protected org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder<org.apache.commons.configuration2.XMLConfiguration> builderLocal -
localConfigDisabled
protected boolean localConfigDisabled -
localConfigDisabledTimestamp
protected long localConfigDisabledTimestamp
-
-
Constructor Details
-
AbstractConfiguration
public AbstractConfiguration()
-
-
Method Details
-
getConfig
protected org.apache.commons.configuration2.XMLConfiguration getConfig()- Returns:
XMLConfigurationthat is synced with the current state of the config file
-
getConfigLocal
protected org.apache.commons.configuration2.XMLConfiguration getConfigLocal()- Returns:
XMLConfigurationthat is synced with the current state of the config file- Throws:
org.apache.commons.configuration2.ex.ConfigurationException
-
getDefaultConfigFile
-
getLocalInt
getLocalInt.- Parameters:
inPath- XML configuration path to look upinDefault- fallback value if path is not configured- Returns:
- a int.
-
getLocalFloat
getLocalFloat.- Parameters:
inPath- XML configuration path to look up- Returns:
- a float.
-
getLocalFloat
getLocalFloat.- Parameters:
inPath- XML configuration path to look upinDefault- fallback value if path is not configured- Returns:
- a float.
-
getLocalString
getLocalString.- Parameters:
inPath- XML configuration path to look upinDefault- fallback value if path is not configured- Returns:
- the configured string value at the given path, preferring local config over global config, or the default if not configured
-
getLocalString
getLocalString.- Parameters:
inPath- XML configuration path to look up- Returns:
- the configured string value at the given path, preferring local config over global config, or null if not configured
-
getLocalNodeList
getLocalNodeList.- Parameters:
inPath- XML configuration path to look up- Returns:
- a list of configuration node objects at the given path, preferring local config over global config
-
getLocalList
protected static List<String> getLocalList(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> altConfig, String inPath, List<String> defaultList) getLocalList.- Parameters:
config- Preferred configurationaltConfig- Alternative configurationinPath- XML pathdefaultList- List of default values to return if none found in config- Returns:
- a list of string values from the preferred config, falling back to the alternative config and then the default list
-
getLocalList
getLocalList.- Parameters:
inPath- XML configuration path to look updefaultList- fallback list if path is not configured- Returns:
- configured list; defaultList if none found
-
getLocalList
getLocalList.- Parameters:
inPath- XML configuration path to look up- Returns:
- configured list; empty list if none found
-
getLocalBoolean
getLocalBoolean.- Parameters:
inPath- XML configuration path to look upinDefault- fallback value if path is not configured- Returns:
- the boolean value at the given path, or inDefault if the path is not configured
-
getLocalConfigurationsAt
protected static List<org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode>> getLocalConfigurationsAt(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> altConfig, String inPath) - Parameters:
config- the primary configuration to queryaltConfig- the fallback configuration used when config yields no resultsinPath- the XPath path to look up in the configuration- Returns:
- List<HierarchicalConfiguration<ImmutableNode>>
-
getLocalConfigurationsAt
protected List<org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode>> getLocalConfigurationsAt(String inPath) getLocalConfigurationsAt.- Parameters:
inPath- XML configuration path to look up- Returns:
- a list of hierarchical sub-configurations at the given path, preferring local config over global config
-
getAllConfigurationsAt
protected List<org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode>> getAllConfigurationsAt(String inPath) Gathers all configuration nodes from both the local and global config, local first.- Parameters:
inPath- the configuration path- Returns:
- A list of all found configurations ath 'inPath'
-
getLocalConfigurationAt
protected org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> getLocalConfigurationAt(String inPath) getLocalConfigurationAt.- Parameters:
inPath- XML configuration path to look up- Returns:
- the first matching hierarchical configuration node for the given path, or null if not found
-
overrideValue
Overrides values in the config file (for unit test purposes).- Parameters:
property- Property path (e.g. "accessConditions.fullAccessForLocalhost")value- New value to set
-