Class AppFileSystem

  • All Implemented Interfaces:
    AutoCloseable

    public class AppFileSystem
    extends Object
    implements AutoCloseable
    An AppFileSystem instance is a tree of Node objects, starting with its root folder.

    Node objects may be Folders or File, or any new file type added by the user through the extension mechanism (see FileExtension). An application may have several instances of AppFileSystem, each one with a unique name. They are accessed through the parent AppData instance.

    The AppFileSystem is backed by an AppStorage implementation, which is in charge of maintaining the state of data of the AppFileSystem. The implementation may bring additional functionalities: in-memory storage, database storage, remote storage, ...

    Users of an AppFileSystem should not need to interact directly with the underlying AppStorage.

    Author:
    Geoffroy Jamgotchian
    • Constructor Detail

      • AppFileSystem

        public AppFileSystem​(String name,
                             boolean remotelyAccessible,
                             AppStorage storage)
    • Method Detail

      • getName

        public String getName()
      • isRemotelyAccessible

        public boolean isRemotelyAccessible()
      • getEventBus

        public EventsBus getEventBus()
      • getRootFolder

        public Folder getRootFolder()
      • createNode

        public Node createNode​(NodeInfo nodeInfo)
        Creates a new Node in this file system. This is a low level method, and should seldom be used by the AFS API users.
      • findProjectFile

        public <T extends ProjectFile> T findProjectFile​(String projectFileId,
                                                         Class<T> clazz)
        Get a project file by its ID.
      • fetchNode

        public AbstractNodeBase fetchNode​(String nodeId,
                                          boolean connected)
        Retrieve a project node with undefined class
        Parameters:
        nodeId - the node Id
        Returns:
        a typed node
        Throws:
        AfsStorageException - if the node not found
      • fetchNode

        public AbstractNodeBase fetchNode​(String nodeId)
        Retrieve a project node with undefined class
        Parameters:
        nodeId - the node Id
        Returns:
        a typed node
      • findProject

        public Optional<Project> findProject​(String projectId)
        Get a project by its ID
        Parameters:
        projectId - projectID
        Returns:
        the optionally found project
      • findProjectFolder

        public ProjectFolder findProjectFolder​(String projectFolderId)
        Get a project folder by its ID.
      • getData

        public AppData getData()
      • isClosed

        public boolean isClosed()