Commit | Line | Data |
---|---|---|
6040f86c ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009 Ericsson | |
3 | * | |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.lttng.stubs; | |
14 | ||
15 | import java.io.IOException; | |
16 | ||
17 | import org.eclipse.linuxtools.tmf.event.TmfEvent; | |
18 | import org.eclipse.linuxtools.tmf.parser.ITmfEventParser; | |
19 | import org.eclipse.linuxtools.tmf.trace.ITmfTrace; | |
9f584e4c | 20 | import org.eclipse.linuxtools.tmf.trace.TmfContext; |
6040f86c ASL |
21 | |
22 | /** | |
23 | * <b><u>TmfEventParserStub</u></b> | |
24 | * <p> | |
25 | * TODO: Implement me. Please. | |
26 | */ | |
27 | public class LTTngEventParserStub implements ITmfEventParser { | |
28 | ||
d4011df2 | 29 | @Override |
9f584e4c | 30 | public TmfEvent parseNextEvent(ITmfTrace stream, TmfContext context) |
6040f86c ASL |
31 | throws IOException { |
32 | // TODO Auto-generated method stub | |
33 | return null; | |
34 | } | |
35 | ||
36 | // // ======================================================================== | |
37 | // // Attributes | |
38 | // // ======================================================================== | |
39 | // | |
40 | // private final int NB_FORMATS = 10; | |
41 | // private final TmfEventFormat[] fFormats; | |
42 | // | |
43 | // // ======================================================================== | |
44 | // // Constructors | |
45 | // // ======================================================================== | |
46 | // | |
47 | // public LTTngEventParserStub() { | |
48 | // fFormats = new TmfEventFormat[NB_FORMATS]; | |
49 | // for (int i = 0; i < NB_FORMATS; i++) { | |
50 | // Vector<String> format = new Vector<String>(); | |
51 | // for (int j = 1; j <= i; j++) { | |
52 | // format.add(new String("Fmt-" + i + "-Fld-" + j)); | |
53 | // } | |
54 | // String[] fields = new String[i]; | |
55 | // fFormats[i] = new TmfEventFormat(format.toArray(fields)); | |
56 | // } | |
57 | // } | |
58 | // | |
59 | // // ======================================================================== | |
60 | // // Accessors | |
61 | // // ======================================================================== | |
62 | // | |
63 | // // ======================================================================== | |
64 | // // Operators | |
65 | // // ======================================================================== | |
66 | // | |
67 | // /* (non-Javadoc) | |
68 | // * @see org.eclipse.linuxtools.tmf.eventlog.ITmfEventParser#parseNextEvent() | |
69 | // */ | |
70 | // static final String typePrefix = "Type-"; | |
71 | // public TmfEvent parseNextEvent(ITmfTrace eventStream, TmfTraceContext context) throws IOException { | |
72 | // | |
73 | // if (! (eventStream instanceof LTTngTraceStub)) { | |
74 | // return null; | |
75 | // } | |
76 | // | |
77 | // // Highly inefficient... | |
78 | // RandomAccessFile stream = ((LTTngTraceStub) eventStream).getStream(); | |
79 | // String name = eventStream.getName(); | |
80 | // name = name.substring(name.lastIndexOf('/') + 1); | |
81 | // | |
82 | // synchronized(stream) { | |
83 | // long location = 0; | |
84 | // if (context != null) | |
85 | // location = (Long) (context.getLocation()); | |
86 | // stream.seek(location); | |
87 | // | |
88 | // try { | |
89 | // // Read the individual fields | |
90 | // long ts = stream.readLong(); | |
91 | // String source = stream.readUTF(); | |
92 | // String type = stream.readUTF(); | |
93 | // @SuppressWarnings("unused") | |
94 | // int reference = stream.readInt(); | |
95 | // | |
96 | // // Read the event parts | |
97 | // int typeIndex = Integer.parseInt(type.substring(typePrefix.length())); | |
98 | // String[] fields = new String[typeIndex]; | |
99 | // for (int i = 0; i < typeIndex; i++) { | |
100 | // fields[i] = stream.readUTF(); | |
101 | // } | |
102 | // | |
103 | // // Format the content from the individual fields | |
104 | // String content = "["; | |
105 | // if (typeIndex > 0) { | |
106 | // content += fields[0]; | |
107 | // } | |
108 | // for (int i = 1; i < typeIndex; i++) { | |
109 | // content += ", " + fields[i]; | |
110 | // } | |
111 | // content += "]"; | |
112 | // | |
113 | // // Update the context | |
114 | // context.setLocation(stream.getFilePointer()); | |
115 | // context.incrIndex(); | |
116 | // try { | |
117 | // long ts2 = stream.readLong(); | |
118 | // context.setTimestamp(new LTTngTimestampStub(ts2)); | |
119 | // } catch (EOFException e) { | |
120 | // context.setTimestamp(null); | |
121 | // } | |
122 | // | |
123 | // // Create the event | |
124 | // TmfEvent event = new TmfEvent( | |
125 | // new LTTngTimestampStub(ts), | |
126 | // new TmfEventSource(source), | |
127 | // new TmfEventType(type, fFormats[typeIndex]), | |
128 | // new TmfEventContent(content, fFormats[typeIndex]), | |
129 | // new TmfEventReference(name)); | |
130 | // | |
131 | // return event; | |
132 | // | |
133 | // } catch (EOFException e) { | |
134 | // context.setTimestamp(null); | |
135 | // } | |
136 | // } | |
137 | // return null; | |
138 | // } | |
139 | ||
140 | } |