package org.gcube.dataanalysis.dataminer.poolmanager.clients.configuration;

***REMOVED***

***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.clients.ScopedCacheMap;
import org.gcube.dataanalysis.dataminer.poolmanager.clients.configuration.ConfigurationImpl.CONFIGURATIONS;
***REMOVED***
***REMOVED***
***REMOVED***

public class DMPMClientConfiguratorManager***REMOVED***
	private  final Logger logger;

	static DMPMClientConfiguratorManager instance;
	
	private ScopedCacheMap cacheMap; 
	
	private DMPMClientConfiguratorManager ()
	***REMOVED***
		this.cacheMap = new ScopedCacheMap();
		this.logger = LoggerFactory.getLogger(DMPMClientConfiguratorManager.class);
***REMOVED***
	
	private ClientConfigurationCache getCurrentCache ()
	***REMOVED***
		String currentScope = ScopeProvider.instance.get();
		this.logger.debug("Current scope = "+currentScope);
		this.logger.debug("Getting current configuration cache");
		ClientConfigurationCache cache = this.cacheMap.get(currentScope);
		
		if (cache == null)
		***REMOVED***
			this.logger.debug("Cache not created yet, creating...");
			cache = new ClientConfigurationCache ();
			this.cacheMap.put(currentScope, cache);
			
	***REMOVED***
		
		return cache;
		
		
***REMOVED***
	

	public static DMPMClientConfiguratorManager getInstance ()
	***REMOVED***
		if (instance == null) instance = new DMPMClientConfiguratorManager();
		
		return instance;
***REMOVED***
	
	public Configuration getProductionConfiguration ()
	***REMOVED***
		return new ConfigurationImpl(CONFIGURATIONS.PROD, getCurrentCache());
***REMOVED***
	
	public Configuration getStagingConfiguration ()
	***REMOVED***
		return new ConfigurationImpl(CONFIGURATIONS.STAGE, getCurrentCache());
***REMOVED***
	
	public static void main(String[] args) throws IOException, SVNException ***REMOVED***
		DMPMClientConfiguratorManager a = new DMPMClientConfiguratorManager();
		ScopeProvider.instance.set("/gcube/devNext/NextNext");
		***REMOVED***SecurityTokenProvider.instance.set("***REMOVED***");
		
		System.out.println("RESULT 1"+a.getStagingConfiguration().getSVNCRANDepsList());
		System.out.println("RESULT 2"+a.getProductionConfiguration().getRepository());
		System.out.println("RESULT 3"+a.getStagingConfiguration().getSVNMainAlgoRepo());
		***REMOVED***System.out.println(a.getRepo());
		***REMOVED***System.out.println(a.getAlgoRepo());
		***REMOVED***System.out.println(a.getSVNRepo());

***REMOVED***
***REMOVED***
