/** * Method to match <code>ClientListEntry</code> objects based on * whether they represent directories or not. * * @param lsEntry The <code>ClientListEntry</code> to match. * @return <code>true</code> if <code>ClientListEntry</code> is a * directory, <code>false</code> otherwise. */ public boolean match(ClientListEntry lsEntry) { return (lsEntry.isDirectory()) ? true: false; }
/** * Method to match <code>ClientListEntry</code> objects based on * whether they represent symbolic links or not. * * @param entry The <code>ClientListEntry</code> to match. * @return <code>true</code> if <code>ClientListEntry</code> is a * symbolic link, <code>false</code> otherwise. */ public boolean match(ClientListEntry entry) { return (entry.isLink()) ? true : false; }
@Override public Object clone() throws CloneNotSupportedException { return this.clone(); } }
/** * Method used to map an <code>Payload</code> object to a * <code>BaseFileTransferMappedRecord</code> object. * * @param payload The payload to transform * @return A BaseFileTransferMappedRecord constructed from the payload. */ public static BaseFileTransferMappedRecord payloadToMappedRecord(Payload payload) { BaseFileTransferMappedRecord record = new BaseFileTransferMappedRecord(); record.setContent(payload.getContent()); //record.setChecksum(payload.getChecksum(), payload.getChecksumAlg()); record.setName(payload.getAttribute(FilePayloadAttributeNames.FILE_NAME)); record.setSize(payload.getSize()); //record.setCreatedDayTime(new Date(payload.getTimestamp())); record.setRecordName(payload.getAttribute(FilePayloadAttributeNames.FILE_NAME)); record.setRecordShortDescription(null); return record; } }
/** * Determines if this file should be chunked or not * * @param entry * @return true if the file should be chunked */ private boolean shouldChunk(ClientListEntry entry) { boolean result = false; if (chunkableThreshold != null) { result = entry.getSize() > chunkableThreshold; } return result; }
public void get(String filePath, OutputStream outputStream, int resume, long offset) throws ClientCommandGetException { throw new ClientCommandGetException("Not yet implemented"); //$NON-NLS-1$ }
/** * Utility method for <code>mkdir(String newDirPath, boolean force)</code> * that defaults the <code>force</code> parameter to <code>true</code>. * * @param newPath The new path to create * @throws ClientCommandMkdirException Exception if we can't make a * directory */ public void mkdir(String newPath) throws ClientCommandMkdirException { try { createRemotePath(newPath, true); } catch (ClientException e) { throw new ClientCommandMkdirException(e); } }
public String pwd() throws ClientCommandPwdException { String currentDir = null; try { currentDir = this.ftpClient.printWorkingDirectory(); } catch (IOException e) { throw new ClientCommandPwdException("Failed to get working directory!", e); //$NON-NLS-1$ } return currentDir; }
public void deleteRemoteFile(String filename) throws ClientException { try { if(!this.ftpClient.deleteFile(filename)) { throw new ClientException("Exception while deleting file [" + filename + "]"); //$NON-NLS-1$//$NON-NLS-2$ } } catch (IOException e) { throw new ClientException("Exception while deleting file [" + filename + "]", e); //$NON-NLS-1$//$NON-NLS-2$ } }
/** * * @param recordName * @param recordDescription */ public BaseFileTransferMappedRecord(String recordName, String recordDescription) { this.setRecordName(recordName); this.setRecordShortDescription(recordDescription); this.mappedRecord = new HashMap<String, Object>(7); }
public Object remove(Object key) { return remove((String) key); }
public InputStream sourceChunkableData(String remoteDir, String fileName) throws ChunkableDataSourceException { try { return getClient().getAsInputStream(remoteDir + fileName); } catch (ClientCommandGetException e) { throw new ChunkableDataSourceException("Exception whilst performing file transfer get ", e); //$NON-NLS-1$ } }
/** * Determines if this file should be chunked or not * * @param entry File to check * @return true if the file should be chunked */ private boolean shouldChunk(ClientListEntry entry) { boolean result = false; if(chunkableThreshold != null) { result = entry.getSize() > chunkableThreshold; } return result; }
public void get(String filePath, OutputStream outputStream, int resume, long offset) throws ClientCommandGetException { throw new ClientCommandGetException("Not yet implemented"); //$NON-NLS-1$ }
/** * Utility method for <code>mkdir(String newDirPath, boolean force)</code> * that defaults the <code>force</code> parameter to <code>true</code>. * * @param newPath The new path to create * @throws ClientCommandMkdirException */ public void mkdir(String newPath) throws ClientCommandMkdirException { try { createRemotePath(newPath, true); } catch (ClientException e) { throw new ClientCommandMkdirException(e); } }
public String pwd() throws ClientCommandPwdException { String currentDir = null; try { currentDir = this.ftpClient.printWorkingDirectory(); } catch (IOException e) { throw new ClientCommandPwdException("Failed to get working directory!", e); //$NON-NLS-1$ } return currentDir; }
public void deleteRemoteFile(String filename) throws ClientException { try { if(!this.ftpClient.deleteFile(filename)) { throw new ClientException("Exception while deleting file [" + filename + "]"); //$NON-NLS-1$//$NON-NLS-2$ } } catch (IOException e) { throw new ClientException("Exception while deleting file [" + filename + "]", e); //$NON-NLS-1$//$NON-NLS-2$ } }
public InputStream getAsInputStream(String filePath) throws ClientCommandGetException { InputStream input = null; try { input = ftpClient.retrieveFileStream(filePath); if(input == null) { throw new ClientCommandGetException("InputStream for [" + filePath + "] was null."); } // Apache recommends using completePendingCommand() after // retrieveFileStream() if(!ftpClient.completePendingCommand()) { throw new ClientCommandGetException("Error trying to complete pending command."); } return input; } catch (IOException e) { throw new ClientCommandGetException(e); } }
/** * Utility method for <code>mkdir(String newDirPath, boolean force)</code> * that defaults the <code>force</code> parameter to <code>true</code>. * * @param newPath The new path to create * @throws ClientCommandMkdirException Exception if we can't make a * directory */ public void mkdir(String newPath) throws ClientCommandMkdirException { try { createRemotePath(newPath, true); } catch (ClientException e) { throw new ClientCommandMkdirException(e); } }
/** * Utilises the underlying API to return an InputStream as the result of the * GET operation * * @param filePath * @return InputStream * * @throws ClientCommandGetException */ public InputStream getAsInputStream(String filePath) throws ClientCommandGetException { try { return channelSftp.get(filePath); } catch (SftpException e) { throw new ClientCommandGetException(e); } }