diff --git a/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/AbstractEcologicalEngineMapper.java b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/AbstractEcologicalEngineMapper.java index 930dddd..cc3e8c6 100644 --- a/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/AbstractEcologicalEngineMapper.java +++ b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/AbstractEcologicalEngineMapper.java @@ -62,6 +62,8 @@ public class AbstractEcologicalEngineMapper extends AbstractAnnotatedAlgorithm i private TokenManager tokenm = null; + private EnvironmentVariableManager env = null; + // inputs and outputs public LinkedHashMap inputs = new LinkedHashMap(); public LinkedHashMap outputs = new LinkedHashMap(); @@ -262,6 +264,10 @@ public class AbstractEcologicalEngineMapper extends AbstractAnnotatedAlgorithm i } + public void setEnvironmentVariableManager(EnvironmentVariableManager env) { + + } + public void updateComputationOnWS(float status, String exception) { updateComputationOnWS(status, exception, null, null); } @@ -301,6 +307,8 @@ public class AbstractEcologicalEngineMapper extends AbstractAnnotatedAlgorithm i } } + + @Execute public void run() throws Exception { if (observer!=null) @@ -324,7 +332,7 @@ public class AbstractEcologicalEngineMapper extends AbstractAnnotatedAlgorithm i } else LOGGER.info("Wps External ID not set"); InputsManager inputsManager = null; - ConfigurationManager configManager = new ConfigurationManager(); // initializes parameters from file + ConfigurationManager configManager = new ConfigurationManager(this.env); // initializes parameters from web.xml manageUserToken(); Path dir = Paths.get(System.getProperty("java.io.tmpdir"), "dmlocks"); if (!Files.exists(dir)) diff --git a/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/ConfigurationManager.java b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/ConfigurationManager.java index 0a746fb..53b1c8b 100644 --- a/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/ConfigurationManager.java +++ b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/ConfigurationManager.java @@ -41,7 +41,12 @@ public class ConfigurationManager { return simulationMode; } + @Deprecated public void getInitializationProperties() { + + } + + private void inizializePropertiesUsingTemplateFile() { try { if (maxComputations == null) { Properties options = new Properties(); @@ -57,7 +62,7 @@ public class ConfigurationManager { logger.error("error initializing properties",e); } } - + private AlgorithmConfiguration config; private String scope; private String username; @@ -71,10 +76,14 @@ public class ConfigurationManager { return username; } - public ConfigurationManager() { - getInitializationProperties(); + public ConfigurationManager(EnvironmentVariableManager env) { + if (env == null) inizializePropertiesUsingTemplateFile(); } - + + public ConfigurationManager() { + inizializePropertiesUsingTemplateFile(); + } + public AlgorithmConfiguration getConfig() { return config; } diff --git a/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/EnvironmentVariableManager.java b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/EnvironmentVariableManager.java new file mode 100644 index 0000000..821c9a1 --- /dev/null +++ b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/EnvironmentVariableManager.java @@ -0,0 +1,26 @@ +package org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping; + +public class EnvironmentVariableManager { + + public EnvironmentVariableManager(int maxComputation, boolean saveOnStorage, boolean simulationMode) { + super(); + this.maxComputation = maxComputation; + this.saveOnStorage = saveOnStorage; + this.simulationMode = simulationMode; + } + private int maxComputation; + private boolean saveOnStorage; + private boolean simulationMode; + + public int getMaxComputation() { + return maxComputation; + } + public boolean isSaveOnStorage() { + return saveOnStorage; + } + public boolean isSimulationMode() { + return simulationMode; + } + + +}