protected GridFSInputFile create(Type type, boolean createEmptyFile) {
   Assert.notNull(type, "Type must not be null");
   GridFSInputFile file = this.fs.createFile(getFilename(getPath()));
   JailedResourcePath parent = this.path.getParent();
   if (parent != null) {
     file.put(PARENT, parent.getUnjailedPath().toString());
   }
   file.put(RESOURCE_TYPE, type.name());
   if (createEmptyFile) {
     try {
       file.getOutputStream().close();
     } catch (IOException e) {
       throw new ResourceException(e);
     }
   }
   return file;
 }
 private String getFilename(JailedResourcePath path) {
   return path.getUnjailedPath().toString();
 }
 public MongoFolderStore(GridFS fs, JailedResourcePath path) {
   super(fs, path);
   if (Type.FILE.equals(getType(path))) {
     throw new ResourceTypeMismatchException(path.getUnjailedPath(), true);
   }
 }
 public MongoFileStore(GridFS fs, JailedResourcePath path) {
   super(fs, path);
   if (Type.FOLDER.equals(getType(path))) {
     throw new ResourceTypeMismatchException(path.getUnjailedPath(), false);
   }
 }