1 package net.sf.appstatus.core.batch; 2 3 import java.util.List; 4 import java.util.Properties; 5 6 import net.sf.appstatus.core.AppStatus; 7 8 /** 9 * 10 * @author Nicolas Richeton 11 * 12 */ 13 public interface IBatchManager { 14 15 /** 16 * Removes batches older than 6 months (default), or older than value 17 * specified in configuration. 18 */ 19 public int REMOVE_OLD = 1; 20 21 /** 22 * Removes all jobs with no error or rejects. 23 */ 24 public int REMOVE_SUCCESS = 2; 25 26 /** 27 * Creates and adds a new Batch to the batch manager. 28 * <p> 29 * If the batch already exists (same uuid). The existing one is returned. 30 * 31 * <p> 32 * NOTE: This method is not intended to be called directly. 33 * 34 * @see AppStatus#getBatchProgressMonitor() 35 * 36 * @param name 37 * @param group 38 * @param uuid 39 * @return new or existing batch object. 40 * 41 */ 42 IBatch addBatch(String name, String group, String uuid); 43 44 /** 45 * Ordered by update date DESC 46 * 47 * @return 48 */ 49 50 List<IBatch> getBatches(String group, String name); 51 52 /** 53 * Get current configuration. 54 * 55 * @return 56 */ 57 Properties getConfiguration(); 58 59 /** 60 * Ordered by update date DESC 61 * 62 * @return 63 */ 64 List<IBatch> getErrorBatches(); 65 66 /** 67 * Ordered by update date DESC 68 * 69 * @return 70 */ 71 72 List<IBatch> getFinishedBatches(); 73 74 /** 75 * Returns the batch monitor for this batch. 76 * <p> 77 * The same progress monitor is always returned. It is expected that only a 78 * single thread updates the monitor. 79 * 80 * @param batch 81 * @return 82 */ 83 IBatchProgressMonitor getMonitor(IBatch batch); 84 85 /** 86 * Returns the list of batchs which are currently running. 87 * 88 * @return 89 */ 90 List<IBatch> getRunningBatches(); 91 92 void init(); 93 94 /** 95 * Removes all jobs matching the scope value. 96 * 97 * @param scope 98 * {@value #REMOVE_OLD} or {@link #REMOVE_SUCCESS} 99 */ 100 void removeAllBatches(int scope); 101 102 /** 103 * Removes a specific job. 104 * 105 * @param b 106 */ 107 void removeBatch(String uuid); 108 109 /** 110 * Inject configuration for service manager. 111 * 112 * @param configuration 113 */ 114 void setConfiguration(Properties configuration); 115 }