Commit | Line | Data |
---|---|---|
8c8bf09f | 1 | /******************************************************************************* |
96b353c5 | 2 | * Copyright (c) 2009, 2010, 2012 Ericsson |
0283f7ff | 3 | * |
8c8bf09f ASL |
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 | |
0283f7ff | 8 | * |
8c8bf09f ASL |
9 | * Contributors: |
10 | * Francois Chouinard - Initial API and implementation | |
96b353c5 | 11 | * Francois Chouinard - Replace background requests by pre-emptable requests |
8c8bf09f ASL |
12 | *******************************************************************************/ |
13 | ||
6c13869b | 14 | package org.eclipse.linuxtools.tmf.core.component; |
8c8bf09f | 15 | |
72f1e62a | 16 | import org.eclipse.linuxtools.tmf.core.event.ITmfEvent; |
8c8bf09f ASL |
17 | |
18 | /** | |
8fd82db5 | 19 | * An extension of TmfDataProvider timestamped events providers. |
0283f7ff | 20 | * |
8fd82db5 | 21 | * @author Francois Chouinard |
96b353c5 | 22 | * @version 1.1 |
8c8bf09f | 23 | */ |
6256d8ad | 24 | public abstract class TmfEventProvider extends TmfDataProvider { |
8c8bf09f | 25 | |
00641a97 FC |
26 | // ------------------------------------------------------------------------ |
27 | // Constructors | |
28 | // ------------------------------------------------------------------------ | |
29 | ||
063f0d27 AM |
30 | /** |
31 | * Default constructor | |
32 | */ | |
12c155f5 | 33 | public TmfEventProvider() { |
00641a97 | 34 | super(); |
12c155f5 | 35 | } |
8c8bf09f | 36 | |
9c272afc | 37 | @Override |
6256d8ad | 38 | public void init(String name, Class<? extends ITmfEvent> type) { |
3791b5df | 39 | super.init(name, type); |
12c155f5 | 40 | } |
8c8bf09f | 41 | |
063f0d27 AM |
42 | /** |
43 | * Standard constructor | |
44 | * | |
45 | * @param name | |
46 | * The name of the provider | |
47 | * @param type | |
48 | * The type of handled events | |
49 | */ | |
6256d8ad | 50 | public TmfEventProvider(String name, Class<? extends ITmfEvent> type) { |
12c155f5 FC |
51 | super(name, type); |
52 | } | |
53 | ||
063f0d27 AM |
54 | /** |
55 | * Standard constructor which also sets the queue size | |
56 | * | |
57 | * @param name | |
58 | * The name of the provider | |
59 | * @param type | |
60 | * The type of handled events | |
61 | * @param queueSize | |
62 | * The size of the queue | |
63 | */ | |
6256d8ad | 64 | public TmfEventProvider(String name, Class<? extends ITmfEvent> type, int queueSize) { |
12c155f5 FC |
65 | super(name, type, queueSize); |
66 | } | |
67 | ||
063f0d27 AM |
68 | /** |
69 | * Copy constructor | |
70 | * | |
71 | * @param other | |
72 | * The other TmfEventProvider to copy | |
73 | */ | |
6256d8ad | 74 | public TmfEventProvider(TmfEventProvider other) { |
00641a97 | 75 | super(other); |
12c155f5 FC |
76 | } |
77 | ||
00641a97 FC |
78 | // ------------------------------------------------------------------------ |
79 | // TmfDataProvider | |
80 | // ------------------------------------------------------------------------ | |
81 | ||
8584dc20 FC |
82 | // @Override |
83 | // public boolean isCompleted(ITmfDataRequest request, ITmfEvent data, int nbRead) { | |
84 | // boolean requestCompleted = super.isCompleted(request, data, nbRead); | |
85 | // if (!requestCompleted && request instanceof ITmfEventRequest) { | |
86 | // ITmfTimestamp endTime = ((ITmfEventRequest) request).getRange().getEndTime(); | |
87 | // return data.getTimestamp().compareTo(endTime, false) > 0; | |
88 | // } | |
89 | // return requestCompleted; | |
90 | // } | |
91 | // | |
92 | // @Override | |
93 | // protected synchronized void newCoalescedDataRequest(ITmfDataRequest request) { | |
94 | // if (request instanceof ITmfEventRequest) { | |
95 | // ITmfEventRequest eventRequest = (ITmfEventRequest) request; | |
96 | // TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(eventRequest.getDataType(), eventRequest.getRange(), | |
97 | // eventRequest.getIndex(), (int) eventRequest.getNbRequested(), eventRequest.getBlockSize(), eventRequest.getExecType()); | |
98 | // coalescedRequest.addRequest(eventRequest); | |
99 | // if (TmfCoreTracer.isRequestTraced()) { | |
100 | // TmfCoreTracer.traceRequest(request, "COALESCED with " + coalescedRequest.getRequestId()); //$NON-NLS-1$ | |
101 | // TmfCoreTracer.traceRequest(coalescedRequest, "now contains " + coalescedRequest.getSubRequestIds()); //$NON-NLS-1$ | |
102 | // } | |
103 | // fPendingCoalescedRequests.add(coalescedRequest); | |
104 | // } else { | |
105 | // super.newCoalescedDataRequest(request); | |
106 | // } | |
107 | // } | |
951d134a | 108 | |
8c8bf09f | 109 | } |