summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satellitedaemon/App.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/satellitedaemon/App.java')
-rw-r--r--src/main/java/org/openslx/satellitedaemon/App.java45
1 files changed, 9 insertions, 36 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/App.java b/src/main/java/org/openslx/satellitedaemon/App.java
index 55e3149..e65f01b 100644
--- a/src/main/java/org/openslx/satellitedaemon/App.java
+++ b/src/main/java/org/openslx/satellitedaemon/App.java
@@ -1,25 +1,14 @@
package org.openslx.satellitedaemon;
import java.math.BigInteger;
-import java.net.Authenticator;
-import java.net.InetSocketAddress;
-import java.net.Proxy;
-import java.net.ProxySelector;
import java.security.NoSuchAlgorithmException;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.openslx.network.ProxyConfiguration;
-import org.openslx.network.ProxyProperties;
-import org.openslx.network.StaticProxyAuthenticator;
-import org.openslx.network.StaticProxySelector;
import org.openslx.satellitedaemon.filetransfer.FileDownloadWorker;
import org.openslx.satellitedaemon.filetransfer.FileUploadWorker;
-
-import com.btr.proxy.search.wpad.WpadProxySearchStrategy;
-import com.btr.proxy.util.ProxyException;
+import org.openslx.satellitedaemon.filetransfer.ThriftConnection;
/***********************************************************************************************/
/**
@@ -34,6 +23,10 @@ public class App
{
BasicConfigurator.configure();
+ log.info( "Ping: " + ThriftConnection.ping() );
+
+ System.exit( 0 );
+
int i = 0;
String arg;
String organizationName;
@@ -45,10 +38,10 @@ public class App
// Arguments available, take the first one.
arg = args[i++];
if ( arg.equals( "--checkconfig" ) ) {
- if ( checkConfig() ) {
+ if ( Identity.load() ) {
System.exit( 0 );
}
- log.error( "Config not valid: existing modulus, private and public exponent no valid key pair." );
+ log.error( "Config not valid: Missing organization, or keypair missing/corrupted." );
System.exit( 2 );
} else if ( arg.equals( "--genid" ) ) {
if ( i < args.length ) {
@@ -113,7 +106,8 @@ public class App
} else if ( args.length == 0 ) {
// No Option choosed, try to load existing identity.
- if ( !tryLoadIdentity() ) {
+ if ( !Identity.load() ) {
+ log.error( "Bailing out!" );
System.exit( 2 );
}
}
@@ -134,22 +128,6 @@ public class App
downloadWorker.start();
}
- private static boolean checkConfig()
- {
- if ( Identity.getOrganizationName() == null ) {
- log.error( "Checking config failed: no existing organization name." );
- return false;
- }
- RSAPublicKey pub = (RSAPublicKey)Identity.getPublicKey();
- RSAPrivateKey priv = (RSAPrivateKey)Identity.getPrivateKey();
- assert ( pub.getModulus() == priv.getModulus() );
- BigInteger modulus = pub.getModulus();
- return Identity.isValidKeyPair(
- modulus,
- priv.getPrivateExponent(),
- pub.getPublicExponent() );
- }
-
private static boolean genId( String organizationName )
{
return Identity.generateIdentity( organizationName );
@@ -173,9 +151,4 @@ public class App
{
return Identity.updateAddress( ipAddress );
}
-
- private static boolean tryLoadIdentity()
- {
- return checkConfig();
- }
}