requestData)) return false; if ($this->requestData->getCmd() == '') { $this->requestData->setLastErrorMessage('No process command defined'); return false; } if ($this->requestData->getOutputDir() == '') { $this->requestData->setLastErrorMessage('No output dir defined'); return false; } if (!is_dir($this->requestData->getOutputDir())) { if (!mkdir($this->requestData->getOutputDir(),0777) || !is_dir($this->requestData->getOutputDir())) { $this->requestData->setLastErrorMessage('Cannot create output dir'); return false; } } if (!file_exists($this->requestData->getOutputDir()."app.properties")) KernelConfigClass::write($this->requestData->getOutputDir(), "", ""); $this->requestData->setEnvVars(KernelConfigClass::getExecEnvVarArray()); return true; } /* * @brief Run a process request */ public function run() { if (!isset($this->requestData)) return false; $this->requestData->setSuccess(false); $this->requestData->setLastErrorMessage('Cannot run process request'); switch ($this->requestData->getType()) { case FunctionTypeEnumClass::TTCONVERT : //run process $args = $this->requestData->getInputFileName()." ".$this->requestData->getInputFileFormat() ." ".$this->requestData->getOutputDir()." ".$this->requestData->getOutputFileName() ." ".$this->requestData->getOutputFileFormat(); $cmd = $this->requestData->getCmd()." ".$args; $process = new ProcessClass($cmd); //, $postProcessCmd); if (!$process->run($this->requestData->getOutputDir(), $this->requestData->getEnvVars())) return array("success" => false, "message" => "Cannot run the TT process"); //TBD while ($process->isRunning() && ( time() - $process->getRunningStart() ) < KernelConfigClass::getTimeToBatchMode()) { sleep(1); } $result = array('success' => true); break; default : $this->requestData->setLastErrorMessage("TT process method not implemented"); return false; } $this->requestData->setSuccess($result['success']); if (!$result['success']) $this->requestData->setLastErrorMessage($result['message']); return ($result['success']); } } ?>