package de.retest.recheck;

import java.util.prefs.Preferences;

import de.retest.recheck.Properties.FileOutputFormat;
import de.retest.recheck.auth.RehubAuthenticationHandler;
import de.retest.recheck.auth.RetestAuthentication;
import de.retest.recheck.persistence.CloudPersistence;

public class Rehub {

	private Rehub() {

	}

	public static void init() {
		final RetestAuthentication auth = RetestAuthentication.getInstance();

		if ( !auth.isAuthenticated( getToken() ) ) {
			auth.login( new RehubAuthenticationHandler() );
		}
		System.setProperty( Properties.FILE_OUTPUT_FORMAT_PROPERTY, FileOutputFormat.CLOUD.toString() );
	}

	private static String getToken() {
		final String tokenFromEnvironment = System.getenv( CloudPersistence.RECHECK_API_KEY );
		final String tokenFromPreferences =
				Preferences.userNodeForPackage( Rehub.class ).get( CloudPersistence.RECHECK_API_KEY, null );

		return tokenFromEnvironment != null ? tokenFromEnvironment : tokenFromPreferences;
	}

}

package de.retest.recheck;

import java.util.prefs.Preferences;

import de.retest.recheck.auth.RehubAuthenticationHandler;
import de.retest.recheck.auth.RetestAuthentication;
import de.retest.recheck.persistence.CloudPersistence;

public class Rehub {

	private Rehub() {

	}

	public static void init() {
		final RetestAuthentication auth = RetestAuthentication.getInstance();

		if ( !auth.isAuthenticated( getToken() ) ) {
			auth.login( new RehubAuthenticationHandler() );
		}
	}

	private static String getToken() {
		final String tokenFromEnvironment = System.getenv( CloudPersistence.RECHECK_API_KEY );
		final String tokenFromPreferences =
				Preferences.userNodeForPackage( Rehub.class ).get( CloudPersistence.RECHECK_API_KEY, null );

		return tokenFromEnvironment != null ? tokenFromEnvironment : tokenFromPreferences;
	}

}

--- 
+++ 
@@ -2,6 +2,7 @@
 
 import java.util.prefs.Preferences;
 
+import de.retest.recheck.Properties.FileOutputFormat;
 import de.retest.recheck.auth.RehubAuthenticationHandler;
 import de.retest.recheck.auth.RetestAuthentication;
 import de.retest.recheck.persistence.CloudPersistence;
@@ -18,6 +19,7 @@
 		if ( !auth.isAuthenticated( getToken() ) ) {
 			auth.login( new RehubAuthenticationHandler() );
 		}
+		System.setProperty( Properties.FILE_OUTPUT_FORMAT_PROPERTY, FileOutputFormat.CLOUD.toString() );
 	}
 
 	private static String getToken() {
Enable cloud persistence for rehub
