{
// Add to junction table
junctions.put(junctionName, targetFile);
// Attach to file
final DelegateFileObject junctionFile = (DelegateFileObject) getFileFromCache(junctionName);
if (junctionFile != null)
{
junctionFile.setFile(targetFile);
}
// Create ancestors of junction point
FileName childName = junctionName;
boolean done = false;
for (FileName parentName = childName.getParent();
!done && parentName != null;
childName = parentName, parentName = parentName.getParent())
{
DelegateFileObject file = (DelegateFileObject) getFileFromCache(parentName);
if (file == null)
{
file = new DelegateFileObject(parentName, this, null);
putFileToCache(file);
}
else
{
done = file.exists();
}
// As this is the parent of our junction it has to be a folder
file.attachChild(childName, FileType.FOLDER);
}
// TODO - attach all cached children of the junction point to their real file
}
catch (final Exception e)