01: package dalma;
02:
03: import java.util.logging.LogRecord;
04: import java.util.logging.Logger;
05: import java.util.List;
06: import java.util.Date;
07:
08: /**
09: * Represents a running instance of a workflow.
10: *
11: * @author Kohsuke Kawaguchi
12: */
13: public interface Conversation {
14:
15: /**
16: * Gets a unique number that identifies this conversation among
17: * other conversations in the same engine.
18: */
19: int getId();
20:
21: /**
22: * Gets the current state of the conversation.
23: */
24: ConversationState getState();
25:
26: /**
27: * Gets the engine to which this conversation belongs to.
28: */
29: Engine getEngine();
30:
31: /**
32: * Kills a conversation forcibly, even if it's running.
33: */
34: void remove();
35:
36: /**
37: * Gets the log that this conversation left.
38: *
39: * <p>
40: *
41: */
42: List<LogRecord> getLog();
43:
44: /**
45: * Waits for the completion of this conversation.
46: *
47: * <p>
48: * If called from a conversation, the calling conversation
49: * suspends and blocks until this conversation exits (and
50: * the thread will be reused to execute other conversations.)
51: *
52: * <p>
53: * If called from outside conversations, the calling
54: * method simply {@link #wait() waits}.
55: *
56: * @throws IllegalStateException
57: * If a conversation tries to join itself.
58: * @throws InterruptedException
59: * If this thread is interrupted while waiting.
60: */
61: // we don't need exit code for the same reason Thread doesn't need one.
62: void join() throws InterruptedException;
63:
64: /**
65: * Gets the title of this conversation.
66: *
67: * <p>
68: * This method returns the last value set by {@link #setTitle(String)}.
69: * Initially the value is null.
70: *
71: * @return
72: * any String. Possibly null.
73: */
74: String getTitle();
75:
76: /**
77: * Returns the time when this conversation is created.
78: *
79: * @return
80: * always non-null.
81: */
82: Date getStartDate();
83:
84: /**
85: * Returns the time when this conversation is completed.
86: *
87: * @return
88: * null if the conversation is not finished yet.
89: */
90: Date getCompletionDate();
91: }
|