Interface IRoomStorage
- 
 public interface IRoomStorageBasic 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); } }- Since:
- 2.8.0
- See Also:
- DBRoomStorage,- FileRoomStorage
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddestroy()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 configuratorjava.util.List<CreateRoomSettings>loadAllRooms()Load all stored Rooms for this Zonejava.util.List<CreateRoomSettings>loadAllRooms(java.lang.String groupId)Load all Rooms belonging to a specific Room GroupCreateRoomSettingsloadRoom(java.lang.String name)Loads the setting of a previously saved RoomvoidremoveAllRooms()Remove all stored Rooms for this Zone from the storage system (Use wisely!)voidremoveAllRooms(java.lang.String groupId)Remove all stored Rooms belonging to a specific Room GroupvoidremoveRoom(java.lang.String name)Remove a saved Room from the storage systemvoidsaveAllRooms()Saves all Rooms in the ZonevoidsaveAllRooms(java.lang.String groupId)Saves all Rooms belonging to the provided group namevoidsaveRoom(Room theRoom)Save a Room and its state
 
- 
- 
- 
Method Detail- 
saveRoomvoid saveRoom(Room theRoom) throws SFSStorageException Save a Room and its state- Parameters:
- theRoom- a reference to a Room
- Throws:
- SFSStorageException
 
 - 
saveAllRoomsvoid saveAllRooms() throws SFSStorageExceptionSaves all Rooms in the Zone- Throws:
- SFSStorageException
 
 - 
saveAllRoomsvoid saveAllRooms(java.lang.String groupId) throws SFSStorageExceptionSaves all Rooms belonging to the provided group name- Parameters:
- groupId- the group name
- Throws:
- SFSStorageException
 
 - 
loadRoomCreateRoomSettings loadRoom(java.lang.String name) throws SFSStorageException 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:
- CreateRoomSettings,- SFSApi.createRoom(com.smartfoxserver.v2.entities.Zone, CreateRoomSettings, com.smartfoxserver.v2.entities.User)
 
 - 
loadAllRoomsjava.util.List<CreateRoomSettings> loadAllRooms() throws SFSStorageException Load all stored Rooms for this Zone- Returns:
- A list of settings objects
- Throws:
- SFSStorageException
- See Also:
- CreateRoomSettings,- SFSApi.createRoom(com.smartfoxserver.v2.entities.Zone, CreateRoomSettings, com.smartfoxserver.v2.entities.User)
 
 - 
loadAllRoomsjava.util.List<CreateRoomSettings> loadAllRooms(java.lang.String groupId) throws SFSStorageException 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:
- CreateRoomSettings,- SFSApi.createRoom(com.smartfoxserver.v2.entities.Zone, CreateRoomSettings, com.smartfoxserver.v2.entities.User)
 
 - 
removeRoomvoid removeRoom(java.lang.String name) throws SFSStorageExceptionRemove a saved Room from the storage system- Parameters:
- name- the name of the Room
- Throws:
- SFSStorageException
 
 - 
removeAllRoomsvoid removeAllRooms() throws SFSStorageExceptionRemove all stored Rooms for this Zone from the storage system (Use wisely!)- Throws:
- SFSStorageException
 
 - 
removeAllRoomsvoid removeAllRooms(java.lang.String groupId) throws SFSStorageExceptionRemove all stored Rooms belonging to a specific Room Group- Parameters:
- groupId- the name of the Room Group
- Throws:
- SFSStorageException
 
 - 
destroyvoid 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...
 - 
initvoid init(Zone zone, BaseStorageConfig cfg) Invoked once after the class is instantiated, it provides the reference to the current Zone and the custom configurator- Parameters:
- zone- The parent Zone
- cfg- The custom configuration for your IRoomStorage implementation
- See Also:
- IRoomStorage,- Zone
 
 
- 
 
-