Class LocalFileSystem
java.lang.Object
rs.edu.raf.dsw.rudok.app.observer.IObserver
rs.edu.raf.dsw.rudok.app.observer.IPublisherGlobal
rs.edu.raf.dsw.rudok.app.observer.IPublisher
rs.edu.raf.dsw.rudok.app.filesystem.IFileSystem
rs.edu.raf.dsw.rudok.app.filesystem.local.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 changedProject
. All repository items are saved as JSON objects via org.json
.-
Constructor Summary
Constructors Constructor Description LocalFileSystem(ApplicationFramework applicationFramework)
-
Method Summary
Modifier and Type Method Description org.json.JSONObject
createJsonConnection(Connection connection)
TranslatesConnection
into JSON format.org.json.JSONObject
createJsonMindMap(MindMap mindMap)
TranslatesMindMap
into JSON format.org.json.JSONObject
createJsonProject(Project project)
TranslatesProject
into JSON format.org.json.JSONObject
createJsonTopic(Topic topic)
TranslatesTopic
into JSON format.boolean
deleteProject(Project p)
Deletes the passedProject
from file system.boolean
exportMindMap(MindMap mindMap, RenderedImage renderedImage)
Exports a rendered mind map.Map<String,String>
loadConfig(String name)
Loads a serializable object from the given path.MindMap
loadMindMapTemplate(String path)
Loads theMindMap
from the given path.Project
loadProject(String filepath)
Loads the project from the given filepath.void
log(String line)
Logs a line to the logfile on the file system of implementation.void
receive(Object message)
Listens for changes to subscriber objects.
Messages regardingvoid
saveConfig(Map<String,String> config)
Saves the config map.boolean
saveMindMapTemplate(MindMap mindMap)
Saves theMindMap
and its subtree.boolean
saveProject(Project project)
Saves theProject
and its subtree.Methods inherited from class rs.edu.raf.dsw.rudok.app.filesystem.IFileSystem
loadAddon, loadProject
Methods inherited from class rs.edu.raf.dsw.rudok.app.observer.IPublisher
addObserver, getObservers, publish, removeObserver, setObservers
Methods inherited from class rs.edu.raf.dsw.rudok.app.observer.IPublisherGlobal
addObserverGlobal, getObserversGlobal, removeObserverGlobal
Methods inherited from class rs.edu.raf.dsw.rudok.app.observer.IObserver
addPublisher, getPublishers, removePublisher, setPublishers
-
Constructor Details
-
LocalFileSystem
-
-
Method Details
-
saveConfig
Description copied from class:IFileSystem
Saves the config map.- Specified by:
saveConfig
in classIFileSystem
- Parameters:
config
- Serializable object.
-
loadConfig
Description copied from class:IFileSystem
Loads a serializable object from the given path. In case of error returns null.- Specified by:
loadConfig
in classIFileSystem
- Parameters:
name
- Relative path to load the object from.- Returns:
- The serializable object or null if error.
-
saveProject
Description copied from class:IFileSystem
Saves theProject
and its subtree.- Specified by:
saveProject
in classIFileSystem
- Parameters:
project
-Project
to save.- Returns:
- True if successful, false otherwise.
-
loadProject
Description copied from class:IFileSystem
Loads the project from the given filepath.- Specified by:
loadProject
in classIFileSystem
- Parameters:
filepath
- Project filepath.- Returns:
- Returns project as an IMapNodeComposite if successful, null otherwise.
-
saveMindMapTemplate
Description copied from class:IFileSystem
Saves theMindMap
and its subtree.- Specified by:
saveMindMapTemplate
in classIFileSystem
- Parameters:
mindMap
-MindMap
to save.- Returns:
- True if successful, false otherwise.
-
loadMindMapTemplate
Description copied from class:IFileSystem
Loads theMindMap
from the given path.- Specified by:
loadMindMapTemplate
in classIFileSystem
- Parameters:
path
- Path to theMindMap
.- Returns:
MindMap
if successful, null otherwise.
-
createJsonProject
TranslatesProject
into JSON format. -
createJsonMindMap
TranslatesMindMap
into JSON format. -
createJsonTopic
TranslatesTopic
into JSON format. -
createJsonConnection
TranslatesConnection
into JSON format.- Parameters:
connection
-Connection
- Returns:
JSONObject
representation of theConnection
-
deleteProject
Description copied from class:IFileSystem
Deletes the passedProject
from file system.- Specified by:
deleteProject
in classIFileSystem
- Returns:
- True if successfully deleted, false otherwise.
-
exportMindMap
Description copied from class:IFileSystem
Exports a rendered mind map.- Specified by:
exportMindMap
in classIFileSystem
- Parameters:
mindMap
- Mind map source.renderedImage
- Mind map render.- Returns:
- True if successfully exported, false otherwise.
-
log
Description copied from class:IFileSystem
Logs a line to the logfile on the file system of implementation.- Specified by:
log
in classIFileSystem
- Parameters:
line
- Message content.
-
receive
Listens for changes to subscriber objects.
Messages regarding
-