/** * 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; }
/** * 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; }
int dLastModified = this.dtLastModified.compareTo(e.getDtLastModified()); int dLastAccessed = this.dtLastAccessed.compareTo(e.getDtLastAccessed()); int dSize = (new Long(this.size)).compareTo(new Long(e.getSize()));
public long getFileSize(String remoteDir, String fileName) throws ChunkableDataSourceException { List<ClientListEntry> entries = null; try { entries = getClient().ls(remoteDir + fileName); if (entries.size() != 1) { // We have failed to uniquely identify the file throw new ChunkableDataSourceException("Could not uniquely find file: [" //$NON-NLS-1$ + fileName + "], in remote dir: [" + remoteDir + "]"); //$NON-NLS-1$ //$NON-NLS-2$ } } catch (ClientCommandLsException e) { throw new ChunkableDataSourceException("Could not perform ls over file transfer for file: [" //$NON-NLS-1$ + fileName + "], in remote dir: [" + remoteDir + "]", e); //$NON-NLS-1$ //$NON-NLS-2$ } catch (URISyntaxException e) { throw new ChunkableDataSourceException("Could not perform ls over file transfer for file: [" //$NON-NLS-1$ + fileName + "], in remote dir:" + remoteDir + "]", e); //$NON-NLS-1$ //$NON-NLS-2$ } ClientListEntry lsEntry = entries.get(0); return lsEntry.getSize(); }
/** * Used to create a <code>FileFilter</code> object which can * be used for persisting/filtering the entry. * * <p>Note: size is currently downcast from long to int. Maybe change the * persist object and table definition to handle this.</p> * * NOTE: Order is important due to the Hibernate mapping * * @return An <code>FileFilter</code> object holding this * entry's URI as string, lastModified, lastAccessed and size. */ public FileFilter toPersistObject() { return new FileFilter( this.getClientId(), this.getFullPath(), this.getDtLastModified(), this.getDtLastAccessed(), (int)this.getSize()); }