public class SettingsService
extends java.lang.Object
implements jadex.bridge.service.types.settings.ISettingsService
Modifier and Type | Field and Description |
---|---|
protected jadex.bridge.IInternalAccess |
access
The service provider.
|
protected jadex.bridge.service.types.context.IContextService |
contextService
The context service.
|
protected java.lang.String |
filename
The properties filename.
|
protected jadex.commons.Properties |
props
The current properties.
|
protected java.util.Map<java.lang.String,jadex.commons.IPropertiesProvider> |
providers
The registered properties provider (id->provider).
|
protected boolean |
saveonexit
Save settings on exit?.
|
static java.lang.String |
SETTINGS_EXTENSION
The filename extension for settings.
|
Constructor and Description |
---|
SettingsService() |
Modifier and Type | Method and Description |
---|---|
jadex.commons.future.IFuture<java.lang.Void> |
deregisterPropertiesProvider(java.lang.String id)
Deregister a property provider.
|
protected jadex.commons.future.IFuture<java.io.File> |
getFile(java.lang.String path)
Returns the File object for a path to a file.
|
jadex.commons.future.IFuture<jadex.commons.Properties> |
getProperties(java.lang.String id)
Get the properties for a given id.
|
jadex.commons.future.IFuture<java.lang.Void> |
loadProperties()
Load the default platform properties.
|
protected jadex.commons.future.IFuture<jadex.commons.Properties> |
readOrCreateProperties() |
protected jadex.commons.future.IFuture<jadex.commons.Properties> |
readPropertiesFromStore()
Reads and returns the stored Properties, usually from a file.
|
jadex.commons.future.IFuture<java.lang.Void> |
registerPropertiesProvider(java.lang.String id,
jadex.commons.IPropertiesProvider provider)
Register a property provider.
|
jadex.commons.future.IFuture<java.lang.Void> |
saveProperties()
Save the platform properties to the default location.
|
jadex.commons.future.IFuture<java.lang.Void> |
saveProperties(boolean shutdown)
Save the platform properties to the default location.
|
jadex.commons.future.IFuture<java.lang.Void> |
setProperties(java.lang.String id,
jadex.commons.Properties props)
Set the properties for a given id.
|
jadex.commons.future.IFuture<java.lang.Void> |
setSaveOnExit(boolean saveonexit)
Set the save on exit policy.
|
jadex.commons.future.IFuture<java.lang.Void> |
shutdownService()
Shutdown the service.
|
jadex.commons.future.IFuture<java.lang.Void> |
startService()
Start the service.
|
protected void |
writePropertiesToStore(jadex.commons.Properties props)
Writes the given properties into a Store, usually a file.
|
public static final java.lang.String SETTINGS_EXTENSION
protected jadex.bridge.IInternalAccess access
protected java.lang.String filename
protected jadex.commons.Properties props
protected java.util.Map<java.lang.String,jadex.commons.IPropertiesProvider> providers
protected boolean saveonexit
protected jadex.bridge.service.types.context.IContextService contextService
public jadex.commons.future.IFuture<java.lang.Void> startService()
public jadex.commons.future.IFuture<java.lang.Void> shutdownService()
public jadex.commons.future.IFuture<java.lang.Void> registerPropertiesProvider(java.lang.String id, jadex.commons.IPropertiesProvider provider)
registerPropertiesProvider
in interface jadex.bridge.service.types.settings.ISettingsService
id
- A unique id to identify the properties (e.g. component or service name).provider
- The properties provider.public jadex.commons.future.IFuture<java.lang.Void> deregisterPropertiesProvider(java.lang.String id)
deregisterPropertiesProvider
in interface jadex.bridge.service.types.settings.ISettingsService
id
- A unique id to identify the properties (e.g. component or service name).public jadex.commons.future.IFuture<java.lang.Void> setProperties(java.lang.String id, jadex.commons.Properties props)
setProperties
in interface jadex.bridge.service.types.settings.ISettingsService
id
- A unique id to identify the properties (e.g. component or service name).properties
- The properties to set.save
- Save platform properties after setting.public jadex.commons.future.IFuture<jadex.commons.Properties> getProperties(java.lang.String id)
getProperties
in interface jadex.bridge.service.types.settings.ISettingsService
id
- A unique id to identify the properties (e.g. component or service name).public jadex.commons.future.IFuture<java.lang.Void> loadProperties()
loadProperties
in interface jadex.bridge.service.types.settings.ISettingsService
protected jadex.commons.future.IFuture<jadex.commons.Properties> readOrCreateProperties()
protected jadex.commons.future.IFuture<jadex.commons.Properties> readPropertiesFromStore()
Properties
java.io.FileNotFoundException
java.lang.Exception
java.io.IOException
public jadex.commons.future.IFuture<java.lang.Void> saveProperties()
saveProperties
in interface jadex.bridge.service.types.settings.ISettingsService
public jadex.commons.future.IFuture<java.lang.Void> saveProperties(boolean shutdown)
shutdown
- Flag indicating if called during shutdown.public jadex.commons.future.IFuture<java.lang.Void> setSaveOnExit(boolean saveonexit)
setSaveOnExit
in interface jadex.bridge.service.types.settings.ISettingsService
saveonexit
- The saveonexit flag.protected void writePropertiesToStore(jadex.commons.Properties props)
java.io.FileNotFoundException
java.lang.Exception
java.io.IOException
protected jadex.commons.future.IFuture<java.io.File> getFile(java.lang.String path)
path
- Path to the file