1 /* 2 * Copyright the original author or authors. 3 * 4 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.mozilla.org/MPL/MPL-1.1.html 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import org.as2lib.app.exec.Process; 18 19 /** 20 * {@code Batch} is the definition for a list of processes that will be executed 21 * after each other. 22 * 23 * <p>{@code Batch} allows with {@link #addProcess} to define a list of processes 24 * that will be started after each other. The execution will follow in the order 25 * of the arrival. 26 * 27 * <p>{@code Batch} is a composite (it implements {@link Process}), so you can 28 * even add one {@code Batch} with {@link #addProcess} to another {@code Batch}. 29 * 30 * <p>It supports beneath all listeners of {@link Process} seperate events for 31 * {@code Batch} processing: 32 * {@link BatchStartListener}, {@link BatchFinishListener}, 33 * {@link BatchUpdateListener} and {@link BatchErrorListener} 34 * 35 * <p>Example: 36 * <code> 37 * import org.as2lib.app.exec.Batch; 38 * import org.as2lib.app.exec.BatchProcess; 39 * 40 * var b:Batch = new BatchProcess(); 41 * b.addListener(new MyStartUpController()); 42 * b.addProcess(new MyStartUpProcess()); 43 * b.addProcess(new MyXMLParsingProcess()); 44 * b.start(); 45 * </code> 46 * 47 * @author Martin Heidegger 48 * @version 1.0 49 * @see Process 50 */ 51 interface org.as2lib.app.exec.Batch extends Process { 52 53 /** 54 * Adds a {@link Process} to the list of processes to execute. 55 * 56 * <p>Its possible to at the same process more than one times. It will be 57 * executed as often as you add it. 58 * 59 * @param process {@link Process} to be added 60 * @return internal identifier of the process 61 */ 62 public function addProcess(process:Process):Number; 63 64 /** 65 * Removes all instances of a process that were added to the {@code Batch}. 66 * 67 * @param process {@link Process} to be removed 68 */ 69 public function removeProcess(process:Process):Void; 70 71 /** 72 * Removes a {@code Process} with a certain id of the {@code Batch}. 73 * 74 * <p>This is necessary if you add the same process more than once. 75 * 76 * @param id identifier for the certain {@code Process} 77 */ 78 public function removeProcessById(id:Number):Void ; 79 80 /** 81 * Returns the currently execution {@code Process} 82 * 83 * @return currently executing {@code Process} 84 */ 85 public function getCurrentProcess(Void):Process; 86 }