public class GlobalyzerAPI
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closeDatabaseConnection()
Closes the database - must be called before your program exits if NOT using an in-memory db.
|
static void |
createProject(java.lang.String projectName,
java.lang.String projectPath)
Creates a new Globalyzer project.
|
static void |
createProjectScans(java.lang.String projectName,
java.lang.String regex)
Create scans for the Globalyzer project - one for each rule set available to the current user that matches regex
|
static java.lang.String[] |
createProjectScans(java.lang.String projectName,
java.lang.String regex,
GlobalyzerAPIScanDetails details)
Create scans for the Globalyzer project - one for each rule set available to the current user that matches regex
|
static java.lang.String[] |
createProjectScans(java.lang.String projectName,
java.lang.String regex,
java.lang.String[] scanItems)
Create scans for the Globalyzer project - one for each rule set available to the current user that matches regex
|
static java.lang.String |
createScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner)
Deprecated.
Use
createScanWithInfo instead |
static java.lang.String[] |
createScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner,
GlobalyzerAPIScanDetails details)
Deprecated.
Use
createScanWithInfo instead |
static java.lang.String[] |
createScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner,
java.lang.String[] scanItems)
Deprecated.
Use
createScanWithInfo instead |
static java.lang.Object[] |
createScanWithInfo(java.lang.String projectName,
java.lang.String scanName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner,
GlobalyzerAPIScanDetails details)
Create a scan for the Globalyzer project.
|
static void |
deleteProject(java.lang.String projectName)
Deletes a Globalyzer project.
|
static void |
deleteScan(java.lang.String projectName,
java.lang.String scanName)
Delete a scan from the Globalyzer project.
|
static void |
deleteScanResults(java.lang.String projectName,
java.lang.String scanName)
Deletes the scan results for one or all scans of a project.
|
static java.lang.String |
executeScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String reportPath,
GlobalyzerAPIReportTypes reportType)
Executes the scan and optionally generates a report for either the scan or the project.
|
static java.lang.Object[] |
executeScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String reportPath,
GlobalyzerAPIReportTypes reportType,
boolean generatePartialResults) |
static java.lang.Object[] |
executeScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String reportPath,
GlobalyzerAPIReportTypes reportType,
java.lang.String reportPriorities,
boolean generatePartialResults)
Executes the scan and optionally generates a report for either the scan or the project.
|
static java.lang.String |
generateDefaultScanName(java.lang.String projectName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner)
Returns the generated scan name for the given rule set name/owner.
|
static java.util.Date |
getAccountExpirationDate()
Returns the account expiration date for the current user
|
static java.lang.String |
getScanHistory(java.lang.String projectName,
java.lang.String scanName)
Returns the scan history for the provided project and scan for the current user.
|
static boolean |
getSendScanHistory()
Determine the current send scan history setting
|
static java.lang.String |
getServerVersion()
Returns the version of the server the current user is logged in to.
|
static boolean |
isValidML(java.lang.String projectPath,
java.lang.String scanName)
Validates that Machine Learning files exist for this scan
|
static java.lang.String[] |
listProjects()
Lists the project names currently in the database.
|
static RuleSetNameAndOwner[] |
listRuleSets()
Lists the rule sets available for the current user.
|
static java.lang.String[] |
listScans(java.lang.String projectName)
Lists the scan names for the given project.
|
static void |
login(java.lang.String username,
java.lang.String password,
java.lang.String server,
java.lang.String proxyUser,
java.lang.String proxyPassword,
java.lang.String proxyHost,
java.lang.String proxyPort)
Logs a user into Globalyzer.
|
static void |
login(java.lang.String username,
java.lang.String password,
java.lang.String server,
java.lang.String proxyUser,
java.lang.String proxyPassword,
java.lang.String proxyHost,
java.lang.String proxyPort,
boolean useLocalRulesets,
java.lang.String rulesetLocation,
java.lang.String licenseLocation)
Logs a user into Globalyzer.
|
static void |
reloadRuleSets()
Reloads the rule sets from the server (as opposed to using cached copies)
|
static void |
sendUseLog()
Sends the use log to the server
|
static void |
setSendScanHistory(boolean setting)
Set whether scan history will be sent to the server; default is true
|
static void |
setSessionSettings(java.lang.String dataDictionaryLocation,
java.lang.Boolean filterWithDictionary,
java.lang.String scanTimeout)
Override default session settings.
|
static void |
setSessionSettings(java.lang.String dataDictionaryDir,
java.lang.String dataDictionaryFilesDir,
java.lang.String cfgFileDir,
java.lang.String log4jPropertiesFileDir,
java.lang.Boolean setLog4jProperties,
java.lang.Boolean filterWithDictionary,
java.lang.String scanTimeout)
Override default session settings.
|
public static void setSessionSettings(java.lang.String dataDictionaryDir,
java.lang.String dataDictionaryFilesDir,
java.lang.String cfgFileDir,
java.lang.String log4jPropertiesFileDir,
java.lang.Boolean setLog4jProperties,
java.lang.Boolean filterWithDictionary,
java.lang.String scanTimeout)
throws GlobalyzerAPIException
dataDictionaryDir - Specify absolute path of new dictionary location; default is {userhome}/.globalyzer; null = use defaultdataDictionaryFilesDir - Specify absolute path of directory containing data/dict; default is directory where application is executed; null = use defaultcfgFileDir - Specify absolute path of directory containing globalyzer.cfg.xml; default is directory where application is executed; null = use defaultlog4jPropertiesFileDir - Specify absolute path of directory containing log4j2.xml; default is directory where application is executed; null = use defaultsetLog4jProperties - Specify whether or not to configure a log4j2.xml file; default is true; null = use defaultfilterWithDictionary - Specify whether or not to filter against dictionary; default is true; null = use defaultscanTimeout - Specify new scanTimeOut value; default is 120 (seconds); value must be between 0 and 600; null = use defaultGlobalyzerAPIException - on failurepublic static void setSessionSettings(java.lang.String dataDictionaryLocation,
java.lang.Boolean filterWithDictionary,
java.lang.String scanTimeout)
throws GlobalyzerAPIException
dataDictionaryLocation - Specify absolute path of new dictionary location; default is {userhome}/.globalyzer; null = use defaultfilterWithDictionary - Specify whether or not to filter against dictionary; default is true; null = use defaultscanTimeout - Specify new scanTimeOut value; default is 120 (seconds); value must be between 0 and 600; null = use defaultGlobalyzerAPIException - on failurepublic static void login(java.lang.String username,
java.lang.String password,
java.lang.String server,
java.lang.String proxyUser,
java.lang.String proxyPassword,
java.lang.String proxyHost,
java.lang.String proxyPort)
throws GlobalyzerAPIException
username - The usernamepassword - The passwordserver - The serverproxyUser - If using a proxyproxyPassword - If using a proxyproxyHost - If using a proxyproxyPort - If using a proxyGlobalyzerAPIException - on failurepublic static void login(java.lang.String username,
java.lang.String password,
java.lang.String server,
java.lang.String proxyUser,
java.lang.String proxyPassword,
java.lang.String proxyHost,
java.lang.String proxyPort,
boolean useLocalRulesets,
java.lang.String rulesetLocation,
java.lang.String licenseLocation)
throws GlobalyzerAPIException
username - The usernamepassword - The passwordserver - The serverproxyUser - If using a proxyproxyPassword - If using a proxyproxyHost - If using a proxyproxyPort - If using a proxyuseLocalRulesets - true if use local rulesets from files as opposed to serverrulesetLocation - Path to exported rule sets; null to use default location (projectpath/lingoport)licenseLocation - Path to globalyzer license file; required when using local rule sets, else nullGlobalyzerAPIException - on failurepublic static void createProject(java.lang.String projectName,
java.lang.String projectPath)
throws GlobalyzerAPIException
projectName - The name of the project to createprojectPath - The location of the project codeGlobalyzerAPIException - on failurepublic static void deleteProject(java.lang.String projectName)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectGlobalyzerAPIException - on failure@Deprecated
public static java.lang.String createScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner)
throws GlobalyzerAPIException
createScanWithInfo insteadprojectName - The name of the Globalyzer projectscanName - The name of the scan (if null, name will be generated from rule set name)ruleSetName - The name of the rule set the scan should referenceruleSetOwner - The owner of the rule set the scan should reference (if null, owner = current user)GlobalyzerAPIException - on failure@Deprecated
public static java.lang.String[] createScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner,
java.lang.String[] scanItems)
throws GlobalyzerAPIException
createScanWithInfo insteadprojectName - The name of the Globalyzer projectscanName - The name of the scan (if null, name will be generated from rule set name)ruleSetName - The name of the rule set the scan should referenceruleSetOwner - The owner of the rule set the scan should reference (if null, owner = current user)scanItems - Specify files and directories to scan (null = all) - Paths can be absolute or relative to project path, but must be within project pathGlobalyzerAPIException - on failure@Deprecated
public static java.lang.String[] createScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner,
GlobalyzerAPIScanDetails details)
throws GlobalyzerAPIException
createScanWithInfo insteadprojectName - The name of the Globalyzer projectscanName - The name of the scan (if null, name will be generated from rule set name)ruleSetName - The name of the rule set the scan should referenceruleSetOwner - The owner of the rule set the scan should reference (if null, owner = current user)details - The optional details of the scan; null = use default settingsGlobalyzerAPIException - on failurepublic static java.lang.Object[] createScanWithInfo(java.lang.String projectName,
java.lang.String scanName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner,
GlobalyzerAPIScanDetails details)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectscanName - The name of the scan (if null, name will be generated from rule set name)ruleSetName - The name of the rule set the scan should referenceruleSetOwner - The owner of the rule set the scan should reference (if null, owner = current user)details - The optional details of the scan; null = use default settings
Object[0] - String - scanName (could have been generated)
Object[1] - String[] - scanItems not found and therefore not scanned (null indicates all scanItems were found and scanned)
Object[2] - boolean - true indicates that server rule set was used because not found locally (if using local rule sets)
Example of use:
Object[] result = createScanWithInfo(...);
String scanName = (String)result[0];
String[] scanItemsNotFound = (String[])result[1]);
boolean localRuleSetNotFound = (boolean)result[2];
GlobalyzerAPIException - on failurepublic static void createProjectScans(java.lang.String projectName,
java.lang.String regex)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectregex - Specify a pattern to match only certain rule set names (if null, scans will be created for all user's rule sets)GlobalyzerAPIException - on failurepublic static java.lang.String[] createProjectScans(java.lang.String projectName,
java.lang.String regex,
java.lang.String[] scanItems)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectregex - Specify a pattern to match only certain rule set names (if null, scans will be created for all user's rule sets)scanItems - Specify files and directories to scan (null = all) - Paths can be absolute or relative to project path, but must be within project pathGlobalyzerAPIException - on failurepublic static java.lang.String[] createProjectScans(java.lang.String projectName,
java.lang.String regex,
GlobalyzerAPIScanDetails details)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectregex - Specify a pattern to match only certain rule set names (if null, scans will be created for all user's rule sets)details - Optional scan detailsGlobalyzerAPIException - on failurepublic static java.lang.String generateDefaultScanName(java.lang.String projectName,
java.lang.String ruleSetName,
java.lang.String ruleSetOwner)
throws GlobalyzerAPIException
projectName - The name of the projectruleSetName - The rule set nameruleSetOwner - The owner of the rule set (if null, owner is current user)GlobalyzerAPIException - on failurepublic static void deleteScan(java.lang.String projectName,
java.lang.String scanName)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectscanName - The name of the scan to deleteGlobalyzerAPIException - on failurepublic static java.lang.String executeScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String reportPath,
GlobalyzerAPIReportTypes reportType)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectscanName - The name of the scan to execute (if null, all scans within project will be executed)reportPath - Where the generated report should be stored (if null, no report generated)reportType - The type of report to generate (if null, no report generated) - GlobalyzerAPIReportTypes.AggregateDetailedExcel, AggregateSummaryExcel, ScanDetailedExcel, ScanDetailedXML, ScanDetailedCSV, ScanSummaryHtml, or ScanSummaryTextGlobalyzerAPIException - on failurepublic static java.lang.Object[] executeScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String reportPath,
GlobalyzerAPIReportTypes reportType,
boolean generatePartialResults)
throws GlobalyzerAPIException
GlobalyzerAPIExceptionpublic static java.lang.Object[] executeScan(java.lang.String projectName,
java.lang.String scanName,
java.lang.String reportPath,
GlobalyzerAPIReportTypes reportType,
java.lang.String reportPriorities,
boolean generatePartialResults)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectscanName - The name of the scan to execute (if null, all scans within project will be executed)reportPath - Where the generated report should be stored (if null, no report generated)reportType - The type of report to generate (if null, no report generated) - GlobalyzerAPIReportTypes.AggregateDetailedExcel, AggregateSummaryExcel, ScanDetailedExcel, ScanDetailedXML, ScanDetailedCSV, ScanSummaryHtml, or ScanSummaryTextreportPriorities - Comma separated list of priorities to include in the report for example "C,1,2,3,4,5"; blank indicates allgeneratePartialResults - If true, will continue scanning files even if some have errors, and generate reports with partial results
Object[0] - String - generated report name (or null)
Object[1] - boolean - true if all files in scan(s) were successfully scanned
Example of use:
Object[] result = executeScan(...);
String reportName = (String)result[0];
boolean success = (boolean)result[1];
GlobalyzerAPIException - on failurepublic static java.lang.String getScanHistory(java.lang.String projectName,
java.lang.String scanName)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectscanName - The name of the scanGlobalyzerAPIException - on failurepublic static void deleteScanResults(java.lang.String projectName,
java.lang.String scanName)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectscanName - The name of the scanGlobalyzerAPIException - on failurepublic static void reloadRuleSets()
throws GlobalyzerAPIException
GlobalyzerAPIException - on failurepublic static void sendUseLog()
throws GlobalyzerAPIException
GlobalyzerAPIException - on failurepublic static void closeDatabaseConnection()
throws GlobalyzerAPIException
GlobalyzerAPIException - on failurepublic static java.lang.String getServerVersion()
throws GlobalyzerAPIException
GlobalyzerAPIException - on failurepublic static java.util.Date getAccountExpirationDate()
public static RuleSetNameAndOwner[] listRuleSets() throws GlobalyzerAPIException
GlobalyzerAPIException - on failurepublic static java.lang.String[] listProjects()
throws GlobalyzerAPIException
GlobalyzerAPIException - on failurepublic static java.lang.String[] listScans(java.lang.String projectName)
throws GlobalyzerAPIException
projectName - The name of the Globalyzer projectGlobalyzerAPIException - on failurepublic static void setSendScanHistory(boolean setting)
setting - true to send scan history to server; false otherwisepublic static boolean getSendScanHistory()
public static boolean isValidML(java.lang.String projectPath,
java.lang.String scanName)
projectPath - Absolute path to projectscanName - Name of scan