~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/request/ITmfDataRequest.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
13
package org.eclipse.linuxtools.tmf.core.request;
 
14
 
 
15
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 
16
 
 
17
/**
 
18
 * The TMF data request
 
19
 * 
 
20
 * @version 1.0
 
21
 * @author Francois Chouinard
 
22
 */
 
23
public interface ITmfDataRequest<T extends ITmfEvent> {
 
24
 
 
25
        // ------------------------------------------------------------------------
 
26
        // Constants
 
27
        // ------------------------------------------------------------------------
 
28
 
 
29
    public enum ExecutionType { BACKGROUND, FOREGROUND };
 
30
    
 
31
        // ------------------------------------------------------------------------
 
32
        // Accessors
 
33
        // ------------------------------------------------------------------------
 
34
 
 
35
    /**
 
36
     * @return request data type (T)
 
37
     */
 
38
    public Class<T> getDataType();
 
39
 
 
40
    /**
 
41
     * @return request ID
 
42
     */
 
43
    public int getRequestId();
 
44
 
 
45
    /**
 
46
     * @return request ID
 
47
     */
 
48
    public ExecutionType getExecType();
 
49
 
 
50
    /**
 
51
         * @return the index of the first event requested
 
52
     */
 
53
    public long getIndex();
 
54
 
 
55
    /**
 
56
     * @return the number of requested events
 
57
     */
 
58
    public int getNbRequested();
 
59
 
 
60
    /**
 
61
     * @return the block size (for BG requests)
 
62
     */
 
63
    public int getBlockSize();
 
64
 
 
65
    /**
 
66
     * @return the number of events read so far
 
67
     */
 
68
    public int getNbRead();
 
69
 
 
70
        // ------------------------------------------------------------------------
 
71
        // Request state
 
72
        // ------------------------------------------------------------------------
 
73
 
 
74
    public boolean isRunning();
 
75
    public boolean isCompleted();
 
76
    public boolean isFailed();
 
77
    public boolean isCancelled();
 
78
 
 
79
        // ------------------------------------------------------------------------
 
80
        // Data handling
 
81
        // ------------------------------------------------------------------------
 
82
 
 
83
    public void handleData(T data);
 
84
 
 
85
        // ------------------------------------------------------------------------
 
86
        // Request handling
 
87
        // ------------------------------------------------------------------------
 
88
 
 
89
    public void handleStarted();
 
90
    public void handleCompleted();
 
91
    public void handleSuccess();
 
92
    public void handleFailure();
 
93
    public void handleCancel();
 
94
 
 
95
    /**
 
96
     * To suspend the client thread until the request completes
 
97
     * (or is canceled).
 
98
     */
 
99
    public void waitForCompletion() throws InterruptedException;
 
100
 
 
101
        // ------------------------------------------------------------------------
 
102
        // Request state modifiers
 
103
        // ------------------------------------------------------------------------
 
104
 
 
105
    public void start();
 
106
    public void done();
 
107
    public void fail();
 
108
    public void cancel();
 
109
}