Commit 952dd7c70ff1eda2ffcd97c91111ecf6cba51242
1 parent
afe1c354
Exists in
master
and in
66 other branches
catalog integration
Showing
6 changed files
with
236 additions
and
15 deletions
Show diff stats
src/InputOutput/IHMImpl/IHMInputOutputClass.php
... | ... | @@ -48,6 +48,10 @@ class IHMInputOutputClass implements InputOutputInterface |
48 | 48 | if (($input->format == "PNG") && ($input->tabId != "")) |
49 | 49 | $requestId = "Plot".$input->tabId; |
50 | 50 | break; |
51 | + case 'catalog' : | |
52 | + //catalog generation | |
53 | + $this->inputOutput = new IHMInputOutputParamsCatalogClass(); | |
54 | + break; | |
51 | 55 | default : |
52 | 56 | throw new Exception('Params request type '.$input_request->nodeType.' not implemented for this client.'); |
53 | 57 | } |
... | ... | @@ -58,7 +62,7 @@ class IHMInputOutputClass implements InputOutputInterface |
58 | 62 | break; |
59 | 63 | case FunctionTypeEnumClass::ACTION : |
60 | 64 | $this->inputOutput = new IHMInputOutputParamsPlotClass(); |
61 | - $requestId = str_replace("_","",$input->folderId); | |
65 | + $requestId = str_replace("_","",$input->folderId); | |
62 | 66 | break; |
63 | 67 | case FunctionTypeEnumClass::PROCESSDELETE : |
64 | 68 | $this->inputOutput = new IHMInputOutputDeleteProcessClass(); |
... | ... | @@ -69,8 +73,8 @@ class IHMInputOutputClass implements InputOutputInterface |
69 | 73 | case FunctionTypeEnumClass::PROCESSGETINFO : |
70 | 74 | $this->inputOutput = new IHMInputOutputGetInfoProcessClass(); |
71 | 75 | break; |
72 | - case FunctionTypeEnumClass::PROCESSCLEAN : | |
73 | - $this->inputOutput = new IHMInputOutputCleanProcessClass(); | |
76 | + case FunctionTypeEnumClass::PROCESSCLEAN : | |
77 | + $this->inputOutput = new IHMInputOutputCleanProcessClass(); | |
74 | 78 | break; |
75 | 79 | /*case FunctionTypeEnumClass::TTMERGE : |
76 | 80 | $this->inputOutput = new IHMInputOutputMergeTTClass(); |
... | ... | @@ -97,4 +101,4 @@ class IHMInputOutputClass implements InputOutputInterface |
97 | 101 | } |
98 | 102 | } |
99 | 103 | |
100 | -?> | |
104 | +?> | ... | ... |
src/InputOutput/IHMImpl/Params/CatalogImpl/IHMInputOutputParamsCatalogClass.php
0 → 100644
... | ... | @@ -0,0 +1,63 @@ |
1 | +<?php | |
2 | + | |
3 | +define ("CATALOG_RESULT_FILE_KEY", "statistic"); | |
4 | + | |
5 | +/** | |
6 | + * @class IHMInputOutputParamsCatalogClass | |
7 | + * @brief Implementation of IHMInputOutputParamsAbstractClass to treat catalog generation request | |
8 | + * @details | |
9 | +*/ | |
10 | +class IHMInputOutputParamsCatalogClass extends IHMInputOutputParamsAbstractClass | |
11 | +{ | |
12 | + /* | |
13 | + * @brief method to unmarshall a catalog generation request | |
14 | + */ | |
15 | + protected function unmarshallRequest($input) | |
16 | + { | |
17 | + /* | |
18 | + {"id":"","timesrc":"TimeTable","name":"test","created":null,"description":"first","objName":"","objFormat":"","folderId":"","nbIntervals":0,"cacheToken":"","parameter":[{"param":"imf_gsm","function":"min"},{"param":"imf_mag","function":"max"}],"timeTables":[{"id":"sharedtt_26"},{"id":"sharedtt_27"}],"leaf":true,"nodeType":"catalog"}]' | |
19 | + */ | |
20 | + $paramsNode = $this->paramsData->getRequestNode()->getParamsNode(); | |
21 | + | |
22 | + //unmarshall time definition | |
23 | + $this->unmarshallTimeDefinition($input); | |
24 | + | |
25 | + //unmarshall statistic output definition | |
26 | + $outputsNode = $this->paramsData->getRequestNode()->getOutputsNode(); | |
27 | + $catalogNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::STATISTIC); | |
28 | + $catalogNode->setTimeFormat(RequestOutputStatisticTimeFormatEnum::ISO); | |
29 | + $catalogNode->setFileFormat(RequestOutputStatisticFileFormatEnum::XML); | |
30 | + | |
31 | + // parse parameters / functions array | |
32 | + foreach ($input->parameter as $obj) { | |
33 | + $paramFunctionAssociation[$obj->param][] = $obj->function; | |
34 | + } | |
35 | + | |
36 | + foreach ($paramFunctionAssociation as $param => $functions) { | |
37 | + $paramsNode->addParam($param); | |
38 | + $outputParamNode = $catalogNode->addParam($param); | |
39 | + foreach ($functions as $function) $outputParamNode->addFunction($function); | |
40 | + $paramInfo = $this->paramManager->addExistingParam($param,$this->paramsData); | |
41 | + } | |
42 | + | |
43 | + $resultFile = "result_".$this->requestID; | |
44 | + $this->paramsData->addWaitingResult(CATALOG_RESULT_FILE_KEY, $resultFile); | |
45 | +// | |
46 | + $postProcessCmd = "mv statistic_*"; | |
47 | + $postProcessCmd .= '.xml'; | |
48 | + $postProcessCmd .= " ".$resultFile.$extension; | |
49 | + | |
50 | +// | |
51 | + $this->paramsData->setPostCmd($postProcessCmd); | |
52 | + return $this->paramsData; | |
53 | + } | |
54 | + | |
55 | + /* | |
56 | + * @brief method to marshall the result of a catalog generation request | |
57 | + */ | |
58 | + protected function marshallResult($data) | |
59 | + { | |
60 | + return $this->commonMarshallResult($data,CATALOG_RESULT_FILE_KEY); | |
61 | + } | |
62 | +} | |
63 | +?> | |
0 | 64 | \ No newline at end of file | ... | ... |
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... | ... | @@ -80,7 +80,6 @@ class IHMParamManagerClass |
80 | 80 | $paramId = $param; |
81 | 81 | |
82 | 82 | $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml"; |
83 | - | |
84 | 83 | if (!file_exists($paramPath)) |
85 | 84 | throw new Exception('Cannot find parameter local file '.$paramId); |
86 | 85 | |
... | ... | @@ -96,8 +95,8 @@ class IHMParamManagerClass |
96 | 95 | */ |
97 | 96 | private function addLinkedLocalParams($paramId,$paramsData) |
98 | 97 | { |
99 | - $doc = new DOMDocument("1.0", "UTF-8"); | |
100 | - $doc->preserveWhiteSpace = false; | |
98 | + $doc = new DOMDocument("1.0", "UTF-8"); | |
99 | + $doc->preserveWhiteSpace = false; | |
101 | 100 | $doc->formatOutput = true; |
102 | 101 | |
103 | 102 | $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml"; |
... | ... | @@ -143,14 +142,14 @@ class IHMParamManagerClass |
143 | 142 | |
144 | 143 | //parse expression |
145 | 144 | if (!isset($this->expressionParser)) |
146 | - $this->expressionParser = new IHMExpressionParserClass(); | |
145 | + $this->expressionParser = new IHMExpressionParserClass(); | |
147 | 146 | $expressionInfo = $this->expressionParser->parse($res["param"]["expression"]); |
148 | 147 | |
149 | - $paramId = $param; | |
150 | - | |
151 | - //create a process param for the derived parameter | |
152 | - $this->addProcessParam($paramId, $expressionInfo["expression"], | |
153 | - $expressionInfo['params'], $res["param"]["timestep"], | |
148 | + $paramId = $param; | |
149 | + | |
150 | + //create a process param for the derived parameter | |
151 | + $this->addProcessParam($paramId, $expressionInfo["expression"], | |
152 | + $expressionInfo['params'], $res["param"]["timestep"], | |
154 | 153 | 0,$res["param"]["dateModif"],$paramsData); |
155 | 154 | |
156 | 155 | return array("id" => $paramId, "indexes" => array(), "calib_infos" => array()); | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputStatisticNodeClass.php
0 → 100644
... | ... | @@ -0,0 +1,150 @@ |
1 | +<?php | |
2 | + | |
3 | +define ("REQUESTOUTPUTSTATISTIC_NAME", "statistic"); | |
4 | +define ("REQUESTOUTPUTSTATISTIC_TIMEFORMAT", "timeFormat"); | |
5 | +define ("REQUESTOUTPUTSTATISTIC_FILEFORMAT", "fileFormat"); | |
6 | +define ("REQUESTOUTPUTSTATISTIC_STRUCTURE", "outputStructure"); | |
7 | +define ("REQUESTOUTPUTSTATISTIC_FILENAME", "fileName"); | |
8 | + | |
9 | +define ("REQUESTOUTPUTSTATISTICPARAM_NAME", "param"); | |
10 | +define ("REQUESTOUTPUTSTATISTICFUNCTION_NAME", "function"); | |
11 | +define ("REQUESTOUTPUTSTATISTICPARAM_ID", "id"); | |
12 | +define ("REQUESTOUTPUTSTATISTICFUNCTION_ID", "name"); | |
13 | + | |
14 | +abstract class RequestOutputStatisticTimeFormatEnum | |
15 | +{ | |
16 | + const UNKNOWN = ""; | |
17 | + const ISO = "ISO"; | |
18 | +} | |
19 | + | |
20 | +abstract class RequestOutputStatisticFileFormatEnum | |
21 | +{ | |
22 | + const UNKNOWN = ""; | |
23 | + const ASCII = "ASCII"; | |
24 | + const XML = "XML"; | |
25 | + const VOT = "VOT"; | |
26 | +} | |
27 | + | |
28 | +abstract class RequestOutputStatisticStructureEnum | |
29 | +{ | |
30 | + const UNKNOWN = ""; | |
31 | + const ONE_FILE = "one-file"; | |
32 | + const ONE_FILE_PER_INTERVAL = "one-file-per-interval"; | |
33 | +} | |
34 | + | |
35 | +class RequestOutputStatisticFunctionNodeClass extends NodeClass | |
36 | +{ | |
37 | + public function __construct() | |
38 | + { | |
39 | + parent::__construct(REQUESTOUTPUTSTATISTICFUNCTION_NAME); | |
40 | + } | |
41 | + | |
42 | + public function setFunctionName($name) | |
43 | + { | |
44 | + $this->setAttribute(REQUESTOUTPUTSTATISTICFUNCTION_ID, $name); | |
45 | + } | |
46 | +} | |
47 | + | |
48 | +class RequestOutputStatisticParamNodeClass extends NodeClass | |
49 | +{ | |
50 | + public function __construct() | |
51 | + { | |
52 | + parent::__construct(REQUESTOUTPUTSTATISTICPARAM_NAME); | |
53 | + } | |
54 | + | |
55 | + public function setId($id) | |
56 | + { | |
57 | + $this->setAttribute(REQUESTOUTPUTSTATISTICPARAM_ID, $id); | |
58 | + } | |
59 | + | |
60 | + public function getId() | |
61 | + { | |
62 | + return $this->getAttribute(REQUESTOUTPUTSTATISTICPARAM_ID); | |
63 | + } | |
64 | + | |
65 | + public function addFunction($name) | |
66 | + { | |
67 | + $node = new RequestOutputStatisticFunctionNodeClass(); | |
68 | + $this->addChild($node); | |
69 | + $node->setFunctionName($name); | |
70 | + } | |
71 | +} | |
72 | + | |
73 | +/** | |
74 | + * @class RequestOutputStatisticNodeClass | |
75 | + * @brief Definition of a request data mining output node for AMDA_Kernel | |
76 | + * @details | |
77 | + */ | |
78 | +class RequestOutputStatisticNodeClass extends NodeClass | |
79 | + { | |
80 | + public function __construct() | |
81 | + { | |
82 | + parent::__construct(REQUESTOUTPUTSTATISTIC_NAME); | |
83 | + } | |
84 | + | |
85 | + public function setTimeFormat($timeFormat) | |
86 | + { | |
87 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTSTATISTIC_TIMEFORMAT, true); | |
88 | + $node->setValue($timeFormat); | |
89 | + } | |
90 | + | |
91 | + public function setFileFormat($fileFormat) | |
92 | + { | |
93 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTSTATISTIC_FILEFORMAT, true); | |
94 | + $node->setValue($fileFormat); | |
95 | + } | |
96 | + | |
97 | + public function setStructure($structure) | |
98 | + { | |
99 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTSTATISTIC_STRUCTURE, true); | |
100 | + $node->setValue($structure); | |
101 | + } | |
102 | + | |
103 | + public function setFileName($fileName) | |
104 | + { | |
105 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTSTATISTIC_FILENAME, true); | |
106 | + $node->setValue($fileName); | |
107 | + } | |
108 | + | |
109 | + public function addParam($id) | |
110 | + { | |
111 | + $paramsNode = $this->getFirstChildByName(REQUESTPARAMS_NAME); | |
112 | + | |
113 | + if (!$paramsNode) | |
114 | + { | |
115 | + $paramsNode = new RequestParamsNodeClass(); | |
116 | + $this->addChild($paramsNode); | |
117 | + } | |
118 | + | |
119 | + $node = new RequestOutputStatisticParamNodeClass(); | |
120 | + $paramsNode->addChild($node); | |
121 | + | |
122 | + $node->setId($id); | |
123 | + | |
124 | + return $node; | |
125 | + } | |
126 | + | |
127 | + public function addPostProcessing($process) | |
128 | + { | |
129 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTPOSTPROCESSING_NAME); | |
130 | + if ($node == NULL) | |
131 | + { | |
132 | + $node = new RequestOutputPostProcessingNodeClass(); | |
133 | + $this->addChild($node); | |
134 | + } | |
135 | + | |
136 | + $node->addPostProcessing($process); | |
137 | + } | |
138 | + | |
139 | + public function isPostProcessing($process) | |
140 | + { | |
141 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTPOSTPROCESSING_NAME); | |
142 | + | |
143 | + if ($node == NULL) | |
144 | + return false; | |
145 | + | |
146 | + return $node->isPostProcessing($process); | |
147 | + } | |
148 | +} | |
149 | + | |
150 | +?> | |
0 | 151 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputsNodeClass.php
... | ... | @@ -6,6 +6,7 @@ abstract class RequestOutputTypeEnum |
6 | 6 | const DOWNLOAD = "Download"; |
7 | 7 | const DATAMINING = "DataMining"; |
8 | 8 | const PLOT = "Plot"; |
9 | + const STATISTIC = "Statistic"; | |
9 | 10 | } |
10 | 11 | |
11 | 12 | /** |
... | ... | @@ -33,6 +34,9 @@ class RequestOutputsNodeClass extends NodeClass |
33 | 34 | case RequestOutputTypeEnum::PLOT : |
34 | 35 | $output = new RequestOutputPlotNodeClass(); |
35 | 36 | break; |
37 | + case RequestOutputTypeEnum::STATISTIC : | |
38 | + $output = new RequestOutputStatisticNodeClass(); | |
39 | + break; | |
36 | 40 | default : |
37 | 41 | throw new Exception('Output node not implemented'); |
38 | 42 | } | ... | ... |
src/RequestManager.php
... | ... | @@ -9,6 +9,7 @@ function amdaintegration_autoload($class_name) |
9 | 9 | 'InputOutput/IHMImpl/Config', |
10 | 10 | 'InputOutput/IHMImpl/Params', |
11 | 11 | 'InputOutput/IHMImpl/Params/DataMiningImpl', |
12 | + 'InputOutput/IHMImpl/Params/CatalogImpl', | |
12 | 13 | 'InputOutput/IHMImpl/Params/DownloadImpl', |
13 | 14 | 'InputOutput/IHMImpl/Params/PlotImpl', |
14 | 15 | 'InputOutput/IHMImpl/Params/GeneratorImpl', |
... | ... | @@ -151,10 +152,10 @@ Class RequestManagerClass |
151 | 152 | |
152 | 153 | //get the input data from the request input data by using the InputOutput interface |
153 | 154 | $inputdata = $inputOutput->getInputData($input,$function); |
154 | - | |
155 | + | |
155 | 156 | //create an instance of the RequestClass to run the request |
156 | 157 | $request = $this->createRequest($userHost, $function); |
157 | - | |
158 | + | |
158 | 159 | if (is_array($inputdata)) |
159 | 160 | { |
160 | 161 | $outputdata = array(); | ... | ... |