8 namespace Fossology\Lib\Plugin;
12 const PRE_JOB_QUEUE =
'preJq';
15 public $Name =
"agent_abstract";
16 public $Dependency = array();
17 public $Title =
'how to show checkbox';
18 public $PluginLevel = 10;
19 public $State = PLUGIN_STATE_READY;
22 function __construct()
28 function postInstall()
34 menu_insert(
"Agents::" . $this->Title, 0, $this->Name);
72 public function AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $arguments=
null)
74 $dependencies[] =
"agent_adj2nest";
80 if ($jobQueueId != 0) {
84 $args = is_array($arguments) ?
'' : $arguments;
85 return $this->
doAgentAdd($jobId, $uploadId, $errorMsg, $dependencies, $uploadId, $args);
100 protected function doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs =
"", $jq_cmd_args =
null)
103 foreach ($dependencies as $dependency) {
111 if (empty($jqargs)) {
114 $jobQueueId =
\JobQueueAdd($jobId, $this->AgentName, $jqargs,
"", $deps, NULL, $jq_cmd_args);
115 if (empty($jobQueueId)) {
116 $errorMsg =
"Failed to insert agent $this->AgentName into job queue. jqargs: $jqargs";
121 $errorMsg .=
"\n" . $output;
136 if (is_array($dependency)) {
137 $pluginName = $dependency[
'name'];
138 $depArgs = array_key_exists(
'args', $dependency) ? $dependency[
'args'] :
null;
139 $preJq = array_key_exists(self::PRE_JOB_QUEUE, $dependency) ? $dependency[self::PRE_JOB_QUEUE] : array();
141 $pluginName = $dependency;
147 $errorMsg =
"Invalid plugin name: $pluginName, (implicitAgentAdd())";
151 return $depPlugin->AgentAdd($jobId, $uploadId, $errorMsg, $preJq, $depArgs);
154 function __toString()
doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs="", $jq_cmd_args=null)
AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $arguments=null)
implicitAgentAdd($jobId, $uploadId, &$errorMsg, $dependency)
AgentHasResults($uploadId=0)
JobQueueAdd($job_pk, $jq_type, $jq_args, $jq_runonpfile, $Depends, $host=NULL, $jq_cmd_args=NULL)
Insert a jobqueue + jobdepends records.
IsAlreadyScheduled($job_pk, $AgentName, $upload_pk)
Check if an agent is already scheduled in a job.
getStringRepresentation($vars, $classname)
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.
fo_communicate_with_scheduler($input, &$output, &$error_msg)
Communicate with scheduler, send commands to the scheduler, then get the output.
#define PLUGIN_DB_WRITE
Plugin requires write permission on DB.