コード例 #1
0
ファイル: ExtractAvroTreeBuilder.java プロジェクト: rvs/cdk
    @Override
    protected boolean doProcess(Record inputRecord) {
      //
      // Preconditions.checkState(ReadAvroBuilder.AVRO_MEMORY_MIME_TYPE.equals(inputRecord.getFirstValue(Fields.ATTACHMENT_MIME_TYPE)));
      GenericContainer datum = (GenericContainer) inputRecord.getFirstValue(Fields.ATTACHMENT_BODY);
      Preconditions.checkNotNull(datum);
      Preconditions.checkNotNull(datum.getSchema());
      Record outputRecord = inputRecord.copy();

      extractTree(datum, datum.getSchema(), outputRecord, outputFieldPrefix);

      // pass record to next command in chain:
      return getChild().process(outputRecord);
    }
コード例 #2
0
 private Schema getSchema(GenericContainer datum, Schema lastSchema) {
   Schema schema = datum.getSchema();
   if (lastSchema != null && lastSchema != schema) {
     throw new MorphlineRuntimeException(
         "Schemas must be identical: " + schema + ", lastSchema: " + lastSchema);
   }
   return schema;
 }