summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satellitedaemon/App.java
diff options
context:
space:
mode:
authorMichael Petretti2014-05-26 15:22:13 +0200
committerMichael Petretti2014-05-26 15:22:13 +0200
commita00f154064936fb3ec8d2ed37a7cf9cc681e0421 (patch)
tree2e0970077f4a740547e2dbe89b1f120f7e513c80 /src/main/java/org/openslx/satellitedaemon/App.java
parentAdded some notes (diff)
downloadsatellite-daemon-a00f154064936fb3ec8d2ed37a7cf9cc681e0421.tar.gz
satellite-daemon-a00f154064936fb3ec8d2ed37a7cf9cc681e0421.tar.xz
satellite-daemon-a00f154064936fb3ec8d2ed37a7cf9cc681e0421.zip
Added a Globals.java class for properties handling.
Diffstat (limited to 'src/main/java/org/openslx/satellitedaemon/App.java')
-rw-r--r--src/main/java/org/openslx/satellitedaemon/App.java40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/App.java b/src/main/java/org/openslx/satellitedaemon/App.java
index 7faf365..490ceba 100644
--- a/src/main/java/org/openslx/satellitedaemon/App.java
+++ b/src/main/java/org/openslx/satellitedaemon/App.java
@@ -9,6 +9,7 @@ import java.security.SignatureException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
+import org.apache.log4j.Logger;
import org.openslx.imagemaster.thrift.iface.ServerAuthenticationException;
import org.openslx.satellitedaemon.ftp.FtpUploadWorker;
@@ -18,20 +19,33 @@ import org.openslx.satellitedaemon.ftp.FtpUploadWorker;
*/
public class App
{
- public static void main( String[] args ) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, FileNotFoundException, IOException, ServerAuthenticationException, UnrecoverableKeyException, InvalidKeyException, SignatureException
+ private static Logger log = Logger.getLogger( App.class );
+
+ public static void main( String[] args )
+ throws NoSuchAlgorithmException, KeyStoreException, CertificateException, FileNotFoundException, IOException, ServerAuthenticationException, UnrecoverableKeyException,
+ InvalidKeyException, SignatureException
{
-
-// // TODO: A Thread that starts the call for new credentials and the upload
-// // whenever a new image was sceduled in the db.
-// ImageData imDat = new ImageData( UUID.randomUUID().toString(), 113,
-// "TestImage", System.currentTimeMillis(), System.currentTimeMillis(), "me", "anyThing",
-// true, false, "best", "theVeryBest", 1024 );
-// FtpCredentials ftpc = ThriftConnection.getFtpCredentials(imDat);
-// Util.notNullFatal( ftpc, "ftpc was null" );
-// FtpImageUploader ftpIU = new FtpImageUploader( ftpc );
-// Util.notNullFatal( ftpIU, "ftpIU was null" );
-// ftpIU.connectTest();
- Thread uploadWorker = new Thread(new FtpUploadWorker());
+ try {
+ Globals.loadProperties();
+ if ( !Globals.propertiesValid() ) {
+ log.error( "Config file contains errors." );
+ System.exit( 1 );
+ }
+ } catch ( IOException e ) {
+ log.error( "Could not load config file. Quitting." );
+ System.exit( 1 );
+ }
+ // // TODO: A Thread that starts the call for new credentials and the upload
+ // // whenever a new image was sceduled in the db.
+ // ImageData imDat = new ImageData( UUID.randomUUID().toString(), 113,
+ // "TestImage", System.currentTimeMillis(), System.currentTimeMillis(), "me", "anyThing",
+ // true, false, "best", "theVeryBest", 1024 );
+ // FtpCredentials ftpc = ThriftConnection.getFtpCredentials(imDat);
+ // Util.notNullFatal( ftpc, "ftpc was null" );
+ // FtpImageUploader ftpIU = new FtpImageUploader( ftpc );
+ // Util.notNullFatal( ftpIU, "ftpIU was null" );
+ // ftpIU.connectTest();
+ Thread uploadWorker = new Thread( new FtpUploadWorker() );
uploadWorker.start();
}
}