package org.gcube.dataanalysis.dataminer.poolmanager.clients.configuration; ***REMOVED*** import java.util.ArrayList; import java.util.Iterator; ***REMOVED*** import java.util.Properties; ***REMOVED*** import org.gcube.dataanalysis.dataminer.poolmanager.clients.ScopedCacheMap; import org.gcube.dataanalysis.dataminer.poolmanager.clients.configuration.ConfigurationImpl.CONFIGURATIONS; ***REMOVED*** ***REMOVED*** import org.tmatesoft.svn.core.SVNException; public class DMPMClientConfiguratorManager { private final Logger logger; private Properties defaultAdmins; static DMPMClientConfiguratorManager instance; private ScopedCacheMap cacheMap; private DMPMClientConfiguratorManager() { this.cacheMap = new ScopedCacheMap(); this.logger = LoggerFactory.getLogger(DMPMClientConfiguratorManager.class); this.defaultAdmins = new Properties(); try { this.defaultAdmins.load(this.getClass().getResourceAsStream("/default.admins")); this.logger.debug("Default users successfully loaded"); ***REMOVED*** catch (Exception e) { this.logger.error("Unable to get default users", e); ***REMOVED*** ***REMOVED*** private ClientConfigurationCache getCurrentCache() { 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) { this.logger.debug("Cache not created yet, creating..."); cache = new ClientConfigurationCache(); this.cacheMap.put(currentScope, cache); ***REMOVED*** return cache; ***REMOVED*** public static DMPMClientConfiguratorManager getInstance() { if (instance == null) instance = new DMPMClientConfiguratorManager(); return instance; ***REMOVED*** public Configuration getProductionConfiguration() { return new ConfigurationImpl(CONFIGURATIONS.PROD, getCurrentCache()); ***REMOVED*** public Configuration getStagingConfiguration() { return new ConfigurationImpl(CONFIGURATIONS.STAGE, getCurrentCache()); ***REMOVED*** public List getDefaultAdmins() { List admins = new ArrayList(); if (defaultAdmins == null || defaultAdmins.isEmpty()) { admins.add("statistical.manager"); ***REMOVED*** else { Iterator keys = this.defaultAdmins.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); admins.add(defaultAdmins.getProperty(key)); ***REMOVED*** ***REMOVED*** this.logger.debug("Default admins list: " + admins); return admins; ***REMOVED*** public static void main(String[] args) throws IOException, SVNException { DMPMClientConfiguratorManager a = new DMPMClientConfiguratorManager(); ScopeProvider.instance.set("/gcube/devNext/NextNext"); ***REMOVED*** SecurityTokenProvider.instance.set("708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548"); System.out.println("RESULT 1" + a.getStagingConfiguration().getSVNCRANDepsList()); System.out.println("RESULT 2" + a.getProductionConfiguration().getRepository()); System.out.println("RESULT 3" + a.getStagingConfiguration().getSVNRepository().getPath()); ***REMOVED*** System.out.println(a.getRepo()); ***REMOVED*** System.out.println(a.getAlgoRepo()); ***REMOVED*** System.out.println(a.getSVNRepo()); ***REMOVED*** ***REMOVED***