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
.TmfData
;
23 import org
.eclipse
.linuxtools
.tmf
.request
.ITmfDataRequest
;
24 import org
.eclipse
.linuxtools
.tmf
.request
.ITmfEventRequest
;
25 import org
.eclipse
.linuxtools
.tmf
.tests
.TmfCoreTestPlugin
;
26 import org
.eclipse
.linuxtools
.tmf
.trace
.ITmfContext
;
27 import org
.eclipse
.linuxtools
.tmf
.trace
.TmfTraceStub
;
30 * <b><u>TmfDataProviderStub</u></b>
32 * TODO: Implement me. Please.
34 public class TmfDataProviderStub
extends TmfDataProvider
<TmfData
> {
36 private static final String DIRECTORY
= "testfiles";
37 private static final String TEST_STREAM
= "M-Test-10K";
39 private TmfTraceStub fTrace
;
41 public TmfDataProviderStub(String path
) throws IOException
{
42 super("TmfDataProviderStub", TmfData
.class);
43 URL location
= FileLocator
.find(TmfCoreTestPlugin
.getDefault().getBundle(), new Path(path
), null);
45 File test
= new File(FileLocator
.toFileURL(location
).toURI());
46 fTrace
= new TmfTraceStub(test
.getPath(), true);
47 } catch (URISyntaxException e
) {
52 public TmfDataProviderStub() throws IOException
{
53 this(DIRECTORY
+ File
.separator
+ TEST_STREAM
);
56 // ------------------------------------------------------------------------
58 // ------------------------------------------------------------------------
61 public ITmfContext
armRequest(ITmfDataRequest
<TmfData
> request
) {
62 if (request
instanceof ITmfEventRequest
<?
>) {
63 ITmfContext context
= fTrace
.seekEvent(((ITmfEventRequest
<?
>) request
).getRange().getStartTime());
70 public TmfData
getNext(ITmfContext context
) {
71 return fTrace
.getNext(context
);
75 public boolean isCompleted(ITmfDataRequest
<TmfData
> request
, TmfData data
, int nbRead
) {
This page took 0.032629 seconds and 6 git commands to generate.