Blame view

src/Request/ParserRequestImpl/ParserRequestClass.php 1.38 KB
a928f9d3   Benjamin Renard   New parser integr...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
 * @class ParserRequestClass
 * @brief Treats a parser request. This class inherits from ProcessRequestClass
 * @details
 */
class ParserRequestClass extends ProcessRequestClass
{
	/*
	 * @brief Init a params request
	*/
	public function init()
	{
		if (!isset($this->requestData))
			return false;
			
		$this->requestData->setType(ProcessTypeEnumClass::RUN);
		$this->requestData->setBatchEnable(FALSE);
		
		$cmd = KernelConfigClass::getKernelBinPath()."expressionParser ";
		foreach ($this->requestData->getExpressions() as $expression)
		{
			$cmd .= "-e \"".$expression."\" ";
		}
		$cmd .= "-o \"".$this->requestData->getOutputFileName()."\"";
		$this->requestData->setCmd($cmd);

		$this->requestData->setEnvVars(KernelConfigClass::getExecEnvVarArray());
			
		if (!parent::init())
			return false;
			
		$this->requestData->setSuccess(false);
		$this->requestData->setLastErrorMessage('Cannot init parser request');

		//create config files
		KernelConfigClass::setForceParamsDir($this->requestData->getLocalParamsPath());
65912bc8   Benjamin Renard   Templated paramet...
38
		KernelConfigClass::write($this->requestData->getWorkingPath(), "", "", $this->requestData->getFunctionsFilePath(), $this->requestData->getConstantsFilePath(), $this->requestData->getParamTemplatesFilePath());
a928f9d3   Benjamin Renard   New parser integr...
39
40
41
42
43
44
45
46
47
48
49
50
51
		KernelConfigClass::setForceParamsDir("");

		return true;
	}
	/*
	 * @brief Run a params request
	*/
	public function run()
	{
		return parent::run();
	}
}
?>