diff options
author | Michael Petretti | 2014-07-15 14:24:38 +0200 |
---|---|---|
committer | Michael Petretti | 2014-07-15 14:24:38 +0200 |
commit | afcdbf700dfdee503bd358f322c84e9114470f2e (patch) | |
tree | 3fc3522d709f41318bb4560f42095a5d92610080 /src/main/java/org/openslx/satellitedaemon/Globals.java | |
parent | Fixed a lot of TODOs and upload works. (diff) | |
download | satellite-daemon-afcdbf700dfdee503bd358f322c84e9114470f2e.tar.gz satellite-daemon-afcdbf700dfdee503bd358f322c84e9114470f2e.tar.xz satellite-daemon-afcdbf700dfdee503bd358f322c84e9114470f2e.zip |
Rename and clean-up.
Diffstat (limited to 'src/main/java/org/openslx/satellitedaemon/Globals.java')
-rw-r--r-- | src/main/java/org/openslx/satellitedaemon/Globals.java | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/Globals.java b/src/main/java/org/openslx/satellitedaemon/Globals.java index afcb3c6..a62ee9e 100644 --- a/src/main/java/org/openslx/satellitedaemon/Globals.java +++ b/src/main/java/org/openslx/satellitedaemon/Globals.java @@ -24,26 +24,28 @@ public class Globals private static boolean loadedProperties = false; private static SSLContext context = null; - /*********************************************************************************************** + /***********************************************************************************************/ + /** * If there are more ints or Strings which should be added to config/global.properties, * add to suiting enum, add a 'case' to getPropertyInt/String() and add checks to * propertiesValid(). * - * As an Example, if you want the value of the FTPSERVERIP you have to call - * Globals.getPropertyString( PropString.FTPSERVERIP ) which returns a string. + * As an Example, if you want the value of the FILETRANSFERSERVERIP you have to call + * Globals.getPropertyString( PropString.FILETRANSFERSERVERIP ) which returns a string. */ public static enum PropInt { - FTPPORT, THRIFTPORT, BLOCKSIZE // More int's? Add them separated with "," + FILETRANSFERPORT, THRIFTPORT, BLOCKSIZE // More int's? Add them separated with "," } public static enum PropString { // More strings's? Add them separated with "," - FTPSERVERIP, KEYSTORETYPE, FTPSKEYSTOREPATH, FTPSKEYSTOREPWD, THRIFTORGANIZATIONNAME, + FILETRANSFERSERVERIP, KEYSTORETYPE, FILETRANSFERSKEYSTOREPATH, FILETRANSFERSKEYSTOREPWD, THRIFTORGANIZATIONNAME, RNDSTRINGENCRYPTALIAS, RNDSTRINGENCRYPTPASSWORD, RNDSTRINGENCRYPTPATH } - /*********************************************************************************************** + /***********************************************************************************************/ + /** * * @return * @throws IOException @@ -61,7 +63,8 @@ public class Globals return true; } - /*********************************************************************************************** + /***********************************************************************************************/ + /** * * @param props * @return @@ -71,8 +74,8 @@ public class Globals String result = null; switch ( props ) { - case FTPPORT: - result = properties.getProperty( "ftp_port" ); + case FILETRANSFERPORT: + result = properties.getProperty( "filetransfer_port" ); break; case BLOCKSIZE: result = properties.getProperty( "blockSize" ); @@ -90,7 +93,8 @@ public class Globals return Integer.valueOf( result ); } - /*********************************************************************************************** + /***********************************************************************************************/ + /** * * @param props * @return @@ -100,17 +104,17 @@ public class Globals String result = null; switch ( props ) { - case FTPSERVERIP: - result = properties.getProperty( "ftp_server_ip" ); + case FILETRANSFERSERVERIP: + result = properties.getProperty( "filetransfer_server_ip" ); break; case KEYSTORETYPE: result = properties.getProperty( "keyStore_type" ); break; - case FTPSKEYSTOREPATH: - result = properties.getProperty( "path_to_ftps_keyStore" ); + case FILETRANSFERSKEYSTOREPATH: + result = properties.getProperty( "path_to_filetransfer_keyStore" ); break; - case FTPSKEYSTOREPWD: - result = properties.getProperty( "ftps_keyStore_password" ); + case FILETRANSFERSKEYSTOREPWD: + result = properties.getProperty( "filetransfer_keyStore_password" ); break; case THRIFTORGANIZATIONNAME: result = properties.getProperty( "organization_name" ); @@ -132,23 +136,24 @@ public class Globals } // TODO: add real checks - /*********************************************************************************************** + /***********************************************************************************************/ + /** * * @return */ public static boolean propertiesValid() { - if ( Globals.getPropertyInt( PropInt.FTPPORT ) == 0 + if ( Globals.getPropertyInt( PropInt.FILETRANSFERPORT ) == 0 || Globals.getPropertyInt( PropInt.BLOCKSIZE ) == 0 || Globals.getPropertyInt( PropInt.THRIFTPORT ) == 0 - || Globals.getPropertyString( PropString.FTPSERVERIP ).isEmpty() - || Globals.getPropertyString( PropString.FTPSERVERIP ) == null + || Globals.getPropertyString( PropString.FILETRANSFERSERVERIP ).isEmpty() + || Globals.getPropertyString( PropString.FILETRANSFERSERVERIP ) == null || Globals.getPropertyString( PropString.KEYSTORETYPE ).isEmpty() || Globals.getPropertyString( PropString.KEYSTORETYPE ) == null - || Globals.getPropertyString( PropString.FTPSKEYSTOREPATH ).isEmpty() - || Globals.getPropertyString( PropString.FTPSKEYSTOREPATH ) == null - || Globals.getPropertyString( PropString.FTPSKEYSTOREPWD ).isEmpty() - || Globals.getPropertyString( PropString.FTPSKEYSTOREPWD ) == null + || Globals.getPropertyString( PropString.FILETRANSFERSKEYSTOREPATH ).isEmpty() + || Globals.getPropertyString( PropString.FILETRANSFERSKEYSTOREPATH ) == null + || Globals.getPropertyString( PropString.FILETRANSFERSKEYSTOREPWD ).isEmpty() + || Globals.getPropertyString( PropString.FILETRANSFERSKEYSTOREPWD ) == null || Globals.getPropertyString( PropString.THRIFTORGANIZATIONNAME ).isEmpty() || Globals.getPropertyString( PropString.THRIFTORGANIZATIONNAME ) == null || Globals.getPropertyString( PropString.RNDSTRINGENCRYPTALIAS ).isEmpty() @@ -164,17 +169,18 @@ public class Globals } } - /*********************************************************************************************** + /***********************************************************************************************/ + /** * * @return */ public static boolean masterServerSslContextInit() { - char[] passphrase = Globals.getPropertyString( PropString.FTPSKEYSTOREPWD ).toCharArray(); + char[] passphrase = Globals.getPropertyString( PropString.FILETRANSFERSKEYSTOREPWD ).toCharArray(); KeyStore keystore; try { keystore = KeyStore.getInstance( "JKS" ); - keystore.load( new FileInputStream( Globals.getPropertyString( PropString.FTPSKEYSTOREPATH ) ), passphrase ); + keystore.load( new FileInputStream( Globals.getPropertyString( PropString.FILETRANSFERSKEYSTOREPATH ) ), passphrase ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm() ); tmf.init( keystore ); context = SSLContext.getInstance( "SSLv3" ); @@ -203,7 +209,8 @@ public class Globals } - /*********************************************************************************************** + /***********************************************************************************************/ + /** * * @return */ |