1 /** 2 * PETALS - PETALS Services Platform. 3 * Copyright (c) 2006 EBM Websourcing, http://www.ebmwebsourcing.com/ 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * 18 * ------------------------------------------------------------------------- 19 * $Id: Task.java 154 6 oct. 06 ofabre $ 20 * ------------------------------------------------------------------------- 21 */ 22 package org.objectweb.petals.processor; 23 24 import java.util.HashMap; 25 26 /** 27 * A Task is an execution unit, that can be executed or undo. Tasks can be used 28 * by a processor that will execute them and reverse execution in case of fault. 29 * 30 * @author ofabre - EBM Websourcing 31 * 32 */ 33 public interface Task { 34 35 /** 36 * Launch the task with the given context. Task can modify information 37 * included in this context during execution. 38 * 39 * @param context 40 * the execution context handling input and output information 41 * @throws Exception 42 * if an error occurs during Task processing 43 */ 44 void execute(HashMap context) throws Exception; 45 46 /** 47 * Reverse the task in order to retrieve the environ state before execution 48 * of this task. 49 * 50 * @param context 51 * the execution context handling input and output information 52 * @throws Exception 53 * if an error occurs during Task unprocessing 54 */ 55 void undo(HashMap context) throws Exception; 56 } 57