From 8ade06fee80a35cef915150f538127c44736f2c0 Mon Sep 17 00:00:00 2001
From: Benjamin Renard <benjamin.renard@akka.eu>
Date: Sun, 1 Apr 2018 15:00:20 +0200
Subject: [PATCH] Improve config load

---
 config/AMDAIntegrationConfig.php                                          | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
 config/kernel/DD.res                                                      |   2 ++
 config/kernel/amda.properties                                             |   2 ++
 config/kernel/log4cxx.config                                              |  14 ++++++++++++++
 config/kernel/plotConfig.xml                                              |  60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 config/kernel/plplot/cmap0_black_on_white.pal                             |  17 +++++++++++++++++
 config/kernel/plplot/cmap0_default.pal                                    |  17 +++++++++++++++++
 config/kernel/plplot/cmap0_test.pal                                       |   9 +++++++++
 config/kernel/plplot/cmap1_blue_red.pal                                   |   4 ++++
 config/kernel/plplot/cmap1_blue_yellow.pal                                |  10 ++++++++++
 config/kernel/plplot/cmap1_default.pal                                    |   7 +++++++
 config/kernel/plplot/cmap1_gray.pal                                       |   4 ++++
 config/kernel/spiceKernelConfig.xml                                       |   9 +++++++++
 config/predefined_env/akka-amdadev.env                                    |  15 +++++++++++++++
 config/predefined_env/akka-dev.env                                        |  14 ++++++++++++++
 config/predefined_env/akka-integration.env                                |  15 +++++++++++++++
 config/predefined_env/apus-dev.env                                        |  14 ++++++++++++++
 config/predefined_env/irap-amdatest.env                                   |  14 ++++++++++++++
 config/predefined_env/irap-test.env                                       |  15 +++++++++++++++
 config/predefined_env/pc1121-dev.env                                      |  14 ++++++++++++++
 config/spiceKernelConfig.xml                                              |   9 ---------
 src/InputOutput/IHMImpl/Config/IHMConfigClass.php                         |   2 +-
 src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php |   4 ++--
 src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php                    |   4 ++--
 src/InputOutput/IHMImpl/Tools/IHMParamTemplateClass.php                   |   5 ++++-
 src/Request/Config/KernelConfigClass.php                                  |  82 ++++++++++++++++++++++++++--------------------------------------------------------
 src/Request/ParamInfoRequestClass.php                                     |   4 ++--
 src/Request/ParamsRequestImpl/Nodes/Infos/InfoParamNodeClass.php          |   7 ++++++-
 src/Request/ParamsRequestImpl/Nodes/NodeClass.php                         |   5 ++++-
 29 files changed, 355 insertions(+), 242 deletions(-)
 create mode 100644 config/kernel/DD.res
 create mode 100644 config/kernel/amda.properties
 create mode 100644 config/kernel/log4cxx.config
 create mode 100644 config/kernel/plotConfig.xml
 create mode 100644 config/kernel/plplot/cmap0_black_on_white.pal
 create mode 100644 config/kernel/plplot/cmap0_default.pal
 create mode 100644 config/kernel/plplot/cmap0_test.pal
 create mode 100644 config/kernel/plplot/cmap1_blue_red.pal
 create mode 100644 config/kernel/plplot/cmap1_blue_yellow.pal
 create mode 100644 config/kernel/plplot/cmap1_default.pal
 create mode 100644 config/kernel/plplot/cmap1_gray.pal
 create mode 100644 config/kernel/spiceKernelConfig.xml
 create mode 100644 config/predefined_env/akka-amdadev.env
 create mode 100644 config/predefined_env/akka-dev.env
 create mode 100644 config/predefined_env/akka-integration.env
 create mode 100644 config/predefined_env/apus-dev.env
 create mode 100644 config/predefined_env/irap-amdatest.env
 create mode 100644 config/predefined_env/irap-test.env
 create mode 100644 config/predefined_env/pc1121-dev.env
 delete mode 100644 config/spiceKernelConfig.xml

diff --git a/config/AMDAIntegrationConfig.php b/config/AMDAIntegrationConfig.php
index 3581ac5..76c96fd 100644
--- a/config/AMDAIntegrationConfig.php
+++ b/config/AMDAIntegrationConfig.php
@@ -1,177 +1,62 @@
 <?php 
 
