Commit efcc4cdf21310d31f31c05000ab8132df1330514
Exists in
master
and in
59 other branches
Merge branch 'rm_5357'
Showing
9 changed files
with
98 additions
and
1 deletions
Show diff stats
src/FunctionTypeEnumClass.php
... | ... | @@ -8,6 +8,7 @@ abstract class FunctionTypeEnumClass |
8 | 8 | { |
9 | 9 | const PARAMS = "params"; |
10 | 10 | const PARAMSGEN = "params_gen"; |
11 | + const PARAMSINFOGEN = "params_info_gen"; | |
11 | 12 | const ACTION = "action"; |
12 | 13 | const PROCESSDELETE = "process_delete"; |
13 | 14 | const PROCESSRUNNINGINFO = "process_running_info"; |
... | ... |
src/InputOutput/IHMImpl/IHMInputOutputClass.php
... | ... | @@ -67,6 +67,10 @@ class IHMInputOutputClass implements InputOutputInterface |
67 | 67 | $this->inputOutput = new IHMInputOutputParamsGeneratorClass(); |
68 | 68 | $requestId = "ParamGen"; |
69 | 69 | break; |
70 | + case FunctionTypeEnumClass::PARAMSINFOGEN : | |
71 | + $this->inputOutput = new IHMInputOutputParamsInfoGeneratorClass(); | |
72 | + $requestId = "ParamInfoGen"; | |
73 | + break; | |
70 | 74 | case FunctionTypeEnumClass::ACTION : |
71 | 75 | $this->inputOutput = new IHMInputOutputParamsPlotClass(); |
72 | 76 | $requestId = "Plot"; |
... | ... |
src/InputOutput/IHMImpl/Params/GenInfoParamImpl/IHMInputOutputParamsInfoGeneratorClass.php
0 → 100644
... | ... | @@ -0,0 +1,71 @@ |
1 | +<?php | |
2 | + | |
3 | +/** | |
4 | + * @class IHMInputOutputParamsGeneratorClass | |
5 | + * @brief Implementation of IHMInputOutputParamsAbstractClass to treat params generation request | |
6 | + * @details | |
7 | +*/ | |
8 | +class IHMInputOutputParamsInfoGeneratorClass extends IHMInputOutputParamsAbstractClass | |
9 | +{ | |
10 | + /* | |
11 | + * @brief method to unmarshall a params generation request | |
12 | + */ | |
13 | + protected function unmarshallRequest($input) | |
14 | + { | |
15 | + $this->paramsData->setRequestType(ParamsRequestTypeEnumClass::PARAMSINFOGEN); | |
16 | + | |
17 | + $this->paramsData->setParamId($input->paramId); | |
18 | + | |
19 | + $this->paramsData->setBatchEnable(FALSE); | |
20 | + | |
21 | + $this->paramManager->addGeneratedParam($input->paramId, $input->buildchain, $input->timestep, $this->paramsData); | |
22 | + | |
23 | + return $this->paramsData; | |
24 | + } | |
25 | + | |
26 | + /* | |
27 | + * @brief method to marshall the result of a download request | |
28 | + */ | |
29 | + protected function marshallResult($data) | |
30 | + { | |
31 | + if (!$data->getSuccess()) | |
32 | + return array( | |
33 | + 'success' => false, | |
34 | + 'message' => $data->getParamId() . " : " . $data->getLastErrorMessage()); | |
35 | + | |
36 | + if ($data->getErrorCode() != 0) | |
37 | + return array( | |
38 | + 'success' => false, | |
39 | + 'message' => $data->getParamId() . " : " . 'Error detected during parameter compilation'); | |
40 | + | |
41 | + $info_file_name = 'info_'.$data->getParamId().'.xml'; | |
42 | + $info_file_path = $this->getWorkingPath().'/'.$info_file_name; | |
43 | + | |
44 | + $doc = new DOMDocument("1.0", "UTF-8"); | |
45 | + if ($doc->load($info_file_path) === FALSE) { | |
46 | + return array( | |
47 | + 'success' => false, | |
48 | + 'message' => $data->getParamId() . " : " . 'Cannot load info file'); | |
49 | + } | |
50 | + | |
51 | + //<paraminfo id="ws_vcxvxcvdsdd"><dimensions dim_1="3" dim_2="1"/><components><component index_1="0" name="ws_vcxvxcvdsdd[0]"/><component index_1="1" name="ws_vcxvxcvdsdd[1]"/><component index_1="2" name="ws_vcxvxcvdsdd[2]"/></components><tables/></paraminfo> | |
52 | + $dimensionsNodes = $doc->getElementsByTagName('dimensions'); | |
53 | + if ($dimensionsNodes->length == 0) { | |
54 | + return array( | |
55 | + 'success' => false, | |
56 | + 'message' => $data->getParamId() . " : " . 'Cannot load dimensions in info file'); | |
57 | + } | |
58 | + | |
59 | + $dim_1 = $dimensionsNodes->item(0)->getAttribute('dim_1'); | |
60 | + $dim_2 = $dimensionsNodes->item(0)->getAttribute('dim_2'); | |
61 | + | |
62 | + return array( | |
63 | + 'success' => true, | |
64 | + 'dimensions' => array( | |
65 | + 'dim_1' => $dim_1, | |
66 | + 'dim_2' => $dim_2, | |
67 | + ), | |
68 | + ); | |
69 | + } | |
70 | +} | |
71 | +?> | |
... | ... |
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... | ... | @@ -20,6 +20,18 @@ class IHMParamManagerClass |
20 | 20 | $this->templateParamsManager = new IHMParamTemplateClass(); |
21 | 21 | } |
22 | 22 | |
23 | + public function addGeneratedParam($paramId, $expression, $sampling, $paramsData) | |
24 | + { | |
25 | + if (!isset($this->expressionParser)) | |
26 | + $this->expressionParser = new IHMExpressionParserClass(); | |
27 | + $expressionInfo = $this->expressionParser->parse($expression); | |
28 | + | |
29 | + //create a process param for the derived parameter | |
30 | + $this->addProcessParam($paramId, $expressionInfo["expression"], $expression, | |
31 | + $expressionInfo['params'], $sampling, | |
32 | + 0, time(), "", "", $paramsData); | |
33 | + } | |
34 | + | |
23 | 35 | /* |
24 | 36 | * @brief Add an existing parameter |
25 | 37 | */ |
... | ... |
src/Request/ParamsRequestImpl/ParamsRequestClass.php
... | ... | @@ -34,6 +34,9 @@ class ParamsRequestClass extends ProcessRequestClass |
34 | 34 | case ParamsRequestTypeEnumClass::PARAMGEN : |
35 | 35 | $this->requestData->setCmd(KernelConfigClass::getKernelBinPath()."amdaParameterGenerator -p ".$this->requestData->getParamId()); |
36 | 36 | break; |
37 | + case ParamsRequestTypeEnumClass::PARAMSINFOGEN : | |
38 | + $this->requestData->setCmd(KernelConfigClass::getKernelBinPath()."amdaParameterInfo -p ".$this->requestData->getParamId()); | |
39 | + break; | |
37 | 40 | } |
38 | 41 | $this->requestData->setEnvVars(KernelConfigClass::getExecEnvVarArray()); |
39 | 42 | |
... | ... |
src/Request/ParamsRequestImpl/ParamsRequestDataClass.php
src/RequestManager.php
... | ... | @@ -11,6 +11,7 @@ function amdaintegration_autoload($class_name) |
11 | 11 | 'InputOutput/IHMImpl/Params/DataMiningImpl', |
12 | 12 | 'InputOutput/IHMImpl/Params/StatisticsImpl', |
13 | 13 | 'InputOutput/IHMImpl/Params/DownloadImpl', |
14 | + 'InputOutput/IHMImpl/Params/GenInfoParamImpl', | |
14 | 15 | 'InputOutput/IHMImpl/Params/PlotImpl', |
15 | 16 | 'InputOutput/IHMImpl/Params/GeneratorImpl', |
16 | 17 | 'InputOutput/IHMImpl/Process', |
... | ... | @@ -71,6 +72,7 @@ abstract class FunctionTypeEnumClass |
71 | 72 | { |
72 | 73 | const PARAMS = "params"; |
73 | 74 | const PARAMSGEN = "params_gen"; |
75 | + const PARAMSGEN = "params_info_gen"; | |
74 | 76 | const ACTION = "action"; |
75 | 77 | const PROCESSDELETE = "process_delete"; |
76 | 78 | const PROCESSRUNNINGINFO = "process_running_info"; |
... | ... |
src/RequestManagerClass.php
... | ... | @@ -56,6 +56,8 @@ Class RequestManagerClass |
56 | 56 | { |
57 | 57 | case FunctionTypeEnumClass::PARAMS : |
58 | 58 | case FunctionTypeEnumClass::PARAMSGEN : |
59 | + case FunctionTypeEnumClass::PARAMSINFOGEN : | |
60 | + return new ParamsRequestClass($user, $userHost); | |
59 | 61 | case FunctionTypeEnumClass::ACTION : |
60 | 62 | return new ParamsRequestClass($user, $userHost); |
61 | 63 | case FunctionTypeEnumClass::PROCESSDELETE : |
... | ... | @@ -152,4 +154,4 @@ Class RequestManagerClass |
152 | 154 | return $request->getData(); |
153 | 155 | } |
154 | 156 | } |
155 | -?> | |
156 | 157 | \ No newline at end of file |
158 | +?> | |
... | ... |
src/amdaintegration_autoload.php
... | ... | @@ -12,6 +12,7 @@ function amdaintegration_autoload($class_name) |
12 | 12 | 'InputOutput/IHMImpl/Params/DownloadImpl', |
13 | 13 | 'InputOutput/IHMImpl/Params/PlotImpl', |
14 | 14 | 'InputOutput/IHMImpl/Params/GeneratorImpl', |
15 | + 'InputOutput/IHMImpl/Params/GenInfoParamImpl', | |
15 | 16 | 'InputOutput/IHMImpl/Process', |
16 | 17 | 'InputOutput/IHMImpl/ParamInfo', |
17 | 18 | 'InputOutput/IHMImpl/Tools', |
... | ... |