1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.apache.hadoop.chukwa.datacollection.writer.gora;
24
25
26
27
28
29
30
31
32
33
34 @SuppressWarnings("all")
35 public class ChukwaChunk extends org.apache.gora.persistency.impl.PersistentBase
36 implements org.apache.avro.specific.SpecificRecord,
37 org.apache.gora.persistency.Persistent {
38 public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser()
39 .parse(
40 "{\"type\":\"record\",\"name\":\"ChukwaChunk\",\"namespace\":\"org.apache.hadoop.chukwa.datacollection.writer.gora\",\"doc\":\"Chukwa Adaptors emit data in Chunks. A Chunk is a sequence of bytes, with some metadata. Several of these are set automatically by the Agent or Adaptors. Two of them require user intervention: cluster name and datatype. Cluster name is specified in conf/chukwa-agent-conf.xml, and is global to each Agent process. Datatype describes the expected format of the data collected by an Adaptor instance, and it is specified when that instance is started. \",\"fields\":[{\"name\":\"source\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"tags\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"datatype\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"sequenceID\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"data\",\"type\":[\"null\",\"bytes\"],\"default\":null}]}");
41
42
43 public static enum Field {
44 SOURCE(0, "source"), TAGS(1, "tags"), DATATYPE(2, "datatype"), SEQUENCE_ID(
45 3, "sequenceID"), NAME(4, "name"), DATA(5, "data"),;
46
47
48
49 private int index;
50
51
52
53
54 private String name;
55
56
57
58
59
60
61
62
63
64 Field(int index, String name) {
65 this.index = index;
66 this.name = name;
67 }
68
69
70
71
72
73
74 public int getIndex() {
75 return index;
76 }
77
78
79
80
81
82
83 public String getName() {
84 return name;
85 }
86
87
88
89
90
91
92 public String toString() {
93 return name;
94 }
95 };
96
97 public static final String[] _ALL_FIELDS = { "source", "tags", "datatype",
98 "sequenceID", "name", "data", };
99
100
101
102
103
104
105 public int getFieldsCount() {
106 return ChukwaChunk._ALL_FIELDS.length;
107 }
108
109 private java.lang.CharSequence source;
110 private java.lang.CharSequence tags;
111 private java.lang.CharSequence datatype;
112 private java.lang.Long sequenceID;
113 private java.lang.CharSequence name;
114 private java.nio.ByteBuffer data;
115
116 public org.apache.avro.Schema getSchema() {
117 return SCHEMA$;
118 }
119
120
121 public java.lang.Object get(int field$) {
122 switch (field$) {
123 case 0:
124 return source;
125 case 1:
126 return tags;
127 case 2:
128 return datatype;
129 case 3:
130 return sequenceID;
131 case 4:
132 return name;
133 case 5:
134 return data;
135 default:
136 throw new org.apache.avro.AvroRuntimeException("Bad index");
137 }
138 }
139
140
141 @SuppressWarnings(value = "unchecked")
142 public void put(int field$, java.lang.Object value) {
143 switch (field$) {
144 case 0:
145 source = (java.lang.CharSequence) (value);
146 break;
147 case 1:
148 tags = (java.lang.CharSequence) (value);
149 break;
150 case 2:
151 datatype = (java.lang.CharSequence) (value);
152 break;
153 case 3:
154 sequenceID = (java.lang.Long) (value);
155 break;
156 case 4:
157 name = (java.lang.CharSequence) (value);
158 break;
159 case 5:
160 data = (java.nio.ByteBuffer) (value);
161 break;
162 default:
163 throw new org.apache.avro.AvroRuntimeException("Bad index");
164 }
165 }
166
167
168
169
170
171
172 public java.lang.CharSequence getSource() {
173 return source;
174 }
175
176
177
178
179
180
181 public void setSource(java.lang.CharSequence value) {
182 this.source = value;
183 setDirty(0);
184 }
185
186
187
188
189
190
191
192 public boolean isSourceDirty() {
193 return isDirty(0);
194 }
195
196
197
198
199
200
201 public java.lang.CharSequence getTags() {
202 return tags;
203 }
204
205
206
207
208
209
210 public void setTags(java.lang.CharSequence value) {
211 this.tags = value;
212 setDirty(1);
213 }
214
215
216
217
218
219
220
221 public boolean isTagsDirty() {
222 return isDirty(1);
223 }
224
225
226
227
228
229
230 public java.lang.CharSequence getDatatype() {
231 return datatype;
232 }
233
234
235
236
237
238
239 public void setDatatype(java.lang.CharSequence value) {
240 this.datatype = value;
241 setDirty(2);
242 }
243
244
245
246
247
248
249
250 public boolean isDatatypeDirty() {
251 return isDirty(2);
252 }
253
254
255
256
257
258
259 public java.lang.Long getSequenceID() {
260 return sequenceID;
261 }
262
263
264
265
266
267
268 public void setSequenceID(java.lang.Long value) {
269 this.sequenceID = value;
270 setDirty(3);
271 }
272
273
274
275
276
277
278
279 public boolean isSequenceIDDirty() {
280 return isDirty(3);
281 }
282
283
284
285
286
287
288 public java.lang.CharSequence getName() {
289 return name;
290 }
291
292
293
294
295
296
297 public void setName(java.lang.CharSequence value) {
298 this.name = value;
299 setDirty(4);
300 }
301
302
303
304
305
306
307
308 public boolean isNameDirty() {
309 return isDirty(4);
310 }
311
312
313
314
315
316
317 public java.nio.ByteBuffer getData() {
318 return data;
319 }
320
321
322
323
324
325
326
327 public void setData(java.nio.ByteBuffer value) {
328 this.data = value;
329 setDirty(5);
330 }
331
332
333
334
335
336
337
338 public boolean isDataDirty() {
339 return isDirty(5);
340 }
341
342
343
344
345
346
347 public static org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder newBuilder() {
348 return new org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder();
349 }
350
351
352
353
354
355
356
357 public static org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder newBuilder(
358 org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder other) {
359 return new org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder(
360 other);
361 }
362
363
364
365
366
367
368
369
370 public static org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder newBuilder(
371 org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk other) {
372 return new org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder(
373 other);
374 }
375
376 private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
377 java.nio.ByteBuffer input) {
378 java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
379 int position = input.position();
380 input.reset();
381 int mark = input.position();
382 int limit = input.limit();
383 input.rewind();
384 input.limit(input.capacity());
385 copy.put(input);
386 input.rewind();
387 copy.rewind();
388 input.position(mark);
389 input.mark();
390 copy.position(mark);
391 copy.mark();
392 input.position(position);
393 copy.position(position);
394 input.limit(limit);
395 copy.limit(limit);
396 return copy.asReadOnlyBuffer();
397 }
398
399
400
401
402 public static class Builder
403 extends org.apache.avro.specific.SpecificRecordBuilderBase<ChukwaChunk>
404 implements org.apache.avro.data.RecordBuilder<ChukwaChunk> {
405
406 private java.lang.CharSequence source;
407 private java.lang.CharSequence tags;
408 private java.lang.CharSequence datatype;
409 private java.lang.Long sequenceID;
410 private java.lang.CharSequence name;
411 private java.nio.ByteBuffer data;
412
413
414 private Builder() {
415 super(
416 org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.SCHEMA$);
417 }
418
419
420 private Builder(
421 org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder other) {
422 super(other);
423 }
424
425
426 private Builder(
427 org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk other) {
428 super(
429 org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.SCHEMA$);
430 if (isValidValue(fields()[0], other.source)) {
431 this.source = (java.lang.CharSequence) data()
432 .deepCopy(fields()[0].schema(), other.source);
433 fieldSetFlags()[0] = true;
434 }
435 if (isValidValue(fields()[1], other.tags)) {
436 this.tags = (java.lang.CharSequence) data()
437 .deepCopy(fields()[1].schema(), other.tags);
438 fieldSetFlags()[1] = true;
439 }
440 if (isValidValue(fields()[2], other.datatype)) {
441 this.datatype = (java.lang.CharSequence) data()
442 .deepCopy(fields()[2].schema(), other.datatype);
443 fieldSetFlags()[2] = true;
444 }
445 if (isValidValue(fields()[3], other.sequenceID)) {
446 this.sequenceID = (java.lang.Long) data().deepCopy(fields()[3].schema(),
447 other.sequenceID);
448 fieldSetFlags()[3] = true;
449 }
450 if (isValidValue(fields()[4], other.name)) {
451 this.name = (java.lang.CharSequence) data()
452 .deepCopy(fields()[4].schema(), other.name);
453 fieldSetFlags()[4] = true;
454 }
455 if (isValidValue(fields()[5], other.data)) {
456 this.data = (java.nio.ByteBuffer) data().deepCopy(fields()[5].schema(),
457 other.data);
458 fieldSetFlags()[5] = true;
459 }
460 }
461
462
463
464
465
466
467 public java.lang.CharSequence getSource() {
468 return source;
469 }
470
471
472
473
474
475
476
477 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder setSource(
478 java.lang.CharSequence value) {
479 validate(fields()[0], value);
480 this.source = value;
481 fieldSetFlags()[0] = true;
482 return this;
483 }
484
485
486
487
488
489
490 public boolean hasSource() {
491 return fieldSetFlags()[0];
492 }
493
494
495
496
497
498
499 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder clearSource() {
500 source = null;
501 fieldSetFlags()[0] = false;
502 return this;
503 }
504
505
506
507
508
509
510 public java.lang.CharSequence getTags() {
511 return tags;
512 }
513
514
515
516
517
518
519
520 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder setTags(
521 java.lang.CharSequence value) {
522 validate(fields()[1], value);
523 this.tags = value;
524 fieldSetFlags()[1] = true;
525 return this;
526 }
527
528
529
530
531
532
533 public boolean hasTags() {
534 return fieldSetFlags()[1];
535 }
536
537
538
539
540
541
542 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder clearTags() {
543 tags = null;
544 fieldSetFlags()[1] = false;
545 return this;
546 }
547
548
549
550
551
552
553 public java.lang.CharSequence getDatatype() {
554 return datatype;
555 }
556
557
558
559
560
561
562
563 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder setDatatype(
564 java.lang.CharSequence value) {
565 validate(fields()[2], value);
566 this.datatype = value;
567 fieldSetFlags()[2] = true;
568 return this;
569 }
570
571
572
573
574
575
576 public boolean hasDatatype() {
577 return fieldSetFlags()[2];
578 }
579
580
581
582
583
584
585 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder clearDatatype() {
586 datatype = null;
587 fieldSetFlags()[2] = false;
588 return this;
589 }
590
591
592
593
594
595
596 public java.lang.Long getSequenceID() {
597 return sequenceID;
598 }
599
600
601
602
603
604
605
606 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder setSequenceID(
607 java.lang.Long value) {
608 validate(fields()[3], value);
609 this.sequenceID = value;
610 fieldSetFlags()[3] = true;
611 return this;
612 }
613
614
615
616
617
618
619 public boolean hasSequenceID() {
620 return fieldSetFlags()[3];
621 }
622
623
624
625
626
627
628 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder clearSequenceID() {
629 sequenceID = null;
630 fieldSetFlags()[3] = false;
631 return this;
632 }
633
634
635
636
637
638
639 public java.lang.CharSequence getName() {
640 return name;
641 }
642
643
644
645
646
647
648
649 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder setName(
650 java.lang.CharSequence value) {
651 validate(fields()[4], value);
652 this.name = value;
653 fieldSetFlags()[4] = true;
654 return this;
655 }
656
657
658
659
660
661
662 public boolean hasName() {
663 return fieldSetFlags()[4];
664 }
665
666
667
668
669
670
671 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder clearName() {
672 name = null;
673 fieldSetFlags()[4] = false;
674 return this;
675 }
676
677
678
679
680
681
682 public java.nio.ByteBuffer getData() {
683 return data;
684 }
685
686
687
688
689
690
691
692 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder setData(
693 java.nio.ByteBuffer value) {
694 validate(fields()[5], value);
695 this.data = value;
696 fieldSetFlags()[5] = true;
697 return this;
698 }
699
700
701
702
703
704
705 public boolean hasData() {
706 return fieldSetFlags()[5];
707 }
708
709
710
711
712
713
714 public org.apache.hadoop.chukwa.datacollection.writer.gora.ChukwaChunk.Builder clearData() {
715 data = null;
716 fieldSetFlags()[5] = false;
717 return this;
718 }
719
720 @Override
721 public ChukwaChunk build() {
722 try {
723 ChukwaChunk record = new ChukwaChunk();
724 record.source = fieldSetFlags()[0] ? this.source
725 : (java.lang.CharSequence) defaultValue(fields()[0]);
726 record.tags = fieldSetFlags()[1] ? this.tags
727 : (java.lang.CharSequence) defaultValue(fields()[1]);
728 record.datatype = fieldSetFlags()[2] ? this.datatype
729 : (java.lang.CharSequence) defaultValue(fields()[2]);
730 record.sequenceID = fieldSetFlags()[3] ? this.sequenceID
731 : (java.lang.Long) defaultValue(fields()[3]);
732 record.name = fieldSetFlags()[4] ? this.name
733 : (java.lang.CharSequence) defaultValue(fields()[4]);
734 record.data = fieldSetFlags()[5] ? this.data
735 : (java.nio.ByteBuffer) defaultValue(fields()[5]);
736 return record;
737 } catch (Exception e) {
738 throw new org.apache.avro.AvroRuntimeException(e);
739 }
740 }
741 }
742
743 public ChukwaChunk.Tombstone getTombstone() {
744 return TOMBSTONE;
745 }
746
747 public ChukwaChunk newInstance() {
748 return newBuilder().build();
749 }
750
751 private static final Tombstone TOMBSTONE = new Tombstone();
752
753 public static final class Tombstone extends ChukwaChunk
754 implements org.apache.gora.persistency.Tombstone {
755
756 private Tombstone() {
757 }
758
759
760
761
762 public java.lang.CharSequence getSource() {
763 throw new java.lang.UnsupportedOperationException(
764 "Get is not supported on tombstones");
765 }
766
767
768
769
770
771
772
773 public void setSource(java.lang.CharSequence value) {
774 throw new java.lang.UnsupportedOperationException(
775 "Set is not supported on tombstones");
776 }
777
778
779
780
781
782 public boolean isSourceDirty() {
783 throw new java.lang.UnsupportedOperationException(
784 "IsDirty is not supported on tombstones");
785 }
786
787
788
789
790 public java.lang.CharSequence getTags() {
791 throw new java.lang.UnsupportedOperationException(
792 "Get is not supported on tombstones");
793 }
794
795
796
797
798
799
800
801 public void setTags(java.lang.CharSequence value) {
802 throw new java.lang.UnsupportedOperationException(
803 "Set is not supported on tombstones");
804 }
805
806
807
808
809
810 public boolean isTagsDirty() {
811 throw new java.lang.UnsupportedOperationException(
812 "IsDirty is not supported on tombstones");
813 }
814
815
816
817
818 public java.lang.CharSequence getDatatype() {
819 throw new java.lang.UnsupportedOperationException(
820 "Get is not supported on tombstones");
821 }
822
823
824
825
826
827
828
829 public void setDatatype(java.lang.CharSequence value) {
830 throw new java.lang.UnsupportedOperationException(
831 "Set is not supported on tombstones");
832 }
833
834
835
836
837
838 public boolean isDatatypeDirty() {
839 throw new java.lang.UnsupportedOperationException(
840 "IsDirty is not supported on tombstones");
841 }
842
843
844
845
846 public java.lang.Long getSequenceID() {
847 throw new java.lang.UnsupportedOperationException(
848 "Get is not supported on tombstones");
849 }
850
851
852
853
854
855
856
857 public void setSequenceID(java.lang.Long value) {
858 throw new java.lang.UnsupportedOperationException(
859 "Set is not supported on tombstones");
860 }
861
862
863
864
865
866 public boolean isSequenceIDDirty() {
867 throw new java.lang.UnsupportedOperationException(
868 "IsDirty is not supported on tombstones");
869 }
870
871
872
873
874 public java.lang.CharSequence getName() {
875 throw new java.lang.UnsupportedOperationException(
876 "Get is not supported on tombstones");
877 }
878
879
880
881
882
883
884
885 public void setName(java.lang.CharSequence value) {
886 throw new java.lang.UnsupportedOperationException(
887 "Set is not supported on tombstones");
888 }
889
890
891
892
893
894 public boolean isNameDirty() {
895 throw new java.lang.UnsupportedOperationException(
896 "IsDirty is not supported on tombstones");
897 }
898
899
900
901
902 public java.nio.ByteBuffer getData() {
903 throw new java.lang.UnsupportedOperationException(
904 "Get is not supported on tombstones");
905 }
906
907
908
909
910
911
912
913 public void setData(java.nio.ByteBuffer value) {
914 throw new java.lang.UnsupportedOperationException(
915 "Set is not supported on tombstones");
916 }
917
918
919
920
921
922 public boolean isDataDirty() {
923 throw new java.lang.UnsupportedOperationException(
924 "IsDirty is not supported on tombstones");
925 }
926
927 }
928
929 }