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
.component
;
16 import java
.io
.IOException
;
17 import java
.net
.URISyntaxException
;
20 import org
.eclipse
.core
.runtime
.FileLocator
;
21 import org
.eclipse
.core
.runtime
.Path
;
22 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEvent
;
23 import org
.eclipse
.linuxtools
.tmf
.request
.TmfDataRequest
;
24 import org
.eclipse
.linuxtools
.tmf
.request
.TmfEventRequest
;
25 import org
.eclipse
.linuxtools
.tmf
.tests
.TmfCoreTestPlugin
;
26 import org
.eclipse
.linuxtools
.tmf
.trace
.ITmfContext
;
27 import org
.eclipse
.linuxtools
.tmf
.trace
.TmfContext
;
28 import org
.eclipse
.linuxtools
.tmf
.trace
.TmfTraceStub
;
31 * <b><u>TmfEventProviderStub</u></b>
33 * TODO: Implement me. Please.
35 public class TmfEventProviderStub
extends TmfEventProvider
<TmfEvent
> {
37 private static final String DIRECTORY
= "testfiles";
38 private static final String TEST_STREAM
= "A-Test-10K";
40 private TmfTraceStub fTrace
;
42 public TmfEventProviderStub(String path
) throws IOException
{
43 super(TmfEvent
.class);
44 URL location
= FileLocator
.find(TmfCoreTestPlugin
.getDefault().getBundle(), new Path(path
), null);
46 File test
= new File(FileLocator
.toFileURL(location
).toURI());
47 fTrace
= new TmfTraceStub(test
.getPath(), true);
48 } catch (URISyntaxException e
) {
53 public TmfEventProviderStub() throws IOException
{
54 this(DIRECTORY
+ File
.separator
+ TEST_STREAM
);
58 public void deregister() {
63 // ------------------------------------------------------------------------
65 // ------------------------------------------------------------------------
68 public ITmfContext
armRequest(TmfDataRequest
<TmfEvent
> request
) {
69 if (request
instanceof TmfEventRequest
<?
>) {
70 TmfContext context
= fTrace
.seekEvent(((TmfEventRequest
<?
>) request
).getRange().getStartTime());
77 public TmfEvent
getNext(ITmfContext context
) {
78 return fTrace
.getNext(context
);
This page took 0.031896 seconds and 5 git commands to generate.