@Override
public void addJunction(final String junctionPoint,
final FileObject targetFile)
throws FileSystemException
{
final FileName junctionName = getFileSystemManager().resolveName(getRootName(), junctionPoint);
// Check for nested junction - these are not supported yet
if (getJunctionForFile(junctionName) != null)
{
throw new FileSystemException("vfs.impl/nested-junction.error", junctionName);
}
try
{
// 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 (AbstractFileName parentName = (AbstractFileName) childName.getParent();
!done && parentName != null;
childName = parentName, parentName = (AbstractFileName) parentName.getParent())
{
DelegateFileObject file = (DelegateFileObject) getFileFromCache(parentName);
if (file == null)