source: trunk/src/org/expeditee/agents/Agent.java@ 1510

Last change on this file since 1510 was 919, checked in by jts21, 10 years ago

Added license headers to all files, added full GPL3 license file, moved license header generator script to dev/bin/scripts

File size: 2.5 KB
Line 
1/**
2 * Agent.java
3 * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package org.expeditee.agents;
20
21import org.expeditee.gui.Frame;
22import org.expeditee.items.Item;
23
24/**
25 * The Interface that all Agents must implement. This interface allows the JAG
26 * classes\ to be loaded dynamically at run-time.
27 *
28 * @author jdm18
29 *
30 */
31public interface Agent extends Runnable {
32
33 /**
34 * This method should always be called before calling process(). The Frame
35 * passed in should be scanned for any paramters that should be set before
36 * process() is called. If this method returns false then process() should
37 * not be called.
38 *
39 * @param toInit
40 * The Frame that has any parameters that need to be set before
41 * processing begins. It is also the first frame for the agent.
42 * @param launcher
43 * The item that was clicked on to launch this agent.
44 * @return True if the initialisation executed correctly, False if an error
45 * occured.
46 */
47 public boolean initialise(Frame toInit, Item launcher);
48
49 /**
50 * Specifies whether this Agents produces a Frame of results to be shown to
51 * the user after execution has completed, or if the program should return
52 * to the Frame the user was on when they invoked this Agent.
53 *
54 * @return True if this Agent produces a results Frame, false otherwise.
55 */
56 public boolean hasResultFrame();
57
58 public boolean hasResultString();
59
60 /**
61 * Returns the results Frame produced by this Agent. This method is only
62 * called if hasResultFrame() returns true. If hasResultFrame() returns
63 * false, it is expected that this method returns null.
64 *
65 * @return The result Frame produced by this Agent if there is one, or null
66 * otherwise.
67 */
68 public Frame getResultFrame();
69
70 public abstract boolean isRunning();
71
72 public abstract void stop();
73
74 public abstract void interrupt();
75}
Note: See TracBrowser for help on using the repository browser.