Skip to content

Add Javadoc to public methods in de.rub.nds.crawler.core.jobs package #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/main/java/de/rub/nds/crawler/core/jobs/PublishBulkScanJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ public class PublishBulkScanJob implements Job {

private static final Logger LOGGER = LogManager.getLogger();

/**
* Executes the bulk scan job which creates scan jobs for a list of targets. This method
* performs the following operations:
*
* <ul>
* <li>Creates and persists a BulkScan entity
* <li>Filters targets based on denylist and DNS resolution
* <li>Submits valid scan jobs to the orchestration provider
* <li>Updates bulk scan statistics with job counts
* </ul>
*
* @param context the job execution context containing configuration and provider instances
* @throws JobExecutionException if an error occurs during job execution
*/
public void execute(JobExecutionContext context) throws JobExecutionException {
try {
JobDataMap data = context.getMergedJobDataMap();
Expand Down Expand Up @@ -109,6 +123,15 @@ private static class JobSubmitter implements Function<String, JobStatus> {
private final BulkScan bulkScan;
private final int defaultPort;

/**
* Constructs a JobSubmitter for processing and submitting scan jobs.
*
* @param orchestrationProvider provider for submitting scan jobs to the message queue
* @param persistenceProvider provider for persisting scan results
* @param denylistProvider provider for checking if targets are denylisted
* @param bulkScan the bulk scan context for which jobs are being created
* @param defaultPort the default port to use if not specified in target string
*/
public JobSubmitter(
IOrchestrationProvider orchestrationProvider,
IPersistenceProvider persistenceProvider,
Expand All @@ -122,6 +145,22 @@ public JobSubmitter(
this.defaultPort = defaultPort;
}

/**
* Processes a target string to create and submit a scan job. This method performs the
* following operations:
*
* <ul>
* <li>Parses the target string and resolves the hostname
* <li>Checks if the target is denylisted
* <li>Creates a scan job description
* <li>Submits valid jobs to the orchestration provider
* <li>Persists error results for invalid targets
* </ul>
*
* @param targetString the target to scan (hostname, IP address, or hostname:port)
* @return the status of the job (TO_BE_EXECUTED, DENYLISTED, UNRESOLVABLE, or
* RESOLUTION_ERROR)
*/
@Override
public JobStatus apply(String targetString) {
ScanJobDescription jobDescription;
Expand Down