summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/openslx/satellitedaemon/App.java67
1 files changed, 30 insertions, 37 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/App.java b/src/main/java/org/openslx/satellitedaemon/App.java
index e43c9a1..3fe143a 100644
--- a/src/main/java/org/openslx/satellitedaemon/App.java
+++ b/src/main/java/org/openslx/satellitedaemon/App.java
@@ -105,68 +105,61 @@ public class App
+ " [--genid <ORGANIZANTIONNAME>] or\n"
+ " [--import <ORGANIZATIONNAME> <MODULUS> <PRIV_EXP> <PUB_EXP>] or\n"
+ " [--submitkey <IPADDRESS>] or\n"
- + " [--updateaddress <IPADDRESS>]");
+ + " [--updateaddress <IPADDRESS>]" );
System.exit( 2 );
}
} else if ( args.length == 0 ) {
// No Option choosed, try to load existing identity.
-
+
if ( !tryLoadIdentity() ) {
System.exit( 2 );
}
}
-
+
if ( !Globals.masterServerSslContextInit() ) {
log.error( "Problem with initializing the SSLContext" );
System.exit( 1 );
}
-
+
log.info( "Configure proxy settings ..." );
// Configuring proxy settings. First read options from config file.
String proxyConfiguration = Globals.getProxyConf();
- if ((proxyConfiguration.equals( "AUTO")) || (proxyConfiguration.equals( "" ))) {
+ if ( ( proxyConfiguration.equals( "AUTO" ) ) || ( proxyConfiguration.equals( "" ) ) ) {
log.info( "Configuring proxy settings automatically..." );
// Configuring proxy settings automatically.
- WpadProxySearchStrategy wPSS = new WpadProxySearchStrategy();
+ WpadProxySearchStrategy wPSS = new WpadProxySearchStrategy();
try {
ProxySelector pS = wPSS.getProxySelector();
- ProxySelector.setDefault(pS);
- } catch (ProxyException e) {
+ ProxySelector.setDefault( pS );
+ } catch ( ProxyException e ) {
log.error( "Setting proxy configuration automatically failed.", e );
}
- } else if (proxyConfiguration.equals( "YES" )) {
+ } else if ( proxyConfiguration.equals( "YES" ) ) {
// Take the proxy settings from config file.
// First check if one of the following necessary options might not be set.
- if (Globals.checkProxySettings()) {
- String proxyAddress = Globals.getProxyAddress();
- int proxyPort = Globals.getProxyPort();
- if (Globals.getProxyUsername().equals( "" ) || Globals.getProxyPassword().equals("")) {
- log.info( "Configuring proxy settings manually without authentication..." );
- // use Proxy without authentication.
- Proxy proxy = new Proxy( Proxy.Type.SOCKS, new InetSocketAddress( proxyAddress, proxyPort ) );
-
- StaticProxySelector sPS = new StaticProxySelector(proxy);
- ProxySelector.setDefault( sPS );
- } else {
- log.info( "Configuring proxy settings manually with authentication..." );
- // Use proxy with authentication.
- String proxyUname = Globals.getProxyUsername();
- String proxyPass = Globals.getProxyPassword();
-
- Proxy proxy = new Proxy( Proxy.Type.SOCKS, new InetSocketAddress( proxyAddress, proxyPort ) );
-
- StaticProxySelector sPS = new StaticProxySelector( proxy );
- ProxySelector.setDefault( sPS );
-
- // Set authentication.
- StaticProxyAuthenticator sPA = new StaticProxyAuthenticator( proxyUname, proxyPass );
- Authenticator.setDefault( sPA );
- }
- }
- }
+ if ( Globals.checkProxySettings() ) {
+ String proxyAddress = Globals.getProxyAddress();
+ int proxyPort = Globals.getProxyPort();
+
+ // Configure proxy.
+ Proxy proxy = new Proxy( Proxy.Type.SOCKS, new InetSocketAddress( proxyAddress, proxyPort ) );
+ StaticProxySelector sPS = new StaticProxySelector( proxy );
+ ProxySelector.setDefault( sPS );
+
+ if ( ! ( Globals.getProxyUsername().equals( "" ) ) && ! ( Globals.getProxyPassword().equals( "" ) ) ) {
+ log.info( "Configuring proxy settings manually WITH authentication..." );
+ // use Proxy with authentication.
+ String proxyUname = Globals.getProxyUsername();
+ String proxyPass = Globals.getProxyPassword();
+
+ // Set authentication.
+ StaticProxyAuthenticator sPA = new StaticProxyAuthenticator( proxyUname, proxyPass );
+ Authenticator.setDefault( sPA );
+ }
+ }
+ }
log.info( "... proxy settings are done." );
-
// Start Up- and Download.
Thread uploadWorker = new Thread( new FileUploadWorker() );
uploadWorker.start();