All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.elephantdrummer.classconfig.DrummerJobConfiguration Maven / Gradle / Ivy

There is a newer version: 1.2.5
Show newest version
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 annotationType() {
				// TODO Auto-generated method stub
				return null;
			}

			
			@Override
			public Class 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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy