1
/*******************************************************************************
2
* Copyright (c) 2009, 2010 Ericsson
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
10
* Francois Chouinard - Initial API and implementation
11
*******************************************************************************/
13
package org.eclipse.linuxtools.tmf.core.request;
15
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
18
* The TMF data request
21
* @author Francois Chouinard
23
public interface ITmfDataRequest<T extends ITmfEvent> {
25
// ------------------------------------------------------------------------
27
// ------------------------------------------------------------------------
29
public enum ExecutionType { BACKGROUND, FOREGROUND };
31
// ------------------------------------------------------------------------
33
// ------------------------------------------------------------------------
36
* @return request data type (T)
38
public Class<T> getDataType();
43
public int getRequestId();
48
public ExecutionType getExecType();
51
* @return the index of the first event requested
53
public long getIndex();
56
* @return the number of requested events
58
public int getNbRequested();
61
* @return the block size (for BG requests)
63
public int getBlockSize();
66
* @return the number of events read so far
68
public int getNbRead();
70
// ------------------------------------------------------------------------
72
// ------------------------------------------------------------------------
74
public boolean isRunning();
75
public boolean isCompleted();
76
public boolean isFailed();
77
public boolean isCancelled();
79
// ------------------------------------------------------------------------
81
// ------------------------------------------------------------------------
83
public void handleData(T data);
85
// ------------------------------------------------------------------------
87
// ------------------------------------------------------------------------
89
public void handleStarted();
90
public void handleCompleted();
91
public void handleSuccess();
92
public void handleFailure();
93
public void handleCancel();
96
* To suspend the client thread until the request completes
99
public void waitForCompletion() throws InterruptedException;
101
// ------------------------------------------------------------------------
102
// Request state modifiers
103
// ------------------------------------------------------------------------
108
public void cancel();