FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
Fossology\SpdxTwo\SpdxTwoAgent Class Reference

SPDX2 agent. More...

Inheritance diagram for Fossology\SpdxTwo\SpdxTwoAgent:
Inheritance graph
Collaboration diagram for Fossology\SpdxTwo\SpdxTwoAgent:
Collaboration graph

Public Member Functions

 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 OUTPUT_FORMAT_KEY = "outputFormat"
 Argument key for output format.
 
const DEFAULT_OUTPUT_FORMAT = "spdx2"
 Default output format.
 
const AVAILABLE_OUTPUT_FORMATS = "spdx2,spdx2tv,dep5"
 Output formats available.
 
const UPLOAD_ADDS = "uploadsAdd"
 Argument for additional uploads.
 

Protected Member Functions

 preWorkOnArgs ($args)
 Parse arguments. More...
 
 getTemplateFile ($partname)
 Get TWIG template file based on output format. More...
 
 getFileBasename ($packageName)
 Generate report basename based on upload name. More...
 
 getFileName ($packageName)
 Get absolute path for report. More...
 
 getUri ($packageName)
 Get the URI for the given package. More...
 
 renderPackage ($uploadId)
 Given an upload id, render the report string. More...
 
 getFilesWithLicensesFromClearings (ItemTreeBounds $itemTreeBounds)
 Given an ItemTreeBounds, get the files with clearings. More...
 
 toLicensesWithFilesAdder (&$filesWithLicenses, $licenses, $copyrights, $file, $fullPath)
 Map licenses, copyrights, files and full path to filesWithLicenses array. More...
 
 toLicensesWithFiles (&$filesWithLicenses, $treeTableName)
 Map findings to the files. More...
 
 addScannerResults (&$filesWithLicenses, ItemTreeBounds $itemTreeBounds)
 Attach finding agents to the files and return names of scanners. More...
 
 addClearingStatus (&$filesWithLicenses, ItemTreeBounds $itemTreeBounds)
 Add clearing status to the files. More...
 
 computeUri ($uploadId)
 For a given upload, compute the URI and filename for the report. More...
 
 writeReport (&$packageNodes, $packageIds, $uploadId)
 Write the report the file and update report table. More...
 
 updateReportTable ($uploadId, $jobId, $fileName)
 Update the reportgen table with new report path. More...
 
 renderString ($templateName, $vars)
 Render a twig template. More...
 
 generateFileNodes ($filesWithLicenses, $treeTableName, $uploadId)
 Generate report nodes for files. More...
 
 generateFileNodesByFiles ($filesWithLicenses, $treeTableName, $uploadId)
 For each file, generate the nodes by files. More...
 
 generateFileNodesByLicenses ($filesWithLicenses, $treeTableName)
 For each file, generate the nodes by licenses. More...
 
 getLicenseTexts ()
 Get the license texts from fossology. More...
 
 getVerificationCode (Upload $upload)
 Get a unique identifier for a given upload. More...
 
 getSPDXReportConf ($uploadId, $key)
 Get spdx license comment state for a given upload. More...
 
- Protected Member Functions inherited from Fossology\Lib\Agent\Agent
 processUploadId ($uploadId)
 Given an upload ID, process the items in it. More...
 

Protected Attributes

 $dbManager
 
 $renderer
 
 $agentNames = AgentRef::AGENT_LIST
 
 $includedLicenseIds = array()
 
 $filebasename = null
 
 $uri
 
 $filename
 
 $outputFormat = self::DEFAULT_OUTPUT_FORMAT
 
 $spdxValidityChecker = null
 
- Protected Attributes inherited from Fossology\Lib\Agent\Agent
 $userId
 
 $groupId
 
 $jobId
 
 $agentSpecifOptions = ""
 
 $agentSpecifLongOptions = array()
 
 $args = array()
 
 $dbManager
 
 $agentDao
 
 $container
 
 $schedulerMode
 

Private Attributes

 $uploadDao
 
 $clearingDao
 
 $licenseDao
 
 $licenseMap
 

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...
 

Detailed Description

SPDX2 agent.

Definition at line 83 of file spdx2.php.

Member Function Documentation

Fossology\SpdxTwo\SpdxTwoAgent::addClearingStatus ( $filesWithLicenses,
ItemTreeBounds  $itemTreeBounds 
)
protected

Add clearing status to the files.

Parameters
[in,out]string&$filesWithLicenses
ItemTreeBounds$itemTreeBounds

Definition at line 560 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::addScannerResults ( $filesWithLicenses,
ItemTreeBounds  $itemTreeBounds 
)
protected

Attach finding agents to the files and return names of scanners.

Parameters
[in,out]string&$filesWithLicenses
ItemTreeBounds$itemTreeBounds
Returns
Name(s) of scanners used

Definition at line 476 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::computeUri (   $uploadId)
protected

For a given upload, compute the URI and filename for the report.

Parameters
int$uploadId

Definition at line 583 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::generateFileNodes (   $filesWithLicenses,
  $treeTableName,
  $uploadId 
)
protected

Generate report nodes for files.

Parameters
string$filesWithLicenses
string$treeTableName
int$uploadID
Returns
string Node content

Definition at line 661 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::generateFileNodesByFiles (   $filesWithLicenses,
  $treeTableName,
  $uploadId 
)
protected

For each file, generate the nodes by files.

Parameters
string&$filesWithLicenses
string$treeTableName
int$uploadID
Returns
string Node string

Definition at line 677 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::generateFileNodesByLicenses (   $filesWithLicenses,
  $treeTableName 
)
protected

For each file, generate the nodes by licenses.

Parameters
string&$filesWithLicenses
string$treeTableName
Returns
string Node string

Definition at line 735 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::getFileBasename (   $packageName)
protected

