Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 private String getFilename(JailedResourcePath path) {
   return path.getUnjailedPath().toString();
 }
Exemplo n.º 3
0
 public MongoFolderStore(GridFS fs, JailedResourcePath path) {
   super(fs, path);
   if (Type.FILE.equals(getType(path))) {
     throw new ResourceTypeMismatchException(path.getUnjailedPath(), true);
   }
 }
Exemplo n.º 4
0
 public MongoFileStore(GridFS fs, JailedResourcePath path) {
   super(fs, path);
   if (Type.FOLDER.equals(getType(path))) {
     throw new ResourceTypeMismatchException(path.getUnjailedPath(), false);
   }
 }