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