EnvironmentVariableManager added

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/DataMiner@173383 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Lucio Lelii 2018-10-12 13:53:36 +00:00
parent 6d3cab333f
commit a2f124a540
3 changed files with 48 additions and 5 deletions

View File

@ -62,6 +62,8 @@ public class AbstractEcologicalEngineMapper extends AbstractAnnotatedAlgorithm i
private TokenManager tokenm = null;
private EnvironmentVariableManager env = null;
// inputs and outputs
public LinkedHashMap<String, Object> inputs = new LinkedHashMap<String, Object>();
public LinkedHashMap<String, Object> outputs = new LinkedHashMap<String, Object>();
@ -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))

View File

@ -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;
}

View File

@ -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;
}
}