FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\Decider\DeciderAgent Class Reference

Agent to decide license findings in an upload. More...

Inheritance diagram for Fossology\Decider\DeciderAgent:
Inheritance graph
Collaboration diagram for Fossology\Decider\DeciderAgent:
Collaboration graph

Public Member Functions

 __construct ($licenseMapUsage=null)
 
 processUploadId ($uploadId)
 Given an upload ID, process the items in it. More...
 
- Public Member Functions inherited from Fossology\Lib\Agent\Agent
 __construct ($agentName, $version, $revision)
 
 scheduler_connect ()
 Connect with scheduler and initialize options. More...
 
 heartbeat ($newProcessed)
 Send hear beat to the scheduler. More...
 
 bail ($exitvalue)
 Bail the agent, print the stack and disconnect from scheduler. More...
 
 scheduler_disconnect ($exitvalue)
 Closes connection from scheduler. More...
 
 scheduler_greet ()
 Greet the scheduler at the beginning of connection. More...
 
 initArsTable ()
 Initialize ARS table.
 
 run_scheduler_event_loop ()
 Runs a loop to read commands from scheduler and process them. More...
 

Public Attributes

const RULES_NOMOS_IN_MONK = 0x1
 
const RULES_NOMOS_MONK_NINKA = 0x2
 
const RULES_BULK_REUSE = 0x4
 
const RULES_WIP_SCANNER_UPDATES = 0x8
 
const RULES_OJO_NO_CONTRADICTION = 0x10
 
const RULES_COPYRIGHT_FALSE_POSITIVE = 0x20
 
const RULES_COPYRIGHT_FALSE_POSITIVE_CLUTTER = 0x40
 
const RULES_LICENSE_TYPE_CONCLUSION = 0x80
 
const RULES_ALL
 

Protected Member Functions

 remapByProjectedId ($matches)
 Given a set of matches, remap according to project id instead of license id. More...
 
 areNomosMonkNinkaAgreed ($licenseMatches)
 Check if findings by all agents are same or not. More...
 
 getLicenseIdsOfMatchesForScanner ($scanner, $licenseMatches)
 extracts the matches corresponding to a scanner from a $licenseMatches structure More...
 
 areOtherScannerFindingsAndOJOAgreed ($licenseMatches)
 Check if the finding by only contains one single license and that no other scanner (nomos) has produced a contradicting statement. More...
 
 areOtherScannerFindingsAndRESOAgreed ($licenseMatches)
 Check if the finding by only contains one single license and that no other scanner (nomos) has produced a contradicting statement. More...
 
 noLicenseConflict ($itemTreeBounds, $licenseMatches)
 Check if findings by all agents are same or not. More...
 
 allLicenseInType ($licenseMatches)
 Check if findings by all agents are same or not. More...
 

Private Member Functions

 processItem (Item $item)
 Given an item, check with the $activeRules and apply rules to it. More...
 
 existsUnhandledMatch ($projectedScannerMatches, $licensesFromDecision)
 Check if matches contains unhandled match. More...
 
 autodecideIfOjoMatchesNoContradiction (ItemTreeBounds $itemTreeBounds, $matches)
 Auto decide matches which are in nomos, monk and OJO findings. More...
 
 autodecideIfResoMatchesNoContradiction (ItemTreeBounds $itemTreeBounds, $matches)
 Auto decide matches which are in nomos, monk, OJO and Reso findings. More...
 
 autodecideNomosMonkNinka (ItemTreeBounds $itemTreeBounds, $matches)
 Auto decide matches which are in nomos, monk and ninka findings. More...
 
 autodecideNomosMatchesInsideMonk (ItemTreeBounds $itemTreeBounds, $matches)
 Auto decide matches by nomos which are in monk findings. More...
 
 autodecideLicenseType (ItemTreeBounds $itemTreeBounds, $matches)
 Auto decide matches where there is no license conflict. More...
 
 isRegionIncluded ($small, $big)
 Check if the small highlight region is inside big one. More...
 
 areNomosMatchesInsideAMonkMatch ($licenseMatches)
 Check if matches by nomos are inside monk findings. More...
 
 getCopyrightsToDisableFalsePositivesClutter ($uploadId, $clutter_flag)
 
 callCopyrightDeactivationClutterRemovalScript ($tmpFilePath, $clutter_flag)
 
 getLicenseType ($licenseType)
 

