Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 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 | * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation | |
3f2b9283 | 11 | * Marc Dumais (marc.dumais@ericsson.com) - Fix for 316455 (first part) |
5d10d135 ASL |
12 | *******************************************************************************/ |
13 | package org.eclipse.linuxtools.lttng.request; | |
14 | ||
15 | import org.eclipse.linuxtools.lttng.event.LttngEvent; | |
5d10d135 ASL |
16 | import org.eclipse.linuxtools.tmf.event.TmfTimeRange; |
17 | import org.eclipse.linuxtools.tmf.event.TmfTimestamp; | |
18 | import org.eclipse.linuxtools.tmf.experiment.TmfExperiment; | |
550d787e | 19 | import org.eclipse.linuxtools.tmf.request.ITmfDataRequest; |
5d10d135 ASL |
20 | import org.eclipse.linuxtools.tmf.request.TmfEventRequest; |
21 | ||
22 | /** | |
23 | * This class is an extension of Tmf Event Request which includes specific | |
24 | * references i.e. a status listener to indicate the start and end of the | |
25 | * request | |
26 | * | |
27 | * @author alvaro | |
28 | * | |
29 | */ | |
30 | public abstract class LttngBaseEventRequest extends TmfEventRequest<LttngEvent> { | |
31 | ||
32 | // ======================================================================== | |
33 | // Data | |
34 | // ======================================================================= | |
35 | private long numOfEvents = 0; | |
36 | private boolean clearDataInd = false; | |
5d10d135 ASL |
37 | /** |
38 | * The time to send events to the application as requested, Note: The start | |
39 | * time of the request for base events is adjusted to the nearest check | |
40 | * point | |
41 | */ | |
42 | private final TmfTimestamp fDispatchTime; | |
43 | ||
44 | // ======================================================================== | |
45 | // Constructors | |
46 | // ======================================================================= | |
47 | /** | |
48 | * @param range | |
49 | * @param dispatchTime | |
50 | * @param offset | |
51 | * @param nbEvents | |
52 | * @param maxBlockSize | |
3f2b9283 | 53 | * @param traceState |
5d10d135 ASL |
54 | * @param listener |
55 | */ | |
9b635e61 | 56 | public LttngBaseEventRequest(TmfTimeRange range, TmfTimestamp dispatchTime, long offset, int nbEvents, |
3f2b9283 | 57 | int maxBlockSize, ITmfDataRequest.ExecutionType execType) { |
a79913eb | 58 | super(LttngEvent.class, range, (int) offset, nbEvents, maxBlockSize, execType); |
5d10d135 ASL |
59 | fDispatchTime = dispatchTime; |
60 | } | |
61 | ||
cb866e08 FC |
62 | @Override |
63 | public void cancel() { | |
64 | super.cancel(); | |
65 | } | |
66 | ||
5d10d135 ASL |
67 | // ======================================================================== |
68 | // Methods | |
69 | // ======================================================================= | |
70 | ||
71 | /** | |
72 | * Trigger the start to process this request right after the notification to | |
73 | * the interested listeners | |
74 | * | |
75 | * @param experiment | |
76 | * @param broadcast | |
77 | * true: All views, false: only to registered listeners | |
78 | */ | |
79 | public void startRequestInd(TmfExperiment<LttngEvent> experiment, | |
80 | boolean broadcast) { | |
81 | // trigger the start to process this request | |
82 | experiment.sendRequest(this); | |
83 | } | |
84 | ||
85 | /** | |
86 | * @param numOfEvents | |
87 | * the numOfEvents to set | |
88 | */ | |
89 | public void setNumOfEvents(long numOfEvents) { | |
90 | this.numOfEvents = numOfEvents; | |
91 | } | |
92 | ||
93 | /** | |
94 | * @return the numOfEvents | |
95 | */ | |
96 | public long getNumOfEvents() { | |
97 | return numOfEvents; | |
98 | } | |
99 | ||
100 | /** | |
101 | * @param clearAllData | |
102 | * indicates the need to clear all previous data e.g. a new | |
103 | * experiment selection | |
104 | */ | |
105 | public void setclearDataInd(boolean clearAllData) { | |
106 | this.clearDataInd = clearAllData; | |
107 | } | |
108 | ||
109 | /** | |
110 | * Returns indication - clearing of all existing data model is required e.g | |
111 | * from the selection of a new experiment | |
112 | * | |
113 | * @return | |
114 | */ | |
115 | public boolean isclearDataInd() { | |
116 | return clearDataInd; | |
117 | } | |
118 | ||
5d10d135 ASL |
119 | /** |
120 | * @return The time to start dispatching events to the application | |
121 | */ | |
122 | public TmfTimestamp getDispatchTime() { | |
123 | return fDispatchTime; | |
124 | } | |
3f2b9283 | 125 | |
5d10d135 | 126 | } |