Commit 01ff2cc669e89577fd72f3cc918f8ad2a28311c1

Authored by elena
1 parent 55f623c0

catalog draft

src/InputOutput/IHMImpl/IHMInputOutputClass.php
@@ -48,9 +48,9 @@ class IHMInputOutputClass implements InputOutputInterface @@ -48,9 +48,9 @@ class IHMInputOutputClass implements InputOutputInterface
48 if (($input->format == "PNG") && ($input->tabId != "")) 48 if (($input->format == "PNG") && ($input->tabId != ""))
49 $requestId = "Plot".$input->tabId; 49 $requestId = "Plot".$input->tabId;
50 break; 50 break;
51 - case 'catalog' : 51 + case 'statistics' :
52 //catalog generation 52 //catalog generation
53 - $this->inputOutput = new IHMInputOutputParamsCatalogClass(); 53 + $this->inputOutput = new IHMInputOutputParamsStatisticsClass();
54 break; 54 break;
55 default : 55 default :
56 throw new Exception('Params request type '.$input_request->nodeType.' not implemented for this client.'); 56 throw new Exception('Params request type '.$input_request->nodeType.' not implemented for this client.');
src/InputOutput/IHMImpl/Params/StatisticsImpl/IHMInputOutputParamsStatisticsClass.php 0 → 100644
@@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
  1 +<?php
  2 +
  3 +define ("STATISTICS_RESULT_FILE_KEY", "statistic");
  4 +
  5 +/**
  6 + * @class IHMInputOutputParamsStatisticsClass
  7 + * @brief Implementation of IHMInputOutputParamsAbstractClass to treat catalog generation request
  8 + * @details
  9 +*/
  10 +class IHMInputOutputParamsStatisticsClass 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(STATISTICS_RESULT_FILE_KEY, $resultFile);
  45 +//
  46 + $postProcessCmd = "mv statistic-*";
  47 + $postProcessCmd .= " ".$resultFile.".xml";
  48 +
  49 +//
  50 + $this->paramsData->setPostCmd($postProcessCmd);
  51 + return $this->paramsData;
  52 + }
  53 +
  54 + /*
  55 + * @brief method to marshall the result of a catalog generation request
  56 + */
  57 + protected function marshallResult($data)
  58 + {
  59 + return $this->commonMarshallResult($data,STATISTICS_RESULT_FILE_KEY);
  60 + }
  61 +}
  62 +?>
0 \ No newline at end of file 63 \ No newline at end of file
src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php
@@ -10,11 +10,13 @@ class IHMJobsManagerClass { @@ -10,11 +10,13 @@ class IHMJobsManagerClass {
10 10
11 protected $bkgRootNode = array('condition' => 'bkgSearch-treeRootNode', 11 protected $bkgRootNode = array('condition' => 'bkgSearch-treeRootNode',
12 'request' => 'bkgPlot-treeRootNode', 12 'request' => 'bkgPlot-treeRootNode',
13 - 'download' => 'bkgDown-treeRootNode'); 13 + 'download' => 'bkgDown-treeRootNode',
  14 + 'statistics' => 'bkgStatistics-treeRootNode');
14 15
15 protected $resRootNode = array('condition' => 'resSearch-treeRootNode', 16 protected $resRootNode = array('condition' => 'resSearch-treeRootNode',
16 'request' => 'resPlot-treeRootNode', 17 'request' => 'resPlot-treeRootNode',
17 - 'download' => 'resDown-treeRootNode'); 18 + 'download' => 'resDown-treeRootNode',
  19 + 'statistics' => 'resStatistics-treeRootNode');
18 20
19 /* 21 /*
20 * @brief Constructor 22 * @brief Constructor
@@ -259,6 +261,10 @@ class IHMJobsManagerClass { @@ -259,6 +261,10 @@ class IHMJobsManagerClass {
259 $name = 'datamining_'.time(); 261 $name = 'datamining_'.time();
260 $info = $obj->expression; 262 $info = $obj->expression;
261 break; 263 break;
  264 + case 'statistics' :
  265 + $name = 'statistics_'.time();
  266 + $info = $obj->expression;
  267 + break;
262 case 'download' : 268 case 'download' :
263 if ($obj->downloadSrc == '2') //fits image 269 if ($obj->downloadSrc == '2') //fits image
264 $name = "download_fits_".time(); 270 $name = "download_fits_".time();
src/RequestManager.php
@@ -9,7 +9,7 @@ function amdaintegration_autoload($class_name) @@ -9,7 +9,7 @@ function amdaintegration_autoload($class_name)
9 'InputOutput/IHMImpl/Config', 9 'InputOutput/IHMImpl/Config',
10 'InputOutput/IHMImpl/Params', 10 'InputOutput/IHMImpl/Params',
11 'InputOutput/IHMImpl/Params/DataMiningImpl', 11 'InputOutput/IHMImpl/Params/DataMiningImpl',
12 - 'InputOutput/IHMImpl/Params/CatalogImpl', 12 + 'InputOutput/IHMImpl/Params/StatisticsImpl',
13 'InputOutput/IHMImpl/Params/DownloadImpl', 13 'InputOutput/IHMImpl/Params/DownloadImpl',
14 'InputOutput/IHMImpl/Params/PlotImpl', 14 'InputOutput/IHMImpl/Params/PlotImpl',
15 'InputOutput/IHMImpl/Params/GeneratorImpl', 15 'InputOutput/IHMImpl/Params/GeneratorImpl',