|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.util.wanderer.Wanderer com.bbn.openmap.util.wanderer.OneWaySync
public class OneWaySync
The OneWaySync is a class that copies files from one directory to another, skipping specified extensions or only copying files and directories with specified extensions. It's used by the OpenMap team to keep the internal CVS tree in sync with the external one. The main() function has the avoid/limit suffixes hard-coded, you can extend or change the settings in a different class.
Nested Class Summary | |
---|---|
static class |
OneWaySync.BackCheck
|
Field Summary | |
---|---|
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. |
Fields inherited from class com.bbn.openmap.util.wanderer.Wanderer |
---|
exhaustiveSearch, topToBottom |
Constructor Summary | |
---|---|
OneWaySync(java.lang.String srcDirName,
java.lang.String targetDirName)
|
Method Summary | |
---|---|
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. |
Methods inherited from class com.bbn.openmap.util.wanderer.Wanderer |
---|
getCallback, handleEntry, isExhaustiveSearch, isTopToBottom, setCallback, setExhaustiveSearch, setTopToBottom |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public OneWaySync(java.lang.String srcDirName, java.lang.String targetDirName)
Method Detail |
---|
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 directory
public 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |