org.entityfs.util.dirdiff
Class DirectorySynchronizer

java.lang.Object
  extended by org.entityfs.util.dirdiff.DirectoryDifferentiator
      extended by org.entityfs.util.dirdiff.DirectorySynchronizer
All Implemented Interfaces:
Runnable

public class DirectorySynchronizer
extends DirectoryDifferentiator

This is a version of the DirectoryDifferentiator that is used for synchronizing the files and subdirectories from a master directory to a target directory. Using this class is equivalent to using the DirectoryDifferentiator with the DeleteUnmatchedTargetEntityStrategy and the CopyUnmatchedMasterEntityStrategy strategies.

Run the synchronization by calling the DirectoryDifferentiator.run() method.

Since:
1.0
Author:
Karl Gustafsson
See Also:
DirectoryTreeSynchronizer, DirectoryDifferentiator

Constructor Summary
DirectorySynchronizer(DirectoryView master, DirectoryView target)
          Create a directory synchronizer with the default EntityMatchStrategy EntitySizeAndFileModificationTimeMatchStrategy.
DirectorySynchronizer(DirectoryView master, DirectoryView target, EntityMatchStrategy ems)
          Create a directory synchronizer using a custom EntityMatchStrategy.
 
Method Summary
 
Methods inherited from class org.entityfs.util.dirdiff.DirectoryDifferentiator
run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectorySynchronizer

public DirectorySynchronizer(DirectoryView master,
                             DirectoryView target)
                      throws NullPointerException
Create a directory synchronizer with the default EntityMatchStrategy EntitySizeAndFileModificationTimeMatchStrategy.

Parameters:
master - The master directory.
target - The target directory.
Throws:
NullPointerException - If any of the arguments is null.

DirectorySynchronizer

public DirectorySynchronizer(DirectoryView master,
                             DirectoryView target,
                             EntityMatchStrategy ems)
                      throws NullPointerException
Create a directory synchronizer using a custom EntityMatchStrategy.

Parameters:
master - The master directory.
target - The target directory.
ems - The strategy used for checking if an entity in the master directory has a matching entity in the target directory.
Throws:
NullPointerException - If any of the arguments is null.