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
.tests
.stubs
.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
.core
.component
.TmfDataProvider
;
23 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfEvent
;
24 import org
.eclipse
.linuxtools
.tmf
.core
.request
.ITmfDataRequest
;
25 import org
.eclipse
.linuxtools
.tmf
.core
.request
.ITmfEventRequest
;
26 import org
.eclipse
.linuxtools
.tmf
.core
.tests
.TmfCoreTestPlugin
;
27 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfContext
;
28 import org
.eclipse
.linuxtools
.tmf
.tests
.stubs
.trace
.TmfTraceStub
;
31 * <b><u>TmfDataProviderStub</u></b>
33 * TODO: Implement me. Please.
35 @SuppressWarnings("nls")
36 public class TmfDataProviderStub
extends TmfDataProvider
<TmfEvent
> {
38 private static final String DIRECTORY
= "testfiles";
39 private static final String TEST_STREAM
= "M-Test-10K";
41 private TmfTraceStub fTrace
;
43 public TmfDataProviderStub(final String path
) throws IOException
{
44 super("TmfDataProviderStub", TmfEvent
.class);
45 final URL location
= FileLocator
.find(TmfCoreTestPlugin
.getDefault().getBundle(), new Path(path
), null);
47 final File test
= new File(FileLocator
.toFileURL(location
).toURI());
48 fTrace
= new TmfTraceStub(test
.getPath(), 0, true);
49 } catch (final URISyntaxException e
) {
54 public TmfDataProviderStub() throws IOException
{
55 this(DIRECTORY
+ File
.separator
+ TEST_STREAM
);
58 // ------------------------------------------------------------------------
60 // ------------------------------------------------------------------------
63 public ITmfContext
armRequest(final ITmfDataRequest
<TmfEvent
> request
) {
64 if (request
instanceof ITmfEventRequest
<?
>) {
65 final ITmfContext context
= fTrace
.seekEvent(((ITmfEventRequest
<?
>) request
).getRange().getStartTime());
72 public TmfEvent
getNext(final ITmfContext context
) {
73 return fTrace
.getNext(context
);
77 public boolean isCompleted(final ITmfDataRequest
<TmfEvent
> request
, final TmfEvent data
, final int nbRead
) {
This page took 0.032146 seconds and 5 git commands to generate.