Class LocalFileSystem


public class LocalFileSystem
extends IFileSystem

Local file system

Saves data into the local file system. Continuously listens for changes to the project structure and (optionally) autosaves each changed Project. All repository items are saved as JSON objects via org.json.
  • Constructor Details

  • Method Details

    • saveConfig

      public void saveConfig​(Map<String,​String> config)
      Description copied from class: IFileSystem
      Saves the config map.
      Specified by:
      saveConfig in class IFileSystem
      Parameters:
      config - Serializable object.
    • loadConfig

      public Map<String,​String> loadConfig​(String name)
      Description copied from class: IFileSystem
      Loads a serializable object from the given path. In case of error returns null.
      Specified by:
      loadConfig in class IFileSystem
      Parameters:
      name - Relative path to load the object from.
      Returns:
      The serializable object or null if error.
    • saveProject

      public boolean saveProject​(Project project)
      Description copied from class: IFileSystem
      Saves the Project and its subtree.
      Specified by:
      saveProject in class IFileSystem
      Parameters:
      project - Project to save.
      Returns:
      True if successful, false otherwise.
    • loadProject

      public Project loadProject​(String filepath)
      Description copied from class: IFileSystem
      Loads the project from the given filepath.
      Specified by:
      loadProject in class IFileSystem
      Parameters:
      filepath - Project filepath.
      Returns:
      Returns project as an IMapNodeComposite if successful, null otherwise.
    • saveMindMapTemplate

      public boolean saveMindMapTemplate​(MindMap mindMap)
      Description copied from class: IFileSystem
      Saves the MindMap and its subtree.
      Specified by:
      saveMindMapTemplate in class IFileSystem
      Parameters:
      mindMap - MindMap to save.
      Returns:
      True if successful, false otherwise.
    • loadMindMapTemplate

      public MindMap loadMindMapTemplate​(String path)
      Description copied from class: IFileSystem
      Loads the MindMap from the given path.
      Specified by:
      loadMindMapTemplate in class IFileSystem
      Parameters:
      path - Path to the MindMap.
      Returns:
      MindMap if successful, null otherwise.
    • createJsonProject

      public org.json.JSONObject createJsonProject​(Project project)
      Translates Project into JSON format.
      Parameters:
      project - Project
      Returns:
      JSONObject representation of the Project
    • createJsonMindMap

      public org.json.JSONObject createJsonMindMap​(MindMap mindMap)
      Translates MindMap into JSON format.
      Parameters:
      mindMap - MindMap
      Returns:
      JSONObject representation of the MindMap
    • createJsonTopic

      public org.json.JSONObject createJsonTopic​(Topic topic)
      Translates Topic into JSON format.
      Parameters:
      topic - Topic
      Returns:
      JSONObject representation of the Topic
    • createJsonConnection

      public org.json.JSONObject createJsonConnection​(Connection connection)
      Translates Connection into JSON format.
      Parameters:
      connection - Connection
      Returns:
      JSONObject representation of the Connection
    • deleteProject

      public boolean deleteProject​(Project p)
      Description copied from class: IFileSystem
      Deletes the passed Project from file system.
      Specified by:
      deleteProject in class IFileSystem
      Returns:
      True if successfully deleted, false otherwise.
    • exportMindMap

      public boolean exportMindMap​(MindMap mindMap, RenderedImage renderedImage)
      Description copied from class: IFileSystem
      Exports a rendered mind map.
      Specified by:
      exportMindMap in class IFileSystem
      Parameters:
      mindMap - Mind map source.
      renderedImage - Mind map render.
      Returns:
      True if successfully exported, false otherwise.
    • log

      public void log​(String line)
      Description copied from class: IFileSystem
      Logs a line to the logfile on the file system of implementation.
      Specified by:
      log in class IFileSystem
      Parameters:
      line - Message content.
    • receive

      public void receive​(Object message)
      Listens for changes to subscriber objects.

      Messages regarding
      Overrides:
      receive in class IObserver
      Parameters:
      message - Data sent by publisher.