-$localIP = exec("hostname -i");
-
-//Add your server below
-switch ($localIP)
-{
-	//bas-amda-01 server (AKKA dev)
-	case  '172.25.30.65' :
-		define('PLATFORM_NAME','AKKA dev'); 
-		
-		//AKKA - Force the IP client value to prevent a bug with DDServer
-		//       The IP client must be write with the pattern : xxx.xxx.xxx.xxx
-		define('FORCE_CLIENT_IP', '172.025.030.065');
-		
-		// true for AKKA
-		// false or not defined for IRAP
-		// It's used to select the correct SVN path for depotInfo repository
-		define('AKKA_SVN', 'true');
-				
-		//Path to AMDA_Kernel base dir
-		define('NEWKERNEL_BASE_PATH', '/home/b.renard/workspace/AMDA-KERNEL/trunk/AMDA_Kernel/');
-
-		//Path to AMDA_IHM base dir
-		define('IHM_SRC_DIR', '/home/b.renard/AMDA_INSTALL/AMDA_IHM/');
-		break;
-		
-	//bas-amda-02 server (AKKA - integration)
-	case '10.168.220.87' :
-		define('PLATFORM_NAME','AKKA integration');
-		
-		//AKKA - Force the IP client value to prevent a bug with DDServer
-		//       The IP client must be write with the pattern : xxx.xxx.xxx.xxx
-		define('FORCE_CLIENT_IP', '010.168.220.087');
-		
-		// true for AKKA
-		// false or not defined for IRAP
-		// It's used to select the correct SVN path for depotInfo repository
-		define('AKKA_SVN', 'true');
-				
-		//Path to AMDA_Kernel base dir
-		define('NEWKERNEL_BASE_PATH', '/var/lib/jenkins/jobs/AMDA_Kernel_Phase3_Integration/workspace/AMDA_Kernel/');
-		
-		//Path to AMDA_IHM base dir
-		define('IHM_SRC_DIR', '/var/lib/jenkins/jobs/AMDA_Kernel_Phase3_Integration/workspace/AMDA_IHM/');
-		
-		break;
-	case '195.83.102.55' :
-		define('PLATFORM_NAME','IRAP test platform');
-		
-		//AKKA - Force the IP client value to prevent a bug with DDServer
-		//       The IP client must be write with the pattern : xxx.xxx.xxx.xxx
-		define('FORCE_CLIENT_IP', '195.083.102.055');
-		
-		// true for AKKA
-		// false or not defined for IRAP
-		// It's used to select the correct SVN path for depotInfo repository
-		//define('AKKA_SVN', 'true');
-		
-		//Path to AMDA_Kernel base dir
-		define('NEWKERNEL_BASE_PATH', '/home/mbouchemit/AMDA_Kernel/');
-		
-		//Path to AMDA_IHM base dir
-		define('IHM_SRC_DIR', '/home/mbouchemit/AMDA_INSTALL/AMDA_IHM/');
-		
-		break;
-	case '10.121.0.3' :
-		define('PLATFORM_NAME','APUS dev platform');
-
-                //AKKA - Force the IP client value to prevent a bug with DDServer
-                //       The IP client must be write with the pattern : xxx.xxx.xxx.xxx
-                define('FORCE_CLIENT_IP', '010.121.000.003');
-
-                // true for AKKA
-                // false or not defined for IRAP
-                // It's used to select the correct SVN path for depotInfo repository
-                //define('AKKA_SVN', 'true');
-
-                //Path to AMDA_Kernel base dir
-                define('NEWKERNEL_BASE_PATH', '/home/benjamin/AMDA-GIT/AMDA_Kernel/');
-
-                //Path to AMDA_IHM base dir
-                define('IHM_SRC_DIR', '/home/benjamin/AMDA-GIT/AMDA_IHM/');
-
-		break;
-	case '10.121.1.121' :
-		define('PLATFORM_NAME','pc1121 dev plaform');
-
-                //AKKA - Force the IP client value to prevent a bug with DDServer
-                //       The IP client must be write with the pattern : xxx.xxx.xxx.xxx
-                define('FORCE_CLIENT_IP', '010.121.001.121');
-
-                // true for AKKA
-                // false or not defined for IRAP
-                // It's used to select the correct SVN path for depotInfo repository
-                //define('AKKA_SVN', 'true');
-
-                //Path to AMDA_Kernel base dir
-                define('NEWKERNEL_BASE_PATH', '/home/myriam/workspacenew/AMDA_Kernel/');
-
-                //Path to AMDA_IHM base dir
-                define('IHM_SRC_DIR', '/home/myriam/workspacenew/AMDA_IHM/');
-
-                break;
-                
-	case '10.121.0.31' :
-    	define('PLATFORM_NAME','amdatest');
-                
-        //AKKA - Force the IP client value to prevent a bug with DDServer
-        //       The IP client must be write with the pattern : xxx.xxx.xxx.xxx
-        define('FORCE_CLIENT_IP', '010.121.000.031');
-                
-        // true for AKKA
-        // false or not defined for IRAP
-        // It's used to select the correct SVN path for depotInfo repository
-        //define('AKKA_SVN', 'true');
-                
-        //Path to AMDA_Kernel base dir
-        define('NEWKERNEL_BASE_PATH', '/home/myriam/AMDA_20161215/AMDA_Kernel/');
-                
-		//Path to AMDA_IHM base dir
-        define('IHM_SRC_DIR', '/home/myriam/AMDA_20161215/AMDA_IHM/');
-      	break;
-        case '192.168.83.101' :
-		define('PLATFORM_NAME','amdadev platform at AKKA');
-
-                //AKKA - Force the IP client value to prevent a bug with DDServer
-                //       The IP client must be write with the pattern : xxx.xxx.xxx.xxx
-                define('FORCE_CLIENT_IP', '192.168.83.101');
-
-                // true for AKKA
-                // false or not defined for IRAP
-                // It's used to select the correct SVN path for depotInfo repository
-                //define('AKKA_SVN', 'true');
-
-                //Path to AMDA_Kernel base dir
-                define('NEWKERNEL_BASE_PATH', '/home/brenard/AMDA-GIT/AMDA_Kernel/');
-
-                //Path to AMDA_IHM base dir
-                define('IHM_SRC_DIR', '/var/www/AMDA_IHM/');
-
-                break;
+$config_file=__DIR__."/my_config.env";
+
+if (!file_exists($config_file)) {
+	$localIP = exec("hostname -i");
+
+	//Add your server below
+	switch ($localIP)
+	{
+		//bas-amda-01 server (AKKA dev)
+		case  '172.25.30.65' :
+			$config_file=__DIR__."/predefined_env/akka-dev.env";
+			break;
+		//bas-amda-02 server (AKKA - integration)
+		case '10.168.220.87' :
+			$config_file=__DIR__."/predefined_env/akka-integration.env";
+			break;
+		case '195.83.102.55' :
+			$config_file=__DIR__."/predefined_env/irap-test.env";
+			break;
+		case '10.121.0.3' :
+			$config_file=__DIR__."/predefined_env/apus-dev.env";
+			break;
+		case '10.121.1.121' :
+			$config_file=__DIR__."/predefined_env/pc1121-dev.env";
+		case '10.121.0.31' :
+			$config_file=__DIR__."/predefined_env/irap-amdatest.env";
+        	case '192.168.83.101' :
+			$config_file=__DIR__."/predefined_env/akka-amdadev.env";
+                	break;
+	}
+} else {
+	$config_file="";
 }
 
+if (empty($config_file) || !file_exists($config_file) || ($config=parse_ini_file($config_file)) == FALSE) {
+        throw new Exception("Error to load environment config file");
+}
 
+define('COTS_BASE_DIR', $config['COTS_BASE_DIR']);
+define('TOOLS_BASE_DIR', $config['TOOLS_BASE_DIR']);
+define('KERNEL_BUILD_TYPE', $config['KERNEL_BUILD_TYPE']);
+define('AMDA_KERNEL_DIR', $config['AMDA_KERNEL_DIR']);
+define('IHM_SRC_DIR', $config['IHM_SRC_DIR']);
 
-//!! WARNING !! - Please don't change anything below this line if you do
-//                a standard installation (describe in CDPP-MI-32500-505-SIL)
+define('GCC_BASE_DIR', TOOLS_BASE_DIR.'/gcc/4.7.2/rtf');
+define('BOOST_BASE_DIR', TOOLS_BASE_DIR.'/gcc/4.7.2/boost');
+define('KERNEL_CONFIG_DIR',__DIR__.'/kernel');
+define('DDRES_DIR',__DIR__.'/kernel');
+define('AMDA_KERNEL_SRC_DIR', AMDA_KERNEL_DIR.'/src');
+define('AMDA_KERNEL_BUILD_DIR', AMDA_KERNEL_DIR.'/build/'.KERNEL_BUILD_TYPE);
 
 //Path to AMDA_Integration source dir
-define('INTEGRATION_SRC_DIR', INTEGRATION_BASE_PATH.'src/');
-
-//Path to AMDA_Kernel source dir
-define('NEWKERNEL_SRC_DIR', NEWKERNEL_BASE_PATH.'src/');
-
-//Path to AMDA_Kernel install dir dir
-define ('NEWKERNEL_INSTALL_DIR', NEWKERNEL_BASE_PATH.'build/Release/');
-
-//Path to AMDA_Kernel config dir
-define('NEWKERNEL_CONFIG_DIR', NEWKERNEL_BASE_PATH.'app-release/');
-
-//Path to AMDA_Kernel XSD files dir
-define('NEWKERNEL_XSD_DIR', NEWKERNEL_BASE_PATH.'config/xsd/');
-
-//Path to local parameters database for the new kernel
-define('PARAMS_LOCALDB_DIR', IHM_SRC_DIR.'generic_data/newKernelDDBase/');
-
-//Path to local parameters information files
-define('PARAMS_LOCALINFO_DIR', IHM_SRC_DIR.'generic_data/ParamInfo/');
-
-//Root path for directories used for databases, instruments and missions information files
-define ('NEWKERNEL_INFO_DIR', IHM_SRC_DIR.'generic_data/');
-
-//Path to dir that include DD.res file
-define('DDRES_DIR', NEWKERNEL_BASE_PATH.'app-release/');
+if (defined('INTEGRATION_BASE_PATH')) {
+	define('INTEGRATION_SRC_DIR', INTEGRATION_BASE_PATH.'/src/');
+}
+else {
+	define('INTEGRATION_SRC_DIR', __DIR__."/../src");
+}
 
 ?>
diff --git a/config/kernel/DD.res b/config/kernel/DD.res
new file mode 100644
index 0000000..01931ea
--- /dev/null
+++ b/config/kernel/DD.res
@@ -0,0 +1,2 @@
+amdadev.fr
+5000
diff --git a/config/kernel/amda.properties b/config/kernel/amda.properties
new file mode 100644
index 0000000..2f8aaee
--- /dev/null
+++ b/config/kernel/amda.properties
@@ -0,0 +1,2 @@
+createdby=Created by AMDA(c)
+acknowledgement=CDPP/AMDA Team
\ No newline at end of file
diff --git a/config/kernel/log4cxx.config b/config/kernel/log4cxx.config
new file mode 100644
index 0000000..a807114
--- /dev/null
+++ b/config/kernel/log4cxx.config
@@ -0,0 +1,14 @@
+log4j.rootLogger=info, stdout, F
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+
+# Pattern to output the caller's file name and line number.
+log4j.appender.stdout.layout.ConversionPattern=%X{PID} %r %5p [%t]  (%r ms)  (%F:%L) - %m%n
+
+log4j.appender.F=org.apache.log4j.FileAppender
+log4j.appender.F.File=example.log
+log4j.appender.F.Append=false
+
+log4j.appender.F.layout=org.apache.log4j.PatternLayout
+log4j.appender.F.layout.ConversionPattern=%p %t (%r ms)  %c - %m%n
diff --git a/config/kernel/plotConfig.xml b/config/kernel/plotConfig.xml
new file mode 100644
index 0000000..0718ea3
--- /dev/null
+++ b/config/kernel/plotConfig.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+	<default>
+		<page dimension="ISO A4" orientation="landscape" mode="color" dpi="90">
+			<font name="sans-serif" size="8" />
+			<margin x="5" y="5" /> <!-- in mm -->
+		</page>
+		<panel resolution="3000" backgroundColor="[255,255,255]"> <!-- charSizeUnits defines space to set all around plot area -->
+			<title position="top" align="center" />
+			<timeAxis id="timeAxis" format="dd/mm/yy" reverse="false" color="[0,0,0]" position="bottom" thickness="1">
+				<legend text="Time, UT" />
+			</timeAxis>
+			<epochAxis id="epochAxis" format="dd/mm/yy" reverse="false" color="[0,0,0]" position="bottom" thickness="1">
+				<legend text="Relative Time" />
+			</epochAxis>
+			<colorAxis id="colorAxis" scale="linear" color="[0,0,0]" reverse="false" position="right" />
+			<xAxis scale="linear" reverse="false" color="[0,0,0]" position="bottom" thickness="1" />
+			<yAxis scale="linear" reverse="false" color="[0,0,0]" position="left" thickness="1" />
+			<timePlot xAxis="timeAxis" zAxis="colorAxis">
+				<line type="line" style="plain" width="1" />
+				<symbol type="no" size="4" />
+			</timePlot>
+			<epochPlot xAxis="epochAxis" zAxis="colorAxis">
+				<line type="line" style="plain" width="1" />
+				<symbol type="no" size="4" color="[0,0,255]" />
+			</epochPlot>
+			<xyPlot zAxis="colorAxis">
+				<line type="no" style="plain" width="1" />
+				<symbol type="dot" size="4"  />
+				<resampling type="auto"/>
+				<timeTick step="0" number="0" minor="0" color="[0,0,0]">
+					<font name="sans-serif" size="5" style="upright" weight="medium" />
+					<firstSymbol type="triangle" size="5" color="[120,0,0]" />
+					<symbol type="circle" size="5" color="[120,120,0]" />
+				</timeTick>
+			</xyPlot>
+			<instantPlot zAxis="colorAxis">
+				<line type="no" style="plain" color="[255,0,0]" width="1" />
+				<symbol type="dot" size="4" color="[0,0,255]" />
+			</instantPlot>
+		</panel>
+	</default>
+	<colormap path="plplot/">
+		<grayscale default="0"> <!-- default is map index used for auto line color generation -->
+			<file index="0">cmap0_black_on_white.pal</file>
+			<file index="1">cmap1_gray.pal</file>
+		</grayscale>
+		<color default="0">
+			<file index="0">cmap0_default.pal</file>
+			<file index="1">cmap1_default.pal</file>
+			<file index="2">cmap0_test.pal</file>
+		</color>
+		<coloraxis default="0">
+			<file index="0">cmap1_default.pal</file>
+			<file index="1">cmap1_blue_red.pal</file>
+			<file index="2">cmap1_blue_yellow.pal</file>
+			<file index="3">cmap1_gray.pal</file>
+		</coloraxis>
+	</colormap>
+</root>
diff --git a/config/kernel/plplot/cmap0_black_on_white.pal b/config/kernel/plplot/cmap0_black_on_white.pal
new file mode 100644
index 0000000..946f59b
--- /dev/null
+++ b/config/kernel/plplot/cmap0_black_on_white.pal
@@ -0,0 +1,17 @@
+16
+#000000 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
+#ffffff 1.0
diff --git a/config/kernel/plplot/cmap0_default.pal b/config/kernel/plplot/cmap0_default.pal
new file mode 100644
index 0000000..da7aac2
--- /dev/null
+++ b/config/kernel/plplot/cmap0_default.pal
@@ -0,0 +1,17 @@
+16
+#000000
+#0000ff
+#ff0000
+#00ffff
+#ff00ff
+#008000
+#808080
+#00ff00
+#800000
+#000080
+#808000
+#800080
+#c0c0c0
+#008080
+#ffff00
+#004040
diff --git a/config/kernel/plplot/cmap0_test.pal b/config/kernel/plplot/cmap0_test.pal
new file mode 100644
index 0000000..445f8e2
--- /dev/null
+++ b/config/kernel/plplot/cmap0_test.pal
@@ -0,0 +1,9 @@
+8
+#4BFF14
+#21B259
+#66AF3B
+#74AD8A
+#096321
+#6DD80F
+#558752
+#A9D6C5
diff --git a/config/kernel/plplot/cmap1_blue_red.pal b/config/kernel/plplot/cmap1_blue_red.pal
new file mode 100644
index 0000000..442cd12
--- /dev/null
+++ b/config/kernel/plplot/cmap1_blue_red.pal
@@ -0,0 +1,4 @@
+v2 hls
+2
+0. 240. 0.5 1.0 1. 0
+1.   0. 0.5 1.0 1. 0
diff --git a/config/kernel/plplot/cmap1_blue_yellow.pal b/config/kernel/plplot/cmap1_blue_yellow.pal
new file mode 100644
index 0000000..a25a698
--- /dev/null
+++ b/config/kernel/plplot/cmap1_blue_yellow.pal
@@ -0,0 +1,10 @@
+v2 rgb
+7
+0.0   1.0   1.0   1.0   1.0 0
+0.001 0.001 0.998 1.0   1.0 0
+0.25  0.25  0.50  1.0   1.0 0
+0.5   0.5   0.5   0.5   1.0 0
+0.75  1.0   0.5   0.25  1.0 0
+0.999 1.0   0.998 0.001 1.0 0
+1.0   0.0   0.0   0.0   1.0 0
+
diff --git a/config/kernel/plplot/cmap1_default.pal b/config/kernel/plplot/cmap1_default.pal
new file mode 100644
index 0000000..62bf75e
--- /dev/null
+++ b/config/kernel/plplot/cmap1_default.pal
@@ -0,0 +1,7 @@
+6
+#5500ff 0 0
+#110033 44 0
+#010005 50 0
+#050000 50 0
+#330000 56 0
+#ff0000 100 0
\ No newline at end of file
diff --git a/config/kernel/plplot/cmap1_gray.pal b/config/kernel/plplot/cmap1_gray.pal
new file mode 100644
index 0000000..0a463df
--- /dev/null
+++ b/config/kernel/plplot/cmap1_gray.pal
@@ -0,0 +1,4 @@
+v2 rgb
+2
+0.0   0.0   0.0   0.0   1.0 0
+1.0   1.0   1.0   1.0   1.0 0
\ No newline at end of file
diff --git a/config/kernel/spiceKernelConfig.xml b/config/kernel/spiceKernelConfig.xml
new file mode 100644
index 0000000..d7c1ea8
--- /dev/null
+++ b/config/kernel/spiceKernelConfig.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<spicekernelconfig>
+	<datafiles rootPath="/usr/local/data/ORBITS/Kernels/">
+		<datafile bodyId="-1" path="general/naif0011.tls"/>
+		<datafile bodyId="-1" path="general/de432s.bsp"/>
+		<datafile bodyId="-1" path="general/pck00010.tpc"/>
+		<datafile bodyId="-1" path="general/frames.tf"/>
+	</datafiles>
+</spicekernelconfig>
\ No newline at end of file
diff --git a/config/predefined_env/akka-amdadev.env b/config/predefined_env/akka-amdadev.env
new file mode 100644
index 0000000..ec6a6f9
--- /dev/null
+++ b/config/predefined_env/akka-amdadev.env
@@ -0,0 +1,15 @@
+;Path to COTS dir
+COTS_BASE_DIR='/opt2/local'
+
+;Path to tools dir
+TOOLS_BASE_DIR='/opt2/tools'
+
+;Define kernel build type
+KERNEL_BUILD_TYPE='Release'
+
+;Path to AMDA_Kernel base dir
+AMDA_KERNEL_DIR='/home/brenard/AMDA-GIT/AMDA_Kernel'
+
+;Path to AMDA_IHM base dir
+IHM_SRC_DIR='/var/www/AMDA_IHM/'
+
diff --git a/config/predefined_env/akka-dev.env b/config/predefined_env/akka-dev.env
new file mode 100644
index 0000000..f34ea8d
--- /dev/null
+++ b/config/predefined_env/akka-dev.env
@@ -0,0 +1,14 @@
+;Path to COTS dir
+COTS_BASE_DIR='/opt/local'
+
+;Path to tools dir
+TOOLS_BASE_DIR='/opt2/tools'
+
+;Define kernel build type
+KERNEL_BUILD_TYPE='Release'
+
+;Path to AMDA_Kernel base dir
+AMDA_KERNEL_DIR='/home/b.renard/workspace/AMDA-KERNEL/trunk/AMDA_Kernel/'
+
+;Path to AMDA_IHM base dir
+IHM_SRC_DIR='/home/b.renard/AMDA_INSTALL/AMDA_IHM/'
diff --git a/config/predefined_env/akka-integration.env b/config/predefined_env/akka-integration.env
new file mode 100644
index 0000000..af0a393
--- /dev/null
+++ b/config/predefined_env/akka-integration.env
@@ -0,0 +1,15 @@
+;Path to COTS dir
+COTS_BASE_DIR='/opt/local'
+
+;Path to tools dir
+TOOLS_BASE_DIR='/opt/tools'
+
+;Define kernel build type
+KERNEL_BUILD_TYPE='Release'
+
+;Path to AMDA_Kernel base dir
+AMDA_KERNEL_DIR='/var/lib/jenkins/jobs/AMDA_Kernel_Phase3_Integration/workspace/AMDA_Kernel/'
+
+;Path to AMDA_IHM base dir
+IHM_SRC_DIR='/var/lib/jenkins/jobs/AMDA_Kernel_Phase3_Integration/workspace/AMDA_IHM/'
+
diff --git a/config/predefined_env/apus-dev.env b/config/predefined_env/apus-dev.env
new file mode 100644
index 0000000..8c1b468
--- /dev/null
+++ b/config/predefined_env/apus-dev.env
@@ -0,0 +1,14 @@
+;Path to COTS dir
+COTS_BASE_DIR='/opt/local'
+
+;Path to tools dir
+TOOLS_BASE_DIR='/opt/tools'
+
+;Define kernel build type
+KERNEL_BUILD_TYPE='Release'
+
+;Path to AMDA_Kernel base dir
+AMDA_KERNEL_DIR='/home/benjamin/AMDA-GIT/AMDA_Kernel/'
+
+;Path to AMDA_IHM base dir
+IHM_SRC_DIR='/home/benjamin/AMDA-GIT/AMDA_IHM/'
diff --git a/config/predefined_env/irap-amdatest.env b/config/predefined_env/irap-amdatest.env
new file mode 100644
index 0000000..3e0cbc1
--- /dev/null
+++ b/config/predefined_env/irap-amdatest.env
@@ -0,0 +1,14 @@
+;Path to COTS dir
+COTS_BASE_DIR='/opt/local'
+
+;Path to tools dir
+TOOLS_BASE_DIR='/opt/tools'
+
+;Define kernel build type
+KERNEL_BUILD_TYPE='Release'
+
+;Path to AMDA_Kernel base dir
+AMDA_KERNEL_DIR='/home/myriam/AMDA_20161215/AMDA_Kernel/'
+
+;Path to AMDA_IHM base dir
+IHM_SRC_DIR='/home/myriam/AMDA_20161215/AMDA_IHM/'
diff --git a/config/predefined_env/irap-test.env b/config/predefined_env/irap-test.env
new file mode 100644
index 0000000..1e4194b
--- /dev/null
+++ b/config/predefined_env/irap-test.env
@@ -0,0 +1,15 @@
+;Path to COTS dir
+COTS_BASE_DIR='/opt/local'
+
+;Path to tools dir
+TOOLS_BASE_DIR='/opt/tools'
+
+;Define kernel build type
+KERNEL_BUILD_TYPE='Release'
+
+;Path to AMDA_Kernel base dir
+AMDA_KERNEL_DIR='/home/mbouchemit/AMDA_Kernel/'
+
+;Path to AMDA_IHM base dir
+IHM_SRC_DIR='/home/mbouchemit/AMDA_INSTALL/AMDA_IHM/'
+
diff --git a/config/predefined_env/pc1121-dev.env b/config/predefined_env/pc1121-dev.env
new file mode 100644
index 0000000..f4d3c24
--- /dev/null
+++ b/config/predefined_env/pc1121-dev.env
@@ -0,0 +1,14 @@
+;Path to COTS dir
+COTS_BASE_DIR='/opt/local'
+
+;Path to tools dir
+TOOLS_BASE_DIR='/opt/tools'
+
+;Define kernel build type
+KERNEL_BUILD_TYPE='Release'
+
+;Path to AMDA_Kernel base dir
+AMDA_KERNEL_DIR='/home/myriam/workspacenew/AMDA_Kernel/'
+
+;Path to AMDA_IHM base dir
+IHM_SRC_DIR='/home/myriam/workspacenew/AMDA_IHM/'
diff --git a/config/spiceKernelConfig.xml b/config/spiceKernelConfig.xml
deleted file mode 100644
index d7c1ea8..0000000
--- a/config/spiceKernelConfig.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<spicekernelconfig>
-	<datafiles rootPath="/usr/local/data/ORBITS/Kernels/">
-		<datafile bodyId="-1" path="general/naif0011.tls"/>
-		<datafile bodyId="-1" path="general/de432s.bsp"/>
-		<datafile bodyId="-1" path="general/pck00010.tpc"/>
-		<datafile bodyId="-1" path="general/frames.tf"/>
-	</datafiles>
-</spicekernelconfig>
\ No newline at end of file
diff --git a/src/InputOutput/IHMImpl/Config/IHMConfigClass.php b/src/InputOutput/IHMImpl/Config/IHMConfigClass.php
index 96f9e5c..de2bf51 100644
--- a/src/InputOutput/IHMImpl/Config/IHMConfigClass.php
+++ b/src/InputOutput/IHMImpl/Config/IHMConfigClass.php
@@ -15,7 +15,7 @@ class IHMConfigClass
 
 	private static $functionsFile  = "functions.xml";
 	
-	private static $paramTemplateDir = "ParamTemplate/";
+	private static $paramTemplateDir = "LocalData/ParamTemplate/";
 
 	private static $paramTemplateFile = "ParamTemplateList.xml";
 	
diff --git a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
index 324367b..e7f0bfd 100644
--- a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
+++ b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
@@ -709,7 +709,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
 			
 			
 			$colorSerieId = -1;
-			if ($paramData->{'param-drawing-object'}->{'serie-colored-param'} != '')
+			if (!empty($paramData->{'param-drawing-object'}->{'serie-colored-param'}))
 				$colorSerieId = $drawingEltIndex;
 
 			switch ($paramData->{'param-drawing-type'})
@@ -759,7 +759,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
 		$drawingEltIndex = 0;
 		foreach ($paramsData as $paramData)
 		{
-			if ($paramData->{'param-drawing-object'}->{'serie-colored-param'} == '')
+			if (empty($paramData->{'param-drawing-object'}->{'serie-colored-param'}))
 			{
 				++$drawingEltIndex;
 				continue;
diff --git a/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php b/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
index 447a97d..561f0eb 100644
--- a/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
+++ b/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
@@ -132,12 +132,12 @@ class IHMParamManagerClass
 		$real_param_id = $paramId;
 		if ($this->templateParamsManager->isTemplatedParam($paramId)) {
 			$paramPath = $this->templateParamsManager->getTemplatePath($paramId);
-			if (empty($paramPath) || !$doc->load($paramPath))
+			if (empty($paramPath) || !@$doc->load($paramPath))
 				throw new Exception('Cannot find parameter template file '.$paramPath);
 		}
 		else {
 			$paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml";
-			if (empty($paramPath) || !$doc->load($paramPath))
+			if (empty($paramPath) || !@$doc->load($paramPath))
 				throw new Exception('Cannot find parameter local file '.$paramPath);
 		}
 			
diff --git a/src/InputOutput/IHMImpl/Tools/IHMParamTemplateClass.php b/src/InputOutput/IHMImpl/Tools/IHMParamTemplateClass.php
index 10133be..e33e6e9 100644
--- a/src/InputOutput/IHMImpl/Tools/IHMParamTemplateClass.php
+++ b/src/InputOutput/IHMImpl/Tools/IHMParamTemplateClass.php
@@ -220,6 +220,9 @@ class IHMParamTemplateClass
 	*/
 	public function replaceArgs($string, $template_args) {
 		$result = $string;
+		if (empty($template_args)) {
+			return $result;
+		}
 		foreach ($template_args as $template_arg_key => $template_arg_value) {
 			$result = str_replace("##".$template_arg_key."##", $template_arg_value, $result);
 		}
@@ -232,7 +235,7 @@ class IHMParamTemplateClass
 	private function addDefaultValues($param_id, &$template_args) {
 		$list = $this->getParamTemplates();
 		
-		if (!array_key_exists($param_id, $list))
+		if (!array_key_exists($param_id, $list) || !isset($list[$param_id]->arguments))
 			return;
 		
 		$arguments = $list[$param_id]->arguments;
diff --git a/src/Request/Config/KernelConfigClass.php b/src/Request/Config/KernelConfigClass.php
index be09e86..4be2e21 100644
--- a/src/Request/Config/KernelConfigClass.php
+++ b/src/Request/Config/KernelConfigClass.php
@@ -7,20 +7,11 @@
  */
 class KernelConfigClass
 {
-	private static $xsdRequestDir    = "request/";
-	private static $xsdParameterDir  = "parameter/";
-	private static $xsdInfoDir       = "info/";
-	private static $xsdLocalBaseDir  = "localbase/";
-	private static $xsdSpiceKernelDir = "spicekernel/";
-
 	private static $propFile         = "app.properties";
 
-	private static $amdaPropFile     = "amda.properties";
-
 	private static $cxxCompiler      = "g++";
 	private static $cmakeFlags       = "-g -std=c++0x -fPIC -Wall -ggdb -DLINUX -Dlinux -D_REENTRANT -malign-double -pthread";
 
-	private static $logConfigFile    = "log4cxx.config";
 	private static $plotConfigFile   = "plotConfig.xml";
 	
 	private static $spiceKernelConfigFile = "spiceKernelConfig.xml";
@@ -33,16 +24,6 @@ class KernelConfigClass
 	private static $userSrcDir       = "src/";
 	private static $userLibDir       = "lib/";
 	
-	private static $datasetInfoDir   = "DataSetInfo/";
-	private static $instrumentInfoDir= "InstrumentInfo/";
-	private static $missionInfoDir   = "MissionInfo/";
-	
-	private static $localInclude     = "/opt/local/include/";
-	private static $boostInclude     = "/opt/tools/gcc/4.7.2/boost/include/";
-	private static $log4cxxInclude   = "/opt/local/include/log4cxx/";
-
-	private static $gccDir           = "/opt/tools/gcc/4.7.2/rtf/";
-
 	private static $defaultGapThreshold = "5";
 
 
@@ -51,9 +32,6 @@ class KernelConfigClass
 	
 	private static $timeToBatchMode = 10; // secs : interval after which batch mode is launched
 
-	private static $kernelAbout   = "Created by CDPP/AMDA(c)";
-	private static $kernelAcknow  = "CDPP/AMDA Team";
-
 	private static $includeArray     = array(
 			"InternLib",
 			"Common",
@@ -77,7 +55,7 @@ class KernelConfigClass
 	{
 		self::$userName = $user;
 	}
-	
+
 	public static function getRequestParamsPath($working_dir)
 	{
 		$paramsPath = $working_dir.self::$requestParamsDir;
@@ -90,72 +68,72 @@ class KernelConfigClass
 
 	public static function getXSDParameterFilePath()
 	{
-		return NEWKERNEL_XSD_DIR.self::$xsdParameterDir.'all.xsd';
+		return AMDA_KERNEL_DIR.'/config/xsd/parameter/all.xsd';
 	}
 
 	public static function getXSDRequestFilePath()
 	{
-		return NEWKERNEL_XSD_DIR.self::$xsdRequestDir.'all.xsd';
+		return AMDA_KERNEL_DIR.'/config/xsd/request/all.xsd';
 	}
 	
 	public static function getXSDParamInfoFilePath()
 	{
-		return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'paramInfo.xsd';
+		return AMDA_KERNEL_DIR.'/config/xsd/info/paramInfo.xsd';
 	}
 	
 	public static function getXSDDatasetInfoFilePath()
 	{
-		return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'dataSetInfo.xsd';
+		return AMDA_KERNEL_DIR.'/config/xsd/info/dataSetInfo.xsd';
 	}
 	
 	public static function getXSDInstrumentInfoFilePath()
 	{
-		return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'instrumentInfo.xsd';
+		return AMDA_KERNEL_DIR.'/config/xsd/info/instrumentInfo.xsd';
 	}
 	
 	public static function getXSDMissionInfoFilePath()
 	{
-		return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'missionInfo.xsd';
+		return AMDA_KERNEL_DIR.'/config/xsd/info/missionInfo.xsd';
 	}
 	
 	public static function getXSDLocalBaseFilePath()
 	{
-		return NEWKERNEL_XSD_DIR.self::$xsdLocalBaseDir.'base.xsd';
+		return AMDA_KERNEL_DIR.'/config/xsd/localbase/base.xsd';
 	}
 	
 	public static function getXSDSpiceKernelConfigFilePath()
 	{
-		return NEWKERNEL_XSD_DIR.self::$xsdSpiceKernelDir.'config.xsd';
+		return AMDA_KERNEL_DIR.'/config/xsd/spicekernel/config.xsd';
 	}
 	
 	
 	public static function getDatasetInfoPath()
 	{
-		return NEWKERNEL_INFO_DIR.self::$datasetInfoDir;
+		return DataSetInfo;
 	}
 	
 	public static function getInstrumentInfoPath()
 	{
-		return NEWKERNEL_INFO_DIR.self::$instrumentInfoDir;
+		return InstrumentInfo;
 	}
 	
 	public static function getMissionInfoPath()
 	{
-		return NEWKERNEL_INFO_DIR.self::$missionInfoDir;
+		return MissionInfo;
 	}
 	
 	public static function getKernelBinPath()
 	{
-		return NEWKERNEL_INSTALL_DIR.self::$binDir;
+		return AMDA_KERNEL_BUILD_DIR.'/'.self::$binDir;
 	}
 
 	public static function getExecEnvVarArray()
 	{
 		return array (
-				"DDPATH" => DDRES_DIR,
-				"MY_GXX_HOME" => self::$gccDir,
-				"PATH" => self::getKernelBinPath().":".self::$gccDir."bin/:".getenv("PATH"),
-				"LD_LIBRARY_PATH" => self::$gccDir."lib64:".self::$gccDir."lib:".getenv("LD_LIBRARY_PATH")
+				"DDPATH" => KERNEL_CONFIG_DIR,
+				"MY_GXX_HOME" => GCC_BASE_DIR,
+				"PATH" => self::getKernelBinPath().":".COTS_BASE_DIR."/bin:".GCC_BASE_DIR."/bin:".getenv("PATH"),
+				"LD_LIBRARY_PATH" => COTS_BASE_DIR."/lib:".GCC_BASE_DIR."/lib64:".GCC_BASE_DIR."/lib:".getenv("LD_LIBRARY_PATH"),
 		);
 	}
 	
@@ -174,7 +152,7 @@ class KernelConfigClass
 		//create app.properties file
 		$appProperties = array();
 
-		$appProperties["app.log4cxx.configfile"]      = NEWKERNEL_CONFIG_DIR.self::$logConfigFile;
+		$appProperties["app.log4cxx.configfile"]      = KERNEL_CONFIG_DIR."/log4cxx.config";
 		$appProperties["app.param.path"]              = self::getRequestParamsPath($working_dir);
 		$appProperties["app.parameter.xsd"]           = self::getXSDParameterFilePath();
 		$appProperties["app.request.xsd"]             = self::getXSDRequestFilePath();
@@ -191,9 +169,9 @@ class KernelConfigClass
 		$appProperties["app.localbase.xsd"]           = self::getXSDLocalBaseFilePath();
 		
 		$appProperties["app.spicekernel.configxsd"]   = self::getXSDSpiceKernelConfigFilePath();
-		$appProperties["app.spicekernel.configfile"]  = INTEGRATION_SRC_DIR.'../config/'.self::$spiceKernelConfigFile;
+		$appProperties["app.spicekernel.configfile"]  = KERNEL_CONFIG_DIR.'/spiceKernelConfig.xml';
 		
-		$appProperties["app.plugin"]                  = NEWKERNEL_INSTALL_DIR.self::$pluginDir;
+		$appProperties["app.plugin"]                  = AMDA_KERNEL_BUILD_DIR.'/'.self::$pluginDir;
 		$appProperties["app.process.src"]             = $compilation_path.self::$userSrcDir;
 		$appProperties["app.process.lib"]             = $compilation_path.self::$userLibDir;
 		$appProperties["app.process.CXX_COMPILER"]    = self::$cxxCompiler;
@@ -201,14 +179,14 @@ class KernelConfigClass
 
 		$appProperties["app.process.INCLUDE"]         = "";
 		foreach (self::$includeArray as $inc)
-			$appProperties["app.process.INCLUDE"] .= ("-I".NEWKERNEL_SRC_DIR.$inc." ");
-		$appProperties["app.process.INCLUDE"]         .= "-I".self::$localInclude." -I".self::$boostInclude." -I".self::$log4cxxInclude;
+			$appProperties["app.process.INCLUDE"] .= ("-I".AMDA_KERNEL_SRC_DIR."/".$inc." ");
+		$appProperties["app.process.INCLUDE"]         .= "-I".COTS_BASE_DIR."/include"." -I".BOOST_BASE_DIR."/include -I".COTS_BASE_DIR."/include/log4cxx";
 
-		$appProperties["app.process.LIB"]             = "-L".NEWKERNEL_INSTALL_DIR.self::$libDir." ";
+		$appProperties["app.process.LIB"]             = "-L".AMDA_KERNEL_BUILD_DIR.'/'.self::$libDir." ";
 		foreach (self::$libArray as $lib)
 			$appProperties["app.process.LIB"] .= ("-l".$lib." ");
 
-		$appProperties["app.plot.configfile"]         = INTEGRATION_SRC_DIR.'../config/'.self::$plotConfigFile;
+		$appProperties["app.plot.configfile"]         = KERNEL_CONFIG_DIR.'/'.self::$plotConfigFile;
 
 		$appProperties["app.param.gapthreshold"] = self::$defaultGapThreshold;
 
@@ -223,16 +201,8 @@ class KernelConfigClass
 			fwrite($fp, $key."=".$value.PHP_EOL);
 		fclose($fp);
 
-		//create amda.properties file
-		$amdaPropertiesArray = array();
-
-		$amdaPropertiesArray["createdby"] = self::$kernelAbout;
-		$amdaPropertiesArray["acknowledgement"] = self::$kernelAcknow;
-
-		$fp = fopen($working_dir.self::$amdaPropFile, 'w');
-		foreach ($amdaPropertiesArray as $key => $value)
-			fwrite($fp, $key."=".$value.PHP_EOL);
-		fclose($fp);
+		//copy amda.properties file
+		copy(KERNEL_CONFIG_DIR.'/amda.properties', $working_dir.'/amda.properties');
 	}
 }
 
diff --git a/src/Request/ParamInfoRequestClass.php b/src/Request/ParamInfoRequestClass.php
index 78452d7..340ee18 100644
--- a/src/Request/ParamInfoRequestClass.php
+++ b/src/Request/ParamInfoRequestClass.php
@@ -49,7 +49,7 @@ class ParamInfoRequestClass extends RequestAbstractClass
 		$dom->preserveWhiteSpace = false;
 		$dom->formatOutput = true;
 		
-		$res = $dom->load($this->requestData->getFilePath());
+		$res = @$dom->load($this->requestData->getFilePath());
  		
 		$this->requestData->setSuccess(false);
 			
@@ -168,4 +168,4 @@ class ParamInfoRequestClass extends RequestAbstractClass
 		return true;
 	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/src/Request/ParamsRequestImpl/Nodes/Infos/InfoParamNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Infos/InfoParamNodeClass.php
index 0750948..33ce626 100644
--- a/src/Request/ParamsRequestImpl/Nodes/Infos/InfoParamNodeClass.php
+++ b/src/Request/ParamsRequestImpl/Nodes/Infos/InfoParamNodeClass.php
@@ -1,5 +1,10 @@
 <?php
 
+require_once("InfoParamTableDefBoundsNodeClass.php");
+require_once("InfoParamTableDefCenterNodeClass.php");
+require_once("InfoParamTableDefCenterWidthNodeClass.php");
+require_once("InfoParamTableDefMinMaxNodeClass.php");
+
 define ("INFOPARAM_TAGNAME", "info");
 define ("INFOPARAM_NAME", "name");
 define ("INFOPARAM_SHORTNAME", "short_name");
@@ -187,7 +192,7 @@ class InfoParamNodeClass extends NodeClass
 					case INFOPARAMTABLEDEFCENTERWIDTH_TAGNAME :
 						$this->addTable(InfoParamTableTypeEnum::CENTERWIDTH, "")->loadFromNode($tableDefXmlNode);
 						break;
-					case InfoParamTableDefMinMaxNodeClass :
+					case INFOPARAMTABLEDEFMINMAX_TAGNAME :
 						$this->addTable(InfoParamTableTypeEnum::MINMAX, "")->loadFromNode($tableDefXmlNode);
 						break;
 					default :
diff --git a/src/Request/ParamsRequestImpl/Nodes/NodeClass.php b/src/Request/ParamsRequestImpl/Nodes/NodeClass.php
index 108f3a1..ba9ebcc 100644
--- a/src/Request/ParamsRequestImpl/Nodes/NodeClass.php
+++ b/src/Request/ParamsRequestImpl/Nodes/NodeClass.php
@@ -42,7 +42,10 @@ class NodeClass
 
 	public function getAttribute($attName)
 	{
-		return $this->attributes[$attName];
+		if (array_key_exists($attName,$this->attributes)) {
+			return $this->attributes[$attName];
+		}
+		return "";
 	}
 
 	protected function hasChildren()
--
libgit2 0.21.2