Private Attributes

 $activeRules
 
 $licenseType
 
 $uploadDao
 
 $clearingDecisionProcessor
 
 $agentLicenseEventProcessor
 
 $clearingDao
 
 $highlightDao
 
 $showJobsDao
 
 $decisionTypes
 
 $licenseMap = null
 
 $licenseMapUsage = null
 
 $copyrightDao
 
 $compatibilityDao
 
 $licenseDao
 

Additional Inherited Members

- Static Public Member Functions inherited from Fossology\Lib\Agent\Agent
static heartbeat_handler ($signo)
 Function to handle hear beats from the agent and send them to the scheduler from STDOUT. More...
 
- Protected Attributes inherited from Fossology\Lib\Agent\Agent
 $userId
 
 $groupId
 
 $jobId
 
 $agentSpecifOptions = ""
 
 $agentSpecifLongOptions = array()
 
 $args = array()
 
 $dbManager
 
 $agentDao
 
 $container
 
 $schedulerMode
 

Detailed Description

Agent to decide license findings in an upload.

Definition at line 77 of file DeciderAgent.php.

Member Function Documentation

◆ allLicenseInType()

Fossology\Decider\DeciderAgent::allLicenseInType (   $licenseMatches)
protected

Check if findings by all agents are same or not.

Parameters
LicenseMatch[][][]$licenseMatchesLicense matches
Returns
boolean True if they match, false otherwise

Definition at line 763 of file DeciderAgent.php.

◆ areNomosMatchesInsideAMonkMatch()

Fossology\Decider\DeciderAgent::areNomosMatchesInsideAMonkMatch (   $licenseMatches)
private

Check if matches by nomos are inside monk findings.

Parameters
LicenseMatch[][]$licenseMatches
Returns
boolean True if matches are inside monk, false otherwise

Definition at line 488 of file DeciderAgent.php.

◆ areNomosMonkNinkaAgreed()

Fossology\Decider\DeciderAgent::areNomosMonkNinkaAgreed (   $licenseMatches)
protected

Check if findings by all agents are same or not.

Parameters
LicenseMatch[][]$licenseMatches
Returns
boolean True if they match, false otherwise

Definition at line 522 of file DeciderAgent.php.

◆ areOtherScannerFindingsAndOJOAgreed()

Fossology\Decider\DeciderAgent::areOtherScannerFindingsAndOJOAgreed (   $licenseMatches)
protected

Check if the finding by only contains one single license and that no other scanner (nomos) has produced a contradicting statement.

Parameters
LicenseMatch[][]$licenseMatches
Returns
boolean True if they match, false otherwise

Definition at line 566 of file DeciderAgent.php.

◆ areOtherScannerFindingsAndRESOAgreed()

Fossology\Decider\DeciderAgent::areOtherScannerFindingsAndRESOAgreed (   $licenseMatches)
protected

Check if the finding by only contains one single license and that no other scanner (nomos) has produced a contradicting statement.

Parameters
LicenseMatch[][]$licenseMatches
Returns
boolean True if they match, false otherwise

Definition at line 593 of file DeciderAgent.php.

◆ autodecideIfOjoMatchesNoContradiction()

Fossology\Decider\DeciderAgent::autodecideIfOjoMatchesNoContradiction ( ItemTreeBounds  $itemTreeBounds,
  $matches 
)
private

Auto decide matches which are in nomos, monk and OJO findings.

Get the matches which really agree and apply the decisions.

Parameters
ItemTreeBounds$itemTreeBoundsItemTreeBounds to apply decisions
LicenseMatch[][][]$matchesNew license matches found
Returns
boolean True if decisions applied, false otherwise

Definition at line 323 of file DeciderAgent.php.

◆ autodecideIfResoMatchesNoContradiction()

Fossology\Decider\DeciderAgent::autodecideIfResoMatchesNoContradiction ( ItemTreeBounds  $itemTreeBounds,
  $matches 
)
private

Auto decide matches which are in nomos, monk, OJO and Reso findings.

Get the matches which really agree and apply the decisions.

Parameters
ItemTreeBounds$itemTreeBoundsItemTreeBounds to apply decisions
LicenseMatch[][][]$matchesNew license matches found
Returns
boolean True if decisions applied, false otherwise

Definition at line 351 of file DeciderAgent.php.

◆ autodecideLicenseType()

Fossology\Decider\DeciderAgent::autodecideLicenseType ( ItemTreeBounds  $itemTreeBounds,
  $matches 
)
private

Auto decide matches where there is no license conflict.

