Interface IRoomStorage
public interface IRoomStorage
Basic interface for Room Storage implementations.
The Room Persistence API provide a way of storing Rooms and their relative states (Room Variables) to disk or database.
The API can be accessed via Extensions from the Zone object, using Zone.getRoomPersistenceApi()
Example:
// Init method of a Zone Extension
public void init()
{
//Initialize Persistence API
getParentZone().initRoomPersistence(RoomStorageMode.FILE_STORAGE, new FileRoomStorageConfig());
// Load all previously stored Rooms
try
{
getParentZone().getRoomPersistenceApi().loadAllRooms();
}
catch (SFSStorageException error)
{
trace("Error loading rooms: " + error);
}
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Invoked by the system when the Storage class is being removed The method is your last chance to release open resources such as local files, database connections etc...voidinit(Zone zone, BaseStorageConfig cfg) Invoked once, after the class is instantiated: it provides the reference to the current Zone and the custom configuratorLoad all stored Rooms for this ZoneloadAllRooms(String groupId) Load all Rooms belonging to a specific Room GroupLoads the setting of a previously saved RoomvoidRemove all stored Rooms for this Zone from the storage system (Use wisely!)voidremoveAllRooms(String groupId) Remove all stored Rooms belonging to a specific Room GroupvoidremoveRoom(String name) Remove a saved Room from the storage systemvoidSaves all Rooms in the ZonevoidsaveAllRooms(String groupId) Saves all Rooms belonging to the provided group namevoidSave a Room and its state
-
Method Details
-
saveRoom
Save a Room and its state- Parameters:
theRoom- a reference to a Room- Throws:
SFSStorageException
-
saveAllRooms
Saves all Rooms in the Zone- Throws:
SFSStorageException
-
saveAllRooms
Saves all Rooms belonging to the provided group name- Parameters:
groupId- the group name- Throws:
SFSStorageException
-
loadRoom
Loads the setting of a previously saved Room- Parameters:
name- the name of the stored Room- Returns:
- the settings object with which the Room can be recreated in the system
- Throws:
SFSStorageException- See Also:
-
loadAllRooms
Load all stored Rooms for this Zone- Returns:
- A list of settings objects
- Throws:
SFSStorageException- See Also:
-
loadAllRooms
Load all Rooms belonging to a specific Room Group- Parameters:
groupId- the Room Group name- Returns:
- A list of settings objects
- Throws:
SFSStorageException- See Also:
-
removeRoom
Remove a saved Room from the storage system- Parameters:
name- the name of the Room- Throws:
SFSStorageException
-
removeAllRooms
Remove all stored Rooms for this Zone from the storage system (Use wisely!)- Throws:
SFSStorageException
-
removeAllRooms
Remove all stored Rooms belonging to a specific Room Group- Parameters:
groupId- the name of the Room Group- Throws:
SFSStorageException
-
destroy
void destroy()Invoked by the system when the Storage class is being removed The method is your last chance to release open resources such as local files, database connections etc... -
init
Invoked once, after the class is instantiated: it provides the reference to the current Zone and the custom configurator- Parameters:
zone- The parent Zonecfg- The custom configuration for your IRoomStorage implementation- See Also:
-