{
boolean directory = isDirectory(file);
long timestamp = file.getLastModified();
List<String> pathElements = getRelativePath(file, root);
RepositoryItemMetadata existing = existingRMD == null ? null : existingRMD.getItemMetadata(pathElements);
// If there's an existing item, assume for now it's unchanged and keep existing originator
String originator = existing == null ? this.localNodeName : existing.getOriginatingNode();
RepositoryItemMetadata md = new RepositoryItemMetadata(pathElements, timestamp, originator, directory, false);
if (md.equals(existing) == false)
{
// above if test failing means this is a new item or
// timestamp, removed or directory status has changed
// In any case, this node is now the originator
md.setOriginatingNode(this.localNodeName);
}
rmd.getContent().add(md);
if (directory)