Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
183 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
spring-batch-core/src/main/java/org/springframework/batch/core/job/CommonJobProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* | ||
* 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.batch.core.job; | ||
|
||
import java.util.ArrayList; | ||
import java.util.LinkedHashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import io.micrometer.core.instrument.MeterRegistry; | ||
import io.micrometer.observation.ObservationRegistry; | ||
|
||
import org.springframework.batch.core.Job; | ||
import org.springframework.batch.core.JobExecutionListener; | ||
import org.springframework.batch.core.JobParametersIncrementer; | ||
import org.springframework.batch.core.JobParametersValidator; | ||
import org.springframework.batch.core.repository.JobRepository; | ||
|
||
/** | ||
* A common properties for {@link Job}. | ||
* | ||
* @author Taeik Lim | ||
*/ | ||
public class CommonJobProperties { | ||
|
||
private String name; | ||
|
||
private boolean restartable = true; | ||
|
||
private JobRepository jobRepository; | ||
|
||
private ObservationRegistry observationRegistry; | ||
|
||
private MeterRegistry meterRegistry; | ||
|
||
private JobParametersIncrementer jobParametersIncrementer; | ||
|
||
private JobParametersValidator jobParametersValidator; | ||
|
||
private Set<JobExecutionListener> jobExecutionListeners = new LinkedHashSet<>(); | ||
|
||
public CommonJobProperties() { | ||
} | ||
|
||
public CommonJobProperties(CommonJobProperties properties) { | ||
this.name = properties.name; | ||
this.restartable = properties.restartable; | ||
this.jobRepository = properties.jobRepository; | ||
this.observationRegistry = properties.observationRegistry; | ||
this.meterRegistry = properties.meterRegistry; | ||
this.jobParametersIncrementer = properties.jobParametersIncrementer; | ||
this.jobParametersValidator = properties.jobParametersValidator; | ||
this.jobExecutionListeners = new LinkedHashSet<>(properties.jobExecutionListeners); | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public boolean getRestartable() { | ||
return restartable; | ||
} | ||
|
||
public void setRestartable(boolean restartable) { | ||
this.restartable = restartable; | ||
} | ||
|
||
public JobRepository getJobRepository() { | ||
return jobRepository; | ||
} | ||
|
||
public void setJobRepository(JobRepository jobRepository) { | ||
this.jobRepository = jobRepository; | ||
} | ||
|
||
public ObservationRegistry getObservationRegistry() { | ||
return observationRegistry; | ||
} | ||
|
||
public void setObservationRegistry(ObservationRegistry observationRegistry) { | ||
this.observationRegistry = observationRegistry; | ||
} | ||
|
||
public MeterRegistry getMeterRegistry() { | ||
return meterRegistry; | ||
} | ||
|
||
public void setMeterRegistry(MeterRegistry meterRegistry) { | ||
this.meterRegistry = meterRegistry; | ||
} | ||
|
||
public JobParametersIncrementer getJobParametersIncrementer() { | ||
return jobParametersIncrementer; | ||
} | ||
|
||
public void setJobParametersIncrementer(JobParametersIncrementer jobParametersIncrementer) { | ||
this.jobParametersIncrementer = jobParametersIncrementer; | ||
} | ||
|
||
public JobParametersValidator getJobParametersValidator() { | ||
return jobParametersValidator; | ||
} | ||
|
||
public void setJobParametersValidator(JobParametersValidator jobParametersValidator) { | ||
this.jobParametersValidator = jobParametersValidator; | ||
} | ||
|
||
public List<JobExecutionListener> getJobExecutionListeners() { | ||
return new ArrayList<>(jobExecutionListeners); | ||
} | ||
|
||
public void addJobExecutionListener(JobExecutionListener jobExecutionListener) { | ||
this.jobExecutionListeners.add(jobExecutionListener); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.