@ -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 ( persistence Path) ;
config . setPersistencePath ( config Path) ;
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 ) ;