Blame view

src/InputOutput/IHMImpl/IHMInputOutputClass.php 3.68 KB
22521f1c   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

/**
 * @class IHMInputOutputClass
 * @brief Class that's implement an InputOutputInterface for AMDA IHM client.
 * @details
 */
class IHMInputOutputClass implements InputOutputInterface
{
	private $inputOutput = null;

	/*
	 * @brief Constructor
	*/
ffc5cb81   Elena.Budnik   temporary commit
15
	function __construct($userName, $userHost)
22521f1c   Benjamin Renard   First commit
16
17
	{
		IHMConfigClass::setUserName($userName);
ffc5cb81   Elena.Budnik   temporary commit
18
		IHMConfigClass::setUserHost($userHost);
22521f1c   Benjamin Renard   First commit
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	}

	/*
	 * @brief translate input data from AMDA IHM to AMDA_Integration module
	*/
	public function getInputData($input,$function,$requestId = "")
	{
		//check user workspace
		if (IHMConfigClass::getUserName() == "" || !is_dir(IHMConfigClass::getUserPath()))
			throw new Exception('Cannot find user workspace.');

		switch ($function)
		{
			case FunctionTypeEnumClass::PARAMS :
				switch ($input->nodeType)
				{
					case 'download' :
						//download data
						if ($input->downloadSrc != "0")
							throw new Exception('Download source '.$input->downloadSrc.' not implemented for this client.');
						$this->inputOutput = new IHMInputOutputParamsDownloadClass();
						break;
					case 'condition' :
						//data mining
						$this->inputOutput = new IHMInputOutputParamsDataMiningClass();
						break;
					case 'request' :
						//plot
8c57155b   Benjamin Renard   Integration for t...
47
48
49
50
51
						if (($input->{"file-format"} == "PNG") && ($input->{"file-output"} == "INTERACTIVE"))
						{
							//set working dir for interactive plot
							$requestId = "Plot";
						}
22521f1c   Benjamin Renard   First commit
52
						$this->inputOutput = new IHMInputOutputParamsPlotClass();
22521f1c   Benjamin Renard   First commit
53
						break;
01ff2cc6   elena   catalog draft
54
					case 'statistics' :
952dd7c7   elena   catalog integration
55
						//catalog generation
01ff2cc6   elena   catalog draft
56
						$this->inputOutput = new IHMInputOutputParamsStatisticsClass();
bda99a72   Benjamin Renard   Add kill plot req...
57
58
59
60
61
						break;
					case 'killplot' :
						$requestId = "Plot";
						$this->inputOutput = new IHMInputOutputParamsKillPlotClass();
						break;
22521f1c   Benjamin Renard   First commit
62
63
64
65
					default :
						throw new Exception('Params request type '.$input_request->nodeType.' not implemented for this client.');
				}
				break;
3493f196   Benjamin Renard   Add request to ge...
66
67
68
69
			case FunctionTypeEnumClass::PARAMSGEN :
				$this->inputOutput = new IHMInputOutputParamsGeneratorClass();
				$requestId = "ParamGen";
				break;
22521f1c   Benjamin Renard   First commit
70
71
			case FunctionTypeEnumClass::ACTION :
				$this->inputOutput = new IHMInputOutputParamsPlotClass();
db9b2cfe   Benjamin Renard   Zoom in interacti...
72
				$requestId = "Plot";
22521f1c   Benjamin Renard   First commit
73
74
75
76
77
78
79
80
81
82
				break;
			case FunctionTypeEnumClass::PROCESSDELETE :
				$this->inputOutput = new IHMInputOutputDeleteProcessClass();
				break;
			case FunctionTypeEnumClass::PROCESSRUNNINGINFO :
				$this->inputOutput = new IHMInputOutputRunningInfoProcessClass();
				break;
			case FunctionTypeEnumClass::PROCESSGETINFO :
				$this->inputOutput = new IHMInputOutputGetInfoProcessClass();
				break;
952dd7c7   elena   catalog integration
83
84
			case FunctionTypeEnumClass::PROCESSCLEAN :
				$this->inputOutput = new IHMInputOutputCleanProcessClass();
22521f1c   Benjamin Renard   First commit
85
86
87
88
89
90
91
				break;
				/*case FunctionTypeEnumClass::TTMERGE :
				 $this->inputOutput = new IHMInputOutputMergeTTClass();
				break;
				case FunctionTypeEnumClass::TTUNION :
				$this->inputOutput = new IHMInputOutputUnionTTClass();
				break;*/
0b6b2080   Elena.Budnik   TT download
92
93
94
			case FunctionTypeEnumClass::TTCONVERT :
				$this->inputOutput = new IHMInputOutputTTClass();
				break;
966bd5f8   Benjamin Renard   Add request to ge...
95
96
97
			case FunctionTypeEnumClass::PARAMINFO :
				$this->inputOutput = new IHMInputOutputParamInfoClass();
				break;
22521f1c   Benjamin Renard   First commit
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
			default :
				throw new Exception('Request type '.$function.' not implemented for this client.');
		}

		return $this->inputOutput->getInputData($input,$function,$requestId);
	}

	/*
	 * @brief translate output data from AMDA_Integration module to AMDA IHM
	*/
	public function getOutput($data)
	{
		if (!isset($this->inputOutput))
			return array("success" => false, "message" => "Input Output Interface not initialized for this request");

		return $this->inputOutput->getOutput($data);
	}
}

952dd7c7   elena   catalog integration
117
?>