Commit 577d5c043c0761adf93e2de4976c51ce05ffceb8

Authored by Elena.Budnik
1 parent ffc5cb81

IMPEX integration

src/InputOutput/IHMImpl/Config/IHMConfigClass.php
@@ -53,8 +53,8 @@ class IHMConfigClass @@ -53,8 +53,8 @@ class IHMConfigClass
53 53
54 private static $userHost; 54 private static $userHost;
55 55
56 - public static $remoteDataDir = "/home/budnik/RemoteDataCenter/MAJ/";  
57 - 56 + public static $remoteDataDir = "RemoteData/";
  57 +
58 public static function setUserName($userName) 58 public static function setUserName($userName)
59 { 59 {
60 self::$userName = $userName; 60 self::$userName = $userName;
@@ -215,8 +215,7 @@ class IHMConfigClass @@ -215,8 +215,7 @@ class IHMConfigClass
215 public static function getRemoteParamsFile() 215 public static function getRemoteParamsFile()
216 { 216 {
217 $remoteBasePath = self::getUserPath().self::$wsDir; 217 $remoteBasePath = self::getUserPath().self::$wsDir;
218 -  
219 - 218 +
220 return $remoteBasePath.'RemoteParams.xml'; 219 return $remoteBasePath.'RemoteParams.xml';
221 } 220 }
222 221
@@ -229,6 +228,14 @@ class IHMConfigClass @@ -229,6 +228,14 @@ class IHMConfigClass
229 228
230 return $requestPath; 229 return $requestPath;
231 } 230 }
  231 +
  232 + public static function getRemoteDataPath()
  233 + {
  234 + $remoteDataPath = IHM_SRC_DIR.self::$genericDataDir.self::$remoteDataDir;
  235 +
  236 + return $remoteDataPath;
  237 + }
  238 +
