Commit | Line | Data |
---|---|---|
8c8bf09f ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009, 2010 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
6c13869b | 13 | package org.eclipse.linuxtools.tmf.core.request; |
8c8bf09f | 14 | |
72f1e62a | 15 | import org.eclipse.linuxtools.tmf.core.event.ITmfEvent; |
8c8bf09f ASL |
16 | |
17 | /** | |
18 | * <b><u>ITmfDataRequest</u></b> | |
19 | * <p> | |
20 | * TODO: Implement me. Please. | |
21 | */ | |
72f1e62a | 22 | public interface ITmfDataRequest<T extends ITmfEvent> { |
8c8bf09f | 23 | |
550d787e FC |
24 | // ------------------------------------------------------------------------ |
25 | // Constants | |
26 | // ------------------------------------------------------------------------ | |
27 | ||
f6b14ce2 | 28 | public enum ExecutionType { BACKGROUND, FOREGROUND }; |
550d787e | 29 | |
8c8bf09f ASL |
30 | // ------------------------------------------------------------------------ |
31 | // Accessors | |
32 | // ------------------------------------------------------------------------ | |
33 | ||
34 | /** | |
35 | * @return request data type (T) | |
36 | */ | |
37 | public Class<T> getDataType(); | |
38 | ||
39 | /** | |
40 | * @return request ID | |
41 | */ | |
2fb2eb37 | 42 | public int getRequestId(); |
8c8bf09f | 43 | |
550d787e FC |
44 | /** |
45 | * @return request ID | |
46 | */ | |
47 | public ExecutionType getExecType(); | |
48 | ||
8c8bf09f ASL |
49 | /** |
50 | * @return the index of the first event requested | |
51 | */ | |
52 | public int getIndex(); | |
53 | ||
54 | /** | |
55 | * @return the number of requested events | |
56 | */ | |
57 | public int getNbRequested(); | |
58 | ||
8016d660 FC |
59 | /** |
60 | * @return the block size (for BG requests) | |
61 | */ | |
62 | public int getBlockSize(); | |
63 | ||
8c8bf09f ASL |
64 | /** |
65 | * @return the number of events read so far | |
66 | */ | |
67 | public int getNbRead(); | |
68 | ||
69 | // ------------------------------------------------------------------------ | |
70 | // Request state | |
71 | // ------------------------------------------------------------------------ | |
72 | ||
550d787e | 73 | public boolean isRunning(); |
8c8bf09f ASL |
74 | public boolean isCompleted(); |
75 | public boolean isFailed(); | |
76 | public boolean isCancelled(); | |
77 | ||
78 | // ------------------------------------------------------------------------ | |
79 | // Data handling | |
80 | // ------------------------------------------------------------------------ | |
81 | ||
f9673903 | 82 | public void handleData(T data); |
8c8bf09f ASL |
83 | |
84 | // ------------------------------------------------------------------------ | |
85 | // Request handling | |
86 | // ------------------------------------------------------------------------ | |
87 | ||
550d787e | 88 | public void handleStarted(); |
8c8bf09f ASL |
89 | public void handleCompleted(); |
90 | public void handleSuccess(); | |
91 | public void handleFailure(); | |
92 | public void handleCancel(); | |
93 | ||
94 | /** | |
95 | * To suspend the client thread until the request completes | |
96 | * (or is canceled). | |
97 | */ | |
2fb2eb37 | 98 | public void waitForCompletion() throws InterruptedException; |
8c8bf09f ASL |
99 | |
100 | // ------------------------------------------------------------------------ | |
101 | // Request state modifiers | |
102 | // ------------------------------------------------------------------------ | |
103 | ||
550d787e | 104 | public void start(); |
8c8bf09f ASL |
105 | public void done(); |
106 | public void fail(); | |
107 | public void cancel(); | |
108 | } |