Package jadex.platform.service.settings
Class PlatformSettings
- java.lang.Object
- 
- jadex.platform.service.settings.PlatformSettings
 
- 
- All Implemented Interfaces:
- IPlatformSettings
 
 public class PlatformSettings extends java.lang.Object implements IPlatformSettings 
- 
- 
Field SummaryFields Modifier and Type Field Description protected RwAutoLocklockLocking mechanism.protected booleanreadonlyRead-only flag.protected java.io.FilesettingsdirThe settings dir.
 - 
Constructor SummaryConstructors Constructor Description PlatformSettings(IComponentIdentifier id, boolean readonly)Creates the settings manager.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.ObjectfromJson(java.lang.String json)Converts JSON to object.byte[]loadFile(java.lang.String filename)Directly loads a file from the settings directory.java.lang.ObjectloadState(java.lang.String id)Loads arbitrary state form a persistent directory.voidsaveFile(java.lang.String filename, byte[] content)Directly saves a file in the settings directory.voidsaveState(java.lang.String id, java.lang.Object state)Saves arbitrary state to a persistent directory as JSON.static java.lang.StringtoJson(java.lang.Object object)Converts object to JSON.
 
- 
- 
- 
Field Detail- 
settingsdirprotected java.io.File settingsdir The settings dir.
 - 
readonlyprotected boolean readonly Read-only flag.
 - 
lockprotected RwAutoLock lock Locking mechanism.
 
- 
 - 
Constructor Detail- 
PlatformSettingspublic PlatformSettings(IComponentIdentifier id, boolean readonly) Creates the settings manager.
 
- 
 - 
Method Detail- 
saveStatepublic void saveState(java.lang.String id, java.lang.Object state)Saves arbitrary state to a persistent directory as JSON. Object must be serializable and the ID must be unique.- Specified by:
- saveStatein interface- IPlatformSettings
- Parameters:
- id- Unique ID for the saved state.
- state- The state being saved.
 
 - 
loadStatepublic java.lang.Object loadState(java.lang.String id) Loads arbitrary state form a persistent directory.- Specified by:
- loadStatein interface- IPlatformSettings
- Parameters:
- id- Unique ID for the saved state.
- Returns:
- The state or null if none was found or corrupt.
 
 - 
saveFilepublic void saveFile(java.lang.String filename, byte[] content)Directly saves a file in the settings directory.- Specified by:
- saveFilein interface- IPlatformSettings
- Parameters:
- filename- Name of the file.
- content- The file content.
 
 - 
loadFilepublic byte[] loadFile(java.lang.String filename) Directly loads a file from the settings directory.- Specified by:
- loadFilein interface- IPlatformSettings
- Parameters:
- filename- Name of the file.
- Returns:
- Content of the file or null if not found.
 
 - 
toJsonpublic static final java.lang.String toJson(java.lang.Object object) Converts object to JSON.- Parameters:
- object- Object.
- Returns:
- JSON string.
 
 - 
fromJsonpublic static final java.lang.Object fromJson(java.lang.String json) Converts JSON to object.- Parameters:
- json- JSON.
- Returns:
- Object.
 
 
- 
 
-