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/FileDownloadWorker.java4
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java4
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java29
3 files changed, 19 insertions, 18 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileDownloadWorker.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileDownloadWorker.java
index 2e92215..160e2fc 100644
--- a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileDownloadWorker.java
+++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileDownloadWorker.java
@@ -8,7 +8,7 @@ import org.apache.log4j.Logger;
import org.openslx.filetransfer.Downloader;
import org.openslx.filetransfer.FileRange;
import org.openslx.filetransfer.WantRangeCallback;
-import org.openslx.imagemaster.thrift.iface.DownloadInfos;
+import org.openslx.imagemaster.thrift.iface.DownloadData;
import org.openslx.satellitedaemon.Globals;
import org.openslx.satellitedaemon.db.DbImage;
@@ -26,7 +26,7 @@ public class FileDownloadWorker implements Runnable {
for (long i = 0; i < (image.fileSize / Globals.BLOCKSIZE); i++) {
range.add((int) i);
}
- DownloadInfos downInfos = ThriftConnection.getDownloadInfos(image);
+ DownloadData downInfos = ThriftConnection.getDownloadInfos(image);
if (downInfos == null) {
log.error("The DownloadInfos returned by ThriftConnection class are null");
continue;
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java
index aec589a..f8a0578 100644
--- a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java
+++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java
@@ -8,7 +8,7 @@ import java.util.UUID;
import org.apache.log4j.Logger;
import org.openslx.filetransfer.Uploader;
import org.openslx.imagemaster.thrift.iface.ImageData;
-import org.openslx.imagemaster.thrift.iface.UploadInfos;
+import org.openslx.imagemaster.thrift.iface.UploadData;
import org.openslx.satellitedaemon.Globals;
import org.openslx.satellitedaemon.db.DbImage;
@@ -43,7 +43,7 @@ public class FileUploadWorker implements Runnable
String crcPath = image.path.concat( ".crc" );
// ThriftConnection.getUploadInfos returns uploadInfo and handles ThriftAuthentication
- UploadInfos upInfos = ThriftConnection.getUploadInfos( imDat, crcPath );
+ UploadData upInfos = ThriftConnection.getUploadInfos( imDat, crcPath );
if ( upInfos == null ) {
log.error( "The UploadInfos returned by ThriftConnection Class are null" );
continue;
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
index ab60d2f..da6c6df 100644
--- a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
+++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
@@ -18,10 +18,11 @@ import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
import org.openslx.imagemaster.crcchecker.CrcFile;
import org.openslx.imagemaster.thrift.iface.AuthorizationError;
import org.openslx.imagemaster.thrift.iface.AuthorizationException;
-import org.openslx.imagemaster.thrift.iface.DownloadInfos;
+import org.openslx.imagemaster.thrift.iface.DownloadData;
import org.openslx.imagemaster.thrift.iface.ImageData;
import org.openslx.imagemaster.thrift.iface.ImageDataError;
import org.openslx.imagemaster.thrift.iface.ImageDataException;
@@ -30,7 +31,7 @@ import org.openslx.imagemaster.thrift.iface.ServerAuthenticationException;
import org.openslx.imagemaster.thrift.iface.ServerSessionData;
import org.openslx.imagemaster.thrift.iface.UploadError;
import org.openslx.imagemaster.thrift.iface.UploadException;
-import org.openslx.imagemaster.thrift.iface.UploadInfos;
+import org.openslx.imagemaster.thrift.iface.UploadData;
import org.openslx.satellitedaemon.Globals;
import org.openslx.satellitedaemon.db.DbImage;
import org.openslx.satellitedaemon.db.DbImage.Status;
@@ -60,7 +61,7 @@ public class ThriftConnection {
*
* @return returns 'null' if there is a problem.
*/
- public static UploadInfos getUploadInfos(ImageData imDat, String filename) {
+ public static UploadData getUploadInfos(ImageData imDat, String filename) {
ImageServer.Client theClient = null;
try {
theClient = getConnection();
@@ -94,13 +95,14 @@ public class ThriftConnection {
// TODO: Mark the Image as corrupted.
} else if (e.getNumber().equals(UploadError.INVALID_CRC)) {
// The CRC sum contained errors
- crc = new CrcFile(filename);
try {
- if (!crc.isValid()) {
- // TODO: Mark CRC-file as corrupted.
- }
+ crc = new CrcFile(filename);
} catch (IOException e1) {
- log.error("IOERROR, while reading from CRC File" + filename);
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ if (!crc.isValid()) {
+ // TODO: Mark CRC-file as corrupted.
}
} else {
e.printStackTrace();
@@ -155,7 +157,7 @@ public class ThriftConnection {
*
* @return returns 'null' if there is a problem.
*/
- public static DownloadInfos getDownloadInfos(DbImage imDat) {
+ public static DownloadData getDownloadInfos(DbImage imDat) {
ImageServer.Client theClient = null;
try {
theClient = getConnection();
@@ -173,7 +175,7 @@ public class ThriftConnection {
// The image requested is not known.
// TODO: change field image_syncMode, so the image is not asked
// for again.
- // Now just changed status of image. Currently no possibility
+ // For now just changed status of image. Currently no possibility
// for creating new useful state in DB. (Offenburg)
log.info("Image not known. For skipping next time, mark as only_local.");
imDat.updateStatus(Status.only_local);
@@ -314,10 +316,9 @@ public class ThriftConnection {
TProtocol protocol = new TBinaryProtocol(transport);
newClient = new ImageServer.Client(protocol);
log.debug("ThriftConnection: Made a new Client");
- } catch (TException x) {
- // TODO: Exception handling
- log.error("ThriftConnection coudn't create new client.");
- x.printStackTrace();
+ } catch (TTransportException tte) {
+ log.error("Transport could not be opened. Couldn't create new client.");
+ tte.printStackTrace();
return null;
}
return newClient;