Skip to content
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

Added missing docs for batch.core and batch.core.configuration packages #4068

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -126,7 +126,7 @@
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>2.22.2</maven-failsafe-plugin.version>
<maven-javadoc-plugin.version>3.3.1</maven-javadoc-plugin.version>
<maven-javadoc-plugin.version>3.3.2</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<jacoco-maven-plugin.version>0.8.7</jacoco-maven-plugin.version>
<flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,8 +37,46 @@ public enum BatchStatus {
* steps that have finished processing, but were not successful, and where
* they should be skipped on a restart (so FAILED is the wrong status).
*/
COMPLETED, STARTING, STARTED, STOPPING, STOPPED, FAILED, ABANDONED, UNKNOWN;

/**
* The batch job has successfully completed its execution
*/
COMPLETED,
/**
* Status of a batch job prior to execution of the job.
*/
STARTING,
/**
* Status of a batch job that is running.
*/
STARTED,
/**
* Status of batch job waiting for a step to complete before stopping the batch job.
*/
STOPPING,
/**
* Status of a batch job that has been stopped by request.
*/
STOPPED,
/**
* Status of a batch job that has failed during its execution.
*/
FAILED,
/**
* Status of a batch job that did not stop properly and can not be restarted.
*/
ABANDONED,
/**
* Status of a batch job that is in an uncertain state.
*/
UNKNOWN;

/**
* Convenience method to return the higher value status of the statuses pass in to the method.
* @param status1 The first status to check.
* @param status2 The second status to check.
* @return The higher value status of the two statuses.
*/
public static BatchStatus max(BatchStatus status1, BatchStatus status2) {
return status1.isGreaterThan(status2) ? status1 : status2;
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,10 @@
*/
public interface ChunkListener extends StepListener {

static final String ROLLBACK_EXCEPTION_KEY = "sb_rollback_exception";
/**
* The key for retrieving the rollback exception.
*/
String ROLLBACK_EXCEPTION_KEY = "sb_rollback_exception";

/**
* Callback before the chunk is executed, but inside the transaction.
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,10 +37,18 @@ public class Entity implements Serializable {

private volatile Integer version;

/**
* Default constructor for {@link Entity}.
* The ID defaults to zero.
*/
public Entity() {
super();
}

/**
* The constructor for the {@link Entity} where the id is established.
* @param id The ID for the entity.
*/
public Entity(Long id) {
super();

Expand All @@ -50,10 +58,16 @@ public Entity(Long id) {
this.id = id;
}

/**
* @return The ID associated with the {@link Entity}.
*/
public Long getId() {
return id;
}

/**
* @param id The ID for the {@link Entity}.
*/
public void setId(Long id) {
this.id = id;
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -74,10 +74,21 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {

private final String exitDescription;

/**
* Constructor that accepts the exitCode and sets the exitDescription to an empty {@link String}.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change exitCode and exitDescription to exit code and exit description (that is, say it in English rather than Java).

*
* @param exitCode The exit code to be used for the {@link ExitStatus}.
*/
public ExitStatus(String exitCode) {
this(exitCode, "");
}

/**
* Constructor that establishes the exitCode and the exitDescription for the {@link ExitStatus}.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change exitCode and exitDescription to exit code and exit description (that is, say it in English rather than Java).

*
* @param exitCode The exit code to be used for the {@link ExitStatus}.
* @param exitDescription The exit description to be used for the {@link ExitStatus}.
*/
public ExitStatus(String exitCode, String exitDescription) {
super();
this.exitCode = exitCode;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -65,6 +65,10 @@ public class JobExecution extends Entity {

private transient volatile List<Throwable> failureExceptions = new CopyOnWriteArrayList<>();

/**
* Constructor that sets the state of the instance to the {@link JobExecution} parameter.
* @param original The {@link JobExecution} to be copied.
*/
public JobExecution(JobExecution original) {
this.jobParameters = original.getJobParameters();
this.jobInstance = original.getJobInstance();
Expand Down Expand Up @@ -98,45 +102,78 @@ public JobExecution(JobInstance job, Long id, @Nullable JobParameters jobParamet
/**
* Constructor for transient (unsaved) instances.
*
* @param job the enclosing {@link JobInstance}
* @param jobParameters {@link JobParameters} instance for this JobExecution.
* @param job The enclosing {@link JobInstance}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a period at the end.

* @param jobParameters The {@link JobParameters} instance for this JobExecution.
*/
public JobExecution(JobInstance job, JobParameters jobParameters) {
this(job, null, jobParameters);
}

/**
* Constructor that accepts the current job execution ID and {@link JobParameters}.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "current".

* @param id The job execution ID.
* @param jobParameters The {@link JobParameters} for the {@link JobExecution}.
*/
public JobExecution(Long id, JobParameters jobParameters) {
this(null, id, jobParameters);
}

/**
* Constructor that accepts the current job execution ID.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "current".

* @param id The job execution ID.
*/
public JobExecution(Long id) {
this(null, id, null);
}

/**
* @return The current {@link JobParameters}.
*/
public JobParameters getJobParameters() {
return this.jobParameters;
}

/**
* @return The current end time.
*/
public Date getEndTime() {
return endTime;
}

/**
* Set the {@link JobInstance} used by the {@link JobExecution}.
* @param jobInstance The {@link JobInstance} used by the {@link JobExecution}.
*/
public void setJobInstance(JobInstance jobInstance) {
this.jobInstance = jobInstance;
}

/**
* Set the end time.
* @param endTime The {@link Date} to be used for the end time.
*/
public void setEndTime(Date endTime) {
this.endTime = endTime;
}

/**
* @return The current start time.
*/
public Date getStartTime() {
return startTime;
}

/**
* Set the start time.
* @param startTime The {@link Date} to be used for the start time.
*/
public void setStartTime(Date startTime) {
this.startTime = startTime;
}

/**
* @return The current {@link BatchStatus}.
*/
public BatchStatus getStatus() {
return status;
}
Expand Down Expand Up @@ -297,6 +334,10 @@ public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}

/**
* Retrieve a list of exceptions.
* @return The {@link List} of {@link Throwable}s.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change "{@link Throwable}s." to "{@link Throwable} objects."

General rule: Don't try to make a plural out of something that needs to have its own formatting (a link, in this case). It nearly always causes rendering problems.

*/
public List<Throwable> getFailureExceptions() {
return failureExceptions;
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,6 +43,11 @@ public class JobInstance extends Entity {

private final String jobName;

/**
* Constructor for {@link JobInstance}.
* @param id The instance ID.
* @param jobName The name associated with the {@link JobInstance}.
*/
public JobInstance(Long id, String jobName) {
super(id);
Assert.hasLength(jobName, "A jobName is required");
Expand All @@ -61,6 +66,9 @@ public String toString() {
return super.toString() + ", Job=[" + jobName + "]";
}

/**
* @return The current instance ID.
*/
public long getInstanceId() {
return super.getId();
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,10 +33,19 @@ public class JobInterruptedException extends JobExecutionException {

private BatchStatus status = BatchStatus.STOPPED;

/**
* Constructor that sets the message for the exception.
* @param msg The message for the exception.
*/
public JobInterruptedException(String msg) {
super(msg);
}

/**
* Constructor that sets the message for the exception.
* @param msg The message for the exception.
* @param status The desired {@link BatchStatus} of the surrounding execution after interruption.
*/
public JobInterruptedException(String msg, BatchStatus status) {
super(msg);
this.status = status;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -125,6 +125,9 @@ public JobParameter(Double parameter) {
this(parameter, true);
}

/**
* @return The identifying flag. It is set to true if the job parameter is identifying.
*/
public boolean isIdentifying() {
return identifying;
}
Expand Down Expand Up @@ -168,10 +171,25 @@ public int hashCode() {
}

/**
* Enumeration representing the type of a JobParameter.
* Enumeration representing the type of {@link JobParameter}.
*/
public enum ParameterType {

STRING, DATE, LONG, DOUBLE;
/**
* String parameter type.
*/
STRING,
/**
* Date parameter type.
*/
DATE,
/**
* Long parameter type.
*/
LONG,
/**
* Double parameter type.
*/
DOUBLE;
}
}