/** * Removes from the upload session the file identified by the given identifier. If the file path * is currently in writing mode, nothing is removed. * * @param fullPath the path of the file into the session. * @return true of removed has been effective, false otherwise. * @throws Exception */ public synchronized boolean remove(String fullPath) throws Exception { boolean removed = false; if (isHandledOnFileSystem()) { UploadSessionFile uploadSessionFile = getUploadSessionFile(fullPath); if (!currentFileWritings.containsKey(fullPath)) { removed = FileUtils.deleteQuietly(uploadSessionFile.getServerFile()); } } return removed; }
void markFileWritingInProgress(UploadSessionFile uploadSessionFile) throws IOException { String fullPath = uploadSessionFile.getFullPath(); if (currentFileWritings.containsKey(fullPath)) { throw new IOException( "An other file with the same name is currently updated (" + fullPath + ")"); } currentFileWritings.put(fullPath, true); }
void markFileWritingDone(UploadSessionFile uploadSessionFile) throws IOException { currentFileWritings.remove(uploadSessionFile.getFullPath()); }