diff --git a/README.md b/README.md
index 0c8d9a7..cc8dce4 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-### Table of Contents
+#### Table of Contents
1. [Demo](#demo)
1. [About](#about)
4. [Package Contents](#package-contents)
@@ -7,19 +7,19 @@
-### Demo
-[](https://youtu.be/cjoVE7d1JXY "ensync WIP Demo")
+#### Demo
+[](https://youtu.be/znR3jyM_4Ss "ensync WIP Demo")
-### About
+#### About
Sync files across directories.

-### Package Contents
+#### Package Contents
| Path | Comment |
|---------------|-------------|
@@ -35,18 +35,12 @@ src.com.olexyn.ensync. | Low level helper methods.
-### Issues
+#### Issues
-##### High Prio
-
-- Have Map entries be remove, once file ops is performed.
-- Create a parallel Thread for each SyncEnity.
-- Add support for modification dates.
- - And thereby eventually support 10 out of 10 file operation types.
+- Add tests.
+- Remove Map entries, once file ops is performed.
- Reduce disk access.
-- Have some error handling. (i.e. if a web-directory is not available)
-- Create a UI.
-- Start the program at system start.
+- Add error handling. (i.e. if a web-directory is not available)
- Track files that were modified during the loop.
- currently `writeStateFile` just takes from `find`
- this means any changes made during the loop will be written to the `StateFile`
@@ -54,23 +48,10 @@ src.com.olexyn.ensync. | Low level helper methods.
- because of this it will appear as if the file created while the loop was running
was already there.
- thus the creation of said file will not be replicated to the other directories.
- - to solve this `writeStateFile` should take the old `State` and manually add every operation that was performed by the loop (!= user created file while the loop was running).
- - however this will be done later . . maybe.
-
-
-##### Medium Prio
-- If file is deleted in DirA and DirB, then two delete commands will be issued.
- - They will both return errors and effectively do nothing.
- - However this is a dirty solution.
- - Fix this by checking if deleted file of DirA exists in DirB.listDeleted
- - To do so .listDeleted would need to be a field of Dir
- - And the .lists of every dir would need to be calculated before any deletion took place.
- - Check if the reduced reobustness is worth the prettier solution.
+ - to solve this `writeStateFile` should take the old `State`
+ and manually add every operation that was performed by the loop (!= user created file while the loop was running).
- File is created in DirB
- Sync creates the file in DirA
- Sync creates the file in DirB
- this means the file in DirB is overwritten with `cp` for no reason.
- implement a check to prevent this.
-
-
-##### Low Prio
\ No newline at end of file
diff --git a/doc/flow-n-instances.png b/doc/flow-n-instances.png
index d68d937..edbda8d 100644
Binary files a/doc/flow-n-instances.png and b/doc/flow-n-instances.png differ
diff --git a/doc/flow-n-instances.uxf b/doc/flow-n-instances.uxf
index 0170764..a28d3ae 100644
--- a/doc/flow-n-instances.uxf
+++ b/doc/flow-n-instances.uxf
@@ -4,152 +4,163 @@
UMLState
- 790
- 570
+ 1070
+ 500
120
40
make
ListCreated
-halign=left
+halign=left
+transparency=0
UMLState
- 790
- 610
+ 1070
+ 540
120
40
make
ListDeleted
-halign=left
+halign=left
+transparency=0
UMLState
- 790
- 720
+ 760
+ 650
120
40
doCreate
halign=left
-style=wordwrap
+style=wordwrap
+transparency=0
+transparency=0
UMLState
- 540
- 380
+ 1270
+ 310
120
50
read StateFile
-bg=yellow
+bg=#FFF59D
halign=left
-style=wordwrap
+style=wordwrap
+transparency=0
UMLState
- 790
- 650
+ 1070
+ 580
120
40
make
ListModified
-halign=left
+halign=left
+transparency=0
UMLState
- 790
- 480
+ 1070
+ 410
120
40
readState
-bg=green
+bg=#A5D6A7
halign=left
-style=wordwrap
+style=wordwrap
+transparency=0
UMLState
- 790
- 320
+ 750
+ 260
120
30
START
-bg=gray
+bg=#B0BEC5
style=wordwrap
UMLState
- 790
- 880
+ 1070
+ 800
120
50
write StateFile
-bg=yellow
+bg=#FFF59D
halign=left
-style=wordwrap
+style=wordwrap
+transparency=0
UMLState
- 790
- 760
+ 760
+ 690
120
40
doDelete
halign=left
-style=wordwrap
+style=wordwrap
+transparency=0
UMLState
- 790
- 800
+ 760
+ 730
120
40
doModify
halign=left
-style=wordwrap
+style=wordwrap
+transparency=0
UMLSpecialState
- 580
- 480
+ 1310
+ 410
40
40
- type=decision
+ type=decision
+transparency=0
Relation
- 590
- 420
+ 1320
+ 350
30
80
@@ -159,111 +170,114 @@ style=wordwrap
Relation
- 590
- 510
- 220
- 410
+ 1180
+ 440
+ 170
+ 400
lt=<-
- 200.0;390.0;10.0;390.0;10.0;10.0
+ 10.0;380.0;150.0;380.0;150.0;10.0
Relation
- 610
- 480
- 200
+ 1180
+ 410
+ 150
40
lt=<-
- 180.0;20.0;10.0;20.0
+ 10.0;20.0;130.0;20.0
Relation
- 900
- 320
- 110
- 690
+ 600
+ 260
+ 180
+ 680
lt=<-
- 10.0;10.0;90.0;10.0;90.0;670.0;10.0;670.0
+ 150.0;10.0;10.0;10.0;10.0;660.0;160.0;660.0
Relation
- 840
- 830
- 30
- 70
+ 870
+ 740
+ 280
+ 80
lt=<-
- 10.0;50.0;10.0;10.0
+ 260.0;60.0;260.0;10.0;10.0;10.0
UMLState
- 790
- 970
+ 760
+ 900
120
- 50
+ 40
Sleep
-style=wordwrap
+style=wordwrap
+transparency=0
Relation
- 840
- 920
- 30
- 70
+ 870
+ 840
+ 280
+ 100
lt=<-
- 10.0;50.0;10.0;10.0
+ 10.0;80.0;260.0;80.0;260.0;10.0
Relation
- 650
- 390
- 200
+ 1140
+ 320
+ 150
30
lt=<-
- 10.0;10.0;180.0;10.0
+ 130.0;10.0;10.0;10.0
UMLSpecialState
- 830
- 380
+ 1110
+ 310
40
40
- type=decision
+ type=decision
+transparency=0
Text
- 600
- 550
- 160
- 30
+ 1240
+ 470
+ 110
+ 50
- [No State File]
+ [No
+StateFile]
Relation
- 840
- 410
+ 1120
+ 340
30
90
@@ -273,8 +287,8 @@ style=wordwrap
Text
- 860
- 420
+ 1030
+ 360
110
30
@@ -284,20 +298,20 @@ style=wordwrap
Relation
- 840
- 340
- 30
- 60
+ 860
+ 260
+ 290
+ 70
lt=<-
- 10.0;40.0;10.0;10.0
+ 270.0;50.0;270.0;10.0;10.0;10.0
Text
- 690
- 370
+ 1150
+ 300
130
30
@@ -307,31 +321,32 @@ style=wordwrap
Text
- 610
- 470
- 190
- 30
+ 1200
+ 390
+ 100
+ 50
- [State File exists]
+ [StateFile
+exists]
Relation
- 840
- 680
- 30
- 60
+ 870
+ 610
+ 280
+ 80
lt=<-
- 10.0;40.0;10.0;10.0
+ 10.0;60.0;260.0;60.0;260.0;10.0
Relation
- 840
- 510
+ 1120
+ 440
30
80
@@ -342,12 +357,12 @@ style=wordwrap
UMLState
- 900
- 1090
- 140
- 50
+ 870
+ 1040
+ 250
+ 40
- addDirectory
+ add/remove Collection (Map)
halign=left
style=wordwrap
bg=#B39DDB
@@ -356,8 +371,8 @@ bg=#B39DDB
UMLSpecialState
- 830
- 1090
+ 800
+ 1040
40
40
@@ -367,20 +382,20 @@ bg=#B39DDB
Relation
- 840
- 1010
+ 810
+ 930
30
- 100
+ 130
lt=<-
- 10.0;80.0;10.0;10.0
+ 10.0;110.0;10.0;10.0
Relation
- 860
- 1090
+ 830
+ 1040
60
40
@@ -391,20 +406,20 @@ bg=#B39DDB
Relation
- 840
- 270
- 270
+ 800
+ 220
+ 680
840
lt=<-
- 10.0;50.0;10.0;20.0;250.0;20.0;250.0;820.0
+ 10.0;40.0;10.0;20.0;660.0;20.0;660.0;820.0
Relation
- 840
- 1120
+ 810
+ 1070
80
70
@@ -415,12 +430,12 @@ bg=#B39DDB
UMLState
- 900
- 1150
- 140
- 50
+ 870
+ 1100
+ 250
+ 40
- removeDirectory
+ add/remove Directory
halign=left
style=wordwrap
bg=#B39DDB
@@ -429,20 +444,20 @@ bg=#B39DDB
Relation
- 1030
- 1090
- 60
+ 1110
+ 1040
+ 350
40
lt=<-
- 40.0;20.0;10.0;20.0
+ 330.0;20.0;10.0;20.0
UMLSpecialState
- 1070
- 1090
+ 1440
+ 1040
40
40
@@ -452,62 +467,20 @@ bg=#B39DDB
Relation
- 1030
- 1120
- 80
+ 1110
+ 1070
+ 370
70
lt=<-
- 60.0;10.0;60.0;50.0;10.0;50.0
-
-
- UMLState
-
- 890
- 480
- 20
- 20
-
-
-bg=green
-halign=left
-style=wordwrap
-
-
-
- UMLState
-
- 640
- 380
- 20
- 20
-
-
-bg=yellow
-halign=left
-style=wordwrap
-
-
-
- UMLState
-
- 890
- 880
- 20
- 20
-
-
-bg=yellow
-halign=left
-style=wordwrap
-
+ 350.0;10.0;350.0;50.0;10.0;50.0
Text
- 900
- 1060
+ 870
+ 1010
160
30
@@ -517,131 +490,102 @@ style=wordwrap
UMLState
- 890
- 570
- 20
- 20
+ 440
+ 160
+ 1060
+ 820
-halign=left
-
-
-
- UMLState
-
- 470
- 260
- 660
- 780
-
- *Logic-Thread*
+* Logic-Thread*
halign=left
valign=top
-layer=-1
+layer=-1
+lt=.
UMLState
- 890
- 610
- 20
- 20
-
-
-halign=left
-
-
-
- UMLState
-
- 890
- 650
- 20
- 20
-
-
-halign=left
-
-
-
- UMLState
-
- 470
- 1040
- 660
+ 440
+ 990
+ 1060
180
- *UI-Thread*
+
+* UI-Thread*
valign=top
halign=left
-layer=-1
+layer=-1
+lt=.
UMLNote
- 680
- 730
- 90
- 100
+ 630
+ 660
+ 110
+ 90
- Compare the Lists of the different instances
+ Compare the Lists of the different Directories
+transparency=0
- UMLNote
+ Relation
- 540
- 320
- 90
+ 730
+ 660
+ 50
50
- 1 per instance
-
+ lt=.
+ 30.0;10.0;10.0;30.0
Relation
- 620
- 330
+ 730
+ 700
50
- 80
+ 30
lt=.
- 10.0;10.0;30.0;10.0;30.0;60.0
+ 30.0;10.0;10.0;10.0
Relation
- 760
- 730
+ 730
+ 720
50
50
lt=.
- 30.0;10.0;10.0;30.0
+ 30.0;30.0;10.0;10.0
- Relation
+ UMLClass
- 760
- 770
- 50
- 30
+ 1010
+ 190
+ 420
+ 770
- lt=.
- 30.0;10.0;10.0;10.0
+ SyncDirectory
+bg=#F6F6F6
+
- Relation
+ UMLClass
- 760
- 790
- 50
- 50
+ 700
+ 190
+ 230
+ 770
- lt=.
- 30.0;30.0;10.0;10.0
+ SyncMap
+bg=#F6F6F6
+
diff --git a/ensync.plantuml b/ensync.plantuml
new file mode 100644
index 0000000..4415ab5
--- /dev/null
+++ b/ensync.plantuml
@@ -0,0 +1,100 @@
+@startuml
+
+title __ENSYNC's Class Diagram__\n
+
+ namespace com.olexyn.ensync {
+ class com.olexyn.ensync.Execute {
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ class com.olexyn.ensync.Flow {
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ class com.olexyn.ensync.Main {
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ class com.olexyn.ensync.Tools {
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace artifacts {
+ class com.olexyn.ensync.artifacts.SyncDirectory {
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace artifacts {
+ class com.olexyn.ensync.artifacts.SyncFile {
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace artifacts {
+ class com.olexyn.ensync.artifacts.SyncMap {
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace ui {
+ class com.olexyn.ensync.ui.Bridge {
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace ui {
+ class com.olexyn.ensync.ui.Controller {
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace ui {
+ class com.olexyn.ensync.ui.UI {
+ }
+ }
+ }
+
+
+ com.olexyn.ensync.Flow .up.|> java.lang.Runnable
+ com.olexyn.ensync.Flow o-- com.olexyn.ensync.Tools : tools
+ com.olexyn.ensync.Tools o-- com.olexyn.ensync.Execute : x
+ com.olexyn.ensync.artifacts.SyncDirectory o-- com.olexyn.ensync.Tools : tools
+ com.olexyn.ensync.artifacts.SyncDirectory o-- com.olexyn.ensync.Execute : x
+ com.olexyn.ensync.artifacts.SyncDirectory o-- com.olexyn.ensync.artifacts.SyncMap : syncMap
+ com.olexyn.ensync.artifacts.SyncDirectory o-- com.olexyn.ensync.artifacts.SyncDirectory : thisSD
+ com.olexyn.ensync.artifacts.SyncFile -up-|> java.io.File
+ com.olexyn.ensync.artifacts.SyncFile o-- com.olexyn.ensync.artifacts.SyncDirectory : sd
+ com.olexyn.ensync.artifacts.SyncMap o-- com.olexyn.ensync.Tools : tools
+ com.olexyn.ensync.ui.Controller .up.|> javafx.fxml.Initializable
+ com.olexyn.ensync.ui.Controller o-- com.olexyn.ensync.ui.Bridge : bridge
+ com.olexyn.ensync.ui.UI .up.|> java.lang.Runnable
+ com.olexyn.ensync.ui.UI -up-|> javafx.application.Application
+
+
+right footer
+
+
+PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
+For more information about this tool, please contact philippe.mesmeur@gmail.com
+endfooter
+
+@enduml
diff --git a/src/com/olexyn/ensync/artifacts/artifacts.plantuml b/src/com/olexyn/ensync/artifacts/artifacts.plantuml
new file mode 100644
index 0000000..36c6a39
--- /dev/null
+++ b/src/com/olexyn/ensync/artifacts/artifacts.plantuml
@@ -0,0 +1,89 @@
+@startuml
+
+title __ARTIFACTS's Class Diagram__\n
+
+ namespace com.olexyn.ensync {
+ namespace artifacts {
+ class com.olexyn.ensync.artifacts.SyncDirectory {
+ + listCreated : Map
+ + listDeleted : Map
+ + listModified : Map
+ + path : String
+ - flowState : String
+ + SyncDirectory()
+ + doCreate()
+ + doDelete()
+ + doModify()
+ + makeListCreated()
+ + makeListDeleted()
+ + makeListModified()
+ + readFreshState()
+ + readStateFile()
+ + writeStateFile()
+ - copyModifDate()
+ - deleteFile()
+ - makeParentChain()
+ - writeFile()
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace artifacts {
+ class com.olexyn.ensync.artifacts.SyncDirectory.Info {
+ - otherFilePath : String
+ - otherParentFile : File
+ - otherParentPath : String
+ - thisFilePath : String
+ - Info()
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace artifacts {
+ class com.olexyn.ensync.artifacts.SyncFile {
+ + relativePath : String
+ + timeModifiedFromStateFile : long
+ + SyncFile()
+ + getTimeModified()
+ + getTimeModifiedFromStateFile()
+ + setTimeModifiedFromStateFile()
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace artifacts {
+ class com.olexyn.ensync.artifacts.SyncMap {
+ + name : String
+ + syncDirectories : Map
+ + SyncMap()
+ + addDirectory()
+ + removeDirectory()
+ }
+ }
+ }
+
+
+ com.olexyn.ensync.artifacts.SyncDirectory o-- com.olexyn.ensync.Tools : tools
+ com.olexyn.ensync.artifacts.SyncDirectory o-- com.olexyn.ensync.Execute : x
+ com.olexyn.ensync.artifacts.SyncDirectory o-- com.olexyn.ensync.artifacts.SyncMap : syncMap
+ com.olexyn.ensync.artifacts.SyncDirectory o-- com.olexyn.ensync.artifacts.SyncDirectory : thisSD
+ com.olexyn.ensync.artifacts.SyncDirectory +-down- com.olexyn.ensync.artifacts.SyncDirectory.Info
+ com.olexyn.ensync.artifacts.SyncFile -up-|> java.io.File
+ com.olexyn.ensync.artifacts.SyncFile o-- com.olexyn.ensync.artifacts.SyncDirectory : sd
+ com.olexyn.ensync.artifacts.SyncMap o-- com.olexyn.ensync.Tools : tools
+
+
+right footer
+
+
+PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
+For more information about this tool, please contact philippe.mesmeur@gmail.com
+endfooter
+
+@enduml
diff --git a/src/com/olexyn/ensync/ensync.plantuml b/src/com/olexyn/ensync/ensync.plantuml
new file mode 100644
index 0000000..a2b15aa
--- /dev/null
+++ b/src/com/olexyn/ensync/ensync.plantuml
@@ -0,0 +1,70 @@
+@startuml
+
+title __ENSYNC's Class Diagram__\n
+
+ namespace com.olexyn.ensync {
+ class com.olexyn.ensync.Execute {
+ + execute()
+ + execute()
+ + executeBatch()
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ class com.olexyn.ensync.Execute.TwoBr {
+ + error : BufferedReader
+ + output : BufferedReader
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ class com.olexyn.ensync.Flow {
+ - state : String
+ + getState()
+ + run()
+ - readOrMakeStateFile()
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ class com.olexyn.ensync.Main {
+ {static} + FLOW_THREAD : Thread
+ {static} + MAP_OF_SYNCMAPS : HashMap
+ {static} + UI_THREAD : Thread
+ {static} + main()
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ class com.olexyn.ensync.Tools {
+ + Tools()
+ + brToListString()
+ + brToString()
+ + fileToLines()
+ + mapMinus()
+ + stateFilePath()
+ + stringListToSb()
+ + writeSbToFile()
+ + writeStringListToFile()
+ }
+ }
+
+
+ com.olexyn.ensync.Execute +-down- com.olexyn.ensync.Execute.TwoBr
+ com.olexyn.ensync.Flow .up.|> java.lang.Runnable
+ com.olexyn.ensync.Flow o-- com.olexyn.ensync.Tools : tools
+ com.olexyn.ensync.Tools o-- com.olexyn.ensync.Execute : x
+
+
+right footer
+
+
+PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
+For more information about this tool, please contact philippe.mesmeur@gmail.com
+endfooter
+
+@enduml
diff --git a/src/com/olexyn/ensync/ui/ui.plantuml b/src/com/olexyn/ensync/ui/ui.plantuml
new file mode 100644
index 0000000..2e09370
--- /dev/null
+++ b/src/com/olexyn/ensync/ui/ui.plantuml
@@ -0,0 +1,59 @@
+@startuml
+
+title __UI's Class Diagram__\n
+
+ namespace com.olexyn.ensync {
+ namespace ui {
+ class com.olexyn.ensync.ui.Bridge {
+ ~ addDirectory()
+ ~ newCollection()
+ ~ removeCollection()
+ ~ removeDirectory()
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace ui {
+ class com.olexyn.ensync.ui.Controller {
+ # gridPane : GridPane
+ {static} ~ COLUMN_COUNT : int
+ {static} ~ SPACE : Text
+ ~ collection_count : int
+ + initialize()
+ - addDirectory()
+ - insertPayload()
+ - newCollection()
+ - redraw()
+ - removeCollection()
+ - removeDirectory()
+ }
+ }
+ }
+
+
+ namespace com.olexyn.ensync {
+ namespace ui {
+ class com.olexyn.ensync.ui.UI {
+ + run()
+ + start()
+ }
+ }
+ }
+
+
+ com.olexyn.ensync.ui.Controller .up.|> javafx.fxml.Initializable
+ com.olexyn.ensync.ui.Controller o-- com.olexyn.ensync.ui.Bridge : bridge
+ com.olexyn.ensync.ui.UI .up.|> java.lang.Runnable
+ com.olexyn.ensync.ui.UI -up-|> javafx.application.Application
+
+
+right footer
+
+
+PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
+For more information about this tool, please contact philippe.mesmeur@gmail.com
+endfooter
+
+@enduml
diff --git a/test/files/files.plantuml b/test/files/files.plantuml
new file mode 100644
index 0000000..c92063f
--- /dev/null
+++ b/test/files/files.plantuml
@@ -0,0 +1,14 @@
+@startuml
+
+title __FILES's Class Diagram__\n
+
+
+
+right footer
+
+
+PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
+For more information about this tool, please contact philippe.mesmeur@gmail.com
+endfooter
+
+@enduml