Skip to content

Persistence

Adrien Castex edited this page May 26, 2017 · 1 revision

The FSManager class provides a way to serialize and unserialize a resource. Each type of FSManager can do so with the resources it manages. For example, the VirtualFSManager can serialize and unserialize the VirtualFile class instances and the VirtualFolder class instances.

The serialization process takes as input the FSManager which contains the serialize method and the resource to serialize. The output of this process is an object (of type Object) with enough information to make the process back. The information to transfer must be selected by the FSManager ; it is the only one which can know what it will need to rebuild the resource. The parent, the children and the fsmanager information MUST NOT be managed by the FSManager.

Here are the information stored in the returning object when serializing a VirtualFile through the VirtualFSManager :

  • The name
  • The creation date
  • The last modified date
  • The list of locks
  • The list of properties
  • The content

About the PhysicalFSManager, the PhysicalFile will be stored with these information :

  • The path of the real file
  • The creation date
  • The last modified date
  • The list of locks
  • The list of properties

There are information that are common and most of uses will need to store them, but sometime it will not be useful. For instance, a FSManager which manage files stored in a database. Only the ID of the tuple is required, no need for the other information if they are already stored in the database.

This allow a maximum degree of freedom to manage the resource the way you need if you need to make your own implements. Follow this link to get more information about the making of a custom FSManager.

Clone this wiki locally