Get the matches where there is no license conflict and licenses are of provided type.

Parameters
ItemTreeBounds$itemTreeBoundsItemTreeBounds to apply decisions
LicenseMatch[][][]$matchesNew license matches found
Returns
boolean True if decisions applied, false otherwise

Definition at line 430 of file DeciderAgent.php.

◆ autodecideNomosMatchesInsideMonk()

Fossology\Decider\DeciderAgent::autodecideNomosMatchesInsideMonk ( ItemTreeBounds  $itemTreeBounds,
  $matches 
)
private

Auto decide matches by nomos which are in monk findings.

Get the nomos matches which really are inside monk findings and apply the decisions.

Parameters
ItemTreeBounds$itemTreeBoundsItemTreeBounds to apply decisions
LicenseMatch[][][]$matchesNew license matches found
Returns
boolean True if decisions applied, false otherwise

Definition at line 404 of file DeciderAgent.php.

◆ autodecideNomosMonkNinka()

Fossology\Decider\DeciderAgent::autodecideNomosMonkNinka ( ItemTreeBounds  $itemTreeBounds,
  $matches 
)
private

Auto decide matches which are in nomos, monk and ninka findings.

Get the matches which really agree and apply the decisions.

Parameters
ItemTreeBounds$itemTreeBoundsItemTreeBounds to apply decisions
LicenseMatch[][][]$matchesNew license matches found
Returns
boolean True if decisions applied, false otherwise

Definition at line 379 of file DeciderAgent.php.

◆ callCopyrightDeactivationClutterRemovalScript()

Fossology\Decider\DeciderAgent::callCopyrightDeactivationClutterRemovalScript (   $tmpFilePath,
  $clutter_flag 
)
private

Run the Python script with required parameters and return the output.

Parameters
string$tmpFilePathPath to temp file with input JSON
bool$clutter_flagRemove clutter as well?
Returns
string Return from script.

Definition at line 681 of file DeciderAgent.php.

◆ existsUnhandledMatch()

Fossology\Decider\DeciderAgent::existsUnhandledMatch (   $projectedScannerMatches,
  $licensesFromDecision 
)
private

Check if matches contains unhandled match.

Parameters
array$projectedScannerMatches
array[]$licensesFromDecision
Returns
boolean True if any unhandled match exists, false otherwise

Definition at line 305 of file DeciderAgent.php.

◆ getCopyrightsToDisableFalsePositivesClutter()

Fossology\Decider\DeciderAgent::getCopyrightsToDisableFalsePositivesClutter (   $uploadId,
  $clutter_flag 
)
private

Use the copyright deactivation script to remove false positive copyrights.

Parameters
int$uploadIdUpload to process
bool$clutter_flagRemove clutter as well?
Returns
void

Definition at line 621 of file DeciderAgent.php.

◆ getLicenseIdsOfMatchesForScanner()

Fossology\Decider\DeciderAgent::getLicenseIdsOfMatchesForScanner (   $scanner,
  $licenseMatches 
)
protected

extracts the matches corresponding to a scanner from a $licenseMatches structure

Parameters
$scanner
LicenseMatch[][]$licenseMatches
Returns
int[] list of license ids

Definition at line 550 of file DeciderAgent.php.

◆ getLicenseType()

Fossology\Decider\DeciderAgent::getLicenseType (   $licenseType)
private

Convert the license type key from flag to string value.

Parameters
string$licenseTypeLicense Type from args
Returns
string License type if key found, empty string otherwise.

Definition at line 716 of file DeciderAgent.php.

◆ isRegionIncluded()

Fossology\Decider\DeciderAgent::isRegionIncluded (   $small,
  $big 
)
private

Check if the small highlight region is inside big one.

Parameters
int[]$smallThe smaller region, start at index 0, end at 1
int[]$bigThe bigger region, start at index 0, end at 1
Returns
boolean True if region is inside, else false

Definition at line 478 of file DeciderAgent.php.

◆ noLicenseConflict()

Fossology\Decider\DeciderAgent::noLicenseConflict (   $itemTreeBounds,
  $licenseMatches 
)
protected

Check if findings by all agents are same or not.

Parameters
ItemTreeBounds$itemTreeBoundsItem tree bound to check conflicts
LicenseMatch[][][]$licenseMatchesLicense matches
Returns
boolean True if they match, false otherwise
Exceptions

Definition at line 734 of file DeciderAgent.php.

◆ processItem()

Fossology\Decider\DeciderAgent::processItem ( Item  $item)
private

