19cdb761f9ad0db8fa94ed00d2350270163de951
1 /*******************************************************************************
2 * Copyright (c) 2009 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
.lttng
.stubs
;
15 import java
.io
.IOException
;
17 import org
.eclipse
.linuxtools
.lttng
.core
.event
.LttngEvent
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
19 import org
.eclipse
.linuxtools
.tmf
.core
.parser
.ITmfEventParser
;
20 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
21 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.TmfContext
;
24 * <b><u>TmfEventParserStub</u></b>
26 * TODO: Implement me. Please.
28 public class LTTngEventParserStub
implements ITmfEventParser
<LttngEvent
> {
31 * @see org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser#parseNextEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfTrace, org.eclipse.linuxtools.tmf.core.trace.TmfContext)
34 public ITmfEvent
parseNextEvent(ITmfTrace
<LttngEvent
> stream
, TmfContext context
)
36 // TODO Auto-generated method stub
40 // // ========================================================================
42 // // ========================================================================
44 // private final int NB_FORMATS = 10;
45 // private final TmfEventFormat[] fFormats;
47 // // ========================================================================
49 // // ========================================================================
51 // public LTTngEventParserStub() {
52 // fFormats = new TmfEventFormat[NB_FORMATS];
53 // for (int i = 0; i < NB_FORMATS; i++) {
54 // Vector<String> format = new Vector<String>();
55 // for (int j = 1; j <= i; j++) {
56 // format.add(new String("Fmt-" + i + "-Fld-" + j));
58 // String[] fields = new String[i];
59 // fFormats[i] = new TmfEventFormat(format.toArray(fields));
63 // // ========================================================================
65 // // ========================================================================
67 // // ========================================================================
69 // // ========================================================================
72 // * @see org.eclipse.linuxtools.tmf.eventlog.ITmfEventParser#parseNextEvent()
74 // static final String typePrefix = "Type-";
75 // public TmfEvent parseNextEvent(ITmfTrace eventStream, TmfTraceContext context) throws IOException {
77 // if (! (eventStream instanceof LTTngTraceStub)) {
81 // // Highly inefficient...
82 // RandomAccessFile stream = ((LTTngTraceStub) eventStream).getStream();
83 // String name = eventStream.getName();
84 // name = name.substring(name.lastIndexOf('/') + 1);
86 // synchronized(stream) {
88 // if (context != null)
89 // location = (Long) (context.getLocation());
90 // stream.seek(location);
93 // // Read the individual fields
94 // long ts = stream.readLong();
95 // String source = stream.readUTF();
96 // String type = stream.readUTF();
97 // @SuppressWarnings("unused")
98 // int reference = stream.readInt();
100 // // Read the event parts
101 // int typeIndex = Integer.parseInt(type.substring(typePrefix.length()));
102 // String[] fields = new String[typeIndex];
103 // for (int i = 0; i < typeIndex; i++) {
104 // fields[i] = stream.readUTF();
107 // // Format the content from the individual fields
108 // String content = "[";
109 // if (typeIndex > 0) {
110 // content += fields[0];
112 // for (int i = 1; i < typeIndex; i++) {
113 // content += ", " + fields[i];
117 // // Update the context
118 // context.setLocation(stream.getFilePointer());
119 // context.incrIndex();
121 // long ts2 = stream.readLong();
122 // context.setTimestamp(new LTTngTimestampStub(ts2));
123 // } catch (EOFException e) {
124 // context.setTimestamp(null);
127 // // Create the event
128 // TmfEvent event = new TmfEvent(
129 // new LTTngTimestampStub(ts),
130 // new TmfEventSource(source),
131 // new TmfEventType(type, fFormats[typeIndex]),
132 // new TmfEventContent(content, fFormats[typeIndex]),
133 // new TmfEventReference(name));
137 // } catch (EOFException e) {
138 // context.setTimestamp(null);
This page took 0.035347 seconds and 4 git commands to generate.