Package org.ametys.runtime.config
Class Config
java.lang.Object
org.ametys.runtime.config.Config
Bean to read / Write config file
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
dispose()
Dispose thisConfig
instancestatic boolean
Returns true if the configuration filename exists.static Config
Get the instance of Config using the config file.long
Get the last modification of the configuration filestatic Model
getModel()
Gets the configuration model<T> T
Retrieves the typed parameter value<T> T
Retrieves the typed parameter value, or the default valueRetrieves all configuration parameter valuesRetrieves all configuration parameter values as JSON objectsstatic void
setFilename
(String filename) Set the configuration filenamestatic void
setInitialized
(boolean initialized) Set the initialization status of the configurationstatic void
Sets the configuration model
-
Method Details
-
getInstance
Get the instance of Config using the config file.- Returns:
- An instance of Config containing config file values and definition, or null if config file cannot be read.
-
getModel
Gets the configuration model- Returns:
- the model or null if the configuration is not initialized
-
setModel
Sets the configuration model- Parameters:
model
- the model to set
-
getLastModified
Get the last modification of the configuration file- Returns:
- The last modified or -1 if the file does not exists
-
setInitialized
Set the initialization status of the configuration- Parameters:
initialized
- the initialization status of the configuration
-
setFilename
Set the configuration filename- Parameters:
filename
- Name with path of the configuration file
-
fileExists
Returns true if the configuration filename exists.- Returns:
- true if the configuration filename exists.
-
getValues
Retrieves all configuration parameter values- Returns:
- the configuration values
-
getValuesAsJSONForClient
Retrieves all configuration parameter values as JSON objects- Returns:
- the configuration values as JSON objects
-
getValue
Retrieves the typed parameter value- Type Parameters:
T
- type of the value to retrieve- Parameters:
name
- name of the configuration parameter- Returns:
- the parameter value
-
getValue
Retrieves the typed parameter value, or the default value- Type Parameters:
T
- type of the value to retrieve- Parameters:
name
- name of the configuration parameteruseDefaultFromModel
- true to use the default value from the model, false to use the give default valuedefaultValue
- default value used if value is null and useDefaultFromModel is false, or if there is no default value on model- Returns:
- the parameter value
-
dispose
Dispose thisConfig
instance
-