1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 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
.tracecompass
.tmf
.tests
.stubs
.trace
;
15 import java
.lang
.reflect
.Method
;
16 import java
.util
.LinkedList
;
17 import java
.util
.List
;
19 import org
.eclipse
.core
.resources
.IResource
;
20 import org
.eclipse
.tracecompass
.internal
.tmf
.core
.request
.TmfCoalescedEventRequest
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.component
.TmfEventProvider
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
23 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
24 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.experiment
.TmfExperiment
;
25 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.indexer
.ITmfTraceIndexer
;
28 * <b><u>TmfExperimentStub</u></b>
30 * Implement me. Please.
33 @SuppressWarnings("javadoc")
34 public class TmfExperimentStub
extends TmfExperiment
{
37 * Default constructor. Should not be called directly by the code, but
38 * needed for the extension point.
40 * @deprecated Only used by the extension point.
43 public TmfExperimentStub() {
47 public TmfExperimentStub(String name
, ITmfTrace
[] traces
, int blockSize
) {
48 super(ITmfEvent
.class, name
, traces
, blockSize
, null);
52 protected ITmfTraceIndexer
createIndexer(int interval
) {
53 return new TmfIndexerStub(this, interval
);
57 public TmfIndexerStub
getIndexer() {
58 return (TmfIndexerStub
) super.getIndexer();
62 public void initExperiment(final Class
<?
extends ITmfEvent
> type
, final String path
, final ITmfTrace
[] traces
, final int indexPageSize
, IResource resource
) {
63 super.initExperiment(type
, path
, traces
, indexPageSize
, resource
);
67 * @return a copy of the pending request list
68 * @throws Exception if java reflection failed
70 public List
<TmfCoalescedEventRequest
> getAllPendingRequests() throws Exception
{
71 Method m
= TmfEventProvider
.class.getDeclaredMethod("getPendingRequests");
72 m
.setAccessible(true);
73 LinkedList
<?
> list
= (LinkedList
<?
>) m
.invoke(this);
74 LinkedList
<TmfCoalescedEventRequest
> retList
= new LinkedList
<>();
75 for (Object element
: list
) {
76 retList
.add((TmfCoalescedEventRequest
) element
);
83 * Clears the pending request list
84 * @throws Exception if java reflection failed
86 public void clearAllPendingRequests() throws Exception
{
87 Method m
= TmfEventProvider
.class.getDeclaredMethod("clearPendingRequests");
88 m
.setAccessible(true);
96 * @throws Exception if java reflection failed
98 public void setTimerEnabledFlag(boolean enabled
) throws Exception
{
99 Class
<?
>[] paramTypes
= new Class
[1];
100 paramTypes
[0] = Boolean
.class;
101 Method m
= TmfEventProvider
.class.getDeclaredMethod("setTimerEnabled", paramTypes
);
103 Object
[] params
= new Object
[1];
104 params
[0] = Boolean
.valueOf(enabled
);
105 m
.setAccessible(true);
106 m
.invoke(this, params
);
This page took 0.047371 seconds and 6 git commands to generate.