if (userSession == null)
throw new SessionException("Invalid session.");
User user = userSession.getUser();
// retrive parent object.
VfsFile parent = VfsFileDB.get(parentFileID, user.getID());
if (parent == null)
throw new VfsIOException("The parent not found.");
// check already exists same name.
if (VfsFileDB.get(parent.getID(), name, user.getID()) != null)
throw new VfsIOException("The name is already used.");
// check number of child object.
int childCount = VfsFileDB.countChild(parent.getID(), user.getID());
if (childCount >= systemInfo.getChildObjectsPerParent())
throw new VfsIOException("Could not create object any more.");
// create object as a file.
return VfsFileDB.createFile(name, parent.getID(), 0, user.getID());
}