From 6c4e2fa4523d4a4858d819064f0ed7c42fa8d89c Mon Sep 17 00:00:00 2001 From: Björn Hagemeister Date: Wed, 8 Oct 2014 18:02:30 +0200 Subject: Splitted Globals.java into two classes and splitted config file global.properties into global.properties and identity.properties. --- .../java/org/openslx/satellitedaemon/Globals.java | 43 +++++----------------- 1 file changed, 10 insertions(+), 33 deletions(-) (limited to 'src/main/java/org/openslx/satellitedaemon/Globals.java') diff --git a/src/main/java/org/openslx/satellitedaemon/Globals.java b/src/main/java/org/openslx/satellitedaemon/Globals.java index 8b0d182..a14f825 100644 --- a/src/main/java/org/openslx/satellitedaemon/Globals.java +++ b/src/main/java/org/openslx/satellitedaemon/Globals.java @@ -19,6 +19,7 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import org.apache.log4j.Logger; +import org.openslx.satellitedaemon.util.Util; public class Globals { @@ -34,8 +35,7 @@ public class Globals */ // * Properties *// - - // Strings // + public static String getMasterserverHost() { return properties.getProperty( "MASTERSERVER_HOST" ); @@ -46,16 +46,13 @@ public class Globals return properties.getProperty( "FILETRANSFER_KEYSTORE_PATH" ); } - public static String getOrganizationName() - { - return properties.getProperty( "ORGANIZATION_NAME" ); - } - public static String getImageFolder() { return properties.getProperty( "IMAGE_FOLDER" ); } + + // Integers // public static int getThriftPort() @@ -78,9 +75,9 @@ public class Globals System.exit( 2 ); } - notNullOrEmptyFatal( getMasterserverHost(), "Masterserver Host must not be empty!" ); - notNullOrEmptyFatal( getOrganizationName(), "Organiziation Name must not be empty!" ); - notNullOrEmptyFatal( getImageFolder(), "Image Folder must not be empty!" ); + Util.notNullOrEmptyFatal( getMasterserverHost(), "Masterserver Host must not be empty!" ); + Util.notNullOrEmptyFatal( getTruststorePath(), "Truststore Path must not be empty!" ); + Util.notNullOrEmptyFatal( getImageFolder(), "Image Folder must not be empty!" ); } /***********************************************************************************************/ @@ -101,7 +98,8 @@ public class Globals TrustManager[] trustManagers = tmf.getTrustManagers(); context.init( null, trustManagers, null ); } catch ( FileNotFoundException e ) { - log.error( "Could not find the keystore for the filetransfer. Path was '" + getTruststorePath() + "'" ); + log.error( "Could not find the keystore for the filetransfer. Path was '" + + getTruststorePath() + "'" ); return false; } catch ( Exception e ) { log.error( "Could not initialize SSL context.", e ); @@ -130,25 +128,4 @@ public class Globals return 0; } } - - public static void notNullOrEmptyFatal( String something, String message ) - { - if ( something == null || something.isEmpty() ) { - if ( message != null ) - log.fatal( "[NOTNULL] " + message ); - log.warn( Thread.currentThread().getStackTrace().toString() ); - System.exit( 2 ); - } - } - - /** - * Get private key for this server. If none exists yet, create a new one. - * - * @return - */ - public static PrivateKey getPrivateKey() - { - return AsymKeyHolder.getPrivateKey(); - } - -} +} \ No newline at end of file -- cgit v1.2.3-55-g7522