List of changes:

* Remove the config file. Directories are now registered to SyncEntity and syncronized.
* Thus any number of directories can be synced.
* Supports 3 out of 10 file operations. See png diagram.
* Mainly sync operations that require modification times are not present yet.
pull/1/head
Ivan Olexyn 5 years ago
parent 1a912fb441
commit 1b64a93dc7

@ -19,7 +19,7 @@ Sync files across directories:
| Class | Description |
|---------------|-------------|
| Execute | Issues shell commands.|
| Execute | Issues com.olexyn.ensync.shell commands.|
| Main | Main class. Run from here.|
| Routines | Contains higher level routines.|
| Tools | Simple tools used by other classes.|
@ -31,3 +31,5 @@ Sync files across directories:
- What about parallel Threads?
- What about error handling? (i.e. if a web-directory is not available)
- Make commands more expressive e.g. collection dir dir dir -> keep all 3 dirs on sync.
- Figure out a way to handle deletions.

@ -0,0 +1,13 @@
package com.olexyn.ensync;
import java.util.List;
public class Core {
public Core(){
}
}

@ -1,24 +1,109 @@
package com.olexyn.ensync;
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.List;
import com.olexyn.ensync.artifacts.SyncDirectory;
import com.olexyn.ensync.artifacts.SyncEntity;
public class Main {
import java.io.File;
import java.util.*;
public class Main {
public static void main(String[] args) {
String conf = new Tools().getConf();
List<String[]> cmdBuffer = new Routines().parseConfToCmdBuffer(conf);
Tools tools = new Tools();
Execute x = new Execute();
SyncEntity syncEntity = new SyncEntity("test");
syncEntity.addDirectory("/home/user/test/a");
syncEntity.addDirectory("/home/user/test/b");
syncEntity.addDirectory("/home/user/test/c");
int br1 = 0;
while (true) {
for (Map.Entry<String, SyncDirectory> entry : syncEntity.syncDirectories.entrySet()) {
SyncDirectory syncDirectory = entry.getValue();
syncDirectory.updateStateFileNew();
syncDirectory.updatePoolNew();
//
for (File createdFile : syncDirectory.getListCreated()) {
for (Map.Entry<String, SyncDirectory> otherEntry : syncEntity.syncDirectories.entrySet()) {
SyncDirectory otherSyncDirectory = otherEntry.getValue();
if (!syncDirectory.equals(otherSyncDirectory)){
// Example:
// syncDirectory /foo
// otherSyncDirectory /bar
// createdFile /foo/hello/created-file.gif
// relativePath /hello/created-file.gif
String relativePath = createdFile.getPath().replace(syncDirectory.realPath, "");
String targetPath = otherSyncDirectory.realPath + relativePath;
String targetParentPath = new File(targetPath).getParent();
if (!new File(targetParentPath).exists()){
String[] cmd = new String[]{"mkdir",
"-p",
targetParentPath};
x.execute(cmd);
}
String[] cmd = new String[]{"cp",
createdFile.getPath(),
otherSyncDirectory.realPath + relativePath};
x.execute(cmd);
}
}
}
//
for (File deletedFile : syncDirectory.getListDeleted()) {
for (Map.Entry<String, SyncDirectory> otherEntry : syncEntity.syncDirectories.entrySet()) {
SyncDirectory otherSyncDirectory = otherEntry.getValue();
if (!syncDirectory.equals(otherSyncDirectory)){
String relativePath = deletedFile.getPath().replace(syncDirectory.realPath, "");
String[] cmd = new String[]{"rm", "-r",
otherSyncDirectory.realPath + relativePath};
x.execute(cmd);
}
}
}
syncEntity.addToMapCreated(syncDirectory.getListCreated());
syncEntity.addToMapDeleted(syncDirectory.getListDeleted());
//
// WARNING:
// Be very carefull when to update the StateFileOld
// i.e. you create a File and update StateFileOld without updating
// -> create newFile -> update StateFileNew-> getListCreated contains newFile -> addToMapCreated -> create copies as needed -> updateStateFileOld -> OK
// -> create newFile -> update StateFileOld -> getListDeletd contains newFile -> VERY BAD
//
syncDirectory.updateStateFileBoth();
syncDirectory.updatePoolBoth();
System.out.println("bar");
new Execute().executeBatch(cmdBuffer);
String br = null;
}
//Map<String,File> mapCreated = syncEntity.getMapCreated();
//Map<String,File> mapDeleted = syncEntity.getMapDeleted();
int br = 0;
try {Thread.sleep(1000);}
catch (InterruptedException e){
}
}
}
}

@ -1,7 +1,11 @@
package com.olexyn.ensync;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -15,14 +19,21 @@ public class Tools {
/**
*
*/
public void rsync(String param , String source , String destination) {
public void rsync(String param,
String source,
String destination) {
//
BufferedReader foo = x.execute(new String[]{"rsync", param, source, destination}).output;
BufferedReader foo = x.execute(new String[]{"rsync",
param,
source,
destination}).output;
}
public String getConf(){
BufferedReader output = x.execute(new String[]{"cat", System.getProperty("user.dir")+"/src/com/olexyn/ensync/sync.conf"}).output;
public String getConf() {
BufferedReader output = x.execute(new String[]{"cat",
System.getProperty("user.dir") + "/src/com/olexyn/ensync/sync.conf"}).output;
return brToString(output);
}
@ -34,4 +45,79 @@ public class Tools {
}
return sb.toString();
}
/**
* StateFile -> FilePool
*/
public Map<String, File> fileToPool(File file,
String type) {
List<String> lines = fileToLines(file);
return linesToFilePool(lines, type);
}
/**
* CREATE a StateFile from realPath. <p>
* WRITE the StateFle to stateFilePath.
* @param realPath the path of the directory the StateFile is created for.
* @param stateFilePath the desired path for the created Statefile.
*/
public File generateStateFile(String realPath, String stateFilePath) {
String[] cmd = new String[]{System.getProperty("user.dir") + "/src/com/olexyn/ensync/shell/toFile.sh",
"find",
realPath,
stateFilePath};
x.execute(cmd);
return new File(realPath);
}
public List<String> fileToLines(File file) {
String filePath = file.getPath();
List<String> lines = null;
try {
lines = Files.readAllLines(Paths.get(filePath));
} catch (IOException e) {
e.printStackTrace();
}
return lines;
}
public Map<String, File> linesToFilePool(List<String> lines,
String type) {
Map<String, File> filepool = new HashMap<>();
for (String line : lines) {
File file = new File(line);
if (type.equals("all") || type.equals("dir") && file.isDirectory() || type.equals("file") && file.isFile()) {
filepool.put(line, file);
}
}
return filepool;
}
public List<File> mapMinus(Map<String, File> fromA,
Map<String, File> substractB) {
List<File> difference = new ArrayList<>();
Iterator iterator = fromA.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String key = (String) entry.getKey();
File file = fromA.get(key);
if (fromA.containsKey(key) && !substractB.containsKey(key)) {
difference.add(file);
}
}
return difference;
}
}

@ -0,0 +1,134 @@
package com.olexyn.ensync.artifacts;
import com.olexyn.ensync.Tools;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SyncDirectory {
public String realPath;
public String stateFileBasePath;
public String stateFileOldPath;
public String stateFileNewPath;
public File stateFileOld;
public File stateFileNew;
private Map<String, File> poolOld = new HashMap<>();
private Map<String, File> poolNew = new HashMap<>();
private List<File> listCreated = new ArrayList<>();
private List<File> listDeleted = new ArrayList<>();
Tools tools = new Tools();
/**
* Create a SyncDirectory from realPath.
*
* @param realPath
* @see SyncEntity
*/
public SyncDirectory(String realPath) {
this.realPath = realPath;
stateFileBasePath = "/tmp/find" + this.realPath.replace("/", "-");
stateFileOldPath = stateFileBasePath + "-old";
stateFileNewPath = stateFileBasePath + "-new";
stateFileOld = getStateFileOld();
stateFileNew = getStateFileNew();
poolOld = getPoolOld();
poolNew = getPoolNew();
}
/**
* IF NOT EXISTS the StateFileOld for this SyncDirectory,<p>
* - THEN create the File on Disk.
*
* @return the StateFileOld.
*/
public File getStateFileOld() {
stateFileOld = new File(stateFileOldPath);
if (!stateFileOld.exists()) {
stateFileOld = tools.generateStateFile(realPath, stateFileOldPath);
}
return stateFileOld;
}
/**
* READ directory contents.<p>
* WRITE a new StateFileNew to Disk. This is IMPORTANT in order to make sure that StateFileOld is NEVER newer than StateFileNew.<p>
* WRITE a new StateFileOld to Disk.
*/
public void updateStateFileBoth() {
//
tools.generateStateFile(realPath, stateFileNewPath);
tools.generateStateFile(realPath, stateFileOldPath);
}
public File getStateFileNew() {
stateFileNew = new File(stateFileNewPath);
if (!stateFileNew.exists()) {
stateFileNew = tools.generateStateFile(realPath, stateFileNewPath);
}
return stateFileNew;
}
/**
* READ directory contents.<p>
* WRITE a new StateFileNew Disk.
*/
public void updateStateFileNew() {
//
tools.generateStateFile(realPath, stateFileNewPath);
}
public Map<String, File> getPoolOld() {
if (poolOld.isEmpty()) {
updatePoolBoth();
}
return poolOld;
}
/**
* UPDATE PoolOld FROM contents of StateFileOld.
*/
public void updatePoolBoth() {
poolNew = tools.fileToPool(getStateFileNew(), "all");
poolOld = tools.fileToPool(getStateFileOld(), "all");
}
public Map<String, File> getPoolNew() {
if (poolNew.isEmpty()) {
updatePoolNew();
}
return poolNew;
}
/**
* UPDATE PoolNew FROM contents of StateFileNew.
*/
public void updatePoolNew() {
poolNew = tools.fileToPool(getStateFileNew(), "all");
}
public List<File> getListCreated() {
listCreated = tools.mapMinus(getPoolNew(), getPoolOld());
return listCreated;
}
public List<File> getListDeleted() {
listDeleted = tools.mapMinus(getPoolOld(), getPoolNew());
return listDeleted;
}
}

@ -0,0 +1,86 @@
package com.olexyn.ensync.artifacts;
import com.olexyn.ensync.Tools;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* A SyncEntity is a collection of SyncDirectories,
* that are supposed to be kept in sync.
*/
public class SyncEntity {
public String name;
public int syncInterval = 3600;
public Map<String, SyncDirectory> syncDirectories = new HashMap<>();
private Map<String, File> mapCreated = new HashMap<>();
private Map<String, File> mapDeleted = new HashMap<>();
Tools tools = new Tools();
/**
* @see SyncEntity
*/
public SyncEntity(String name) {
this.name = name;
}
/**
* Creates a new Syncdirectory.
* <p>
* Adds the created SyncDirectory to this SyncEntity.
*
* @param realPath the path from which the Syncdirectory is created.
* @see SyncDirectory
*/
public void addDirectory(String realPath) {
if (new File(realPath).isDirectory()) {
syncDirectories.put(realPath, new SyncDirectory(realPath));
}
}
public Map<String, File> getMapCreated() {
for (Map.Entry<String, SyncDirectory> entry : syncDirectories.entrySet()) {
SyncDirectory syncDirectory = entry.getValue();
for (File file : syncDirectory.getListCreated()) {
mapCreated.put(file.getPath(), file);
}
}
return mapCreated;
}
public Map<String, File> getMapDeleted() {
for (Map.Entry<String, SyncDirectory> entry : syncDirectories.entrySet()) {
SyncDirectory syncDirectory = entry.getValue();
for (File file : syncDirectory.getListDeleted()) {
mapDeleted.put(file.getPath(), file);
}
}
return mapDeleted;
}
public void addToMapCreated(List<File> listCreated) {
for (File file : listCreated) {
mapCreated.put(file.getPath(), file);
}
}
public void addToMapDeleted(List<File> listDeleted) {
for (File file : listDeleted) {
mapDeleted.put(file.getPath(), file);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

@ -0,0 +1,458 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="13.3">
<zoom_level>10</zoom_level>
<element>
<id>UMLObject</id>
<coordinates>
<x>290</x>
<y>420</y>
<w>110</w>
<h>40</h>
</coordinates>
<panel_attributes>Directory B</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLObject</id>
<coordinates>
<x>290</x>
<y>380</y>
<w>110</w>
<h>40</h>
</coordinates>
<panel_attributes>Directory A</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLObject</id>
<coordinates>
<x>290</x>
<y>230</y>
<w>110</w>
<h>40</h>
</coordinates>
<panel_attributes>Delete
bg=red
group=1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLObject</id>
<coordinates>
<x>290</x>
<y>270</y>
<w>110</w>
<h>40</h>
</coordinates>
<panel_attributes>Create
bg=green
group=1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLObject</id>
<coordinates>
<x>290</x>
<y>310</y>
<w>110</w>
<h>40</h>
</coordinates>
<panel_attributes>Modify
bg=yellow
group=1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>440</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>YES
bg=green</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>440</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File </panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>530</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>890</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>NO
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLObject</id>
<coordinates>
<x>290</x>
<y>190</y>
<w>110</w>
<h>40</h>
</coordinates>
<panel_attributes>Unchanged
bg=white
group=1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>440</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File </panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>530</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File </panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>620</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>620</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>710</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=green</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>710</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File </panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>800</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=green</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>800</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=green</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>890</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=yellow</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>890</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File </panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>980</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=yellow</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>980</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=yellow</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1070</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1070</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=green</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1160</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1160</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=yellow</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1250</x>
<y>380</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=green</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1250</x>
<y>420</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>File
bg=yellow</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLNote</id>
<coordinates>
<x>420</x>
<y>190</y>
<w>150</w>
<h>80</h>
</coordinates>
<panel_attributes>2^4 = 16
however only 10
because 6 are symmetrical.
bg=white</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLObject</id>
<coordinates>
<x>290</x>
<y>530</y>
<w>110</w>
<h>40</h>
</coordinates>
<panel_attributes>Covered?</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>620</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>MAYBE
bg=yellow</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>530</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>YES
bg=green</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>710</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>YES
bg=green</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>980</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>NO
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1160</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>NO
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1250</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>NO
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>800</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>NO
bg=red</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1070</x>
<y>530</y>
<w>70</w>
<h>40</h>
</coordinates>
<panel_attributes>NO
bg=red</panel_attributes>
<additional_attributes/>
</element>
</diagram>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

@ -0,0 +1,588 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="13.3">
<zoom_level>10</zoom_level>
<element>
<id>UMLClass</id>
<coordinates>
<x>250</x>
<y>120</y>
<w>140</w>
<h>40</h>
</coordinates>
<panel_attributes>File System
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>310</x>
<y>150</y>
<w>160</w>
<h>280</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>140.0;260.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>100</x>
<y>580</y>
<w>120</w>
<h>60</h>
</coordinates>
<panel_attributes>Collection of
Accepted
State Files
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>370</x>
<y>410</y>
<w>170</w>
<h>40</h>
</coordinates>
<panel_attributes>User initiates a
File System update.
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>210</x>
<y>590</y>
<w>180</w>
<h>30</h>
</coordinates>
<panel_attributes>lt=.</panel_attributes>
<additional_attributes>10.0;10.0;160.0;10.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>370</x>
<y>570</y>
<w>150</w>
<h>60</h>
</coordinates>
<panel_attributes>Check if a newer
State File
is available
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>80</x>
<y>240</y>
<w>170</w>
<h>40</h>
</coordinates>
<panel_attributes>Update State File
from File System
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>100</x>
<y>500</y>
<w>130</w>
<h>40</h>
</coordinates>
<panel_attributes>Last Accepted
State File
bg=green
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>100</x>
<y>320</y>
<w>130</w>
<h>40</h>
</coordinates>
<panel_attributes>Current
State File
bg=yellow
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>80</x>
<y>410</y>
<w>160</w>
<h>40</h>
</coordinates>
<panel_attributes>Accept State File</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>430</x>
<y>440</y>
<w>40</w>
<h>150</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;130.0;20.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>150</x>
<y>350</y>
<w>30</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>310</x>
<y>620</y>
<w>150</w>
<h>120</h>
</coordinates>
<panel_attributes>lt=&lt;-
[YES]</panel_attributes>
<additional_attributes>10.0;100.0;130.0;10.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>240</x>
<y>720</y>
<w>170</w>
<h>60</h>
</coordinates>
<panel_attributes>Update File System
according to newest
State File</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>150</x>
<y>440</y>
<w>30</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>150</x>
<y>150</y>
<w>190</w>
<h>110</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;90.0;170.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>150</x>
<y>270</y>
<w>30</w>
<h>70</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;50.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>150</x>
<y>530</y>
<w>30</w>
<h>70</h>
</coordinates>
<panel_attributes>lt=.</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>860</x>
<y>0</y>
<w>340</w>
<h>50</h>
</coordinates>
<panel_attributes>SyncEntity
--
Map&lt;SyncDirectory&gt; directories
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1300</x>
<y>90</y>
<w>230</w>
<h>200</h>
</coordinates>
<panel_attributes>SyncDirectory
--
String realPath
String stateFileBasePath
File stateFileOld
File stateFileNew
Map&lt;String,File&gt; poolOld
Map&lt;String,File&gt; poolNew
List&lt;String&gt; listCreated
List&lt;String&gt; listDeleted
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1190</x>
<y>30</y>
<w>130</w>
<h>90</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>110.0;70.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1620</x>
<y>740</y>
<w>130</w>
<h>60</h>
</coordinates>
<panel_attributes>StateFileOld
bg=yellow
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1750</x>
<y>740</y>
<w>130</w>
<h>30</h>
</coordinates>
<panel_attributes>StateFileNew
bg=green
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1750</x>
<y>770</y>
<w>130</w>
<h>30</h>
</coordinates>
<panel_attributes>ListDeleted
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1620</x>
<y>820</y>
<w>130</w>
<h>30</h>
</coordinates>
<panel_attributes>StateFileOld
bg=yellow
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1750</x>
<y>820</y>
<w>130</w>
<h>60</h>
</coordinates>
<panel_attributes>StateFileNew
bg=green
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1620</x>
<y>850</y>
<w>130</w>
<h>30</h>
</coordinates>
<panel_attributes>ListCreated
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1220</x>
<y>650</y>
<w>170</w>
<h>60</h>
</coordinates>
<panel_attributes>update
StateFileNew</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1190</x>
<y>770</y>
<w>120</w>
<h>40</h>
</coordinates>
<panel_attributes>get
ListCreated</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1310</x>
<y>770</y>
<w>120</w>
<h>40</h>
</coordinates>
<panel_attributes>get
ListDeleted</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1230</x>
<y>700</y>
<w>90</w>
<h>90</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;70.0;70.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1310</x>
<y>700</y>
<w>80</w>
<h>90</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>60.0;70.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1190</x>
<y>850</y>
<w>120</w>
<h>40</h>
</coordinates>
<panel_attributes>add to
MapCreated</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1310</x>
<y>850</y>
<w>120</w>
<h>40</h>
</coordinates>
<panel_attributes>add to
MapDeleted</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1360</x>
<y>800</y>
<w>30</w>
<h>70</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;50.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1240</x>
<y>800</y>
<w>30</w>
<h>70</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;50.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1230</x>
<y>970</y>
<w>170</w>
<h>60</h>
</coordinates>
<panel_attributes>Perform
File Operations
for Sycronization</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1310</x>
<y>880</y>
<w>80</w>
<h>110</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;90.0;60.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1240</x>
<y>880</y>
<w>100</w>
<h>110</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>80.0;90.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1020</x>
<y>610</y>
<w>440</w>
<h>320</h>
</coordinates>
<panel_attributes>For Each SyncDirectory
halign=left
layer=-1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1600</x>
<y>720</y>
<w>300</w>
<h>180</h>
</coordinates>
<panel_attributes>
halign=left
layer=-1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1420</x>
<y>780</y>
<w>200</w>
<h>50</h>
</coordinates>
<panel_attributes>lt=.</panel_attributes>
<additional_attributes>180.0;30.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1280</x>
<y>580</y>
<w>40</w>
<h>90</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;70.0;20.0;10.0</additional_attributes>
</element>
<element>
<id>UMLSpecialState</id>
<coordinates>
<x>1290</x>
<y>570</y>
<w>20</w>
<h>20</h>
</coordinates>
<panel_attributes>type=initial</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLSpecialState</id>
<coordinates>
<x>1300</x>
<y>1200</y>
<w>20</w>
<h>20</h>
</coordinates>
<panel_attributes>type=final</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1300</x>
<y>1020</y>
<w>30</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1290</x>
<y>1130</y>
<w>40</w>
<h>90</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>20.0;70.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLState</id>
<coordinates>
<x>1220</x>
<y>1080</y>
<w>170</w>
<h>60</h>
</coordinates>
<panel_attributes>update
StateFileBoth</panel_attributes>
<additional_attributes/>
</element>
</diagram>

@ -0,0 +1,6 @@
#!/bin/bash
a=$1
b=$2
$a | $b
# this is a pipe

@ -0,0 +1,7 @@
#!/bin/bash
a=$1
b=$2
c=$3
$a | $b | $c
# this is a double pipe

@ -0,0 +1,7 @@
#!/bin/bash
a=$1
b=$2
c=$3
$a $b > $c

@ -1,13 +0,0 @@
# -u update
# -r recursive
# -v verbose
# -t keep modification times
# -W whole file (faster if network bandwith is faster then disk bandwith)
#
# examples:
# ./dirA -- urvtW -> ./dirB
# ./dirA <- urvtW ---- urvtW -> ./dirB
/home/user/ws/idea/env-sync/src/com/olexyn/ensync/tmp/in/ <- urvtW ---- urvtW -> /home/user/ws/idea/env-sync/src/com/olexyn/ensync/tmp/out/
# backup
# /home/user/ws/ -- urvtW -> /media/time/backup/auto/ws
/home/user/wiki/ -- urvtW -> /media/time/backup/auto/wiki
Loading…
Cancel
Save