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);
      }
     }
     
    Since:
    2.8.0
    See Also:
    DBRoomStorage, FileRoomStorage
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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...
      void init​(Zone zone, BaseStorageConfig cfg)
      Invoked once after the class is instantiated, it provides the reference to the current Zone and the custom configurator
      java.util.List<CreateRoomSettings> loadAllRooms()
      Load all stored Rooms for this Zone
      java.util.List<CreateRoomSettings> loadAllRooms​(java.lang.String groupId)
      Load all Rooms belonging to a specific Room Group
      CreateRoomSettings loadRoom​(java.lang.String name)
      Loads the setting of a previously saved Room
      void removeAllRooms()
      Remove all stored Rooms for this Zone from the storage system (Use wisely!)
      void removeAllRooms​(java.lang.String groupId)
      Remove all stored Rooms belonging to a specific Room Group
      void removeRoom​(java.lang.String name)
      Remove a saved Room from the storage system
      void saveAllRooms()
      Saves all Rooms in the Zone
      void saveAllRooms​(java.lang.String groupId)
      Saves all Rooms belonging to the provided group name
      void saveRoom​(Room theRoom)
      Save a Room and its state