public class OneWaySync extends Wanderer implements WandererCallback
Modifier and Type | Class and Description |
---|---|
static class |
OneWaySync.BackCheck |
Modifier and Type | Field and Description |
---|---|
java.lang.String[] |
dirSuffixAvoids
The suffixes to skip over for directories.
|
java.lang.String[] |
dirSuffixLimits
The suffixes to limit copying to for directories.
|
protected boolean |
fakeit
Flag for not doing the changes, just saying what would happen.
|
java.lang.String[] |
fileSuffixAvoids
The suffixes to skip over for files.
|
java.lang.String[] |
fileSuffixLimits
The suffixes to limit copying to for files.
|
protected java.util.LinkedList<java.io.File> |
notCopiedList
The list of stuff skipped over.
|
protected boolean |
overwrite
Flag to not have files that exist overwritten.
|
protected java.io.File |
src
The source directory.
|
protected java.io.File |
tgt
The target directory.
|
protected boolean |
verbose
Flag for printing out activities.
|
exhaustiveSearch, topToBottom
Constructor and Description |
---|
OneWaySync(java.lang.String srcDirName,
java.lang.String targetDirName) |
Modifier and Type | Method and Description |
---|---|
void |
checkTargetSolos()
Create a BackCheck object that looks to see what files are in the target
but not in the source.
|
protected boolean |
checkToSkipDirectory(java.lang.String name)
Check to see if a source directory name should be skipped, based on the
avoid and limit list.
|
protected boolean |
checkToSkipFile(java.lang.String name)
Check to see if a source file name should be skipped, based on the avoid
and limit list.
|
void |
copy(java.io.File fromFile,
java.io.File toFile)
Copy files.
|
boolean |
getFakeit() |
java.lang.String |
getRelativePathFromSource(java.io.File file)
Strip the source directory part of the path from the file, return what
remains.
|
java.lang.String |
getRelativePathFromTarget(java.io.File file)
Strip the target directory part of the path from the file, return what
remains.
|
java.io.File |
getSourceFile(java.lang.String relativePath)
Tack the file path onto the source directory.
|
java.io.File |
getTargetFile(java.lang.String relativePath)
Tack the file path onto the target directory.
|
boolean |
getVerbose() |
boolean |
handleDirectory(java.io.File file)
WandererCallback method handing directories, not used.
|
boolean |
handleDirectory(java.io.File directory,
java.lang.String[] contentNames)
Wanderer method handing directories.
|
boolean |
handleFile(java.io.File file)
WandererCallback method handing files, check and copy those that fit the
avoid and limit parameters.
|
static void |
main(java.lang.String[] argv) |
void |
setDirSuffixAvoids(java.lang.String[] avoids) |
void |
setDirSuffixLimits(java.lang.String[] limits) |
void |
setFakeit(boolean val) |
void |
setFileSuffixAvoids(java.lang.String[] avoids) |
void |
setFileSuffixLimits(java.lang.String[] limits) |
void |
setVerbose(boolean val) |
void |
start()
Start copying files from the source directory to the target directory.
|
protected java.lang.String |
subtractPathFromDirectory(java.io.File dir,
java.io.File file)
Take the source directory out of the path to the directory.
|
void |
writeUnsynched()
Print out the files/directories not copied.
|
getCallback, handleEntry, isExhaustiveSearch, isTopToBottom, setCallback, setExhaustiveSearch, setTopToBottom
protected java.io.File src
protected java.io.File tgt
public java.lang.String[] dirSuffixAvoids
public java.lang.String[] fileSuffixAvoids
public java.lang.String[] dirSuffixLimits
public java.lang.String[] fileSuffixLimits
protected java.util.LinkedList<java.io.File> notCopiedList
protected boolean verbose
protected boolean fakeit
protected boolean overwrite
public OneWaySync(java.lang.String srcDirName, java.lang.String targetDirName)
protected boolean checkToSkipDirectory(java.lang.String name)
protected boolean checkToSkipFile(java.lang.String name)
public boolean handleDirectory(java.io.File directory, java.lang.String[] contentNames)
handleDirectory
in class Wanderer
directory
- the directory to handlecontentNames
- an array of Strings representing children of the
directorypublic boolean handleDirectory(java.io.File file)
handleDirectory
in interface WandererCallback
file
- that represents a directory to deal with.public boolean handleFile(java.io.File file)
handleFile
in interface WandererCallback
file
- to handle.public void copy(java.io.File fromFile, java.io.File toFile)
public java.lang.String getRelativePathFromSource(java.io.File file)
public java.lang.String getRelativePathFromTarget(java.io.File file)
public java.io.File getSourceFile(java.lang.String relativePath)
public java.io.File getTargetFile(java.lang.String relativePath)
public void writeUnsynched()
public void checkTargetSolos()
protected java.lang.String subtractPathFromDirectory(java.io.File dir, java.io.File file)
public void start()
public void setVerbose(boolean val)
public boolean getVerbose()
public void setFakeit(boolean val)
public boolean getFakeit()
public void setDirSuffixAvoids(java.lang.String[] avoids)
public void setFileSuffixAvoids(java.lang.String[] avoids)
public void setDirSuffixLimits(java.lang.String[] limits)
public void setFileSuffixLimits(java.lang.String[] limits)
public static void main(java.lang.String[] argv)
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details