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 | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java b/src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java index 91d4e9c..73ec705 100644 --- a/src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java +++ b/src/main/java/org/openslx/satellitedaemon/ftp/FtpUploadWorker.java @@ -44,7 +44,7 @@ public class FtpUploadWorker implements Runnable true, false, "best", "theVeryBest", 1024 ); FtpCredentials ftpc = ThriftConnection.getFtpCredentials( imDat ); - if (ftpc == null) { + if ( ftpc == null ) { log.error( "The FtpCredentials are null" ); } @@ -52,10 +52,10 @@ public class FtpUploadWorker implements Runnable // ToDo: Add everything with the keyStores to config/global.properties TrustManagerFactory trustManagerFactory = TrustManagerFactory .getInstance( KeyManagerFactory.getDefaultAlgorithm() ); - KeyStore keystore = KeyStore.getInstance( "JKS" ); + KeyStore keystore = KeyStore.getInstance( Globals.getPropertyString( PropString.KEYSTORETYPE ) ); keystore.load( new FileInputStream( new File( - "/home/michael/satellite-daemon/config/ftpsid.jks" ) ), - "password".toCharArray() ); // TODO: define relative path, eg. "config/masterserver_cert.jks" + Globals.getPropertyString( PropString.FTPSKEYSTOREPATH ) ) ), + Globals.getPropertyString( PropString.FTPSKEYSTOREPWD ).toCharArray() ); trustManagerFactory.init( keystore ); TrustManager trustManager = trustManagerFactory.getTrustManagers()[0]; FTPSClient ftpClient = new FTPSClient( "SSL", true ); @@ -63,11 +63,8 @@ public class FtpUploadWorker implements Runnable try { ftpClient.connect( Globals.getPropertyString( PropString.FTPSERVERIP ), Globals.getPropertyInt( PropInt.FTPPORT ) ); if ( !ftpClient.login( ftpc.username, ftpc.password ) ) { - throw new ConnectException( "Could not login." ); // TODO: Should not throw exception, otherwise we'd exit the run() method + log.error( "FTP problem. Coundn't log in!" ); } - // System.out.println( "Connected to " + nilsIp + ":" + ftpPort - // + ". Reply code: " + ftpClient.getReplyCode() ); - // 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( imageList.get( 0 ).path ); FileInputStream fis = new FileInputStream( file ); @@ -91,5 +88,4 @@ public class FtpUploadWorker implements Runnable } } - } |