Generate report basename based on upload name.

The base name is in format <OutputFormat>_<packagename>_<timestamp><-spdx.rdf|.spdx|.txt>

Parameters
string$packageNameName of the upload
Returns
string Report file's base name

Definition at line 256 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::getFileName (   $packageName)
protected

Get absolute path for report.

Parameters
string$packageNameName of the upload
Returns
string Absolute file path for report

Definition at line 281 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::getFilesWithLicensesFromClearings ( ItemTreeBounds  $itemTreeBounds)
protected

Given an ItemTreeBounds, get the files with clearings.

Parameters
ItemTreeBounds$itemTreeBounds
Returns
string[][][] Mapping item->'concluded'->(array of shortnames)

Definition at line 364 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::getLicenseTexts ( )
protected

Get the license texts from fossology.

Returns
string[] with keys being shortname

Definition at line 774 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::getSPDXReportConf (   $uploadId,
  $key 
)
protected

Get spdx license comment state for a given upload.

Parameters
int$uploadId
Returns
boolval License comment state (TRUE : show license comment, FALSE : don't show it)

Definition at line 832 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::getTemplateFile (   $partname)
protected

Get TWIG template file based on output format.

Parameters
string$partnamecopyright|document|file|package
Returns
string Template file path

Definition at line 232 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::getUri (   $packageName)
protected

Get the URI for the given package.

Parameters
string$packageNameName of the upload
Returns
string URI for the upload

Definition at line 293 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::getVerificationCode ( Upload  $upload)
protected

Get a unique identifier for a given upload.

This is done using concatinating SHA1 of every pfile in upload and calculating the SHA1 of the resulted string.

Parameters
Upload$upload
Returns
string The unique identifier

Definition at line 807 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::preWorkOnArgs (   $args)
protected

Parse arguments.

Parameters
string$argsArray of arguments to be parsed
Returns
array $args Parsed arguments

Definition at line 184 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::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.
See also
Fossology::Lib::Agent::Agent::processUploadId()

Definition at line 202 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::renderPackage (   $uploadId)
protected

Given an upload id, render the report string.

Parameters
int$uploadId
Returns
string Rendered report string

Definition at line 309 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::renderString (   $templateName,
  $vars 
)
protected

Render a twig template.

Parameters
string$templateNameName of the template to be rendered
array$varsVariables for the template
Returns
string The rendered output

Definition at line 649 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::toLicensesWithFiles ( $filesWithLicenses,
  $treeTableName 
)
protected

Map findings to the files.

Parameters
[in,out]string&$filesWithLicenses
string$treeTableName
Returns
String array of files with associated findings

Definition at line 436 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::toLicensesWithFilesAdder ( $filesWithLicenses,
  $licenses,
  $copyrights,
  $file,
  $fullPath 
)
protected

Map licenses, copyrights, files and full path to filesWithLicenses array.

Parameters
[in,out]string$filesWithLicenses
string$licenses
string$copyrights
string$file
string$fullPath

Definition at line 411 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::updateReportTable (   $uploadId,
  $jobId,
  $fileName 
)
protected

Update the reportgen table with new report path.

Parameters
int$uploadIdUpload id
int$jobIdJob id
string$fileNameFile name of the report

Definition at line 636 of file spdx2.php.

Fossology\SpdxTwo\SpdxTwoAgent::writeReport ( $packageNodes,
  $packageIds,
  $uploadId 
)
protected

Write the report the file and update report table.

Parameters
string$packageNodes
int$packageIds
int$uploadId

Definition at line 598 of file spdx2.php.

Member Data Documentation

array Fossology\SpdxTwo\SpdxTwoAgent::$agentNames = AgentRef::AGENT_LIST
protected

Agent names mapping

Definition at line 118 of file spdx2.php.

ClearingDao Fossology\SpdxTwo\SpdxTwoAgent::$clearingDao
private

ClearingDao object

Definition at line 98 of file spdx2.php.

DbManager Fossology\SpdxTwo\SpdxTwoAgent::$dbManager
protected

DbManager object

Definition at line 106 of file spdx2.php.

string Fossology\SpdxTwo\SpdxTwoAgent::$filebasename = null
protected

Basename of SPDX2 report

Definition at line 126 of file spdx2.php.

string Fossology\SpdxTwo\SpdxTwoAgent::$filename
protected

File name

Definition at line 134 of file spdx2.php.

array Fossology\SpdxTwo\SpdxTwoAgent::$includedLicenseIds = array()
protected

License ids included

Definition at line 122 of file spdx2.php.

LicenseDao Fossology\SpdxTwo\SpdxTwoAgent::$licenseDao
private

LicenseDao object

Definition at line 102 of file spdx2.php.

LicenseMap Fossology\SpdxTwo\SpdxTwoAgent::$licenseMap
private

LicenseMap object

Definition at line 114 of file spdx2.php.

string Fossology\SpdxTwo\SpdxTwoAgent::$outputFormat = self::DEFAULT_OUTPUT_FORMAT
protected

Output format of the report

Definition at line 138 of file spdx2.php.

Twig_Environment Fossology\SpdxTwo\SpdxTwoAgent::$renderer
protected

Twig_Environment object

Definition at line 110 of file spdx2.php.

callable Fossology\SpdxTwo\SpdxTwoAgent::$spdxValidityChecker = null
protected

SPDX validator to be used

Definition at line 143 of file spdx2.php.

UploadDao Fossology\SpdxTwo\SpdxTwoAgent::$uploadDao
private

UploadDao object

Definition at line 94 of file spdx2.php.

string Fossology\SpdxTwo\SpdxTwoAgent::$uri
protected

URI of the file

Definition at line 130 of file spdx2.php.


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