summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2014-10-02 16:03:55 +0200
committerSimon Rettberg2014-10-02 16:03:55 +0200
commit8bfacf56a15cb1d784d55852d7bf208beab3c915 (patch)
tree0ef93ed55a35bc59d63c5adc72aa4bb00bafabb4
parentException handling. (diff)
downloadsatellite-daemon-8bfacf56a15cb1d784d55852d7bf208beab3c915.tar.gz
satellite-daemon-8bfacf56a15cb1d784d55852d7bf208beab3c915.tar.xz
satellite-daemon-8bfacf56a15cb1d784d55852d7bf208beab3c915.zip
Update thrift usage according to changes to master-sync-shared
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java23
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java15
2 files changed, 15 insertions, 23 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java
index 09e412a..b7b87cb 100644
--- a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java
+++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java
@@ -1,6 +1,5 @@
package org.openslx.satellitedaemon.filetransfer;
-import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
@@ -37,12 +36,12 @@ public class FileUploadWorker implements Runnable
// 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() / 1000),
- (System.currentTimeMillis() / 1000), image.creator, "anyThing",
- true, false, "best", "theVeryBest", image.fileSize );
+ image.name, ( System.currentTimeMillis() / 1000 ),
+ ( System.currentTimeMillis() / 1000 ), image.creator, "anyThing",
+ true, false, "best", image.fileSize );
String path = Globals.getImageFolder() + "/" + image.path;
-
+
// ThriftConnection.getUploadInfos returns uploadInfo and handles ThriftAuthentication
UploadData upInfos = ThriftConnection.getUploadInfos( imDat, path );
if ( upInfos == null ) {
@@ -57,18 +56,18 @@ public class FileUploadWorker implements Runnable
try {
u = new Uploader( Globals.getMasterserverHost(),
upInfos.port, Globals.getMasterServerSslContext(), upInfos.token );
- } catch (IOException e) {
+ } catch ( IOException e ) {
e.printStackTrace();
continue;
}
-
+
// Start upload process.
- if (u.upload(path)) {
- u.close(null);
- log.info("Uploaded image successfuly.");
- image.updateStatus(Status.successfully_published);
+ if ( u.upload( path ) ) {
+ u.close( null );
+ log.info( "Uploaded image successfuly." );
+ image.updateStatus( Status.successfully_published );
}
-
+
}
try {
Thread.sleep( 1 * 60 * 1000 );
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
index 37c4ebd..89a8122 100644
--- a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
+++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
@@ -3,12 +3,6 @@ package org.openslx.satellitedaemon.filetransfer;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
-import java.security.InvalidKeyException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.SignatureException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
import java.util.List;
import org.apache.log4j.Logger;
@@ -21,6 +15,7 @@ import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import org.openslx.encryption.AsymEncryptionHandler;
import org.openslx.imagemaster.crcchecker.CrcFile;
+import org.openslx.imagemaster.thrift.iface.AuthenticationException;
import org.openslx.imagemaster.thrift.iface.AuthorizationError;
import org.openslx.imagemaster.thrift.iface.AuthorizationException;
import org.openslx.imagemaster.thrift.iface.DownloadData;
@@ -28,15 +23,13 @@ import org.openslx.imagemaster.thrift.iface.ImageData;
import org.openslx.imagemaster.thrift.iface.ImageDataError;
import org.openslx.imagemaster.thrift.iface.ImageDataException;
import org.openslx.imagemaster.thrift.iface.ImageServer;
-import org.openslx.imagemaster.thrift.iface.ServerAuthenticationException;
import org.openslx.imagemaster.thrift.iface.ServerSessionData;
+import org.openslx.imagemaster.thrift.iface.UploadData;
import org.openslx.imagemaster.thrift.iface.UploadError;
import org.openslx.imagemaster.thrift.iface.UploadException;
-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;
-import org.openslx.satellitedaemon.util.EncryptWithServerIdPublicKey;
// TODO: Handle all the auto-generated catch blocks in a meaningful way
@@ -248,8 +241,8 @@ public class ThriftConnection
sSD = theClient.serverAuthenticate(
Globals.getOrganizationName(),
ByteBuffer.wrap( byteArray ) );
- } catch ( ServerAuthenticationException e ) {
- log.error( "ThriftConnection: ServerAuthenticationException: Server Authetication was not sucessful." );
+ } catch ( AuthenticationException e ) {
+ log.error( "ThriftConnection: AuthenticationException: Server Authetication was not sucessful." );
e.printStackTrace();
return null;
} catch ( TException e ) {