SettingsFacade¶
-
public class
SettingsFacade
¶ SettingsFacade provides an interface to access application configuration present in files or database.
Methods¶
areConfigurationSettingsRegistered¶
-
public boolean
areConfigurationSettingsRegistered
()¶ Checks if configuration settings have been registered.
Returns: true if setting have been registered, false otherwise
asProperties¶
-
public Properties
asProperties
()¶ Converts stored configuration to
Properties
.Returns: the configuration as Properties
findFilename¶
getPlatformSettings¶
-
public MotechSettings
getPlatformSettings
()¶
getProperties¶
-
public Properties
getProperties
(String filename)¶ Returns properties from a resource with given filename.
Parameters: - filename – the resource filename
Returns: properties stored in the file
getProperty¶
getRawConfig¶
-
public InputStream
getRawConfig
(String filename)¶ Allows to retrieve raw JSON data either from the database or file.
Parameters: - filename – Resource filename
Throws: - org.motechproject.commons.api.MotechException – when I/O error occurs
Returns: Raw JSON data as InputStream
getResourceFileName¶
registerAllProperties¶
-
protected void
registerAllProperties
()¶ Registers all the properties to the configuration service.
registerAllRawConfig¶
-
protected void
registerAllRawConfig
()¶ Registers all raw configurations to the configuration service.
registerProperties¶
-
protected void
registerProperties
(String filename, Properties properties)¶ Registers properties from file with given name to the configuration service.
Parameters: - filename – the name of the file with properties
- properties – properties to be registered
saveConfigProperties¶
-
public void
saveConfigProperties
(String filename, Properties properties)¶ Saves given properties and resource filename to the configuration. If configuration properties stored in this object were already registered to the configuration service, the given properties and resource filename will also be added there.
Parameters: - filename – the resource filename
- properties – the properties to be saved
Throws: - org.motechproject.commons.api.MotechException – when I/O error occurs
savePlatformSettings¶
-
public void
savePlatformSettings
(MotechSettings settings)¶ Saves given MOTECH settings to the configuration service.
Parameters: - settings – the
MotechSettings
to be saved
- settings – the
saveRawConfig¶
-
public void
saveRawConfig
(String filename, Resource resource)¶ Allows persisting of raw JSON properties either in the database or file.
Parameters: - filename – resource filename
- resource – resource data to persist
Throws: - org.motechproject.commons.api.MotechException – when I/O error occurs
saveRawConfig¶
-
public void
saveRawConfig
(String filename, String jsonText)¶ Allows persisting of raw JSON properties either in the database or file.
Parameters: - filename – json filename
- jsonText – json data to persist
Throws: - org.motechproject.commons.api.MotechException – when I/O error occurs
setBundleContext¶
-
public void
setBundleContext
(BundleContext bundleContext)¶