config Path can be set from EnvManager
This commit is contained in:
parent
4bff1bd79d
commit
95a92df6de
|
@ -21,11 +21,13 @@
|
|||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
|
|
|
@ -7,6 +7,9 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
|||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
|
||||
## [v1.6.0] [r4.23.0] - 2020-05-12
|
||||
## [v1.76.0] - 2020-11-20
|
||||
|
||||
- Config path passed as parameter
|
||||
|
||||
## [v1.6.0] - 2020-05-12
|
||||
|
||||
### Fixes
|
||||
|
||||
|
|
40
pom.xml
40
pom.xml
|
@ -9,7 +9,7 @@
|
|||
</parent>
|
||||
<groupId>org.gcube.dataanalysis</groupId>
|
||||
<artifactId>dataminer</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
<name>dataminer</name>
|
||||
<description>An e-Infrastructure service providing state-of-the art DataMining algorithms and ecological modelling approaches under the Web Processing Service (WPS) standard.</description>
|
||||
|
||||
|
@ -46,6 +46,23 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<!-- Old solution <dependencies> <dependency> <groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-smartgears-bom</artifactId> <version>2.1.0</version> <type>pom</type>
|
||||
<scope>import</scope> </dependency> </dependencies> -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-bom</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.reflections/reflections-maven -->
|
||||
<dependency>
|
||||
|
@ -162,7 +179,6 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-lib</artifactId>
|
||||
<version>[3.0.0,4.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -174,31 +190,11 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.18.1</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
|
|
|
@ -28,6 +28,8 @@ public class ConfigurationManager {
|
|||
private static Integer maxComputations = null;
|
||||
private static Boolean useStorage = null;
|
||||
static boolean simulationMode = false;
|
||||
private String baseConfigPath;
|
||||
|
||||
|
||||
EnvironmentVariableManager env = null;
|
||||
|
||||
|
@ -84,6 +86,7 @@ public class ConfigurationManager {
|
|||
maxComputations = env.getMaxComputation();
|
||||
useStorage = env.isSaveOnStorage();
|
||||
simulationMode = env.isSimulationMode();
|
||||
baseConfigPath = env.getConfigPath();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,33 +106,35 @@ public class ConfigurationManager {
|
|||
// selecting persistence path
|
||||
// String persistencePath = File.createTempFile("wpsstatcheck", ".sm").getParent() + "/../cfg/";
|
||||
|
||||
//TODO: REMOVE this shit (the persistence must be the persistence dir of the webapp)
|
||||
String persistencePath = WPSConfig.getConfigDir() + "../ecocfg/";
|
||||
String configPath = persistencePath;
|
||||
if (!new File(configPath).isDirectory()) {
|
||||
//String webperspath = baseConfigPath + "/persistence/";
|
||||
|
||||
//String persistencePath = baseConfigPath; WPSConfig.getConfigDir() + "../ecocfg/";
|
||||
String configPath = baseConfigPath + "/ecocfg/"; //persistencePath;
|
||||
/*if (!new File(configPath).isDirectory()) {
|
||||
configPath = "./cfg/";
|
||||
persistencePath = "./";
|
||||
}
|
||||
logger.debug("Taking configuration from " + (new File(configPath).getAbsolutePath()) + " and persistence in " + persistencePath);
|
||||
}*/
|
||||
logger.debug("Taking configuration from {}", configPath);
|
||||
//+ " and persistence in " + persistencePath);
|
||||
// setting configuration and logger
|
||||
config.setPersistencePath(persistencePath);
|
||||
config.setPersistencePath(configPath);
|
||||
config.setConfigPath(configPath);
|
||||
config.setNumberOfResources(1);
|
||||
// setting application paths
|
||||
String webapp = WPSConfig.getInstance().getWPSConfig().getServer().getWebappPath();
|
||||
String host = WPSConfig.getInstance().getWPSConfig().getServer().getHostname();
|
||||
String port = WPSConfig.getInstance().getWPSConfig().getServer().getHostport();
|
||||
logger.debug("Host: " + host + " Port: " + port + " Webapp: " + webapp + " ");
|
||||
logger.debug("Web persistence path: " + webperspath);
|
||||
logger.debug("Host: {} Port: {} Webapp: {} ", host, port, webapp );
|
||||
logger.debug("Web persistence path:{} ", webperspath);
|
||||
|
||||
String webPath = "http://" + host + ":" + port + "/" + webapp + "/persistence/";
|
||||
|
||||
// logger.debug("Env Vars: \n"+System.getenv());
|
||||
logger.debug("Web app path: " + webPath);
|
||||
logger.debug("Web app path: {} ", webPath);
|
||||
|
||||
// retrieving scope
|
||||
scope = (String) inputs.get(scopeParameter);
|
||||
logger.debug("Retrieved scope: " + scope);
|
||||
logger.debug("Retrieved scope: {} ", scope);
|
||||
if (scope == null)
|
||||
throw new Exception("Error: scope parameter (scope) not set! This violates e-Infrastructure security policies");
|
||||
if (!scope.startsWith("/"))
|
||||
|
@ -138,8 +143,8 @@ public class ConfigurationManager {
|
|||
username = (String) inputs.get(usernameParameter);
|
||||
token = (String) inputs.get(tokenParameter);
|
||||
|
||||
logger.debug("User name used by the client: " + username);
|
||||
logger.debug("User token used by the client: " + token);
|
||||
logger.debug("User name used by the client:{} ", username);
|
||||
logger.debug("User token used by the client:{} ", token);
|
||||
|
||||
if (username == null || username.trim().length() == 0)
|
||||
throw new Exception("Error: user name parameter (user.name) not set! This violates e-Infrastructure security policies");
|
||||
|
@ -152,7 +157,7 @@ public class ConfigurationManager {
|
|||
config.setGcubeToken(token);
|
||||
// DONE get username from request
|
||||
config.setParam(serviceUserNameParameterVariable, username);
|
||||
config.setParam(processingSessionVariable, "" + UUID.randomUUID());
|
||||
config.setParam(processingSessionVariable, UUID.randomUUID().toString());
|
||||
config.setParam(webpathVariable, webPath);
|
||||
config.setParam(webPersistencePathVariable, webperspath);
|
||||
|
||||
|
|
|
@ -4,13 +4,15 @@ import java.util.List;
|
|||
|
||||
public class EnvironmentVariableManager {
|
||||
|
||||
public EnvironmentVariableManager(int maxComputation, boolean saveOnStorage, boolean simulationMode, List<String> shubUsersExcluded) {
|
||||
public EnvironmentVariableManager(int maxComputation, boolean saveOnStorage, boolean simulationMode, List<String> shubUsersExcluded, String configPath ) {
|
||||
super();
|
||||
this.maxComputation = maxComputation;
|
||||
this.saveOnStorage = saveOnStorage;
|
||||
this.simulationMode = simulationMode;
|
||||
this.shubUsersExcluded = shubUsersExcluded;
|
||||
this.configPath = configPath;
|
||||
}
|
||||
|
||||
private int maxComputation;
|
||||
private boolean saveOnStorage;
|
||||
private boolean simulationMode;
|
||||
|
@ -20,6 +22,8 @@ public class EnvironmentVariableManager {
|
|||
//filled: users reported will not write on Shub
|
||||
private List<String> shubUsersExcluded;
|
||||
|
||||
private String configPath;
|
||||
|
||||
public int getMaxComputation() {
|
||||
return maxComputation;
|
||||
}
|
||||
|
@ -34,5 +38,7 @@ public class EnvironmentVariableManager {
|
|||
return shubUsersExcluded;
|
||||
}
|
||||
|
||||
|
||||
public String getConfigPath() {
|
||||
return configPath;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue