org.entityfs.util.dirdiff
Interface EntityMatchStrategy

All Known Implementing Classes:
EntitySizeAndFileModificationTimeMatchStrategy, EntitySizeAndModificationTimeMatchStrategy, FileSizeAndModificationTimeMatchStrategy

public interface EntityMatchStrategy

This strategy object is used by a DirectoryDifferentiator to see if an entity in the master directory has a matching entity in the target directory.

Since:
1.0
Author:
Karl Gustafsson
See Also:
DirectoryDifferentiator, DirectorySynchronizer, DirectoryTreeSynchronizer, UnmatchedMasterEntityStrategy, UnmatchedTargetEntityStrategy

Method Summary
 String getMatchingEntityName(EntityView ev, Map<String,? extends EntityView> m)
          Check if there is a matching entity in the supplied entity map.
 

Method Detail

getMatchingEntityName

String getMatchingEntityName(EntityView ev,
                             Map<String,? extends EntityView> m)
Check if there is a matching entity in the supplied entity map. If there is one, return its name.

When this method is called, the master directory (ev's parent) is locked for reading, and the target directory (the parent of all entities in the map) is locked for writing.

Parameters:
ev - The entity to search for a matching entity to.
m - A map containing all remaining entities in the target directory, keyed under their names. Remaining entities are all of the entities in the target directory that has not been matched by a previous invocation of this method.
Returns:
The name of the matching entity, or null if no entity in the target directory matched ev. The returned name, if non-null, must be the same as one of the keys in the map.