Given an item, check with the $activeRules and apply rules to it.

Get an UploadTree item, get the previous matches, current matches. Mark new licenses as WIP. Check the $activeRules and apply them on the item

Parameters
Item$itemItem to be processes
Returns
int 1 if operation resulted in success, 0 otherwise

Definition at line 232 of file DeciderAgent.php.

◆ processUploadId()

Fossology\Decider\DeciderAgent::processUploadId (   $uploadId)

Given an upload ID, process the items in it.

This function is implemented by agent and should call heartbeat() at regular intervals.

Parameters
int$uploadIdUpload to be processed by the agent.
Returns
bool Process status
See also
Fossology::Lib::Agent::Agent::processUploadId()

Reimplemented from Fossology\Lib\Agent\Agent.

Definition at line 173 of file DeciderAgent.php.

◆ remapByProjectedId()

Fossology\Decider\DeciderAgent::remapByProjectedId (   $matches)
protected

Given a set of matches, remap according to project id instead of license id.

Parameters
LicenseMatch[]$matchesMatches to be remapped
Returns
LicenseMatch[][][] Remapped matches

Definition at line 453 of file DeciderAgent.php.

Member Data Documentation

◆ $activeRules

int Fossology\Decider\DeciderAgent::$activeRules
private

Rules active for upload (nomos in monk; ninka in monk; nomos, ninka and monk)

Definition at line 94 of file DeciderAgent.php.

◆ $agentLicenseEventProcessor

AgentLicenseEventProcessor Fossology\Decider\DeciderAgent::$agentLicenseEventProcessor
private

AgentLicenseEventProcessor object

Definition at line 110 of file DeciderAgent.php.

◆ $clearingDao

ClearingDao Fossology\Decider\DeciderAgent::$clearingDao
private

ClearingDao object

Definition at line 114 of file DeciderAgent.php.

◆ $clearingDecisionProcessor

ClearingDecisionProcessor Fossology\Decider\DeciderAgent::$clearingDecisionProcessor
private

ClearingDecisionProcessor object

Definition at line 106 of file DeciderAgent.php.

◆ $compatibilityDao

CompatibilityDao Fossology\Decider\DeciderAgent::$compatibilityDao
private

Compatibility Dao

Definition at line 144 of file DeciderAgent.php.

◆ $copyrightDao

CopyrightDao Fossology\Decider\DeciderAgent::$copyrightDao
private

CopyrightDao object

Definition at line 139 of file DeciderAgent.php.

◆ $decisionTypes

DecisionTypes Fossology\Decider\DeciderAgent::$decisionTypes
private

DecisionTypes object

Definition at line 126 of file DeciderAgent.php.

◆ $highlightDao

HighlightDao Fossology\Decider\DeciderAgent::$highlightDao
private

HighlightDao object

Definition at line 118 of file DeciderAgent.php.

◆ $licenseDao

LicenseDao Fossology\Decider\DeciderAgent::$licenseDao
private

License Dao

Definition at line 149 of file DeciderAgent.php.

◆ $licenseMap

LicenseMap Fossology\Decider\DeciderAgent::$licenseMap = null
private

LicenseMap object

Definition at line 130 of file DeciderAgent.php.

◆ $licenseMapUsage

int Fossology\Decider\DeciderAgent::$licenseMapUsage = null
private

licenseMapUsage

Definition at line 134 of file DeciderAgent.php.

◆ $licenseType

string Fossology\Decider\DeciderAgent::$licenseType
private

License Type to use if concluding.

Definition at line 98 of file DeciderAgent.php.

◆ $showJobsDao

ShowJobsDao Fossology\Decider\DeciderAgent::$showJobsDao
private

ShowJobsDao object

Definition at line 122 of file DeciderAgent.php.

◆ $uploadDao

UploadDao Fossology\Decider\DeciderAgent::$uploadDao
private

UploadDao object

Definition at line 102 of file DeciderAgent.php.

◆ RULES_ALL

const Fossology\Decider\DeciderAgent::RULES_ALL
Initial value:
= self::RULES_NOMOS_IN_MONK | self::RULES_NOMOS_MONK_NINKA |
self::RULES_BULK_REUSE | self::RULES_WIP_SCANNER_UPDATES |
self::RULES_OJO_NO_CONTRADICTION | self::RULES_LICENSE_TYPE_CONCLUSION

Definition at line 87 of file DeciderAgent.php.


The documentation for this class was generated from the following file: