From 74b6b379c89e1e720cbaabf7c06c210ddb279b22 Mon Sep 17 00:00:00 2001 From: anew Date: Mon, 15 Apr 2019 17:51:25 -0700 Subject: [PATCH] v1.1.0 for package rename, update to cdap6 --- README.md | 2 +- pom.xml | 41 +++++++++++++------ .../plugin/cobol}/CobolRecordConverter.java | 39 +++++++++--------- .../cdap/plugin}/cobol/CopybookReader.java | 10 ++--- .../cdap/plugin}/common/AvroConverter.java | 8 ++-- .../plugin}/common/LocationByteSource.java | 4 +- .../plugin}/common/LocationCharSource.java | 4 +- .../cdap/plugin}/common/StreamByteSource.java | 4 +- .../cdap/plugin}/common/StreamCharSource.java | 4 +- .../cdap/plugin}/cobol/SimpleTest.java | 14 +++---- src/test/resources/logback-test.xml | 2 +- 11 files changed, 74 insertions(+), 58 deletions(-) rename src/main/java/{co/cask/plugin => io/cdap/plugin/cobol}/CobolRecordConverter.java (85%) rename src/main/java/{co/cask => io/cdap/plugin}/cobol/CopybookReader.java (97%) rename src/main/java/{co/cask => io/cdap/plugin}/common/AvroConverter.java (98%) rename src/main/java/{co/cask => io/cdap/plugin}/common/LocationByteSource.java (93%) rename src/main/java/{co/cask => io/cdap/plugin}/common/LocationCharSource.java (94%) rename src/main/java/{co/cask => io/cdap/plugin}/common/StreamByteSource.java (93%) rename src/main/java/{co/cask => io/cdap/plugin}/common/StreamCharSource.java (93%) rename src/test/java/{co/cask => io/cdap/plugin}/cobol/SimpleTest.java (85%) diff --git a/README.md b/README.md index 151fc8d..8556a7f 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ CDAP Slack Channel: http://cdap-users.herokuapp.com/ ## License and Trademarks -Copyright © 2017 Cask Data, Inc. +Copyright © 2017-2019 Cask Data, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pom.xml b/pom.xml index a5873c4..24227bd 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,24 @@ + + + 4.0.0 - co.cask + io.cdap.plugin cobol-to-avro-transform jar 1.0.0 @@ -9,24 +26,24 @@ 1.7.7 - 4.3.1 + 6.0.0-SNAPSHOT 18.0 3.0.7 0.4.2 1.2.3 UTF-8 - - ${project.basedir} + system:cdap-data-streams[6.0.0-SNAPSHOT,7.0.0-SNAPSHOT) + system:cdap-data-pipeline[6.0.0-SNAPSHOT,7.0.0-SNAPSHOT) - co.cask.cdap + io.cdap.cdap cdap-api ${cdap.version} - co.cask.cdap + io.cdap.cdap cdap-etl-api ${cdap.version} @@ -75,7 +92,7 @@ test - co.cask.cdap + io.cdap.cdap cdap-formats ${cdap.version} @@ -84,13 +101,13 @@ - co.cask + io.cdap cdap-maven-plugin - 1.0.0-SNAPSHOT + 1.1.0 - system:cdap-data-pipeline[4.0.0,5.0.0-SNAPSHOT) - system:cdap-data-streams[4.0.0,5.0.0-SNAPSHOT) + ${data.pipeline.parent} + ${data.stream.parent} @@ -120,7 +137,7 @@ <_exportcontents> - co.cask.*; + io.cdap.plugin.*; com.google.common.*; com.legstar.* diff --git a/src/main/java/co/cask/plugin/CobolRecordConverter.java b/src/main/java/io/cdap/plugin/cobol/CobolRecordConverter.java similarity index 85% rename from src/main/java/co/cask/plugin/CobolRecordConverter.java rename to src/main/java/io/cdap/plugin/cobol/CobolRecordConverter.java index 3f675ac..d1598e7 100644 --- a/src/main/java/co/cask/plugin/CobolRecordConverter.java +++ b/src/main/java/io/cdap/plugin/cobol/CobolRecordConverter.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017 Cask Data, Inc. + * Copyright © 2017-2019 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -14,25 +14,24 @@ * the License. */ -package co.cask.plugin; - -import co.cask.cdap.api.annotation.Description; -import co.cask.cdap.api.annotation.Macro; -import co.cask.cdap.api.annotation.Name; -import co.cask.cdap.api.annotation.Plugin; -import co.cask.cdap.api.data.format.StructuredRecord; -import co.cask.cdap.api.plugin.EndpointPluginContext; -import co.cask.cdap.api.plugin.PluginConfig; -import co.cask.cdap.etl.api.Emitter; -import co.cask.cdap.etl.api.Transform; -import co.cask.cdap.etl.api.TransformContext; -import co.cask.cdap.format.StructuredRecordStringConverter; -import co.cask.cobol.CopybookReader; -import co.cask.common.AvroConverter; -import co.cask.common.StreamByteSource; -import co.cask.common.StreamCharSource; +package io.cdap.plugin.cobol; + import com.legstar.avro.cob2avro.io.AbstractZosDatumReader; import com.legstar.cob2xsd.Cob2XsdConfig; +import io.cdap.cdap.api.annotation.Description; +import io.cdap.cdap.api.annotation.Macro; +import io.cdap.cdap.api.annotation.Name; +import io.cdap.cdap.api.annotation.Plugin; +import io.cdap.cdap.api.data.format.StructuredRecord; +import io.cdap.cdap.api.plugin.EndpointPluginContext; +import io.cdap.cdap.api.plugin.PluginConfig; +import io.cdap.cdap.etl.api.Emitter; +import io.cdap.cdap.etl.api.Transform; +import io.cdap.cdap.etl.api.TransformContext; +import io.cdap.cdap.format.StructuredRecordStringConverter; +import io.cdap.plugin.common.AvroConverter; +import io.cdap.plugin.common.StreamByteSource; +import io.cdap.plugin.common.StreamCharSource; import org.apache.avro.Schema; import org.apache.avro.generic.GenericRecord; import org.slf4j.Logger; @@ -61,7 +60,7 @@ public CobolRecordConverter(Config config) { private CopybookReader copybookReader; private Schema avroSchema; - private co.cask.cdap.api.data.schema.Schema schema; + private io.cdap.cdap.api.data.schema.Schema schema; @Override public void initialize(TransformContext context) throws Exception { @@ -107,7 +106,7 @@ private String getCodeFormat() { * @throws IOException if there are any errors converting schema */ @javax.ws.rs.Path("outputSchema") - public co.cask.cdap.api.data.schema.Schema getSchema(GetSchemaRequest request, + public io.cdap.cdap.api.data.schema.Schema getSchema(GetSchemaRequest request, EndpointPluginContext pluginContext) throws IOException { Properties properties = new Properties(); properties.setProperty(Cob2XsdConfig.CODE_FORMAT, request.getCodeFormat()); diff --git a/src/main/java/co/cask/cobol/CopybookReader.java b/src/main/java/io/cdap/plugin/cobol/CopybookReader.java similarity index 97% rename from src/main/java/co/cask/cobol/CopybookReader.java rename to src/main/java/io/cdap/plugin/cobol/CopybookReader.java index 74f296e..406c58a 100644 --- a/src/main/java/co/cask/cobol/CopybookReader.java +++ b/src/main/java/io/cdap/plugin/cobol/CopybookReader.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017 Cask Data, Inc. + * Copyright © 2017-2019 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -14,7 +14,7 @@ * the License. */ -package co.cask.cobol; +package io.cdap.plugin.cobol; import com.github.jknack.handlebars.Handlebars; import com.github.jknack.handlebars.Template; @@ -75,13 +75,13 @@ public CopybookReader(CharSource copybookSource, Properties cobolConfig) throws // Generate XML schema from the copybook XmlSchema xmlSchema = new XmlSchemaCollection().read( - cob2xsd.emitXsd(cobolDataItems, "co.cask.cobol").getSchemaDocument()); + cob2xsd.emitXsd(cobolDataItems, "io.cdap.plugin.cobol").getSchemaDocument()); // Convert XML schema to Avro schema Schema avroSchema = translate(xmlSchema); // Generate the CobolType classes ClassLoader - this.cobolTypeClassLoader = createCobolTypesClassLoader(xmlSchema, "co.cask.cobol"); + this.cobolTypeClassLoader = createCobolTypesClassLoader(xmlSchema, "io.cdap.plugin.cobol"); this.avroSchema = avroSchema; } catch (RecognizerException e) { throw new IOException("Failed to parse cobol copybook: " + System.lineSeparator() @@ -170,7 +170,7 @@ private List parseCopybook(Cob2Xsd cob2xsd, Reader reader) throws */ private Schema translate(XmlSchema xmlSchema) throws Xsd2AvroTranslatorException { Xsd2AvroTranslator avroTranslator = new Xsd2AvroTranslator(); - return new Schema.Parser().parse(avroTranslator.translate(xmlSchema, "co.cask.cobol", "schema")); + return new Schema.Parser().parse(avroTranslator.translate(xmlSchema, "io.cdap.plugin.cobol", "schema")); } /** diff --git a/src/main/java/co/cask/common/AvroConverter.java b/src/main/java/io/cdap/plugin/common/AvroConverter.java similarity index 98% rename from src/main/java/co/cask/common/AvroConverter.java rename to src/main/java/io/cdap/plugin/common/AvroConverter.java index a265d83..db4ea7f 100644 --- a/src/main/java/co/cask/common/AvroConverter.java +++ b/src/main/java/io/cdap/plugin/common/AvroConverter.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017 Cask Data, Inc. + * Copyright © 2017-2019 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -14,13 +14,13 @@ * the License. */ -package co.cask.common; +package io.cdap.plugin.common; -import co.cask.cdap.api.data.format.StructuredRecord; -import co.cask.cdap.api.data.schema.Schema; import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; +import io.cdap.cdap.api.data.format.StructuredRecord; +import io.cdap.cdap.api.data.schema.Schema; import org.apache.avro.generic.GenericArray; import org.apache.avro.generic.GenericEnumSymbol; import org.apache.avro.generic.GenericFixed; diff --git a/src/main/java/co/cask/common/LocationByteSource.java b/src/main/java/io/cdap/plugin/common/LocationByteSource.java similarity index 93% rename from src/main/java/co/cask/common/LocationByteSource.java rename to src/main/java/io/cdap/plugin/common/LocationByteSource.java index 84c9430..6a41ffc 100644 --- a/src/main/java/co/cask/common/LocationByteSource.java +++ b/src/main/java/io/cdap/plugin/common/LocationByteSource.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017 Cask Data, Inc. + * Copyright © 2017-2019 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -14,7 +14,7 @@ * the License. */ -package co.cask.common; +package io.cdap.plugin.common; import com.google.common.io.ByteSource; import org.apache.twill.filesystem.Location; diff --git a/src/main/java/co/cask/common/LocationCharSource.java b/src/main/java/io/cdap/plugin/common/LocationCharSource.java similarity index 94% rename from src/main/java/co/cask/common/LocationCharSource.java rename to src/main/java/io/cdap/plugin/common/LocationCharSource.java index 27b9572..8a814d6 100644 --- a/src/main/java/co/cask/common/LocationCharSource.java +++ b/src/main/java/io/cdap/plugin/common/LocationCharSource.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017 Cask Data, Inc. + * Copyright © 2017-2019 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -14,7 +14,7 @@ * the License. */ -package co.cask.common; +package io.cdap.plugin.common; import com.google.common.io.CharSource; import org.apache.twill.filesystem.Location; diff --git a/src/main/java/co/cask/common/StreamByteSource.java b/src/main/java/io/cdap/plugin/common/StreamByteSource.java similarity index 93% rename from src/main/java/co/cask/common/StreamByteSource.java rename to src/main/java/io/cdap/plugin/common/StreamByteSource.java index 6189584..8eb8858 100644 --- a/src/main/java/co/cask/common/StreamByteSource.java +++ b/src/main/java/io/cdap/plugin/common/StreamByteSource.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017 Cask Data, Inc. + * Copyright © 2017-2019 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -14,7 +14,7 @@ * the License. */ -package co.cask.common; +package io.cdap.plugin.common; import com.google.common.io.ByteSource; diff --git a/src/main/java/co/cask/common/StreamCharSource.java b/src/main/java/io/cdap/plugin/common/StreamCharSource.java similarity index 93% rename from src/main/java/co/cask/common/StreamCharSource.java rename to src/main/java/io/cdap/plugin/common/StreamCharSource.java index 195a006..7ecaf3e 100644 --- a/src/main/java/co/cask/common/StreamCharSource.java +++ b/src/main/java/io/cdap/plugin/common/StreamCharSource.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017 Cask Data, Inc. + * Copyright © 2017-2019 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -14,7 +14,7 @@ * the License. */ -package co.cask.common; +package io.cdap.plugin.common; import com.google.common.io.CharSource; diff --git a/src/test/java/co/cask/cobol/SimpleTest.java b/src/test/java/io/cdap/plugin/cobol/SimpleTest.java similarity index 85% rename from src/test/java/co/cask/cobol/SimpleTest.java rename to src/test/java/io/cdap/plugin/cobol/SimpleTest.java index 9883510..d2e1b45 100644 --- a/src/test/java/co/cask/cobol/SimpleTest.java +++ b/src/test/java/io/cdap/plugin/cobol/SimpleTest.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017 Cask Data, Inc. + * Copyright © 2017-2019 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -14,14 +14,14 @@ * the License. */ -package co.cask.cobol; +package io.cdap.plugin.cobol; -import co.cask.cdap.api.data.format.StructuredRecord; -import co.cask.cdap.api.data.schema.Schema; -import co.cask.cdap.format.StructuredRecordStringConverter; -import co.cask.common.AvroConverter; import com.google.common.io.Resources; import com.legstar.avro.cob2avro.io.AbstractZosDatumReader; +import io.cdap.cdap.api.data.format.StructuredRecord; +import io.cdap.cdap.api.data.schema.Schema; +import io.cdap.cdap.format.StructuredRecordStringConverter; +import io.cdap.plugin.common.AvroConverter; import org.apache.avro.generic.GenericRecord; import org.junit.Assert; import org.junit.ClassRule; @@ -63,7 +63,7 @@ public void test() throws Exception { copybookReader.createRecordReader(Resources.asByteSource(dataURL), "IBM01140", true)) { for (GenericRecord record : reader) { StructuredRecord structuredRecord = AvroConverter.fromAvroRecord(record, schema); - LOG.info(StructuredRecordStringConverter.toJsonString(structuredRecord)); + LOG.trace(StructuredRecordStringConverter.toJsonString(structuredRecord)); } } } diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml index b3e2101..818825d 100644 --- a/src/test/resources/logback-test.xml +++ b/src/test/resources/logback-test.xml @@ -24,7 +24,7 @@ - +