Revision 52042
Added by Claudio Atzori almost 6 years ago
StreamingRecordParser.java | ||
---|---|---|
19 | 19 |
*/ |
20 | 20 |
public class StreamingRecordParser implements RecordParser { |
21 | 21 |
|
22 |
private long ts; |
|
23 |
|
|
22 | 24 |
@Override |
23 | 25 |
public Map<String, String> parseRecord(String record) { |
24 | 26 |
|
... | ... | |
27 | 29 |
XMLStreamReader parser = factory.createXMLStreamReader(new ByteArrayInputStream(record.getBytes())); |
28 | 30 |
|
29 | 31 |
HashMap<String, String> res = new HashMap<String, String>(); |
32 |
res.put("timestamp", String.valueOf(getTimestamp())); |
|
30 | 33 |
|
31 | 34 |
Stack<String> elementStack = new Stack<String>(); |
32 | 35 |
elementStack.push("/"); |
... | ... | |
75 | 78 |
return elementStack.get(elementStack.size() - 3); |
76 | 79 |
} |
77 | 80 |
|
81 |
@Override |
|
82 |
public void setTimestamp(final long ts) { |
|
83 |
this.ts = ts; |
|
84 |
} |
|
85 |
|
|
86 |
@Override |
|
87 |
public long getTimestamp() { |
|
88 |
return ts; |
|
89 |
} |
|
90 |
|
|
78 | 91 |
} |
Also available in: Unified diff
use the same (hopefully) format for field timestamp, and the same value for each record involved in a transaction