summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satellitedaemon/filetransfer
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/satellitedaemon/filetransfer')
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java13
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java6
2 files changed, 10 insertions, 9 deletions
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
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
index c77d6d6..22f270a 100644
--- a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
+++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
@@ -114,7 +114,7 @@ public class ThriftConnection {
// SessionID is not valid
// TODO: Code for new SSID
} else if (e.getNumber().equals(AuthorizationError.NO_PERMISSION)) {
- // Gibts noch gar nicht
+ // not yet implemented.
} else {
e.printStackTrace();
@@ -338,6 +338,8 @@ public class ThriftConnection {
theClient = client;
isAuthenticated = true;
}
+ // here the client was already used so we are just assuming that the client is still
+ // authenticated. Should be checked with the ping() method.
// try {
// isAuthenticated = theClient.ping();
// } catch ( TException x ) {
@@ -387,8 +389,8 @@ public class ThriftConnection {
/***********************************************************************************************/
/**
+ * Method for creating a new Client for Thrift communication.
*
- * @return
* @throws IOException
*/
private static ImageServer.Client newClient() throws IOException {