summaryrefslogblamecommitdiffstats
path: root/src/main/java/org/openslx/satellitedaemon/App.java
blob: 2dcaec67513b4d27f1097f00a1b64aa9e438f2b3 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                    





                                              
                                          
                               

                                                                   
 

                                                                                                 
                                                                              

   

                

                                                                  
                                                                                
         
                                              















                                                                                     
                                                                                           
                               



                                                                                
                                          
                                                                           
                                     
                                                                               
                                       

         
package org.openslx.satellitedaemon;

import java.security.KeyPair;
import java.security.KeyPairGenerator;
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.satellitedaemon.filetransfer.FileDownloadWorker;
import org.openslx.satellitedaemon.filetransfer.FileUploadWorker;

/***********************************************************************************************/
/**
 * Main class for uploading images from the HS-Server to the Satellite Server.
 * 
 */
public class App
{
	private static Logger log = Logger.getLogger( App.class );
	
	public static void main( String[] args ) throws NoSuchAlgorithmException
	{
		BasicConfigurator.configure();
		
//		KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
//		kpg.initialize(4096);
//		KeyPair kp = kpg.generateKeyPair();
//		RSAPrivateKey privateKey = (RSAPrivateKey) kp.getPrivate();
//		RSAPublicKey publicKey = (RSAPublicKey) kp.getPublic();
//		
//		log.debug("modulus: " + privateKey.getModulus().toString());
//		log.debug("exponent: " + privateKey.getPrivateExponent().toString());
//		
//		
//		log.debug("modulus: " + publicKey.getModulus().toString());
//		log.debug("exponent: " + publicKey.getPublicExponent().toString());
//		
//		System.exit(1);
		
		// Loads all entries from the configuration file config/globals.properties 
		Globals.init();
		if (!Globals.masterServerSslContextInit()){
			log.error( "Problem with initializing the SSLContext" );
			System.exit( 1 );
		}
		// Start Up- and Download.
		Thread uploadWorker = new Thread( new FileUploadWorker() );
		uploadWorker.start();
		Thread downloadWorker = new Thread( new FileDownloadWorker() );
		downloadWorker.start();
	}
}