232 } 239 }
233 240
234 ?> 241 ?>
src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php
@@ -100,7 +100,7 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface @@ -100,7 +100,7 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface
100 $templatedParams = $this->paramImpexMgr->getParamTemplates(); 100 $templatedParams = $this->paramImpexMgr->getParamTemplates();
101 101
102 $simRegion = $this->paramImpexMgr->getSimulationRegion($input->paramId); 102 $simRegion = $this->paramImpexMgr->getSimulationRegion($input->paramId);
103 - 103 +
104 // No SimulationRuns (LESIA) 104 // No SimulationRuns (LESIA)
105 if ($simRegion == "UNKNOWN") 105 if ($simRegion == "UNKNOWN")
106 $simRegion = $this->paramImpexMgr->getResourceID($input->paramId); 106 $simRegion = $this->paramImpexMgr->getResourceID($input->paramId);
src/InputOutput/IHMImpl/Tools/IHMImpexParamClass.php
@@ -132,7 +132,7 @@ class IHMImpexParamClass extends IHMParamTemplateClass @@ -132,7 +132,7 @@ class IHMImpexParamClass extends IHMParamTemplateClass
132 132
133 public function setParamTemplateListFilePath($paramId) 133 public function setParamTemplateListFilePath($paramId)
134 { 134 {
135 - $this->paramTemplateListFilePath = IHMConfigClass::$remoteDataDir.$this->getDataProducer($paramId).'_Templates.xml'; 135 + $this->paramTemplateListFilePath = IHMConfigClass::getRemoteDataPath().$this->getDataProducer($paramId)."/".$this->getDataProducer($paramId).'_Templates.xml';
136 } 136 }
137 137
138 /* 138 /*
@@ -252,7 +252,7 @@ class IHMImpexParamClass extends IHMParamTemplateClass @@ -252,7 +252,7 @@ class IHMImpexParamClass extends IHMParamTemplateClass
252 if ($this->getDataProducer($paramId) != "IPIM" && !$this->isSpectra($paramId)) 252 if ($this->getDataProducer($paramId) != "IPIM" && !$this->isSpectra($paramId))
253 return null; 253 return null;
254 254
255 - $templateXml = IHMConfigClass::$remoteDataDir.$this->getDataProducer($paramId).'_PlotSettings.xml'; 255 + $templateXml = IHMConfigClass::getRemoteDataPath().$this->getDataProducer($paramId)."/".$this->getDataProducer($paramId).'_PlotSettings.xml';
256 256
257 if (!file_exists($templateXml)) 257 if (!file_exists($templateXml))
258 throw new Exception("No $templateXml"); 258 throw new Exception("No $templateXml");
@@ -285,4 +285,32 @@ class IHMImpexParamClass extends IHMParamTemplateClass @@ -285,4 +285,32 @@ class IHMImpexParamClass extends IHMParamTemplateClass
285 return $paramNode->hasAttribute('isSpectra'); 285 return $paramNode->hasAttribute('isSpectra');
286 286
287 } 287 }
  288 +
  289 + public function getEnergyTableName($paramId)
  290 + {
  291 + $paramNode = $this->dom->getElementById($paramId);
  292 + if (!$paramNode)
  293 + throw new Exception("No $paramId");
  294 +
  295 + return $paramNode->getAttribute('energyRange');
  296 +
  297 + }
  298 +
  299 + public function getEnergyUnits($paramId)
  300 + {
  301 + $paramNode = $this->dom->getElementById($paramId);
  302 + if (!$paramNode)
  303 + throw new Exception("No $paramId");
  304 +
  305 + return $paramNode->getAttribute('energyUnits');
  306 + }
  307 +
  308 + public function getUnits($paramId)
  309 + {
  310 + $paramNode = $this->dom->getElementById($paramId);
  311 + if (!$paramNode)
  312 + throw new Exception("No $paramId");
  313 +
  314 + return $paramNode->getAttribute('units');
  315 + }
288 } 316 }
289 \ No newline at end of file 317 \ No newline at end of file
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
@@ -233,10 +233,45 @@ class IHMParamManagerClass @@ -233,10 +233,45 @@ class IHMParamManagerClass
233 $res["param"]["info"]["type"],$res["param"]["info"]["size"], 233 $res["param"]["info"]["type"],$res["param"]["info"]["size"],
234 $res["param"]["dateModif"],true); 234 $res["param"]["dateModif"],true);
235 235
  236 + $newParamNode->getInfo()->setName($res["param"]["info"]['name']);
  237 + $newParamNode->getInfo()->setShortName($res["param"]["info"]['name']);
  238 + $newParamNode->getInfo()->setUnits($res["param"]["info"]['units']);
  239 +
236 $tableDef = $res["param"]["info"]["tableDef"]; 240 $tableDef = $res["param"]["info"]["tableDef"];
237 if (isset($tableDef) && array_key_exists('tableDefType', $tableDef) && ($tableDef['tableDefType'] != 'NONE')) 241 if (isset($tableDef) && array_key_exists('tableDefType', $tableDef) && ($tableDef['tableDefType'] != 'NONE'))
238 { 242 {
239 - 243 + switch ($tableDef['channelsDefType'])
  244 + {
  245 + case 'BOUND' :
  246 + $boundTable = $newParamNode->getInfo()->addTable(InfoParamTableTypeEnum::BOUNDS, $res["param"]["info"]["yTitle"]);
  247 + $boundTable->setUnits($res["param"]["info"]["yUnits"]);
  248 + switch ($tableDef['tableDefType'])
  249 + {
  250 + case 'SELECT' :
  251 + $boundTable->setBoundsName($tableDef['data']['bound']);
  252 + $newParamNode->getParamGet()->getLocalParam($res["param"]["info"]["realVar"])->addCalibInfo($tableDef['data']['bound']);
  253 + break;
  254 + default :
  255 + throw new Exception("Unknown tableDefType ".$tableDef['tableDefType']);
  256 + }
  257 + break;
  258 + case 'CENTER' :
  259 + $centerTable = $newParamNode->getInfo()->addTable(InfoParamTableTypeEnum::CENTER, $res["param"]["info"]["yTitle"]);
  260 + $centerTable->setUnits($res["param"]["info"]["yUnits"]);
  261 + $centerTable->setSize($tableDef['data']['width']);
  262 + switch ($tableDef['tableDefType'])
  263 + {
  264 + case 'SELECT' :
  265 + $centerTable->setCenterName($tableDef['data']['center']);
  266 + $newParamNode->getParamGet()->getLocalParam($res["param"]["info"]["realVar"])->addCalibInfo($tableDef['data']['center']);
  267 + break;
  268 + default :
  269 + throw new Exception("Unknown tableDefType ".$tableDef['tableDefType']);
  270 + }
  271 + break;
  272 + default :
  273 + throw new Exception("Unknown tableDefType ".$tableDef['channelsDefType']);
  274 + }
240 } 275 }
241 276
242 return array("id" => $res["param"]["id"], "plotType" => $res["param"]["info"]["plotType"]); 277 return array("id" => $res["param"]["id"], "plotType" => $res["param"]["info"]["plotType"]);
src/RequestManager.php
@@ -27,19 +27,37 @@ function amdaintegration_autoload($class_name) @@ -27,19 +27,37 @@ function amdaintegration_autoload($class_name)
27 'Request/ParamsRequestImpl/Nodes/Requests', 27 'Request/ParamsRequestImpl/Nodes/Requests',
28 'Request/ProcessRequestImpl', 28 'Request/ProcessRequestImpl',
29 'Request/ProcessRequestImpl/Process', 29 'Request/ProcessRequestImpl/Process',
30 - 'Request/TTRequestImpl',  
31 - 'RemoteDataCenter' 30 + 'Request/TTRequestImpl'
32 ); 31 );
33 - 32 +
  33 + $ihm_dirs = array(
  34 + IHM_SRC_DIR.'php/classes',
  35 + IHM_SRC_DIR.'php/RemoteDataCenter'
  36 + );
  37 +
  38 + $find = false;
  39 +
34 foreach($dirs as $dir) 40 foreach($dirs as $dir)
35 { 41 {
36 $file = __DIR__.'/'.$dir.'/'.$class_name.'.php'; 42 $file = __DIR__.'/'.$dir.'/'.$class_name.'.php';
37 if (file_exists($file)) 43 if (file_exists($file))
38 { 44 {
39 require $file; 45 require $file;
  46 + $find = true;
40 break; 47 break;
41 } 48 }
42 } 49 }
  50 +
  51 + if (!$find)
  52 + foreach($ihm_dirs as $dir)
  53 + {
  54 + $file = $dir.'/'.$class_name.'.php';
  55 + if (file_exists($file))
  56 + {
  57 + require $file;
  58 + break;
  59 + }
  60 + }
43 } 61 }
44 62
45 spl_autoload_register('amdaintegration_autoload'); 63 spl_autoload_register('amdaintegration_autoload');