com.elephantdrummer.classconfig.DrummerJobConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of drummer Show documentation
Show all versions of drummer Show documentation
Elephant Drummer Java Job Scheduler
package com.elephantdrummer.classconfig;
import java.lang.annotation.Annotation;
import java.util.LinkedList;
import java.util.List;
import com.elephantdrummer.annotation.DrummerJob;
import com.elephantdrummer.annotation.trigger.At;
import com.elephantdrummer.annotation.trigger.Every;
import com.elephantdrummer.annotation.trigger.Range;
import com.elephantdrummer.classconfig.base.AtConfig;
import com.elephantdrummer.classconfig.base.EveryConfig;
import com.elephantdrummer.classconfig.base.ShiftConfig;
import com.elephantdrummer.trigger.DummyTrigger;
import com.elephantdrummer.trigger.base.DrumTrigger;
/**
* Copyright 2018 Elephant Software Klaudiusz Wojtkowiak e-mail: [email protected]
*
* 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
*
* http://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.
*/
public class DrummerJobConfiguration extends JobClassConfig {
private String name;
private int threads=0;
private int priority=0;
private List everyList=new LinkedList<>();
private List atList=new LinkedList<>();
private ShiftConfig shift=new ShiftConfig();
private boolean clusterSingleExecution=false;
private boolean onStartup=false;
private boolean skipExecutionWhenPreviousJobIsRunning=false;
private boolean cacheThreads=false;
private List cronList=new LinkedList<>();
// @Override
public String getDescription() {
return "Drummer Job configuration";
}
@Override
public DrummerJob getDrummerJob(){
DrummerJob drummerJob=new DrummerJob() {
@Override
public Class extends Annotation> annotationType() {
// TODO Auto-generated method stub
return null;
}
@Override
public Class extends DrumTrigger> trigger() {
return DummyTrigger.class;
}
@Override
public int threads() {
return getThreads();
}
@Override
public Range shift() {
return getShiftConfig().getPeriod();
}
@Override
public Every[] every() {
if (everyList==null) return new Every[] {};
Every[] rv=new Every[everyList.size()];
for (int i=0;i