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
{
25 // ------------------------------------------------------------------------
27 // ------------------------------------------------------------------------
30 * The request execution type/priority
32 public enum ExecutionType
{
34 * Backgroung, long-running, lower priority request
38 * Foreground, short-running, high priority request
43 // ------------------------------------------------------------------------
45 // ------------------------------------------------------------------------
48 * @return request data type (T)
50 public Class
<?
extends ITmfEvent
> getDataType();
55 public int getRequestId();
60 public ExecutionType
getExecType();
63 * @return the index of the first event requested
65 public long getIndex();
68 * @return the number of requested events
70 public int getNbRequested();
73 * @return the block size (for BG requests)
75 public int getBlockSize();
78 * @return the number of events read so far
80 public int getNbRead();
82 // ------------------------------------------------------------------------
83 // Request state predicates
84 // ------------------------------------------------------------------------
87 * @return true if the request is still active
89 public boolean isRunning();
92 * @return true if the request is completed
94 public boolean isCompleted();
97 * @return true if the request has failed
99 public boolean isFailed();
102 * @return true if the request was cancelled
104 public boolean isCancelled();
106 // ------------------------------------------------------------------------
108 // ------------------------------------------------------------------------
111 * Process the piece of data
113 * @param data the data to process
115 public void handleData(ITmfEvent data
);
117 // ------------------------------------------------------------------------
118 // Request notifications
119 // ------------------------------------------------------------------------
122 * Request processing start notification
124 public void handleStarted();
127 * Request processing completion notification
129 public void handleCompleted();
132 * Request successful completion notification
134 public void handleSuccess();
137 * Request failure notification
139 public void handleFailure();
142 * Request cancellation notification
144 public void handleCancel();
147 * To suspend the client thread until the request completes
150 * @throws InterruptedException thrown if the request was cancelled
152 public void waitForCompletion() throws InterruptedException
;
154 // ------------------------------------------------------------------------
155 // Request state modifiers
156 // ------------------------------------------------------------------------
159 * Put the request in the running state
164 * Put the request in the completed state
169 * Put the request in the failed completed state
174 * Put the request in the cancelled completed state
176 public void cancel();
This page took 0.03524 seconds and 5 git commands to generate.