diff options
Diffstat (limited to 'src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java')
-rw-r--r-- | src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java b/src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java index 91571ed..6b213b1 100644 --- a/src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java +++ b/src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java @@ -32,7 +32,7 @@ public class FtpUploadWorker implements Runnable while ( true ) { List<DbImage> imageList = DbImage.getAllMarkedForUpload(); for ( DbImage image : imageList ) { - // TODO: imDat should be filled by the first entry of imageList. + // 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", true, false, "best", "theVeryBest", image.fileSize ); @@ -43,7 +43,6 @@ public class FtpUploadWorker implements Runnable } try { - // ToDo: Add everything with the keyStores to config/global.properties TrustManagerFactory trustManagerFactory = TrustManagerFactory .getInstance( KeyManagerFactory.getDefaultAlgorithm() ); KeyStore keystore = KeyStore.getInstance( Globals.getPropertyString( PropString.KEYSTORETYPE ) ); @@ -59,23 +58,24 @@ public class FtpUploadWorker implements Runnable if ( !ftpClient.login( ftpc.username, ftpc.password ) ) { log.error( "FTP problem. Coundn't log in!" ); } - // TODO: Where do I find the path to the db-image? <-- in DbImage. It's relative, base path should come from config/???.properties (global static config class, see masterserver's Globals class) File file = new File( image.path ); FileInputStream fis = new FileInputStream( file ); + ftpClient.storeFile( image.name, fis ); - // TODO: What is the path where it should be stored? <-- Should be set in the FtpCredentials you get via Thrift, but doesn't really matter, Server can decide to ignore the name and pick own (talk to Nils) - ftpClient.storeFile( "/path/where/theImage/belongs", fis ); - - } finally { + } catch (IOException e) { + log.error("FtpUploadWorker: Error creating the FileInputStream"); + } + finally { ftpClient.disconnect(); } } catch ( NoSuchAlgorithmException | KeyStoreException | CertificateException | IOException e ) { + log.debug( "FtpUploadWorker: Problem with Keystore ore FtpsClient creation." ); } } try { Thread.sleep( 5 * 60 * 1000 ); } catch ( InterruptedException e ) { - // TODO Auto-generated catch block + log.error( "FtpUploadWorker: Sleep interrupted" ); e.printStackTrace(); } } |