package org.aktin.broker.admin.standalone;

import java.nio.file.Path;
import java.nio.file.Paths;

import org.aktin.broker.server.auth.AuthProvider;

public class DefaultConfiguration implements Configuration{

	public DefaultConfiguration() {
		
	}

	@Override
	public int getPort() {
		return 8080;
	}

//	@Override
//	public String getDatabasePath() {
//		return "broker";
//	}
//	@Override
//	public String getAggregatorDataPath() {
//		return "aggregator-data";
//	}
//	@Override
//	public String getBrokerDataPath() {
//		return "broker-data";
//	}
//
//	@Override
//	public String getTempDownloadPath() {
//		return "download-temp";
//	}

	@Override
	public AuthProvider getAuthProvider() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Path getBasePath() {
		return Paths.get(".");
	}

}

@@ -53,199 +53,1505 @@
 ava.
-nio.file.Path;%0Aimport java.nio.file.Paths;%0A%0Aimport org.aktin.broker.server.auth.AuthProvider;%0A%0Apublic class DefaultConfiguration implements Configuration%7B%0A%0A%09public DefaultConfiguration() %7B%0A%09%09
+lang.reflect.Constructor;%0Aimport java.lang.reflect.InvocationTargetException;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0Aimport java.util.Arrays;%0A%0Aimport org.aktin.broker.auth.CascadedAuthProvider;%0Aimport org.aktin.broker.server.auth.AuthProvider;%0A%0Apublic class DefaultConfiguration implements Configuration%7B%0A%09private static final String DEFAULT_AUTH_PROVIDER = %22org.aktin.broker.auth.apikey.ApiKeyPropertiesAuthProvider,org.aktin.broker.auth.cred.CredentialTokenAuthProvider%22;%0A%09private AuthProvider authProvider;%0A%0A%09%0A%09public DefaultConfiguration() %7B%0A%09%09String ap = System.getProperty(%22broker.auth.provider%22, DEFAULT_AUTH_PROVIDER);%0A%0A%09%09String%5B%5D aps = ap.split(%22,%22);%0A%09%09if( aps.length == 1 ) %7B%0A%09%09%09// single auth provider%0A%09%09%09authProvider = loadProviderClass(aps%5B0%5D);%0A%09%09%7Delse %7B%0A%09%09%09// multiple auth providers%0A%09%09%09AuthProvider%5B%5D provs = new AuthProvider%5Baps.length%5D;%0A%09%09%09for( int i=0; i%3Cprovs.length; i++ ) %7B%0A%09%09%09%09provs%5Bi%5D = loadProviderClass(aps%5Bi%5D.trim());%0A%09%09%09%7D%0A%09%09%09authProvider = new CascadedAuthProvider(Arrays.asList(provs));%0A%09%09%7D%0A%09%7D%0A%09private AuthProvider loadProviderClass(String name) throws IllegalArgumentException %7B%0A%09%09Constructor%3C?%3E c;%0A%09%09try %7B%0A%09%09%09c = Class.forName(name).getConstructor();%0A%09%09%09return (AuthProvider)c.newInstance();%0A%09%09%7D catch (NoSuchMethodException %7C SecurityException %7C ClassNotFoundException %7C InstantiationException %7C IllegalAccessException %7C InvocationTargetException e) %7B%0A%09%09%09throw new IllegalArgumentException(%22Unable to instantiate auth provider class: %22+name, e);%0A%09%09%7D
 %0A%09%7D%0A
@@ -2004,56 +2004,27 @@
 %7B%0A%09%09
-// TODO Auto-generated method stub%0A%09%09return null
+return authProvider
 ;%0A%09%7D

update default configuration to use system property for auth provider selection