From dabd31a107bb8818596002b4edf12477ac241d61 Mon Sep 17 00:00:00 2001 From: Michael Petretti Date: Wed, 27 Aug 2014 16:10:08 +0200 Subject: Added comments for better documentation. --- .../satellitedaemon/filetransfer/FileUploadWorker.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java') diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java index 829a903..2677c53 100644 --- a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java +++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java @@ -27,23 +27,22 @@ public class FileUploadWorker implements Runnable // Upload one Image after the other. for ( DbImage image : imageList ) { - // TODO: still some fields for ImageData, which i can't fill - // with info from DbImage. + // TODO: still some fields for ImageData, which i can't fill with info from DbImage. // ImageData imDat = new ImageData(image.guid, image.rid, // image.name, System.currentTimeMillis(), // System.currentTimeMillis(), image.creator, "anyThing", // TODO: fields in databases need to fit somehow... // true, false, "best", "theVeryBest", image.fileSize); + // Only for testing because a random UUID is used. Later the method above should be used. ImageData imDat = new ImageData( UUID.randomUUID().toString(), image.rid, image.name, System.currentTimeMillis(), System.currentTimeMillis(), image.creator, "anyThing", true, false, "best", "theVeryBest", image.fileSize ); - // uploadInfo and ThriftAuthentication String crcPath = image.path.concat( ".crc" ); - UploadInfos upInfos = ThriftConnection.getUploadInfos( imDat, - crcPath ); + // ThriftConnection.getUploadInfos returns uploadInfo and handles ThriftAuthentication + UploadInfos upInfos = ThriftConnection.getUploadInfos( imDat, crcPath ); if ( upInfos == null ) { log.error( "The UploadInfos returned by ThriftConnection Class are null" ); continue; @@ -61,6 +60,7 @@ public class FileUploadWorker implements Runnable + e.toString() ); continue; } + // Necessary authentication before upload. u.sendToken( upInfos.token ); log.info( "upInfos.getMissingBlocks().size() = " @@ -73,8 +73,7 @@ public class FileUploadWorker implements Runnable log.info( "Anzahl angeforderter Blöcke : " + blocks.size() ); log.info( blocks ); for ( int i = 0; i < blocks.size(); i++ ) { - int startOffset = blocks.get( i ) * Globals.BLOCKSIZE; // TODO: - // long + int startOffset = blocks.get( i ) * Globals.BLOCKSIZE; // TODO: long int endOffset = startOffset + Globals.BLOCKSIZE; if ( endOffset > fileSize ) endOffset = (int)fileSize; // TODO: Long -- cgit v1.2.3-55-g7522