}
folder.setPath(path);
}
// setup folder implementation
FolderImpl folderImpl = (FolderImpl)folder;
folderImpl.setFolderHandler(this);
folderImpl.setHandlerFactory(handlerFactory);
folderImpl.setPermissionsEnabled(handlerFactory.getPermissionsEnabled());
folderImpl.setConstraintsEnabled(handlerFactory.getConstraintsEnabled());
folderImpl.marshalling();
// create underlying folder if it does not exist
File folderFile = new File(documentRootDir, path);
if ((folderFile.exists() && !folderFile.isDirectory()) || (!folderFile.exists() && !folderFile.mkdir()))
{
throw new FailedToUpdateFolderException(folderFile.getAbsolutePath()+" does not exist and cannot be created.");
}
// update metadata
try
{
FolderMetaDataImpl metadata = folderImpl.getFolderMetaData();
metadata.setPath(path + Folder.PATH_SEPARATOR + FolderMetaDataImpl.DOCUMENT_TYPE);
metadataDocHandler.updateDocument(metadata);
}
catch (Exception e)
{