|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.entityfs.util.dirdiff.DirectoryTreeDifferentiator
public class DirectoryTreeDifferentiator
This is a recursive DirectoryDifferentiator
that is used for
analyzing differences between a master directory hierarchy and a target
directory hierarchy. When the client calls run()
, it creates a
DirectoryDifferentiator
to analyze the differences between the master
and the target directory. After doing so, it calls itself recursively for
each subdirectory of the master directory that has a corresponding
subdirectory in the target directory.
iterates over every child entity in the master directory and tries to find a
matching entity in the target directory using a EntityMatchStrategy
.
After iterating, it calls its UnmatchedTargetEntityStrategy
for each
unmatched entity in the target directory, and then its
UnmatchedMasterEntityStrategy
for each unmatched entity in the master
directory.
DirectoryDifferentiator
Constructor Summary | |
---|---|
DirectoryTreeDifferentiator(DirectoryView master,
DirectoryView target,
EntityMatchStrategy ems,
UnmatchedTargetEntityStrategy utes,
UnmatchedMasterEntityStrategy umes)
Create a new differentiator that will analyze the differences between two directory hierarchies recursively. |
Method Summary | |
---|---|
protected Pair<DirectoryView> |
getSubdirectoryPair(DirectoryView master,
DirectoryView dir,
DirectoryView target)
Get a Pair of a master subdirectory and a target subdirectory if
the supplied master subdirectory has a matching target subdirectory. |
void |
run()
Run the differentiator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DirectoryTreeDifferentiator(DirectoryView master, DirectoryView target, EntityMatchStrategy ems, UnmatchedTargetEntityStrategy utes, UnmatchedMasterEntityStrategy umes) throws NullPointerException
master
- The root of the master directory hierarchy.target
- The root of the target directory hierarchy.ems
- The strategy object that is used to see if an entity in a
master directory has a matching entity in a target directory.utes
- The strategy object that is used to handle each entity in a
target directory that does not have a matching entity in its
corresponding master directory.umes
- The strategy object that is used to handle each entity in a
master directory that does not have a matching entity in its
corresponding target directory.
NullPointerException
- If any of the arguments is null
.Method Detail |
---|
protected Pair<DirectoryView> getSubdirectoryPair(DirectoryView master, DirectoryView dir, DirectoryView target)
Pair
of a master subdirectory and a target subdirectory if
the supplied master subdirectory has a matching target subdirectory. If
not, return null
.
This implementation returns a directory pair if there is a subdirectory of the same name as the master subdirectory in the target directory. Subclasses may override this to change this behavior.
master
- The master directory. Locked for reading.dir
- The master directory subdirectory to search for a match for.target
- The target directory. Locked for writing.
null
is returned.public void run()
run
in interface Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |