-
Notifications
You must be signed in to change notification settings - Fork 0
/
Event.java
607 lines (540 loc) · 21.7 KB
/
Event.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package com.rocana.event;
@SuppressWarnings("all")
/** A generic event. See the reference guide for event format information. */
@org.apache.avro.specific.AvroGenerated
public class Event extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Event\",\"namespace\":\"com.rocana.event\",\"doc\":\"A generic event. See the reference guide for event format information.\",\"fields\":[{\"name\":\"id\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"A globally unique identifier for this event.\",\"default\":null},{\"name\":\"ts\",\"type\":\"long\",\"doc\":\"Epoch timestamp in millis. Required.\"},{\"name\":\"event_type_id\",\"type\":\"int\",\"doc\":\"ID indicating the type of event. Required.\"},{\"name\":\"source\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"],\"doc\":\"Deprecated event source. Optional.\",\"default\":\"\"},{\"name\":\"location\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Location from which the event was generated. Required.\",\"default\":\"\"},{\"name\":\"host\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Hostname, IP, or other device identifier from which the event was generated. Required.\",\"default\":\"\"},{\"name\":\"service\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Service or process from which the event was generated. Required.\",\"default\":\"\"},{\"name\":\"body\",\"type\":[\"null\",\"bytes\"],\"doc\":\"Raw event content in bytes. Optional.\",\"default\":null},{\"name\":\"attributes\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"doc\":\"Event type-specific key/value pairs, usually extracted from the event body. Required.\",\"order\":\"ignore\"}],\"version\":2}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
/** A globally unique identifier for this event. */
@Deprecated public java.lang.CharSequence id;
/** Epoch timestamp in millis. Required. */
@Deprecated public long ts;
/** ID indicating the type of event. Required. */
@Deprecated public int event_type_id;
/** Deprecated event source. Optional. */
@Deprecated public java.lang.CharSequence source;
/** Location from which the event was generated. Required. */
@Deprecated public java.lang.CharSequence location;
/** Hostname, IP, or other device identifier from which the event was generated. Required. */
@Deprecated public java.lang.CharSequence host;
/** Service or process from which the event was generated. Required. */
@Deprecated public java.lang.CharSequence service;
/** Raw event content in bytes. Optional. */
@Deprecated public java.nio.ByteBuffer body;
/** Event type-specific key/value pairs, usually extracted from the event body. Required. */
@Deprecated public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> attributes;
/**
* Default constructor. Note that this does not initialize fields
* to their default values from the schema. If that is desired then
* one should use <code>newBuilder()</code>.
*/
public Event() {}
@Override
public String toString() {
StringBuilder builder2 = new StringBuilder();
builder2.append("Event [id=");
builder2.append(id);
builder2.append(", ts=");
builder2.append(ts);
builder2.append(", event_type_id=");
builder2.append(event_type_id);
builder2.append(", source=");
builder2.append(source);
builder2.append(", location=");
builder2.append(location);
builder2.append(", host=");
builder2.append(host);
builder2.append(", service=");
builder2.append(service);
builder2.append(", body=");
builder2.append(body);
builder2.append(", attributes=");
builder2.append(attributes);
builder2.append("]");
return builder2.toString();
}
/**
* All-args constructor.
*/
public Event(java.lang.CharSequence id, java.lang.Long ts, java.lang.Integer event_type_id, java.lang.CharSequence source, java.lang.CharSequence location, java.lang.CharSequence host, java.lang.CharSequence service, java.nio.ByteBuffer body, java.util.Map<java.lang.CharSequence,java.lang.CharSequence> attributes) {
this.id = id;
this.ts = ts;
this.event_type_id = event_type_id;
this.source = source;
this.location = location;
this.host = host;
this.service = service;
this.body = body;
this.attributes = attributes;
}
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
case 0: return id;
case 1: return ts;
case 2: return event_type_id;
case 3: return source;
case 4: return location;
case 5: return host;
case 6: return service;
case 7: return body;
case 8: return attributes;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
// Used by DatumReader. Applications should not call.
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
case 0: id = (java.lang.CharSequence)value$; break;
case 1: ts = (java.lang.Long)value$; break;
case 2: event_type_id = (java.lang.Integer)value$; break;
case 3: source = (java.lang.CharSequence)value$; break;
case 4: location = (java.lang.CharSequence)value$; break;
case 5: host = (java.lang.CharSequence)value$; break;
case 6: service = (java.lang.CharSequence)value$; break;
case 7: body = (java.nio.ByteBuffer)value$; break;
case 8: attributes = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'id' field.
* A globally unique identifier for this event. */
public java.lang.CharSequence getId() {
return id;
}
/**
* Sets the value of the 'id' field.
* A globally unique identifier for this event. * @param value the value to set.
*/
public void setId(java.lang.CharSequence value) {
this.id = value;
}
/**
* Gets the value of the 'ts' field.
* Epoch timestamp in millis. Required. */
public java.lang.Long getTs() {
return ts;
}
/**
* Sets the value of the 'ts' field.
* Epoch timestamp in millis. Required. * @param value the value to set.
*/
public void setTs(java.lang.Long value) {
this.ts = value;
}
/**
* Gets the value of the 'event_type_id' field.
* ID indicating the type of event. Required. */
public java.lang.Integer getEventTypeId() {
return event_type_id;
}
/**
* Sets the value of the 'event_type_id' field.
* ID indicating the type of event. Required. * @param value the value to set.
*/
public void setEventTypeId(java.lang.Integer value) {
this.event_type_id = value;
}
/**
* Gets the value of the 'source' field.
* Deprecated event source. Optional. */
public java.lang.CharSequence getSource() {
return source;
}
/**
* Sets the value of the 'source' field.
* Deprecated event source. Optional. * @param value the value to set.
*/
public void setSource(java.lang.CharSequence value) {
this.source = value;
}
/**
* Gets the value of the 'location' field.
* Location from which the event was generated. Required. */
public java.lang.CharSequence getLocation() {
return location;
}
/**
* Sets the value of the 'location' field.
* Location from which the event was generated. Required. * @param value the value to set.
*/
public void setLocation(java.lang.CharSequence value) {
this.location = value;
}
/**
* Gets the value of the 'host' field.
* Hostname, IP, or other device identifier from which the event was generated. Required. */
public java.lang.CharSequence getHost() {
return host;
}
/**
* Sets the value of the 'host' field.
* Hostname, IP, or other device identifier from which the event was generated. Required. * @param value the value to set.
*/
public void setHost(java.lang.CharSequence value) {
this.host = value;
}
/**
* Gets the value of the 'service' field.
* Service or process from which the event was generated. Required. */
public java.lang.CharSequence getService() {
return service;
}
/**
* Sets the value of the 'service' field.
* Service or process from which the event was generated. Required. * @param value the value to set.
*/
public void setService(java.lang.CharSequence value) {
this.service = value;
}
/**
* Gets the value of the 'body' field.
* Raw event content in bytes. Optional. */
public java.nio.ByteBuffer getBody() {
return body;
}
/**
* Sets the value of the 'body' field.
* Raw event content in bytes. Optional. * @param value the value to set.
*/
public void setBody(java.nio.ByteBuffer value) {
this.body = value;
}
/**
* Gets the value of the 'attributes' field.
* Event type-specific key/value pairs, usually extracted from the event body. Required. */
public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getAttributes() {
return attributes;
}
/**
* Sets the value of the 'attributes' field.
* Event type-specific key/value pairs, usually extracted from the event body. Required. * @param value the value to set.
*/
public void setAttributes(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
this.attributes = value;
}
/** Creates a new Event RecordBuilder */
public static com.rocana.event.Event.Builder newBuilder() {
return new com.rocana.event.Event.Builder();
}
/** Creates a new Event RecordBuilder by copying an existing Builder */
public static com.rocana.event.Event.Builder newBuilder(com.rocana.event.Event.Builder other) {
return new com.rocana.event.Event.Builder(other);
}
/** Creates a new Event RecordBuilder by copying an existing Event instance */
public static com.rocana.event.Event.Builder newBuilder(com.rocana.event.Event other) {
return new com.rocana.event.Event.Builder(other);
}
/**
* RecordBuilder for Event instances.
*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Event>
implements org.apache.avro.data.RecordBuilder<Event> {
private java.lang.CharSequence id;
private long ts;
private int event_type_id;
private java.lang.CharSequence source;
private java.lang.CharSequence location;
private java.lang.CharSequence host;
private java.lang.CharSequence service;
private java.nio.ByteBuffer body;
private java.util.Map<java.lang.CharSequence,java.lang.CharSequence> attributes;
/** Creates a new Builder */
private Builder() {
super(com.rocana.event.Event.SCHEMA$);
}
/** Creates a Builder by copying an existing Builder */
private Builder(com.rocana.event.Event.Builder other) {
super(other);
if (isValidValue(fields()[0], other.id)) {
this.id = data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.ts)) {
this.ts = data().deepCopy(fields()[1].schema(), other.ts);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.event_type_id)) {
this.event_type_id = data().deepCopy(fields()[2].schema(), other.event_type_id);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.source)) {
this.source = data().deepCopy(fields()[3].schema(), other.source);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.location)) {
this.location = data().deepCopy(fields()[4].schema(), other.location);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.host)) {
this.host = data().deepCopy(fields()[5].schema(), other.host);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.service)) {
this.service = data().deepCopy(fields()[6].schema(), other.service);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.body)) {
this.body = data().deepCopy(fields()[7].schema(), other.body);
fieldSetFlags()[7] = true;
}
if (isValidValue(fields()[8], other.attributes)) {
this.attributes = data().deepCopy(fields()[8].schema(), other.attributes);
fieldSetFlags()[8] = true;
}
}
/** Creates a Builder by copying an existing Event instance */
private Builder(com.rocana.event.Event other) {
super(com.rocana.event.Event.SCHEMA$);
if (isValidValue(fields()[0], other.id)) {
this.id = data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.ts)) {
this.ts = data().deepCopy(fields()[1].schema(), other.ts);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.event_type_id)) {
this.event_type_id = data().deepCopy(fields()[2].schema(), other.event_type_id);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.source)) {
this.source = data().deepCopy(fields()[3].schema(), other.source);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.location)) {
this.location = data().deepCopy(fields()[4].schema(), other.location);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.host)) {
this.host = data().deepCopy(fields()[5].schema(), other.host);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.service)) {
this.service = data().deepCopy(fields()[6].schema(), other.service);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.body)) {
this.body = data().deepCopy(fields()[7].schema(), other.body);
fieldSetFlags()[7] = true;
}
if (isValidValue(fields()[8], other.attributes)) {
this.attributes = data().deepCopy(fields()[8].schema(), other.attributes);
fieldSetFlags()[8] = true;
}
}
/** Gets the value of the 'id' field */
public java.lang.CharSequence getId() {
return id;
}
/** Sets the value of the 'id' field */
public com.rocana.event.Event.Builder setId(java.lang.CharSequence value) {
validate(fields()[0], value);
this.id = value;
fieldSetFlags()[0] = true;
return this;
}
/** Checks whether the 'id' field has been set */
public boolean hasId() {
return fieldSetFlags()[0];
}
/** Clears the value of the 'id' field */
public com.rocana.event.Event.Builder clearId() {
id = null;
fieldSetFlags()[0] = false;
return this;
}
/** Gets the value of the 'ts' field */
public java.lang.Long getTs() {
return ts;
}
/** Sets the value of the 'ts' field */
public com.rocana.event.Event.Builder setTs(long value) {
validate(fields()[1], value);
this.ts = value;
fieldSetFlags()[1] = true;
return this;
}
/** Checks whether the 'ts' field has been set */
public boolean hasTs() {
return fieldSetFlags()[1];
}
/** Clears the value of the 'ts' field */
public com.rocana.event.Event.Builder clearTs() {
fieldSetFlags()[1] = false;
return this;
}
/** Gets the value of the 'event_type_id' field */
public java.lang.Integer getEventTypeId() {
return event_type_id;
}
/** Sets the value of the 'event_type_id' field */
public com.rocana.event.Event.Builder setEventTypeId(int value) {
validate(fields()[2], value);
this.event_type_id = value;
fieldSetFlags()[2] = true;
return this;
}
/** Checks whether the 'event_type_id' field has been set */
public boolean hasEventTypeId() {
return fieldSetFlags()[2];
}
/** Clears the value of the 'event_type_id' field */
public com.rocana.event.Event.Builder clearEventTypeId() {
fieldSetFlags()[2] = false;
return this;
}
/** Gets the value of the 'source' field */
public java.lang.CharSequence getSource() {
return source;
}
/** Sets the value of the 'source' field */
public com.rocana.event.Event.Builder setSource(java.lang.CharSequence value) {
validate(fields()[3], value);
this.source = value;
fieldSetFlags()[3] = true;
return this;
}
/** Checks whether the 'source' field has been set */
public boolean hasSource() {
return fieldSetFlags()[3];
}
/** Clears the value of the 'source' field */
public com.rocana.event.Event.Builder clearSource() {
source = null;
fieldSetFlags()[3] = false;
return this;
}
/** Gets the value of the 'location' field */
public java.lang.CharSequence getLocation() {
return location;
}
/** Sets the value of the 'location' field */
public com.rocana.event.Event.Builder setLocation(java.lang.CharSequence value) {
validate(fields()[4], value);
this.location = value;
fieldSetFlags()[4] = true;
return this;
}
/** Checks whether the 'location' field has been set */
public boolean hasLocation() {
return fieldSetFlags()[4];
}
/** Clears the value of the 'location' field */
public com.rocana.event.Event.Builder clearLocation() {
location = null;
fieldSetFlags()[4] = false;
return this;
}
/** Gets the value of the 'host' field */
public java.lang.CharSequence getHost() {
return host;
}
/** Sets the value of the 'host' field */
public com.rocana.event.Event.Builder setHost(java.lang.CharSequence value) {
validate(fields()[5], value);
this.host = value;
fieldSetFlags()[5] = true;
return this;
}
/** Checks whether the 'host' field has been set */
public boolean hasHost() {
return fieldSetFlags()[5];
}
/** Clears the value of the 'host' field */
public com.rocana.event.Event.Builder clearHost() {
host = null;
fieldSetFlags()[5] = false;
return this;
}
/** Gets the value of the 'service' field */
public java.lang.CharSequence getService() {
return service;
}
/** Sets the value of the 'service' field */
public com.rocana.event.Event.Builder setService(java.lang.CharSequence value) {
validate(fields()[6], value);
this.service = value;
fieldSetFlags()[6] = true;
return this;
}
/** Checks whether the 'service' field has been set */
public boolean hasService() {
return fieldSetFlags()[6];
}
/** Clears the value of the 'service' field */
public com.rocana.event.Event.Builder clearService() {
service = null;
fieldSetFlags()[6] = false;
return this;
}
/** Gets the value of the 'body' field */
public java.nio.ByteBuffer getBody() {
return body;
}
/** Sets the value of the 'body' field */
public com.rocana.event.Event.Builder setBody(java.nio.ByteBuffer value) {
validate(fields()[7], value);
this.body = value;
fieldSetFlags()[7] = true;
return this;
}
/** Checks whether the 'body' field has been set */
public boolean hasBody() {
return fieldSetFlags()[7];
}
/** Clears the value of the 'body' field */
public com.rocana.event.Event.Builder clearBody() {
body = null;
fieldSetFlags()[7] = false;
return this;
}
/** Gets the value of the 'attributes' field */
public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getAttributes() {
return attributes;
}
/** Sets the value of the 'attributes' field */
public com.rocana.event.Event.Builder setAttributes(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
validate(fields()[8], value);
this.attributes = value;
fieldSetFlags()[8] = true;
return this;
}
/** Checks whether the 'attributes' field has been set */
public boolean hasAttributes() {
return fieldSetFlags()[8];
}
/** Clears the value of the 'attributes' field */
public com.rocana.event.Event.Builder clearAttributes() {
attributes = null;
fieldSetFlags()[8] = false;
return this;
}
@Override
public Event build() {
try {
Event record = new Event();
record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
record.ts = fieldSetFlags()[1] ? this.ts : (java.lang.Long) defaultValue(fields()[1]);
record.event_type_id = fieldSetFlags()[2] ? this.event_type_id : (java.lang.Integer) defaultValue(fields()[2]);
record.source = fieldSetFlags()[3] ? this.source : (java.lang.CharSequence) defaultValue(fields()[3]);
record.location = fieldSetFlags()[4] ? this.location : (java.lang.CharSequence) defaultValue(fields()[4]);
record.host = fieldSetFlags()[5] ? this.host : (java.lang.CharSequence) defaultValue(fields()[5]);
record.service = fieldSetFlags()[6] ? this.service : (java.lang.CharSequence) defaultValue(fields()[6]);
record.body = fieldSetFlags()[7] ? this.body : (java.nio.ByteBuffer) defaultValue(fields()[7]);
record.attributes = fieldSetFlags()[8] ? this.attributes : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) defaultValue(fields()[8]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
}