1 /* 2 Copyright (C) 2006 Grid Systems, S.A. 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 package com.gridsystems.nextgrid.api.pom; 19 20 import java.net.URI; 21 22 import nextgrid.api.pom.ProcessException; 23 24 /** 25 * Variant of the Runnable interface. 26 */ 27 public interface Enactable { 28 /** 29 * Performs the actual enaction of a process. 30 * <p> 31 * The instance must take into account possible errors, like service 32 * unavailability, or execution errors. As long as there are more "valid" 33 * candidates for the process, errors should not be propagated to the parent, 34 * and the next candidate should be selected and enacted. 35 * <p> 36 * A ProcessException as a result of this call means that this process is 37 * unable to correctly finish its execution, and that the parent must do 38 * something to fix the problem. 39 * 40 * @param ctx A process context 41 * @throws InterruptedException If the thread is interrupted 42 * @throws ProcessException If an unrecoverable local error occurs 43 */ 44 void run(ProcessContext ctx) throws ProcessException, InterruptedException; 45 46 /** 47 * Gets the name of this instance. The name will be used to set the 48 * name of the wrapping Thread. 49 * <p> 50 * The name type and method name are intentionally the same as in the 51 * Process interface, because in most cases, the implementor class for 52 * this interface will be a Process implementation. 53 * 54 * @return A name 55 */ 56 URI getId(); 57 }