org.entityfs.util.dirdiff
Class DirectoryDifferentiator
java.lang.Object
org.entityfs.util.dirdiff.DirectoryDifferentiator
- All Implemented Interfaces:
- Runnable
- Direct Known Subclasses:
- DirectorySynchronizer
public class DirectoryDifferentiator
- extends Object
- implements Runnable
The DirectoryDifferentiator
is used for calculating differences
between a master directory and a target directory. When the client calls
run()
, it 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.
This can for instance be used for implementing directory synchronization. See
DirectorySynchronizer
.
- Since:
- 1.0
- Author:
- Karl Gustafsson
- See Also:
DirectorySynchronizer
,
DirectoryTreeDifferentiator
,
EntityMatchStrategy
,
UnmatchedMasterEntityStrategy
,
UnmatchedTargetEntityStrategy
- In_jar:
- entityfs-util
Method Summary |
void |
run()
Run the analysis. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DirectoryDifferentiator
public DirectoryDifferentiator(DirectoryView master,
DirectoryView target,
EntityMatchStrategy ems,
UnmatchedTargetEntityStrategy unmatchedTargetEntityStrategy,
UnmatchedMasterEntityStrategy unmatchedMasterEntityStrategy)
throws NullPointerException
- Create a new
DirectoryDifferentiator
.
- Parameters:
master
- The master directory.target
- The target directory.ems
- The strategy used for deciding if an entity in the master
directory matches an entity in the target directory.unmatchedTargetEntityStrategy
- The strategy object that is run for
each unmatched entity in the target directory.unmatchedMasterEntityStrategy
- The strategy object that is run for
each unmatched entity in the master directory.
- Throws:
NullPointerException
- If any of the arguments is null
.
run
public void run()
- Run the analysis.
- Specified by:
run
in interface Runnable