diff --git a/application/config/jqm.php b/application/config/jqm.php new file mode 100644 index 000000000..5890241ae --- /dev/null +++ b/application/config/jqm.php @@ -0,0 +1,6 @@ + 'monitoring:r', + 'getJobsByStatus' => 'monitoring:r', + 'getJobsByCreationTime' => 'monitoring:r' + ) + ); + + // Loads JobsQueueLib + $this->load->library('JobsQueueLib'); + } + + /** + * + */ + public function getJobsByType() + { + $jobType = $this->input->get(JobsQueueLib::PARAM_JOB_TYPE); + + $this->outputJson($this->jobsqueuelib->getJobsByType($jobType)); + } + + /** + * + */ + public function getJobsByStatus() + { + $jobStatus = $this->input->get(JobsQueueLib::PARAM_JOB_STATUS); + + $this->outputJson($this->jobsqueuelib->getJobsByStatus($jobStatus)); + } + + /** + * + */ + public function getJobsByCreationTime() + { + $jobCreationTime = $this->input->get(JobsQueueLib::PARAM_JOB_CREATION_TIME); + + $this->outputJson($this->jobsqueuelib->getJobsByCreationTime($jobCreationTime)); + } +} diff --git a/application/core/JQW_Controller.php b/application/core/JQW_Controller.php new file mode 100644 index 000000000..9cb058f6b --- /dev/null +++ b/application/core/JQW_Controller.php @@ -0,0 +1,56 @@ +load->library('LogLib', array( + 'classIndex' => 5, + 'functionIndex' => 5, + 'lineIndex' => 4, + 'dbLogType' => 'job', // required + 'dbExecuteUser' => 'Jobs queue system' + )); + + // Loads JobsQueueLib + $this->load->library('JobsQueueLib'); + } + + // ------------------------------------------------------------------------------------------------------------ + // Protected methods to read/write the jobs queue + + /** + * + */ + protected function getJobsByType($jobType) + { + $jobs = $this->jobsqueuelib->getJobsByType($jobType); + + if (isError($jobs)) $this->logError(getError($jobs), $jobType); + + return $jobs; + } + + /** + * + */ + protected function addNewJobsToQueue($jobType, $jobs) + { + $result = $this->jobsqueuelib->addNewJobsToQueue($jobType, $jobs); + + if (isError($result)) $this->logError(getError($result), $jobType); + + return $result; + } +} diff --git a/application/libraries/JobsQueueLib.php b/application/libraries/JobsQueueLib.php new file mode 100644 index 000000000..0c7e44274 --- /dev/null +++ b/application/libraries/JobsQueueLib.php @@ -0,0 +1,56 @@ +_ci =& get_instance(); + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + /** + * + */ + public function getJobsByType() + { + } + + /** + * + */ + public function addNewJobsToQueue() + { + } + + /** + * + */ + public function getJobsByStatus() + { + } +}