// unpack handler
File copy = copy(guidDir, handler);
String path = handler.getPathName();
// create new handler
FileSystemContext fileSystemContext = new TempContext(copy, oldVFSContext, path);
// merge old options
Options newOptions = fileSystemContext.getOptions();
if (newOptions != null) // shouldn't be null, but we check anyway
{
Options oldOptions = oldVFSContext.getOptions();
if (oldOptions != null && oldOptions.size() > 0)
newOptions.merge(oldOptions);
newOptions.addOption(VFSUtils.IS_TEMP_FILE, Boolean.TRUE);
// save old handler
newOptions.addOption(VirtualFileHandler.class.getName(), handler);
}
VirtualFileHandler newHandler = fileSystemContext.getRoot();
oldVFSContext.addTempInfo(new BasicTempInfo(path, copy, newHandler));
VirtualFileHandler parent = handler.getParent();
if (parent != null && replaceOldHandler(parent, handler, newHandler))
parent.replaceChild(handler, newHandler);