@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { callback.delete(file); try { if(file.isFile()) {
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { if(file.getType().contains(Path.Type.placeholder)) { continue; } callback.delete(file); try { if(DriveHomeFinderService.TEAM_DRIVES_NAME.equals(file.getParent())) { session.getClient().teamdrives().delete(fileid.getFileid(file, new DisabledListProgressListener())).execute(); } else { if(PreferencesFactory.get().getBoolean("googledrive.delete.trash")) { final File properties = new File(); properties.setTrashed(true); session.getClient().files().update(fileid.getFileid(file, new DisabledListProgressListener()), properties) .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute(); } else { session.getClient().files().delete(fileid.getFileid(file, new DisabledListProgressListener())) .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute(); } } } catch(IOException e) { throw new DriveExceptionMappingService().map("Cannot delete {0}", e, file); } } }
callback.delete(file); try { final IRODSFile f = session.getClient().getIRODSFileFactory().instanceIRODSFile(file.getAbsolute());
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { final List<Path> deleted = new ArrayList<Path>(); for(Path file : files) { boolean skip = false; for(Path d : deleted) { if(file.isChild(d)) { skip = true; break; } } if(skip) { continue; } deleted.add(file); callback.delete(file); try { session.getClient().delete(new DAVPathEncoder().encode(file)); } catch(SardineException e) { throw new DAVExceptionMappingService().map("Cannot delete {0}", e, file); } catch(IOException e) { throw new HttpExceptionMappingService().map(e, file); } } }
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { if(file.isFile() || file.isSymbolicLink()) { callback.delete(file); try { Files.delete(session.toPath(file)); } catch(IOException e) { throw new LocalExceptionMappingService().map("Cannot delete {0}", e, file); } } } for(Path file : files) { if(file.isDirectory() && !file.isSymbolicLink()) { callback.delete(file); try { Files.delete(session.toPath(file)); } catch(IOException e) { throw new LocalExceptionMappingService().map("Cannot delete {0}", e, file); } } } }
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { if(file.isFile() || file.isSymbolicLink()) { callback.delete(file); try { session.sftp().remove(file.getAbsolute()); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot delete {0}", e, file); } } } for(Path file : files) { if(file.isDirectory() && !file.isSymbolicLink()) { callback.delete(file); try { session.sftp().removeDir(file.getAbsolute()); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot delete {0}", e, file); } } } }
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { callback.delete(file); try { if(file.isFile() || file.isSymbolicLink()) { if(!session.getClient().deleteFile(file.getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } } else if(file.isDirectory()) { // Change working directory to parent if(!session.getClient().changeWorkingDirectory(file.getParent().getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } if(!session.getClient().removeDirectory(file.getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } } } catch(IOException e) { throw new FTPExceptionMappingService().map("Cannot delete {0}", e, file); } } }
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { callback.delete(file); try { final OneDriveItem item = session.toItem(file); item.delete(); } catch(NotfoundException e) { logger.warn(String.format("Cannot delete %s. Not found.", file)); } catch(OneDriveAPIException e) { throw new GraphExceptionMappingService().map("Cannot delete {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot delete {0}", e, file); } } }
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { callback.delete(file); try { if(file.isDirectory()) { session.getClient().deleteRecursive(file.getAbsolute()); } else { session.getClient().delete(file.getAbsolute()); } } catch(MantaException e) { throw new MantaExceptionMappingService().map("Cannot delete {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Cannot delete {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot delete {0}", e, file); } } }
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { try { callback.delete(file); // Delete the file or folder at a given path. If the path is a folder, all its contents will be deleted too. new DbxUserFilesRequests(session.getClient()).deleteV2(file.getAbsolute()); } catch(DbxException e) { throw new DropboxExceptionMappingService().map("Cannot delete {0}", e, file); } } }
@Override public void onSuccess(final V aVoid, final HttpHeaders responseHeaders) { callback.delete(file); } }