01 /*
02 * Controller.java
03 *
04 * Copyright (c) 1995-2010, The University of Sheffield. See the file
05 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
06 *
07 * This file is part of GATE (see http://gate.ac.uk/), and is free
08 * software, licenced under the GNU Library General Public License,
09 * Version 2, June 1991 (in the distribution as file licence.html,
10 * and also available at http://gate.ac.uk/gate/licence.html).
11 *
12 * Hamish Cunningham, 9/Nov/2000
13 *
14 * $Id: Controller.java 12006 2009-12-01 17:24:28Z thomas_heitz $
15 */
16
17 package gate;
18
19 import java.util.Collection;
20
21 import gate.creole.ControllerAwarePR;
22 import gate.creole.ExecutionException;
23 import gate.util.FeatureBearer;
24 import gate.util.NameBearer;
25
26 /**
27 * Models the execution of groups of ProcessingResources.
28 */
29 public interface Controller extends Resource, Executable, NameBearer,
30 FeatureBearer {
31 /**
32 * Returns all the {@link gate.ProcessingResource}s contained by this
33 * controller. The actual type of collection returned depends on the
34 * controller type.
35 */
36 public Collection getPRs();
37
38 /**
39 * Populates this controller from a collection of
40 * {@link ProcessingResource}s (optional operation).
41 *
42 * Controllers that are serializable must implement this method needed
43 * by GATE to restore their contents.
44 *
45 * @throws UnsupportedOperationException if the <tt>setPRs</tt>
46 * method is not supported by this controller.
47 */
48 public void setPRs(Collection PRs);
49
50 /**
51 * <p>
52 * Executes this controller. Different controller implementations will
53 * provide different strategies for executing the PRs they contain,
54 * e.g. execute the PRs one after the other in sequence, execute them
55 * once for each document in a corpus, or in parallel, based on some
56 * condition, or in a branching workflow arrangement, etc.
57 * </p>
58 *
59 * <p>
60 * If any of its child PRs implement the
61 * {@link gate.creole.ControllerAwarePR} interface, then the controller
62 * must ensure that all their relevant methods are called at the
63 * correct times. See the documentation for {@link ControllerAwarePR}
64 * for details.
65 * </p>
66 */
67 public void execute() throws ExecutionException;
68
69 } // interface Controller
|