diff --git a/README.md b/README.md index 8c181bf95..bd914564e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![Build Status](https://travis-ci.org/debezium/debezium.svg?branch=master)](https://travis-ci.org/debezium/debezium) [![License](http://img.shields.io/:license-apache-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) -Copyright 2008-2016 Debezium Authors. Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). +Copyright Debezium Authors. Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). # Debezium diff --git a/copyright.txt b/copyright.txt new file mode 100644 index 000000000..05632f0e3 --- /dev/null +++ b/copyright.txt @@ -0,0 +1,6 @@ +Barry LaFond +Daniel Kelleher +Horia Chiorean +Jure Kajzer +Randall Hauch +Sanne Grinovero diff --git a/debezium-core/src/main/java/io/debezium/config/Configuration.java b/debezium-core/src/main/java/io/debezium/config/Configuration.java index 2387997ba..7b6b91f69 100644 --- a/debezium-core/src/main/java/io/debezium/config/Configuration.java +++ b/debezium-core/src/main/java/io/debezium/config/Configuration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/CRDT.java b/debezium-core/src/main/java/io/debezium/crdt/CRDT.java index 79e0117f8..c8fb071c8 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/CRDT.java +++ b/debezium-core/src/main/java/io/debezium/crdt/CRDT.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/Count.java b/debezium-core/src/main/java/io/debezium/crdt/Count.java index b429d6358..b8aaf109f 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/Count.java +++ b/debezium-core/src/main/java/io/debezium/crdt/Count.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/DeltaCount.java b/debezium-core/src/main/java/io/debezium/crdt/DeltaCount.java index 6023aec9d..953d50ab1 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/DeltaCount.java +++ b/debezium-core/src/main/java/io/debezium/crdt/DeltaCount.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/DeltaCounter.java b/debezium-core/src/main/java/io/debezium/crdt/DeltaCounter.java index f543b4fb8..171a254b9 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/DeltaCounter.java +++ b/debezium-core/src/main/java/io/debezium/crdt/DeltaCounter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/GCount.java b/debezium-core/src/main/java/io/debezium/crdt/GCount.java index 0b3b1d118..2e5f29078 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/GCount.java +++ b/debezium-core/src/main/java/io/debezium/crdt/GCount.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/GCounter.java b/debezium-core/src/main/java/io/debezium/crdt/GCounter.java index 9f3585cbb..77ccb6385 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/GCounter.java +++ b/debezium-core/src/main/java/io/debezium/crdt/GCounter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/PNCount.java b/debezium-core/src/main/java/io/debezium/crdt/PNCount.java index 1f3db346d..f52ff1447 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/PNCount.java +++ b/debezium-core/src/main/java/io/debezium/crdt/PNCount.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/PNCounter.java b/debezium-core/src/main/java/io/debezium/crdt/PNCounter.java index 7a1c8a3a9..1afcc4505 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/PNCounter.java +++ b/debezium-core/src/main/java/io/debezium/crdt/PNCounter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/StateBasedGCounter.java b/debezium-core/src/main/java/io/debezium/crdt/StateBasedGCounter.java index 76cd78ff2..d9729f49d 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/StateBasedGCounter.java +++ b/debezium-core/src/main/java/io/debezium/crdt/StateBasedGCounter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/StateBasedPNCounter.java b/debezium-core/src/main/java/io/debezium/crdt/StateBasedPNCounter.java index b60ba04d6..a0184a12a 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/StateBasedPNCounter.java +++ b/debezium-core/src/main/java/io/debezium/crdt/StateBasedPNCounter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/crdt/StateBasedPNDeltaCounter.java b/debezium-core/src/main/java/io/debezium/crdt/StateBasedPNDeltaCounter.java index b68f1035b..cac664f60 100644 --- a/debezium-core/src/main/java/io/debezium/crdt/StateBasedPNDeltaCounter.java +++ b/debezium-core/src/main/java/io/debezium/crdt/StateBasedPNDeltaCounter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/data/Bits.java b/debezium-core/src/main/java/io/debezium/data/Bits.java index 3b75d543b..2027f7008 100644 --- a/debezium-core/src/main/java/io/debezium/data/Bits.java +++ b/debezium-core/src/main/java/io/debezium/data/Bits.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/data/IsoTime.java b/debezium-core/src/main/java/io/debezium/data/IsoTime.java index 833b92583..effb86238 100644 --- a/debezium-core/src/main/java/io/debezium/data/IsoTime.java +++ b/debezium-core/src/main/java/io/debezium/data/IsoTime.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/data/IsoTimestamp.java b/debezium-core/src/main/java/io/debezium/data/IsoTimestamp.java index 2fffff071..7f1106eca 100644 --- a/debezium-core/src/main/java/io/debezium/data/IsoTimestamp.java +++ b/debezium-core/src/main/java/io/debezium/data/IsoTimestamp.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/function/BooleanConsumer.java b/debezium-core/src/main/java/io/debezium/function/BooleanConsumer.java index ad409d9d9..1b15259a1 100644 --- a/debezium-core/src/main/java/io/debezium/function/BooleanConsumer.java +++ b/debezium-core/src/main/java/io/debezium/function/BooleanConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/function/Callable.java b/debezium-core/src/main/java/io/debezium/function/Callable.java index 66f45148e..cd98be140 100644 --- a/debezium-core/src/main/java/io/debezium/function/Callable.java +++ b/debezium-core/src/main/java/io/debezium/function/Callable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/function/Predicates.java b/debezium-core/src/main/java/io/debezium/function/Predicates.java index b4b21b076..d9ea2149c 100644 --- a/debezium-core/src/main/java/io/debezium/function/Predicates.java +++ b/debezium-core/src/main/java/io/debezium/function/Predicates.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/jdbc/JdbcConfiguration.java b/debezium-core/src/main/java/io/debezium/jdbc/JdbcConfiguration.java index f0c7c7441..e05663621 100644 --- a/debezium-core/src/main/java/io/debezium/jdbc/JdbcConfiguration.java +++ b/debezium-core/src/main/java/io/debezium/jdbc/JdbcConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/jdbc/JdbcConnection.java b/debezium-core/src/main/java/io/debezium/jdbc/JdbcConnection.java index 349366eed..582806c36 100644 --- a/debezium-core/src/main/java/io/debezium/jdbc/JdbcConnection.java +++ b/debezium-core/src/main/java/io/debezium/jdbc/JdbcConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/Column.java b/debezium-core/src/main/java/io/debezium/relational/Column.java index 0023d7933..3bba00242 100644 --- a/debezium-core/src/main/java/io/debezium/relational/Column.java +++ b/debezium-core/src/main/java/io/debezium/relational/Column.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/ColumnEditor.java b/debezium-core/src/main/java/io/debezium/relational/ColumnEditor.java index 5b74c202e..68a8e13db 100644 --- a/debezium-core/src/main/java/io/debezium/relational/ColumnEditor.java +++ b/debezium-core/src/main/java/io/debezium/relational/ColumnEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/ColumnEditorImpl.java b/debezium-core/src/main/java/io/debezium/relational/ColumnEditorImpl.java index 7dfeb449b..c0be7f9e2 100644 --- a/debezium-core/src/main/java/io/debezium/relational/ColumnEditorImpl.java +++ b/debezium-core/src/main/java/io/debezium/relational/ColumnEditorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/ColumnImpl.java b/debezium-core/src/main/java/io/debezium/relational/ColumnImpl.java index 9deeeda79..a7241abb9 100644 --- a/debezium-core/src/main/java/io/debezium/relational/ColumnImpl.java +++ b/debezium-core/src/main/java/io/debezium/relational/ColumnImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/Table.java b/debezium-core/src/main/java/io/debezium/relational/Table.java index 42866c949..ce9f9c0d1 100644 --- a/debezium-core/src/main/java/io/debezium/relational/Table.java +++ b/debezium-core/src/main/java/io/debezium/relational/Table.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/TableEditor.java b/debezium-core/src/main/java/io/debezium/relational/TableEditor.java index 27c19ccd7..2a9b06023 100644 --- a/debezium-core/src/main/java/io/debezium/relational/TableEditor.java +++ b/debezium-core/src/main/java/io/debezium/relational/TableEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/TableEditorImpl.java b/debezium-core/src/main/java/io/debezium/relational/TableEditorImpl.java index 5e8d9a16d..544734cc9 100644 --- a/debezium-core/src/main/java/io/debezium/relational/TableEditorImpl.java +++ b/debezium-core/src/main/java/io/debezium/relational/TableEditorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/TableId.java b/debezium-core/src/main/java/io/debezium/relational/TableId.java index 6a8c4dea1..f1921f7d1 100644 --- a/debezium-core/src/main/java/io/debezium/relational/TableId.java +++ b/debezium-core/src/main/java/io/debezium/relational/TableId.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/TableImpl.java b/debezium-core/src/main/java/io/debezium/relational/TableImpl.java index 2757b0e37..d88b996a2 100644 --- a/debezium-core/src/main/java/io/debezium/relational/TableImpl.java +++ b/debezium-core/src/main/java/io/debezium/relational/TableImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/TableSchema.java b/debezium-core/src/main/java/io/debezium/relational/TableSchema.java index e5ac628c6..ed7f4b78f 100644 --- a/debezium-core/src/main/java/io/debezium/relational/TableSchema.java +++ b/debezium-core/src/main/java/io/debezium/relational/TableSchema.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/TableSchemaBuilder.java b/debezium-core/src/main/java/io/debezium/relational/TableSchemaBuilder.java index ed8e1649c..a17988b3c 100644 --- a/debezium-core/src/main/java/io/debezium/relational/TableSchemaBuilder.java +++ b/debezium-core/src/main/java/io/debezium/relational/TableSchemaBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/Tables.java b/debezium-core/src/main/java/io/debezium/relational/Tables.java index 041d05346..82dae76ee 100644 --- a/debezium-core/src/main/java/io/debezium/relational/Tables.java +++ b/debezium-core/src/main/java/io/debezium/relational/Tables.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/ddl/DataType.java b/debezium-core/src/main/java/io/debezium/relational/ddl/DataType.java index 84f146308..3444d543c 100644 --- a/debezium-core/src/main/java/io/debezium/relational/ddl/DataType.java +++ b/debezium-core/src/main/java/io/debezium/relational/ddl/DataType.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -12,18 +12,20 @@ /** * An immutable representation of a data type + * * @author Randall Hauch */ @Immutable public final class DataType { - + /** * Obtain the data type for a user-defined or fully-qualified type name. + * * @param qualifiedName the fully-qualified name; may not be null * @return the data type; never null */ - public static DataType userDefinedType( String qualifiedName ) { - return new DataType(qualifiedName,qualifiedName,Types.OTHER,-1,-1,null,0); + public static DataType userDefinedType(String qualifiedName) { + return new DataType(qualifiedName, qualifiedName, Types.OTHER, -1, -1, null, 0); } private final String expression; @@ -32,44 +34,44 @@ public static DataType userDefinedType( String qualifiedName ) { private final long length; private final int scale; private final int[] arrayDimensions; - - protected DataType( String expr, String name, int jdbcType, long length, int scale, int[] arrayDimensions, int arrayDimLength ) { + + protected DataType(String expr, String name, int jdbcType, long length, int scale, int[] arrayDimensions, int arrayDimLength) { this.expression = expr; - this.name= name; + this.name = name; this.jdbcType = jdbcType; this.length = length; this.scale = scale; - if ( arrayDimensions == null || arrayDimLength == 0 ) { + if (arrayDimensions == null || arrayDimLength == 0) { this.arrayDimensions = null; } else { this.arrayDimensions = Arrays.copyOf(arrayDimensions, arrayDimLength); } } - + public String expression() { return expression; } - + public String name() { return name; } - + public int jdbcType() { return jdbcType; } - + public long length() { return length; } - + public int scale() { return scale; } - + public int[] arrayDimensions() { return arrayDimensions; } - + @Override public String toString() { return expression; diff --git a/debezium-core/src/main/java/io/debezium/relational/ddl/DataTypeGrammarParser.java b/debezium-core/src/main/java/io/debezium/relational/ddl/DataTypeGrammarParser.java index 88e11da01..7be399975 100644 --- a/debezium-core/src/main/java/io/debezium/relational/ddl/DataTypeGrammarParser.java +++ b/debezium-core/src/main/java/io/debezium/relational/ddl/DataTypeGrammarParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/ddl/DataTypeParser.java b/debezium-core/src/main/java/io/debezium/relational/ddl/DataTypeParser.java index d1beba29a..5100fe939 100644 --- a/debezium-core/src/main/java/io/debezium/relational/ddl/DataTypeParser.java +++ b/debezium-core/src/main/java/io/debezium/relational/ddl/DataTypeParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -19,10 +19,14 @@ import io.debezium.text.TokenStream.Marker; /** - * A parser of SQL data types. Callers set up a parser and register patterns that describe the possible lists of tokens, and then - * can repeatedly {@link #parse(TokenStream, Consumer) parse} {@link TokenStream streams of tokens} looking for matches. + * A parser of SQL data types. Callers set up a parser and register patterns that describe the possible lists of data type tokens, + * and then repeatedly {@link #parse(TokenStream, Consumer) parse} {@link TokenStream streams of tokens} looking for matches. + *

+ * This is typically used within a {@link DdlParser} implementation to parse and identify data types appearing within a stream + * of DDL content. * * @author Randall Hauch + * @see DdlParser */ @ThreadSafe public class DataTypeParser { diff --git a/debezium-core/src/main/java/io/debezium/relational/ddl/DdlConstants.java b/debezium-core/src/main/java/io/debezium/relational/ddl/DdlConstants.java deleted file mode 100644 index 3a52445d7..000000000 --- a/debezium-core/src/main/java/io/debezium/relational/ddl/DdlConstants.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2016 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.relational.ddl; - -import java.util.Arrays; -import java.util.List; - -public interface DdlConstants { - - public static final long KILO = 1024; - public static final long MEGA = KILO * 1024; - public static final long GIGA = MEGA * 1024; - - public static final String DEFAULT_TERMINATOR = ";"; - - /* - * Character Strings - */ - public static final String SPACE = " "; - public static final String PERIOD = "."; - public static final String COMMA = ","; - public static final String SEMICOLON = ";"; - public static final String L_PAREN = "("; - public static final String R_PAREN = ")"; - public static final String L_SQUOTE = "’"; - public static final String LS_BRACE = "["; - public static final String RS_BRACE = "]"; - - /* - * Table Constraint ID's - */ - public static final int CONSTRAINT_UC = 0; - public static final int CONSTRAINT_FK = 1; - public static final int CONSTRAINT_PK = 2; - public static final int CONSTRAINT_C = 3; - - public static final String PRIMARY_KEY = "PRIMARY KEY"; - public static final String FOREIGN_KEY = "FOREIGN KEY"; - - /* - * Common DDL Keywords - */ - public static final String ALTER = "ALTER"; - public static final String CHECK = "CHECK"; - public static final String COLUMN = "COLUMN"; - public static final String CONSTRAINT = "CONSTRAINT"; - public static final String CREATE = "CREATE"; - public static final String DECLARE = "DECLARE"; - public static final String DROP = "DROP"; - public static final String FOREIGN = "FOREIGN"; - public static final String GRANT = "GRANT"; - public static final String REVOKE = "REVOKE"; - public static final String INDEX = "INDEX"; - public static final String INSERT = "INSERT"; - public static final String UPDATE = "UPDATE"; - public static final String DELETE = "DELETE"; - public static final String SELECT = "SELECT"; - public static final String KEY = "KEY"; - public static final String OFF = "OFF"; - public static final String ON = "ON"; - public static final String PRIMARY = "PRIMARY"; - public static final String SCHEMA = "SCHEMA"; - public static final String SET = "SET"; - public static final String TABLE = "TABLE"; - public static final String UNIQUE = "UNIQUE"; - public static final String VIEW = "VIEW"; - public static final String NOT = "NOT"; - public static final String NULL = "NULL"; - - public static final String MISSING_TERMINATOR_NODE_LITERAL = "missingTerminator"; - - interface DropBehavior { - public static final String CASCADE = "CASCADE"; - public static final String RESTRICT = "RESTRICT"; - } - - interface MatchType { - public static final String FULL = "FULL"; - public static final String PARTIAL = "PARTIAL"; - } - - interface ReferencialAction { - public static final String CASCADE = "CASCADE"; - public static final String SET_NULL = "SET NULL"; - public static final String SET_DEFAULT = "SET DEFAULT"; - public static final String NO_ACTION = "NO ACTION"; - } - - // Basic SQL 92 statement start phrases - interface StatementStartPhrases { - public static final String[] STMT_CREATE_SCHEMA = {CREATE, SCHEMA}; - public static final String[] STMT_CREATE_TABLE = {CREATE, TABLE}; // { GLOBAL | LOCAL } TEMPORARY ] TABLE - public static final String[] STMT_CREATE_GLOBAL_TEMPORARY_TABLE = {CREATE, "GLOBAL", "TEMPORARY", TABLE}; - public static final String[] STMT_CREATE_LOCAL_TEMPORARY_TABLE = {CREATE, "LOCAL", "TEMPORARY", TABLE}; - public static final String[] STMT_CREATE_VIEW = {CREATE, VIEW}; - public static final String[] STMT_CREATE_OR_REPLACE_VIEW = {CREATE, "OR", "REPLACE", VIEW}; - public static final String[] STMT_CREATE_ASSERTION = {CREATE, "ASSERTION"}; - public static final String[] STMT_CREATE_CHARACTER_SET = {CREATE, "CHARACTER", SET}; - public static final String[] STMT_CREATE_COLLATION = {CREATE, "COLLATION"}; - public static final String[] STMT_CREATE_DOMAIN = {CREATE, "DOMAIN"}; - public static final String[] STMT_CREATE_TRANSLATION = {CREATE, "TRANSLATION"}; - public static final String[] STMT_ALTER_TABLE = {ALTER, TABLE}; - public static final String[] STMT_ALTER_DOMAIN = {ALTER, "DOMAIN"}; - public static final String[] STMT_GRANT = {GRANT}; - public static final String[] STMT_REVOKE = {REVOKE}; - public static final String[] STMT_DROP_SCHEMA = {DROP, SCHEMA}; - public static final String[] STMT_DROP_TABLE = {DROP, TABLE}; - public static final String[] STMT_DROP_VIEW = {DROP, VIEW}; - public static final String[] STMT_DROP_DOMAIN = {DROP, "DOMAIN"}; - public static final String[] STMT_DROP_CHARACTER_SET = {DROP, "CHARACTER", SET}; - public static final String[] STMT_DROP_COLLATION = {DROP, "COLLATION"}; - public static final String[] STMT_DROP_TRANSLATION = {DROP, "TRANSLATION"}; - public static final String[] STMT_DROP_ASSERTION = {DROP, "ASSERTION"}; - public static final String[] STMT_INSERT_INTO = {"INSERT", "INTO"}; - public static final String[] STMT_SET_DEFINE = {"SET", "DEFINE"}; - - public final static String[][] SQL_92_ALL_PHRASES = {STMT_CREATE_SCHEMA, STMT_CREATE_TABLE, - STMT_CREATE_GLOBAL_TEMPORARY_TABLE, STMT_CREATE_LOCAL_TEMPORARY_TABLE, STMT_CREATE_VIEW, STMT_CREATE_OR_REPLACE_VIEW, - STMT_CREATE_ASSERTION, STMT_CREATE_CHARACTER_SET, STMT_CREATE_COLLATION, STMT_CREATE_TRANSLATION, STMT_CREATE_DOMAIN, - STMT_ALTER_TABLE, STMT_ALTER_DOMAIN, STMT_GRANT, STMT_REVOKE, STMT_DROP_SCHEMA, STMT_DROP_TABLE, STMT_DROP_VIEW, - STMT_DROP_DOMAIN, STMT_DROP_CHARACTER_SET, STMT_DROP_COLLATION, STMT_DROP_TRANSLATION, STMT_DROP_ASSERTION, - STMT_INSERT_INTO, STMT_SET_DEFINE}; - } - - /** - * Constants related to Data Types - */ - interface DataTypes { - public static final int DTYPE_CODE_ANY = -1; - public static final int DTYPE_CODE_CHAR_STRING = 0; - public static final int DTYPE_CODE_NCHAR_STRING = 1; - public static final int DTYPE_CODE_BIT_STRING = 2; - public static final int DTYPE_CODE_EXACT_NUMERIC = 3; - public static final int DTYPE_CODE_APROX_NUMERIC = 4; - public static final int DTYPE_CODE_DATE_TIME = 5; - public static final int DTYPE_CODE_MISC = 6; - public static final int DTYPE_CODE_CUSTOM = 7; - - // CHAR - public static final String[] DTYPE_CHARACTER = {"CHARACTER"}; - public static final String[] DTYPE_CHAR = {"CHAR"}; - public static final String[] DTYPE_CHARACTER_VARYING = {"CHARACTER", "VARYING"}; - public static final String[] DTYPE_CHAR_VARYING = {"CHAR", "VARYING"}; - public static final String[] DTYPE_VARCHAR = {"VARCHAR"}; - // NATIONAL CHAR - public static final String[] DTYPE_NATIONAL_CHARACTER = {"NATIONAL", "CHARACTER"}; - public static final String[] DTYPE_NATIONAL_CHAR = {"NATIONAL", "CHAR"}; - public static final String[] DTYPE_NATIONAL_CHARACTER_VARYING = {"NATIONAL", "CHARACTER", "VARYING"}; - public static final String[] DTYPE_NATIONAL_CHAR_VARYING = {"NATIONAL", "CHAR", "VARYING"}; - public static final String[] DTYPE_NCHAR_VARYING = {"NCHAR", "VARYING"}; - public static final String[] DTYPE_NCHAR = {"NCHAR"}; - // BIT STRING - public static final String[] DTYPE_BIT = {"BIT"}; - public static final String[] DTYPE_BIT_VARYING = {"BIT", "VARYING"}; - // EXACT NUMERIC - public static final String[] DTYPE_NUMERIC = {"NUMERIC"}; - public static final String[] DTYPE_DEC = {"DEC"}; - public static final String[] DTYPE_DECIMAL = {"DECIMAL"}; - public static final String[] DTYPE_INTEGER = {"INTEGER"}; - public static final String[] DTYPE_INT = {"INT"}; - public static final String[] DTYPE_SMALLINT = {"SMALLINT"}; - // APPROXIMATE NUMERIC - public static final String[] DTYPE_FLOAT = {"FLOAT"}; - public static final String[] DTYPE_REAL = {"REAL"}; - public static final String[] DTYPE_DOUBLE_PRECISION = {"DOUBLE", "PRECISION"}; - // DATE-TIME - public static final String[] DTYPE_DATE = {"DATE"}; - public static final String[] DTYPE_TIME = {"TIME"}; - public static final String[] DTYPE_TIMESTAMP = {"TIMESTAMP"}; - // INTERVAL - public static final String[] DTYPE_INTERVAL = {"INTERVAL"}; - - public final static List DATATYPE_START_WORDS = Arrays.asList(new String[] {"CHAR", "CHARACTER", "VARCHAR", - "NATIONAL", "NCHAR", "BIT", "NUMERIC", "DEC", "DECIMAL", "INT", "INTEGER", "SMALLINT", "FLOAT", "REAL", "DOUBLE", - "DATE", "TIME", "TIMESTAMP", "INTERVAL"}); - } - - @SuppressWarnings( "nls" ) - public final static String[] SQL_92_RESERVED_WORDS = {"ABSOLUTE", "ACTION", "ADD", "ALL", "ALLOCATE", ALTER, "AND", "ANY", - "ARE", "AS", "ASC", "ASSERTION", "AT", "AUTHORIZATION", "AVG", "BEGIN", "BETWEEN", "BIT", "BIT_LENGTH", "BOTH", "BY", - "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG", "CHAR", "CHARACTER", "CHAR_LENGTH", "CHARACTER_LENGTH", CHECK, "CLOSE", - "COALESCE", "COLLATE", "COLLATION", COLUMN, "COMMIT", "CONNECT", "CONNECTION", CONSTRAINT, "CONSTRAINTS", "CONTINUE", - "CONVERT", "CORRESPONDING", "COUNT", CREATE, "CROSS", "CURRENT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", - "CURRENT_USER", "CURSOR", "DATE", "DAY", "DEALLOCATE", "DEC", "DECIMAL", DECLARE, "DEFAULT", "DEFERRABLE", "DEFERRED", - "DELETE", "DESC", "DESCRIBE", "DESCRIPTOR", "DIAGNOSTICS", "DISCONNECT", "DISTINCT", "DOMAIN", "DOUBLE", DROP, "ELSE", - "END", "END_EXEC", "ESCAPE", "EXCEPT", "EXCEPTION", "EXEC", "EXECUTE", "EXISTS", "EXTERNAL", "EXTRACT", "FALSE", "FETCH", - "FIRST", "FLOAT", "FOR", FOREIGN, "FOUND", "FROM", "FULL", "GET", "GLOBAL", "GO", "GOTO", GRANT, "GROUP", "HAVING", - "HOUR", "IDENTITY", "IMMEDIATE", "IN", "INDICATOR", "INITIALLY", "INNER", "INPUT", "INSENSITIVE", INSERT, "INT", - "INTEGER", "INTERSECT", "INTERVAL", "INTO", "IS", "ISOLATION", "JOIN", KEY, "LANGUAGE", "LAST", "LEADING", "LEFT", - "LEVEL", "LIKE", "LOCAL", "LOWER", "MATCH", "MAX", "MIN", "MINUTE", "MODULE", "MONTH", "NAMES", "NATIONAL", "NATURAL", - "NCHAR", "NEXT", "NO", "NOT", "NULL", "NULLIF", "NUMERIC", "OCTET_LENGTH", "OF", ON, "ONLY", "OPEN", "OPTION", "OR", - "ORDER", "OUTER", "OUTPUT", "OVERLAPS", "PAD", "PARTIAL", "POSITION", "PRECISION", "PREPARE", "PRESERVE", PRIMARY, - "PRIOR", "PRIVILEGES", "PROCEDURE", "PUBLIC", "READ", "REAL", "REFERENCES", "RELATIVE", "RESTRICT", "REVOKE", "RIGHT", - "ROLLBACK", "ROWS", SCHEMA, "SCROLL", "SECOND", "SECTION", "SELECT", "SESSION", "SESSION_USER", SET, "SIZE", "SMALLINT", - "SOME", "SPACE", "SQL", "SQLCODE", "SQLERROR", "SQLSTATE", "SUBSTRING", "SUM", "SYSTEM_USER", TABLE, "TEMPORARY", "THEN", - "TIME", "TIMESTAMP", "TIMEZONE_HOUR", "TIMEZONE_MINUTE", "TO", "TRAILING", "TRANSACTION", "TRANSLATE", "TRANSLATION", - "TRIM", "TRUE", "UNION", UNIQUE, "UNKNOWN", "UPDATE", "UPPER", "USAGE", "USER", "USING", "VALUE", "VALUES", "VARCHAR", - "VARYING", VIEW, "WHEN", "WHENEVER", "WHERE", "WITH", "WORK", "WRITE", "YEAR", "ZONE"}; - - interface Problems { - public static final int OK = 0; - public static final int WARNING = 1; - public static final int ERROR = 2; - } - - interface AstNodeNames { - public static final String TABLE_DEFINITION = "TABLE_DEFINITION"; - public static final String ALTER_TABLE_DEFINITION = "ALTER_TABLE_DEFINITION"; - public static final String COLUMN_DEFINITION = "COLUMN_DEFINITION"; - public static final String COLUMN_REFERENCE = "COLUMN_REFERENCE"; - public static final String TABLE_CONSTRAINT = "TABLE_CONSTRAINT"; - // public static final String TABLE_OPTION = "TABLE_OPTION"; - public static final String ADD_COLUMN_DEFINITION = "ADD_COLUMN_DEFINITION"; - public static final String ADD_TABLE_CONSTRAINT = "ADD_TABLE_CONSTRAINT"; - public static final String DROP_COLUMN_DEFINITION = "DROP_COLUMN_DEFINITION"; - public static final String DROP_TABLE_CONSTRAINT = "DROP_TABLE_CONSTRAINT"; - public static final String ALTER_COLUMN_DEFINITION = "ALTER_COLUMN_DEFINITION"; - - } -} \ No newline at end of file diff --git a/debezium-core/src/main/java/io/debezium/relational/ddl/DdlParser.java b/debezium-core/src/main/java/io/debezium/relational/ddl/DdlParser.java index 252402042..822dd2f0f 100644 --- a/debezium-core/src/main/java/io/debezium/relational/ddl/DdlParser.java +++ b/debezium-core/src/main/java/io/debezium/relational/ddl/DdlParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -33,6 +33,8 @@ * A parser for DDL statements. * * @author Randall Hauch + * @author Horia Chiorean + * @author Barry LaFond */ @NotThreadSafe public class DdlParser { diff --git a/debezium-core/src/main/java/io/debezium/relational/ddl/DdlParserSql2003.java b/debezium-core/src/main/java/io/debezium/relational/ddl/DdlParserSql2003.java index 5722f01c7..be84168a0 100644 --- a/debezium-core/src/main/java/io/debezium/relational/ddl/DdlParserSql2003.java +++ b/debezium-core/src/main/java/io/debezium/relational/ddl/DdlParserSql2003.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/relational/ddl/DdlTokenizer.java b/debezium-core/src/main/java/io/debezium/relational/ddl/DdlTokenizer.java index 75fb224be..55cb3ed54 100644 --- a/debezium-core/src/main/java/io/debezium/relational/ddl/DdlTokenizer.java +++ b/debezium-core/src/main/java/io/debezium/relational/ddl/DdlTokenizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -13,8 +13,12 @@ import io.debezium.text.TokenStream.Tokens; /** + * A {@link Tokenizer} that is specialized for tokenizing DDL streams. + * * @author Randall Hauch - * + * @author Horia Chiorean + * @author Barry LaFond + * @author Jure Kajzer */ public class DdlTokenizer implements Tokenizer { @@ -56,7 +60,6 @@ public class DdlTokenizer implements Tokenizer { *

* Examples would be: "CREATE", "TABLE", "ALTER", "SCHEMA", "DROP", etc... *

- * see {@link DdlConstants} for the default SQL 92 representations. */ public static final int KEYWORD = 64; @@ -66,7 +69,6 @@ public class DdlTokenizer implements Tokenizer { *

* Examples would be: {"CREATE", "TABLE"} {"CREATE", "OR", "REPLACE", "VIEW"} *

- * see {@link DdlConstants} for the default SQL 92 representations. */ public static final int STATEMENT_KEY = 128; diff --git a/debezium-core/src/main/java/io/debezium/text/MultipleParsingExceptions.java b/debezium-core/src/main/java/io/debezium/text/MultipleParsingExceptions.java index e4fbaa9a6..30d8b34ea 100644 --- a/debezium-core/src/main/java/io/debezium/text/MultipleParsingExceptions.java +++ b/debezium-core/src/main/java/io/debezium/text/MultipleParsingExceptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/text/ParsingException.java b/debezium-core/src/main/java/io/debezium/text/ParsingException.java index c0f4af331..9d838d4a8 100644 --- a/debezium-core/src/main/java/io/debezium/text/ParsingException.java +++ b/debezium-core/src/main/java/io/debezium/text/ParsingException.java @@ -1,5 +1,5 @@ /* - * Copyright 2010 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -7,6 +7,8 @@ /** * An exception representing a problem during parsing of text. + * + * @author Randall Hauch */ public class ParsingException extends RuntimeException { diff --git a/debezium-core/src/main/java/io/debezium/text/Position.java b/debezium-core/src/main/java/io/debezium/text/Position.java index ed0d53910..d42dd672b 100644 --- a/debezium-core/src/main/java/io/debezium/text/Position.java +++ b/debezium-core/src/main/java/io/debezium/text/Position.java @@ -1,5 +1,5 @@ /* - * Copyright 2010 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -9,6 +9,8 @@ /** * A class that represents the position of a particular character in terms of the lines and columns of a character sequence. + * + * @author Randall Hauch */ @Immutable public final class Position { diff --git a/debezium-core/src/main/java/io/debezium/text/TokenStream.java b/debezium-core/src/main/java/io/debezium/text/TokenStream.java index 3f6133e4d..ee9faca78 100644 --- a/debezium-core/src/main/java/io/debezium/text/TokenStream.java +++ b/debezium-core/src/main/java/io/debezium/text/TokenStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2010 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -337,6 +337,9 @@ * {@link Tokenizer}s with exactly this behavior can actually be created using the {@link #basicTokenizer(boolean)} method. So * while this very basic implementation is not meant to be used in all situations, it may be useful in some situations. *

+ * @author Randall Hauch + * @author Horia Chiorean + * @author Daniel Kelleher */ @NotThreadSafe public class TokenStream { diff --git a/debezium-core/src/main/java/io/debezium/text/XmlCharacters.java b/debezium-core/src/main/java/io/debezium/text/XmlCharacters.java index a8318c5ec..1939a8d5b 100644 --- a/debezium-core/src/main/java/io/debezium/text/XmlCharacters.java +++ b/debezium-core/src/main/java/io/debezium/text/XmlCharacters.java @@ -1,5 +1,5 @@ /* - * Copyright 2010 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -13,6 +13,8 @@ /** * A utility class for determining the validity of various XML names, per the XML 1.0 * Specification. + * + * @author Randall Hauch */ @Immutable public class XmlCharacters { diff --git a/debezium-core/src/main/java/io/debezium/util/Clock.java b/debezium-core/src/main/java/io/debezium/util/Clock.java deleted file mode 100644 index 3119d6e11..000000000 --- a/debezium-core/src/main/java/io/debezium/util/Clock.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2015 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.util; - -/** - * @author Randall Hauch - * - */ -public interface Clock { - - public static final Clock SYSTEM = new Clock() { - @Override - public long currentTimeInMillis() { - return System.currentTimeMillis(); - } - @Override - public long currentTimeInNanos() { - return System.nanoTime(); - } - }; - - public static Clock system() { - return SYSTEM; - } - - public long currentTimeInNanos(); - - public long currentTimeInMillis(); - -} diff --git a/debezium-core/src/main/java/io/debezium/util/Collect.java b/debezium-core/src/main/java/io/debezium/util/Collect.java index 235f5e05d..2abfddcc9 100644 --- a/debezium-core/src/main/java/io/debezium/util/Collect.java +++ b/debezium-core/src/main/java/io/debezium/util/Collect.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/util/CommandLineOptions.java b/debezium-core/src/main/java/io/debezium/util/CommandLineOptions.java deleted file mode 100644 index 6716c309b..000000000 --- a/debezium-core/src/main/java/io/debezium/util/CommandLineOptions.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright 2015 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.util; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringJoiner; - -import io.debezium.annotation.Immutable; - -/** - * Utility for parsing and accessing the command line options and parameters. - * - * @author Randall Hauch - */ -@Immutable -public class CommandLineOptions { - - /** - * Parse the array of arguments passed to a Java {@code main} method and create a {@link CommandLineOptions} instance. - * - * @param args the {@code main} method's parameters; may not be null - * @return the representation of the command line options and parameters; never null - */ - public static CommandLineOptions parse(String[] args) { - Map options = new HashMap<>(); - List params = new ArrayList<>(); - List optionNames = new ArrayList<>(); - String optionName = null; - for (String value : args) { - value = value.trim(); - if (value.startsWith("-")) { - optionName = value; - options.put(optionName, "true"); - optionNames.add(optionName); - } else { - if (optionName != null) - options.put(optionName, value); - else - params.add(value); - } - } - return new CommandLineOptions(options, params, optionNames); - } - - private final Map options; - private final List params; - private final List orderedOptionNames; - - private CommandLineOptions(Map options, List params, List orderedOptionNames) { - this.options = options; - this.params = params; - this.orderedOptionNames = orderedOptionNames; - } - - /** - * Determine if the option with the given name was used on the command line. - *

- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters - * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @return true if the exact option was used, or false otherwise or if the supplied option name is null - * @see #hasOption(String, String) - */ - public boolean hasOption(String name) { - return hasOption(name, null); - } - - /** - * Determine if the option with one of the given names was used on the command line. - *

- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that - * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @param alternativeName an alternative name for the option; may be null - * @return true if the exact option was used, or false otherwise or if both the supplied option name and alternative name are - * null - * @see #hasOption(String) - */ - public boolean hasOption(String name, String alternativeName) { - return getOption(name, alternativeName, null) != null; - } - - /** - * Obtain the value associated with the named option. - *

- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters - * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @return the value associated with the option, or null if no option was found or the name is null - * @see #getOption(String, String) - * @see #getOption(String, String, String) - */ - public String getOption(String name) { - return getOption(name, null); - } - - /** - * Obtain the value associated with the named option, using the supplied default value if none is found. - *

- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters - * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @param defaultValue the value that should be returned no named option was found - * @return the value associated with the option, or the default value if none was found or the name is null - * @see #getOption(String) - * @see #getOption(String, String, String) - */ - public String getOption(String name, String defaultValue) { - return getOption(name, null, defaultValue); - } - - /** - * Obtain the value associated with the option given the name and alternative name of the option, using the supplied default - * value if none is found. - *

- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that - * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @param alternativeName an alternative name for the option; may be null - * @param defaultValue the value that should be returned no named option was found - * @return the value associated with the option, or the default value if none was found or if both the name and alternative - * name are null - * @see #getOption(String) - * @see #getOption(String, String) - */ - public String getOption(String name, String alternativeName, String defaultValue) { - recordOptionUsed(name, alternativeName); - String result = options.get(name.trim()); - if (result == null && alternativeName != null) result = options.get(alternativeName.trim()); - return result != null ? result : defaultValue; - } - - protected void recordOptionUsed(String name, String alternativeName) { - orderedOptionNames.remove(name.trim()); - if (alternativeName != null) orderedOptionNames.remove(alternativeName.trim()); - } - - /** - * Obtain the long value associated with the named option, using the supplied default value if none is found or if the value - * cannot be parsed as a long value. - *

- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters - * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @param defaultValue the value that should be returned no named option was found - * @return the value associated with the option, or the default value if none was found or the name is null - * @see #getOption(String, String, long) - */ - public long getOption(String name, long defaultValue) { - return getOption(name, null, defaultValue); - } - - /** - * Obtain the long value associated with the option given the name and alternative name of the option, using the supplied - * default value if none is found or if the value cannot be parsed as a long value. - *

- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that - * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @param alternativeName an alternative name for the option; may be null - * @param defaultValue the value that should be returned no named option was found - * @return the value associated with the option, or the default value if none was found or if both the name and alternative - * name are null - * @see #getOption(String, long) - */ - public long getOption(String name, String alternativeName, long defaultValue) { - return Strings.asLong(getOption(name, alternativeName, null), defaultValue); - } - - /** - * Obtain the integer value associated with the named option, using the supplied default value if none is found or if the - * value - * cannot be parsed as an integer value. - *

- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters - * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @param defaultValue the value that should be returned no named option was found - * @return the value associated with the option, or the default value if none was found or the name is null - * @see #getOption(String, String, int) - */ - public int getOption(String name, int defaultValue) { - return getOption(name, null, defaultValue); - } - - /** - * Obtain the integer value associated with the option given the name and alternative name of the option, using the supplied - * default value if none is found or if the value cannot be parsed as an integer value. - *

- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that - * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @param alternativeName an alternative name for the option; may be null - * @param defaultValue the value that should be returned no named option was found - * @return the value associated with the option, or the default value if none was found or if both the name and alternative - * name are null - * @see #getOption(String, int) - */ - public int getOption(String name, String alternativeName, int defaultValue) { - return Strings.asInt(getOption(name, alternativeName, null), defaultValue); - } - - /** - * Obtain the boolean value associated with the named option, using the supplied default value if none is found or if the - * value - * cannot be parsed as a boolean value. - *

- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters - * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @param defaultValue the value that should be returned no named option was found - * @return the value associated with the option, or the default value if none was found or the name is null - * @see #getOption(String, String, boolean) - */ - public boolean getOption(String name, boolean defaultValue) { - return getOption(name, null, defaultValue); - } - - /** - * Obtain the boolean value associated with the option given the name and alternative name of the option, using the supplied - * default value if none is found or if the value cannot be parsed as a boolean value. - *

- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that - * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name. - * - * @param name the name for the option (e.g., "-v" or "--verbose") - * @param alternativeName an alternative name for the option; may be null - * @param defaultValue the value that should be returned no named option was found - * @return the value associated with the option, or the default value if none was found or if both the name and alternative - * name are null - * @see #getOption(String, boolean) - */ - public boolean getOption(String name, String alternativeName, boolean defaultValue) { - return Strings.asBoolean(getOption(name, alternativeName, null), defaultValue); - } - - /** - * Obtain the parameter at the given index. Parameters are those arguments that are not preceded by an option name. - * - * @param index the index of the parameter - * @return the parameter value, or null if there was no parameter at the given index - */ - public String getParameter(int index) { - return index < 0 || index >= params.size() ? null : params.get(index); - } - - /** - * Determine whether the specified value matches one of the parameters. - * - * @param value the parameter value to match - * @return true if one of the parameter matches the value, or false otherwise - */ - public boolean hasParameter(String value) { - return value == null || params.isEmpty() ? false : params.contains(value); - } - - /** - * Determine whether there were any unknown option names after all possible options have been checked via one of the - * {@code getOption(String,...)} methods. - * - * @return true if there was at least one option (e.g., beginning with '{@code -}') that was not checked, or false - * if there were no unknown options on the command line - * @see #getFirstUnknownOptionName() - * @see #hasUnknowns() - */ - public boolean hasUnknowns() { - return !orderedOptionNames.isEmpty(); - } - - /** - * Get the list of unknown option names after all possible options have been checked via one of the - * {@code getOption(String,...)} methods. - * - * @return the list of options (e.g., beginning with '{@code -}') that were not checked; never null but possible empty - * @see #getFirstUnknownOptionName() - * @see #hasUnknowns() - */ - public List getUnknownOptionNames() { - return Collections.unmodifiableList(orderedOptionNames); - } - - /** - * If there were {@link #hasUnknowns() unknown options}, return the first one that appeared on the command line. - * @return the first unknown option, or null if there were no {@link #hasUnknowns() unknown options} - * @see #getUnknownOptionNames() - * @see #getFirstUnknownOptionName() - */ - public String getFirstUnknownOptionName() { - return orderedOptionNames.isEmpty() ? null : orderedOptionNames.get(0); - } - - @Override - public String toString() { - StringJoiner joiner = new StringJoiner(" "); - options.forEach((opt, val) -> { - joiner.add("-" + opt).add(val); - }); - params.forEach(joiner::add); - return joiner.toString(); - } - -} diff --git a/debezium-core/src/main/java/io/debezium/util/FunctionalReadWriteLock.java b/debezium-core/src/main/java/io/debezium/util/FunctionalReadWriteLock.java index 9fcfbf149..e4fb9884c 100644 --- a/debezium-core/src/main/java/io/debezium/util/FunctionalReadWriteLock.java +++ b/debezium-core/src/main/java/io/debezium/util/FunctionalReadWriteLock.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/main/java/io/debezium/util/HashCode.java b/debezium-core/src/main/java/io/debezium/util/HashCode.java index 753f55a69..36bbd66fb 100644 --- a/debezium-core/src/main/java/io/debezium/util/HashCode.java +++ b/debezium-core/src/main/java/io/debezium/util/HashCode.java @@ -1,5 +1,5 @@ /* - * Copyright 2008 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -15,10 +15,10 @@ */ @Immutable public class HashCode { - + // Prime number used in improving distribution private static final int PRIME = 103; - + /** * Compute a combined hash code from the supplied objects. This method always returns 0 if no objects are supplied. * @@ -26,9 +26,9 @@ public class HashCode { * @return the hash code */ public static int compute(Object... objects) { - return _compute(0, objects); + return computeHashCode(0, objects); } - + /** * Compute a combined hash code from the supplied objects using the supplied seed. * @@ -36,8 +36,8 @@ public static int compute(Object... objects) { * @param objects the objects that should be used to compute the hash code * @return the hash code */ - private static int _compute(int seed, - Object... objects) { + private static int computeHashCode(int seed, + Object... objects) { if (objects == null || objects.length == 0) { return seed * HashCode.PRIME; } @@ -69,8 +69,8 @@ private static int _compute(int seed, } return hc; } - + private HashCode() { } - + } \ No newline at end of file diff --git a/debezium-core/src/main/java/io/debezium/util/IoUtil.java b/debezium-core/src/main/java/io/debezium/util/IoUtil.java index 432f0edb9..377c91366 100644 --- a/debezium-core/src/main/java/io/debezium/util/IoUtil.java +++ b/debezium-core/src/main/java/io/debezium/util/IoUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2008 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -164,7 +164,7 @@ public static String read(InputStream stream) throws IOException { * reading. * * @param stream the streamed contents; may be null - * @param charset charset of the stream data; may not be null + * @param charset character set of the stream data; may not be null * @return the contents, or an empty string if the supplied stream is null * @throws IOException if there is an error reading the content */ diff --git a/debezium-core/src/main/java/io/debezium/util/Iterators.java b/debezium-core/src/main/java/io/debezium/util/Iterators.java deleted file mode 100644 index 097e883f8..000000000 --- a/debezium-core/src/main/java/io/debezium/util/Iterators.java +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright 2015 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.util; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.function.BiFunction; -import java.util.function.Function; - -import io.debezium.annotation.Immutable; - -/** - * A utility for creating iterators. - * - * @author Randall Hauch - */ -@Immutable -public class Iterators { - - public static Iterator empty() { - return new Iterator() { - @Override - public boolean hasNext() { - return false; - } - - @Override - public T next() { - throw new NoSuchElementException(); - } - }; - } - - public static Iterator with(final T value) { - return new Iterator() { - private boolean finished = false; - - @Override - public boolean hasNext() { - return !finished; - } - - @Override - public T next() { - if (finished) { - throw new NoSuchElementException(); - } - finished = true; - return value; - } - }; - } - - public static Iterator with(T value1, T value2) { - return new Iterator() { - private int remaining = 2; - - @Override - public boolean hasNext() { - return remaining > 0; - } - - @Override - public T next() { - if (remaining == 2) { - --remaining; - return value1; - } - if (remaining == 1) { - --remaining; - return value2; - } - throw new NoSuchElementException(); - } - }; - } - - public static Iterator with(T value1, T value2, T value3) { - return new Iterator() { - private int remaining = 3; - - @Override - public boolean hasNext() { - return remaining > 0; - } - - @Override - public T next() { - if (remaining == 3) { - --remaining; - return value1; - } - if (remaining == 2) { - --remaining; - return value2; - } - if (remaining == 1) { - --remaining; - return value3; - } - throw new NoSuchElementException(); - } - }; - } - - @SafeVarargs - public static Iterator with(T value1, T value2, T value3, T... additional) { - return new Iterator() { - private int index = 0; - - @Override - public boolean hasNext() { - return index < additional.length + 3; - } - - @Override - public T next() { - try { - if (index == 0) return value1; - if (index == 1) return value2; - if (index == 2) return value3; - if (index < additional.length + 3) return additional[index - 3]; - --index; - throw new NoSuchElementException(); - } finally { - ++index; - } - } - }; - } - - public static Iterator with(T[] values) { - return new Iterator() { - private int index = 0; - - @Override - public boolean hasNext() { - return index < values.length; - } - - @Override - public T next() { - try { - if (index < values.length) return values[index]; - --index; - throw new NoSuchElementException(); - } finally { - ++index; - } - } - }; - } - - public static Iterator around(Iterable first, - Iterable second, - BiFunction conversion) { - return around(first.iterator(), second.iterator(), conversion); - } - - public static Iterator around(final Iterator first, - final Iterator second, - final BiFunction combineFirstAndSecond) { - return new Iterator() { - @Override - public boolean hasNext() { - return second.hasNext(); - } - - @Override - public V next() { - return combineFirstAndSecond.apply(first.next(), second.next()); - } - }; - } - - public static Iterator around(final Iterable iterable, Function conversion) { - return around(iterable.iterator(), conversion); - } - - public static Iterator around(final Iterator iterator, Function conversion) { - return new Iterator() { - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public T next() { - return conversion.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - }; - } - - public static Iterable around(final Iterator iterator) { - return new Iterable() { - @Override - public Iterator iterator() { - return iterator; - } - }; - } - - public static Iterator readOnly(final Iterator iterator) { - return new Iterator() { - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public T next() { - return iterator.next(); - } - }; - } - - public static Iterator readOnly(final Iterator iterator, Function conversion) { - return new Iterator() { - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public T next() { - return conversion.apply(iterator.next()); - } - }; - } - - public static Iterator readOnly(final Iterable iterable) { - return readOnly(iterable.iterator()); - } - - public static Iterator readOnly(final Iterable iterable, Function conversion) { - return readOnly(iterable.iterator(), conversion); - } - - public static Iterable readOnlyIterable(final Iterable iterable) { - return new Iterable() { - @Override - public Iterator iterator() { - return readOnly(iterable.iterator()); - } - }; - } - - public static Iterable readOnlyIterable(final Iterable iterable, Function conversion) { - return new Iterable() { - @Override - public Iterator iterator() { - return readOnly(iterable.iterator(), conversion); - } - }; - } - - public static Iterator join(Iterable first, T last) { - return join(first.iterator(), with(last)); - } - - public static Iterator join(Iterable first, T last1, T last2) { - return join(first.iterator(), with(last1, last2)); - } - - public static Iterator join(Iterable first, T last1, T last2, T last3) { - return join(first.iterator(), with(last1, last2, last3)); - } - - public static Iterator join(Iterable first, T last1, T last2, T last3, T last4) { - return join(first.iterator(), with(last1, last2, last3, last4)); - } - - public static Iterator join(Iterable first, Iterable second) { - return join(first.iterator(), second.iterator()); - } - - public static Iterator join(Iterator first, Iterator second) { - return new Iterator() { - private boolean completedFirst = false; - - @Override - public boolean hasNext() { - if (!completedFirst) { - if (first.hasNext()) return true; - completedFirst = true; - } - return second.hasNext(); - } - - @Override - public T next() { - if (!completedFirst) { - if (first.hasNext()) return first.next(); - completedFirst = true; - } - return second.next(); - } - - @Override - public void remove() { - if (!completedFirst) { - first.remove(); - } - second.remove(); - } - }; - } -} diff --git a/debezium-core/src/main/java/io/debezium/util/Joiner.java b/debezium-core/src/main/java/io/debezium/util/Joiner.java deleted file mode 100644 index ae96de0a8..000000000 --- a/debezium-core/src/main/java/io/debezium/util/Joiner.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.util; - -import java.util.Iterator; -import java.util.StringJoiner; - -import io.debezium.annotation.Immutable; - -/** - * A utility for joining multiple {@link CharSequence character sequences} together. - * - * @author Randall Hauch - */ -@Immutable -public final class Joiner { - - public static Joiner on(CharSequence delimiter) { - return new Joiner(new StringJoiner(delimiter)); - } - - public static Joiner on(CharSequence prefix, CharSequence delimiter) { - return new Joiner(new StringJoiner(delimiter, prefix, "")); - } - - public static Joiner on(CharSequence prefix, CharSequence delimiter, CharSequence suffix) { - return new Joiner(new StringJoiner(delimiter, prefix, suffix)); - } - - private final StringJoiner joiner; - - private Joiner(StringJoiner joiner) { - this.joiner = joiner; - } - - public String join(Object[] values) { - for (Object value : values) { - if (value != null) joiner.add(value.toString()); - } - return joiner.toString(); - } - - public String join(CharSequence firstValue, CharSequence... additionalValues) { - if (firstValue != null) joiner.add(firstValue); - for (CharSequence value : additionalValues) { - if (value != null) joiner.add(value); - } - return joiner.toString(); - } - - public String join(Iterable values) { - for (Object value : values) { - if (value != null) joiner.add(value.toString()); - } - return joiner.toString(); - } - - public String join(Iterable values, CharSequence nextValue, CharSequence... additionalValues) { - for (Object value : values) { - if (value != null) joiner.add(value.toString()); - } - if (nextValue != null) joiner.add(nextValue); - for (CharSequence value : additionalValues) { - if (value != null) joiner.add(value); - } - return joiner.toString(); - } - - public String join(Iterator values) { - while (values.hasNext()) { - Object value = values.next(); - if (value != null) joiner.add(value.toString()); - } - return joiner.toString(); - } - -} diff --git a/debezium-core/src/main/java/io/debezium/util/LazyReference.java b/debezium-core/src/main/java/io/debezium/util/LazyReference.java deleted file mode 100644 index 161b487f8..000000000 --- a/debezium-core/src/main/java/io/debezium/util/LazyReference.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2015 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.util; - -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Consumer; -import java.util.function.Supplier; - -import io.debezium.annotation.ThreadSafe; - -/** - * An atomic reference that atomically uses a supplier to lazily accesses the referenced object the first time it is needed. - * - * @author Randall Hauch - * @param the type of referenced object - */ -@ThreadSafe -public final class LazyReference { - - public static LazyReference create(Supplier supplier) { - return new LazyReference(supplier); - } - - private final AtomicReference ref = new AtomicReference<>(); - private final Supplier supplier; - - private LazyReference(Supplier supplier) { - this.supplier = supplier; - } - - /** - * Determine if the referenced object has been created and accessed. - * - * @return {@code true} if the object has been created, or false otherwise - */ - public boolean isInitialized() { - return ref.get() != null; - } - - /** - * If the referenced object has been {@link #isInitialized() initialized}, then release it. - * This method does nothing if the reference has not yet been accessed or {@link #isInitialized() initialized}. - */ - public void release() { - release(null); - } - - /** - * If the referenced object has been {@link #isInitialized() initialized}, then release it and call the supplied function with - * the reference. This method does nothing if the reference has not yet been accessed or {@link #isInitialized() initialized}. - * - * @param finalizer the function that should be called when the previously-{@link #isInitialized() initialized} referenced - * object is released; may be null - */ - public void release(Consumer finalizer) { - ref.updateAndGet(existing->{ - if ( existing != null && finalizer != null ) finalizer.accept(existing); - return null; - }); - } - - /** - * Get the referenced value (creating it if required) and call the supplied function. - * - * @param consumer the function that operates on the value; may not be null - * @return true if the function was called on the referenced value, or false if there is no referenced value - */ - public boolean execute(Consumer consumer) { - T value = get(); - if (value == null) return false; - consumer.accept(value); - return true; - } - - public T get() { - return ref.updateAndGet(existing->existing != null ? existing : supplier.get()); - } -} diff --git a/debezium-core/src/main/java/io/debezium/util/MathOps.java b/debezium-core/src/main/java/io/debezium/util/MathOps.java deleted file mode 100644 index dde50a93b..000000000 --- a/debezium-core/src/main/java/io/debezium/util/MathOps.java +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Copyright 2010 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.util; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; - -import io.debezium.annotation.Immutable; - -/** - * Utilities for performing math operations with mixed native and advanced numeric types. - * - * @author Randall Hauch - */ -@Immutable -public final class MathOps { - - public static Number add(Number first, Number second) { - if (second == null) - return first; - else if (first == null) return second; - if (first instanceof Short) return add((Short) first, second); - if (first instanceof Integer) return add((Integer) first, second); - if (first instanceof Long) return add((Long) first, second); - if (first instanceof Float) return add((Float) first, second); - if (first instanceof Double) return add((Double) first, second); - if (first instanceof BigInteger) return add((BigInteger) first, second); - if (first instanceof BigDecimal) return add((BigDecimal) first, second); - if (first instanceof AtomicLong) return add((AtomicLong) first, second); - if (first instanceof AtomicInteger) return add((AtomicInteger) first, second); - throw new IllegalArgumentException(); - } - - public static Number add(Short first, Number second) { - if (second instanceof Short) return add(first, (Short) second); - if (second instanceof Integer) return add(first, (Integer) second); - if (second instanceof Long) return add(first, (Long) second); - if (second instanceof Float) return add(first, (Float) second); - if (second instanceof Double) return add(first, (Double) second); - if (second instanceof BigInteger) return add(first, (BigInteger) second); - if (second instanceof BigDecimal) return add(first, (BigDecimal) second); - if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second); - if (second instanceof AtomicLong) return add(first, (AtomicLong) second); - throw new IllegalArgumentException(); - } - - public static Number add(Short first, short second) { - int sum = first.shortValue() + second; - if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum); - return new Integer(sum); - } - - public static Number add(Short first, int second) { - long sum = first.longValue() + second; - if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum); - if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum); - return new Long(sum); - } - - public static Number add(Short first, long second) { - long sum = first.longValue() + second; - if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum); - if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum); - return new Long(sum); - } - - public static Number add(Short first, float second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Short first, double second) { - double sum = first.doubleValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Short first, Short second) { - return add(first, second.shortValue()); - } - - public static Number add(Short first, Integer second) { - return add(first, second.intValue()); - } - - public static Number add(Short first, Long second) { - return add(first, second.longValue()); - } - - public static Number add(Short first, Float second) { - return add(first, second.floatValue()); - } - - public static Number add(Short first, Double second) { - return add(first, second.doubleValue()); - } - - public static Number add(Short first, BigDecimal second) { - return second.add(BigDecimal.valueOf(first.longValue())); - } - - public static Number add(Short first, BigInteger second) { - return second.add(BigInteger.valueOf(first.longValue())); - } - - public static Number add(Short first, AtomicInteger second) { - return add(first, second.intValue()); - } - - public static Number add(Short first, AtomicLong second) { - return add(first, second.longValue()); - } - - public static Number add(Integer first, Number second) { - if (second instanceof Short) return add(first, (Short) second); - if (second instanceof Integer) return add(first, (Integer) second); - if (second instanceof Long) return add(first, (Long) second); - if (second instanceof Float) return add(first, (Float) second); - if (second instanceof Double) return add(first, (Double) second); - if (second instanceof BigInteger) return add(first, (BigInteger) second); - if (second instanceof BigDecimal) return add(first, (BigDecimal) second); - if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second); - if (second instanceof AtomicLong) return add(first, (AtomicLong) second); - throw new IllegalArgumentException(); - } - - public static Number add(Integer first, short second) { - long sum = first.longValue() + second; - if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum); - if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum); - return new Long(sum); - } - - public static Number add(Integer first, int second) { - long sum = first.longValue() + second; - if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum); - if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum); - return new Long(sum); - } - - public static Number add(Integer first, long second) { - long sum = first.longValue() + second; - if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum); - if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum); - return new Long(sum); - } - - public static Number add(Integer first, float second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Integer first, double second) { - double sum = first.doubleValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Integer first, Short second) { - return add(first, second.shortValue()); - } - - public static Number add(Integer first, Integer second) { - return add(first, second.intValue()); - } - - public static Number add(Integer first, Long second) { - return add(first, second.longValue()); - } - - public static Number add(Integer first, Float second) { - return add(first, second.floatValue()); - } - - public static Number add(Integer first, Double second) { - return add(first, second.doubleValue()); - } - - public static Number add(Integer first, BigDecimal second) { - return second.add(BigDecimal.valueOf(first.longValue())); - } - - public static Number add(Integer first, BigInteger second) { - return second.add(BigInteger.valueOf(first.longValue())); - } - - public static Number add(Integer first, AtomicInteger second) { - return add(first, second.intValue()); - } - - public static Number add(Integer first, AtomicLong second) { - return add(first, second.longValue()); - } - - public static Number add(Long first, Number second) { - if (second instanceof Short) return add(first, (Short) second); - if (second instanceof Integer) return add(first, (Integer) second); - if (second instanceof Long) return add(first, (Long) second); - if (second instanceof Float) return add(first, (Float) second); - if (second instanceof Double) return add(first, (Double) second); - if (second instanceof BigInteger) return add(first, (BigInteger) second); - if (second instanceof BigDecimal) return add(first, (BigDecimal) second); - if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second); - if (second instanceof AtomicLong) return add(first, (AtomicLong) second); - throw new IllegalArgumentException(); - } - - public static Number add(Long first, short second) { - long sum = first.longValue() + second; - if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum); - if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum); - return new Long(sum); - } - - public static Number add(Long first, int second) { - long sum = first.longValue() + second; - if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum); - if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum); - return new Long(sum); - } - - public static Number add(Long first, long second) { - long sum = first.longValue() + second; - if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum); - if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum); - return new Long(sum); - } - - public static Number add(Long first, float second) { - double sum = first.doubleValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Long first, double second) { - double sum = first.doubleValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Long first, Short second) { - return add(first, second.shortValue()); - } - - public static Number add(Long first, Integer second) { - return add(first, second.intValue()); - } - - public static Number add(Long first, Long second) { - return add(first, second.longValue()); - } - - public static Number add(Long first, Float second) { - return add(first, second.floatValue()); - } - - public static Number add(Long first, Double second) { - return add(first, second.doubleValue()); - } - - public static Number add(Long first, BigDecimal second) { - return second.add(BigDecimal.valueOf(first.longValue())); - } - - public static Number add(Long first, BigInteger second) { - return second.add(BigInteger.valueOf(first.longValue())); - } - - public static Number add(Long first, AtomicInteger second) { - return add(first, second.intValue()); - } - - public static Number add(Long first, AtomicLong second) { - return add(first, second.longValue()); - } - - public static Number add(Float first, Number second) { - if (second instanceof Short) return add(first, (Short) second); - if (second instanceof Integer) return add(first, (Integer) second); - if (second instanceof Long) return add(first, (Long) second); - if (second instanceof Float) return add(first, (Float) second); - if (second instanceof Double) return add(first, (Double) second); - if (second instanceof BigInteger) return add(first, (BigInteger) second); - if (second instanceof BigDecimal) return add(first, (BigDecimal) second); - if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second); - if (second instanceof AtomicLong) return add(first, (AtomicLong) second); - throw new IllegalArgumentException(); - } - - public static Number add(Float first, short second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Float first, int second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Float first, long second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Float first, float second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Float first, double second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Float first, Short second) { - return add(first, second.shortValue()); - } - - public static Number add(Float first, Integer second) { - return add(first, second.intValue()); - } - - public static Number add(Float first, Long second) { - return add(first, second.longValue()); - } - - public static Number add(Float first, Float second) { - return add(first, second.floatValue()); - } - - public static Number add(Float first, Double second) { - return add(first, second.doubleValue()); - } - - public static Number add(Float first, BigDecimal second) { - return second.add(BigDecimal.valueOf(first.longValue())); - } - - public static Number add(Float first, BigInteger second) { - return second.add(BigInteger.valueOf(first.longValue())); - } - - public static Number add(Float first, AtomicInteger second) { - return add(first, second.intValue()); - } - - public static Number add(Float first, AtomicLong second) { - return add(first, second.longValue()); - } - - public static Number add(Double first, Number second) { - if (second instanceof Short) return add(first, (Short) second); - if (second instanceof Integer) return add(first, (Integer) second); - if (second instanceof Long) return add(first, (Long) second); - if (second instanceof Float) return add(first, (Float) second); - if (second instanceof Double) return add(first, (Double) second); - if (second instanceof BigInteger) return add(first, (BigInteger) second); - if (second instanceof BigDecimal) return add(first, (BigDecimal) second); - if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second); - if (second instanceof AtomicLong) return add(first, (AtomicLong) second); - throw new IllegalArgumentException(); - } - - public static Number add(Double first, short second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Double first, int second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Double first, long second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Double first, float second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Double first, double second) { - double sum = first.floatValue() + second; - if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum); - return new Double(sum); - } - - public static Number add(Double first, Short second) { - return add(first, second.shortValue()); - } - - public static Number add(Double first, Integer second) { - return add(first, second.intValue()); - } - - public static Number add(Double first, Long second) { - return add(first, second.longValue()); - } - - public static Number add(Double first, Float second) { - return add(first, second.floatValue()); - } - - public static Number add(Double first, Double second) { - return add(first, second.doubleValue()); - } - - public static Number add(Double first, BigDecimal second) { - return second.add(BigDecimal.valueOf(first.longValue())); - } - - public static Number add(Double first, BigInteger second) { - return second.add(BigInteger.valueOf(first.longValue())); - } - - public static Number add(Double first, AtomicInteger second) { - return add(first, second.intValue()); - } - - public static Number add(Double first, AtomicLong second) { - return add(first, second.longValue()); - } - - public static Number add(BigInteger first, Number second) { - if (second instanceof Short) return add(first, (Short) second); - if (second instanceof Integer) return add(first, (Integer) second); - if (second instanceof Long) return add(first, (Long) second); - if (second instanceof Float) return add(first, (Float) second); - if (second instanceof Double) return add(first, (Double) second); - if (second instanceof BigInteger) return add(first, (BigInteger) second); - if (second instanceof BigDecimal) return add(first, (BigDecimal) second); - if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second); - if (second instanceof AtomicLong) return add(first, (AtomicLong) second); - throw new IllegalArgumentException(); - } - - public static Number add(BigInteger first, short second) { - return first.add(BigInteger.valueOf(second)); - } - - public static Number add(BigInteger first, int second) { - return first.add(BigInteger.valueOf(second)); - } - - public static Number add(BigInteger first, long second) { - return first.add(BigInteger.valueOf(second)); - } - - public static Number add(BigInteger first, float second) { - return new BigDecimal(first).add(BigDecimal.valueOf(second)); - } - - public static Number add(BigInteger first, double second) { - return new BigDecimal(first).add(BigDecimal.valueOf(second)); - } - - public static Number add(BigInteger first, Short second) { - return add(first, second.shortValue()); - } - - public static Number add(BigInteger first, Integer second) { - return add(first, second.intValue()); - } - - public static Number add(BigInteger first, Long second) { - return add(first, second.longValue()); - } - - public static Number add(BigInteger first, Float second) { - return add(first, second.floatValue()); - } - - public static Number add(BigInteger first, Double second) { - return add(first, second.doubleValue()); - } - - public static Number add(BigInteger first, BigDecimal second) { - return second.add(new BigDecimal(first)); - } - - public static Number add(BigInteger first, BigInteger second) { - return second.add(second); - } - - public static Number add(BigInteger first, AtomicInteger second) { - return add(first, second.intValue()); - } - - public static Number add(BigInteger first, AtomicLong second) { - return add(first, second.longValue()); - } - - public static Number add(BigDecimal first, Number second) { - if (second instanceof Short) return add(first, (Short) second); - if (second instanceof Integer) return add(first, (Integer) second); - if (second instanceof Long) return add(first, (Long) second); - if (second instanceof Float) return add(first, (Float) second); - if (second instanceof Double) return add(first, (Double) second); - if (second instanceof BigInteger) return add(first, (BigInteger) second); - if (second instanceof BigDecimal) return add(first, (BigDecimal) second); - if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second); - if (second instanceof AtomicLong) return add(first, (AtomicLong) second); - throw new IllegalArgumentException(); - } - - public static Number add(BigDecimal first, short second) { - return first.add(BigDecimal.valueOf(second)); - } - - public static Number add(BigDecimal first, int second) { - return first.add(BigDecimal.valueOf(second)); - } - - public static Number add(BigDecimal first, long second) { - return first.add(BigDecimal.valueOf(second)); - } - - public static Number add(BigDecimal first, float second) { - return first.add(BigDecimal.valueOf(second)); - } - - public static Number add(BigDecimal first, double second) { - return first.add(BigDecimal.valueOf(second)); - } - - public static Number add(BigDecimal first, Short second) { - return add(first, second.shortValue()); - } - - public static Number add(BigDecimal first, Integer second) { - return add(first, second.intValue()); - } - - public static Number add(BigDecimal first, Long second) { - return add(first, second.longValue()); - } - - public static Number add(BigDecimal first, Float second) { - return add(first, second.floatValue()); - } - - public static Number add(BigDecimal first, Double second) { - return add(first, second.doubleValue()); - } - - public static Number add(BigDecimal first, BigDecimal second) { - return second.add(first); - } - - public static Number add(BigDecimal first, BigInteger second) { - return second.add(second); - } - - public static Number add(BigDecimal first, AtomicInteger second) { - return add(first, second.intValue()); - } - - public static Number add(BigDecimal first, AtomicLong second) { - return add(first, second.longValue()); - } - - public static Number add(AtomicInteger first, Number second) { - if (second instanceof Short) return add(first, (Short) second); - if (second instanceof Integer) return add(first, (Integer) second); - if (second instanceof Long) return add(first, (Long) second); - if (second instanceof Float) return add(first, (Float) second); - if (second instanceof Double) return add(first, (Double) second); - if (second instanceof BigInteger) return add(first, (BigInteger) second); - if (second instanceof BigDecimal) return add(first, (BigDecimal) second); - if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second); - if (second instanceof AtomicLong) return add(first, (AtomicLong) second); - throw new IllegalArgumentException(); - } - - public static Number add(AtomicInteger first, short second) { - return add(new Integer(first.intValue()), second); - } - - public static Number add(AtomicInteger first, int second) { - return add(new Integer(first.intValue()), second); - } - - public static Number add(AtomicInteger first, long second) { - return add(new Integer(first.intValue()), second); - } - - public static Number add(AtomicInteger first, float second) { - return add(new Integer(first.intValue()), second); - } - - public static Number add(AtomicInteger first, double second) { - return add(new Integer(first.intValue()), second); - } - - public static Number add(AtomicInteger first, Short second) { - return add(first, second.shortValue()); - } - - public static Number add(AtomicInteger first, Integer second) { - return add(first, second.intValue()); - } - - public static Number add(AtomicInteger first, Long second) { - return add(first, second.longValue()); - } - - public static Number add(AtomicInteger first, Float second) { - return add(first, second.floatValue()); - } - - public static Number add(AtomicInteger first, Double second) { - return add(first, second.doubleValue()); - } - - public static Number add(AtomicInteger first, BigDecimal second) { - return add(second, first); - } - - public static Number add(AtomicInteger first, BigInteger second) { - return add(second, first); - } - - public static Number add(AtomicInteger first, AtomicInteger second) { - return add(first, second.intValue()); - } - - public static Number add(AtomicInteger first, AtomicLong second) { - return add(first, second.longValue()); - } - - public static Number add(AtomicLong first, Number second) { - if (second instanceof Short) return add(first, (Short) second); - if (second instanceof Integer) return add(first, (Integer) second); - if (second instanceof Long) return add(first, (Long) second); - if (second instanceof Float) return add(first, (Float) second); - if (second instanceof Double) return add(first, (Double) second); - if (second instanceof BigInteger) return add(first, (BigInteger) second); - if (second instanceof BigDecimal) return add(first, (BigDecimal) second); - if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second); - if (second instanceof AtomicLong) return add(first, (AtomicLong) second); - throw new IllegalArgumentException(); - } - - public static Number add(AtomicLong first, short second) { - return add(new Long(first.longValue()), second); - } - - public static Number add(AtomicLong first, int second) { - return add(new Long(first.longValue()), second); - } - - public static Number add(AtomicLong first, long second) { - return add(new Long(first.longValue()), second); - } - - public static Number add(AtomicLong first, float second) { - return add(new Long(first.longValue()), second); - } - - public static Number add(AtomicLong first, double second) { - return add(new Long(first.longValue()), second); - } - - public static Number add(AtomicLong first, Short second) { - return add(first, second.shortValue()); - } - - public static Number add(AtomicLong first, Integer second) { - return add(first, second.intValue()); - } - - public static Number add(AtomicLong first, Long second) { - return add(first, second.longValue()); - } - - public static Number add(AtomicLong first, Float second) { - return add(first, second.floatValue()); - } - - public static Number add(AtomicLong first, Double second) { - return add(first, second.doubleValue()); - } - - public static Number add(AtomicLong first, BigDecimal second) { - return add(second, first); - } - - public static Number add(AtomicLong first, BigInteger second) { - return add(second, first); - } - - public static Number add(AtomicLong first, AtomicInteger second) { - return add(first, second.intValue()); - } - - public static Number add(AtomicLong first, AtomicLong second) { - return add(first, second.longValue()); - } - - private MathOps() { - } - -} diff --git a/debezium-core/src/main/java/io/debezium/util/NamedThreadFactory.java b/debezium-core/src/main/java/io/debezium/util/NamedThreadFactory.java deleted file mode 100644 index 8d5ed3cfc..000000000 --- a/debezium-core/src/main/java/io/debezium/util/NamedThreadFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2010 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.util; - -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Consumer; - -import io.debezium.annotation.ThreadSafe; - -/** - * A simple named thread factory that creates threads named "{@code $PREFIX$-$NAME$-thread-$NUMBER$}". - * - * @author Randall Hauch - */ -@ThreadSafe -public final class NamedThreadFactory implements ThreadFactory { - - private static final boolean DEFAULT_DAEMON_THREAD = true; - private static final int DEFAULT_STACK_SIZE = 0; - - private final boolean daemonThreads; - private final ThreadGroup group; - private final AtomicInteger threadNumber = new AtomicInteger(1); - private final String namePrefix; - private final int stackSize; - private final Consumer afterThreadCreation; - - public NamedThreadFactory(String prefix) { - this(prefix, DEFAULT_DAEMON_THREAD, DEFAULT_STACK_SIZE); - } - - public NamedThreadFactory(String prefix, boolean daemonThreads) { - this(prefix, daemonThreads, DEFAULT_STACK_SIZE); - } - - public NamedThreadFactory(String prefix, boolean daemonThreads, int stackSize) { - this(prefix, daemonThreads, stackSize, null); - } - - public NamedThreadFactory(String prefix, boolean daemonThreads, int stackSize, Consumer afterThreadCreation) { - if ( prefix == null ) throw new IllegalArgumentException("The thread prefix may not be null"); - final SecurityManager s = System.getSecurityManager(); - this.group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); - this.namePrefix = prefix; - this.daemonThreads = daemonThreads; - this.stackSize = stackSize; - this.afterThreadCreation = afterThreadCreation; - } - - @Override - public Thread newThread(final Runnable runnable) { - String threadName = namePrefix + threadNumber.getAndIncrement(); - final Thread t = new Thread(group, runnable, threadName, stackSize); - t.setDaemon(daemonThreads); - if (t.getPriority() != Thread.NORM_PRIORITY) { - t.setPriority(Thread.NORM_PRIORITY); - } - if (afterThreadCreation != null) { - try { - afterThreadCreation.accept(threadName); - } catch (Throwable e) { - // do nothing - } - } - return t; - } -} diff --git a/debezium-core/src/main/java/io/debezium/util/Sequences.java b/debezium-core/src/main/java/io/debezium/util/Sequences.java deleted file mode 100644 index fb4e71853..000000000 --- a/debezium-core/src/main/java/io/debezium/util/Sequences.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2015 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.util; - -import java.util.Iterator; -import java.util.Random; -import java.util.function.Supplier; -import java.util.stream.IntStream; - -import io.debezium.annotation.Immutable; - -/** - * Utility methods for obtaining streams of integers. - * - * @author Randall Hauch - */ -@Immutable -public class Sequences { - - /** - * Create a stream of number monotonically increasing numbers starting at 0, useful when performing an operation - * number times. - * - * @param number the number of values to include in the stream; must be positive - * @return the sequence; never null - */ - public static IntStream times(int number) { - return IntStream.range(0, number); - } - - /** - * Create an iterator over an infinite number of monotonically increasing numbers starting at 0, useful when performing an - * operation an unknown number of times. - * - * @return the sequence; never null - */ - public static Iterable infiniteIntegers() { - return infiniteIntegers(0); - } - - /** - * Create an iterator over an infinite number monotonically increasing numbers starting at the given number, useful when - * performing an operation an unknown number of times. - * - * @param startingAt the first number to include in the resulting stream - * @return the sequence; never null - */ - public static Iterable infiniteIntegers(int startingAt) { - return Iterators.around(new Iterator() { - private int counter = startingAt; - - @Override - public boolean hasNext() { - return true; - } - - @Override - public Integer next() { - return Integer.valueOf(counter++); - } - }); - } - - /** - * Obtain a supplier function that randomly selects from the given values. If the supplied values contain nulls, then - * the resulting supplier function may return null values. - * - * @param first the first value that may be randomly picked - * @param additional the additional values to randomly pick from; may be null or empty - * @return the supplier function; never null - */ - @SafeVarargs - public static Supplier randomlySelect(T first, T... additional) { - if (additional == null || additional.length == 0) return () -> first; - Random rng = new Random(System.currentTimeMillis()); - int max = additional.length + 1; - return () -> { - int index = rng.nextInt(max); - return index == 0 ? first : additional[index-1]; - }; - } - - /** - * Obtain a supplier function that randomly selects from the given values. If the supplied values contain nulls, then - * the resulting supplier function may return null values. - * - * @param values the values to randomly pick from; may not be null, should not be empty - * @return the supplier function; never null - */ - @SafeVarargs - public static Supplier randomlySelect(T... values) { - if (values == null || values.length == 0) throw new IllegalArgumentException("The values array may not be null or empty"); - Random rng = new Random(System.currentTimeMillis()); - return () -> values[rng.nextInt(values.length)]; - } -} diff --git a/debezium-core/src/main/java/io/debezium/util/Stopwatch.java b/debezium-core/src/main/java/io/debezium/util/Stopwatch.java index 61e1c04be..9ee8c043f 100644 --- a/debezium-core/src/main/java/io/debezium/util/Stopwatch.java +++ b/debezium-core/src/main/java/io/debezium/util/Stopwatch.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -65,9 +65,6 @@ public static interface Durations { /** * The timing statistics for a recorded set of samples. - * - * @author Randall Hauch - * */ public static interface Statistics { /** @@ -255,8 +252,6 @@ public static Stopwatch accumulating() { * This set is threadsafe, meaning that multiple threads can {@link #create()} new stopwatches concurrently, and each * stopwatch's duration is measured separately. Additionally, all of the other methods of this interface are also threadsafe. *

- * - * @author Randall Hauch */ @ThreadSafe public static interface StopwatchSet extends Durations { @@ -464,8 +459,6 @@ protected static String asString(Duration duration) { /** * Abstract base class for {@link Durations} implementations. - * - * @author Randall Hauch */ @ThreadSafe protected static abstract class BaseDurations implements Durations { @@ -479,8 +472,6 @@ public String toString() { /** * A {@link Durations} implementation that only remembers the most recently {@link #add(Duration) added} duration. - * - * @author Randall Hauch */ @ThreadSafe private static final class SingleDuration extends BaseDurations { @@ -501,8 +492,6 @@ public void add(Duration duration) { /** * A {@link Durations} implementation that accumulates all {@link #add(Duration) added} durations. - * - * @author Randall Hauch */ @ThreadSafe private static final class MultipleDurations extends BaseDurations { diff --git a/debezium-core/src/main/java/io/debezium/util/Stringifiable.java b/debezium-core/src/main/java/io/debezium/util/Stringifiable.java deleted file mode 100644 index 790aadbbf..000000000 --- a/debezium-core/src/main/java/io/debezium/util/Stringifiable.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 Debezium Authors. - * - * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 - */ -package io.debezium.util; - -import java.util.StringJoiner; - -/** - * Interface that allows a class to more efficiently generate a string that is to be added to other strings via a - * {@link StringJoiner}. - * - * @author Randall Hauch - */ -@FunctionalInterface -public interface Stringifiable { - - /** - * Used the supplied {@link StringJoiner} to record string representations of this object. The supplied joiner may concatenate - * these strings together using custom delimiter strings. - * - * @param joiner the string joiner instance that will accumulate the - */ - void asString(StringJoiner joiner); - -} diff --git a/debezium-core/src/main/java/io/debezium/util/Strings.java b/debezium-core/src/main/java/io/debezium/util/Strings.java index 50461ff48..e5b48da04 100644 --- a/debezium-core/src/main/java/io/debezium/util/Strings.java +++ b/debezium-core/src/main/java/io/debezium/util/Strings.java @@ -1,5 +1,5 @@ /* - * Copyright 2008 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -18,6 +18,7 @@ * String-related utility methods. * * @author Randall Hauch + * @author Horia Chiorean */ @ThreadSafe public final class Strings { diff --git a/debezium-core/src/test/java/io/debezium/jdbc/TestDatabase.java b/debezium-core/src/test/java/io/debezium/jdbc/TestDatabase.java index cdd1287b6..b1998d6fb 100644 --- a/debezium-core/src/test/java/io/debezium/jdbc/TestDatabase.java +++ b/debezium-core/src/test/java/io/debezium/jdbc/TestDatabase.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/test/java/io/debezium/relational/ColumnEditorTest.java b/debezium-core/src/test/java/io/debezium/relational/ColumnEditorTest.java index cc9d1f015..c84a457f3 100644 --- a/debezium-core/src/test/java/io/debezium/relational/ColumnEditorTest.java +++ b/debezium-core/src/test/java/io/debezium/relational/ColumnEditorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/test/java/io/debezium/relational/TableEditorTest.java b/debezium-core/src/test/java/io/debezium/relational/TableEditorTest.java index c59e51a43..52cd36db3 100644 --- a/debezium-core/src/test/java/io/debezium/relational/TableEditorTest.java +++ b/debezium-core/src/test/java/io/debezium/relational/TableEditorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/test/java/io/debezium/relational/TableSchemaBuilderTest.java b/debezium-core/src/test/java/io/debezium/relational/TableSchemaBuilderTest.java index 54e977585..d050ad0fc 100644 --- a/debezium-core/src/test/java/io/debezium/relational/TableSchemaBuilderTest.java +++ b/debezium-core/src/test/java/io/debezium/relational/TableSchemaBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/test/java/io/debezium/relational/TableTest.java b/debezium-core/src/test/java/io/debezium/relational/TableTest.java index d785da890..66751e5d8 100644 --- a/debezium-core/src/test/java/io/debezium/relational/TableTest.java +++ b/debezium-core/src/test/java/io/debezium/relational/TableTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeGrammarParserTest.java b/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeGrammarParserTest.java index 295e0466a..6f1778097 100644 --- a/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeGrammarParserTest.java +++ b/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeGrammarParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeParserTest.java b/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeParserTest.java index 2a6f3206d..9521464c6 100644 --- a/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeParserTest.java +++ b/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/test/java/io/debezium/relational/ddl/DdlParserSql2003Test.java b/debezium-core/src/test/java/io/debezium/relational/ddl/DdlParserSql2003Test.java index ec28bae5c..c86c3bf10 100644 --- a/debezium-core/src/test/java/io/debezium/relational/ddl/DdlParserSql2003Test.java +++ b/debezium-core/src/test/java/io/debezium/relational/ddl/DdlParserSql2003Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-core/src/test/java/io/debezium/text/PositionTest.java b/debezium-core/src/test/java/io/debezium/text/PositionTest.java index ee66c2bfe..c2af73e33 100644 --- a/debezium-core/src/test/java/io/debezium/text/PositionTest.java +++ b/debezium-core/src/test/java/io/debezium/text/PositionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2010 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -9,6 +9,9 @@ import static org.fest.assertions.Assertions.assertThat; +/** + * @author Randall Hauch + */ public class PositionTest { private int combinedIndex(int firstIndex, diff --git a/debezium-core/src/test/java/io/debezium/text/TokenStreamTest.java b/debezium-core/src/test/java/io/debezium/text/TokenStreamTest.java index e566ad619..1c829951b 100644 --- a/debezium-core/src/test/java/io/debezium/text/TokenStreamTest.java +++ b/debezium-core/src/test/java/io/debezium/text/TokenStreamTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2010 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -15,6 +15,10 @@ import io.debezium.text.TokenStream.BasicTokenizer; import io.debezium.text.TokenStream.Tokenizer; +/** + * @author Randall Hauch + * @author Daniel Kelleher + */ public class TokenStreamTest { public static final int WORD = TokenStream.BasicTokenizer.WORD; public static final int SYMBOL = TokenStream.BasicTokenizer.SYMBOL; @@ -44,25 +48,25 @@ public void makeCaseInsensitive() { tokens.start(); } - @Test( expected = IllegalStateException.class ) + @Test(expected = IllegalStateException.class) public void shouldNotAllowConsumeBeforeStartIsCalled() { tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false); tokens.consume("Select"); } - @Test( expected = IllegalStateException.class ) + @Test(expected = IllegalStateException.class) public void shouldNotAllowHasNextBeforeStartIsCalled() { tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false); tokens.hasNext(); } - @Test( expected = IllegalStateException.class ) + @Test(expected = IllegalStateException.class) public void shouldNotAllowMatchesBeforeStartIsCalled() { tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false); tokens.matches("Select"); } - @Test( expected = IllegalStateException.class ) + @Test(expected = IllegalStateException.class) public void shouldNotAllowCanConsumeBeforeStartIsCalled() { tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false); tokens.canConsume("Select"); @@ -88,7 +92,7 @@ public void shouldConsumeInCaseSensitiveMannerWithExpectedValuesWhenMatchingExac assertThat(tokens.hasNext()).isFalse(); } - @Test( expected = ParsingException.class ) + @Test(expected = ParsingException.class) public void shouldFailToConsumeInCaseSensitiveMannerWithExpectedValuesWhenMatchingIncorrectCase() { makeCaseSensitive(); tokens.consume("Select"); @@ -108,7 +112,7 @@ public void shouldConsumeInCaseInsensitiveMannerWithExpectedValuesWhenMatchingNo assertThat(tokens.hasNext()).isFalse(); } - @Test( expected = ParsingException.class ) + @Test(expected = ParsingException.class) public void shouldFailToConsumeInCaseInsensitiveMannerWithExpectedValuesWhenMatchingStringIsInLowerCase() { makeCaseInsensitive(); tokens.consume("SELECT"); @@ -311,7 +315,7 @@ public void shouldConsumeMultipleTokensIfTheyMatch() { assertThat(tokens.hasNext()).isFalse(); } - @Test( expected = ParsingException.class ) + @Test(expected = ParsingException.class) public void shouldFailToConsumeMultipleTokensIfTheyDoNotMatch() { makeCaseInsensitive(); tokens.consume("SELECT", "ALL", "COLUMNS", "FROM", "TABLE"); @@ -327,8 +331,8 @@ public void shouldReturnTrueFromCanConsumeMultipleTokensIfTheyAllMatch() { @Test public void shouldReturnTrueFromCanConsumeArrayOfTokensIfTheyAllMatch() { makeCaseInsensitive(); - assertThat(tokens.matches(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"})).isTrue(); - assertThat(tokens.canConsume(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"})).isTrue(); + assertThat(tokens.matches(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" })).isTrue(); + assertThat(tokens.canConsume(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" })).isTrue(); assertThat(tokens.hasNext()).isFalse(); } @@ -417,7 +421,7 @@ public void shouldCanConsumeSingleAfterTokensCompleteFromCanConsumeStringList() public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringArray() { makeCaseInsensitive(); // consume ALL the tokens using canConsume() - tokens.canConsume(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"}); + tokens.canConsume(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" }); // try to canConsume() single word assertThat(tokens.canConsume("SELECT")).isFalse(); assertThat(tokens.canConsume(TokenStream.ANY_VALUE)).isFalse(); @@ -428,7 +432,7 @@ public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringArray() public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringIterator() { makeCaseInsensitive(); // consume ALL the tokens using canConsume() - tokens.canConsume(Arrays.asList(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"})); + tokens.canConsume(Arrays.asList(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" })); // try to canConsume() single word assertThat(tokens.canConsume("SELECT")).isFalse(); assertThat(tokens.canConsume(TokenStream.ANY_VALUE)).isFalse(); diff --git a/debezium-core/src/test/java/io/debezium/text/XmlCharactersTest.java b/debezium-core/src/test/java/io/debezium/text/XmlCharactersTest.java index 6816d812f..e2c83f370 100644 --- a/debezium-core/src/test/java/io/debezium/text/XmlCharactersTest.java +++ b/debezium-core/src/test/java/io/debezium/text/XmlCharactersTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2010 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -9,6 +9,9 @@ import static org.fest.assertions.Assertions.assertThat; +/** + * @author Randall Hauch + */ public class XmlCharactersTest { @Test diff --git a/debezium-core/src/test/java/io/debezium/util/HashCodeTest.java b/debezium-core/src/test/java/io/debezium/util/HashCodeTest.java index 015b1aad7..bcf306a78 100644 --- a/debezium-core/src/test/java/io/debezium/util/HashCodeTest.java +++ b/debezium-core/src/test/java/io/debezium/util/HashCodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -11,6 +11,9 @@ import org.junit.Test; +/** + * @author Randall Hauch + */ public class HashCodeTest { @Test diff --git a/debezium-core/src/test/java/io/debezium/util/StringsTest.java b/debezium-core/src/test/java/io/debezium/util/StringsTest.java index e47c22a51..630db6b55 100644 --- a/debezium-core/src/test/java/io/debezium/util/StringsTest.java +++ b/debezium-core/src/test/java/io/debezium/util/StringsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -14,6 +14,10 @@ import org.junit.Test; +/** + * @author Randall Hauch + * @author Horia Chiorean + */ public class StringsTest { public void compareSeparatedLines( Object... lines ) { diff --git a/debezium-ingest-jdbc/src/test/java/io/debezium/injest/jdbc/util/TestDatabase.java b/debezium-ingest-jdbc/src/test/java/io/debezium/injest/jdbc/util/TestDatabase.java index 90302d51c..95f2f86bc 100644 --- a/debezium-ingest-jdbc/src/test/java/io/debezium/injest/jdbc/util/TestDatabase.java +++ b/debezium-ingest-jdbc/src/test/java/io/debezium/injest/jdbc/util/TestDatabase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlConfiguration.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlConfiguration.java index 76d560fac..4427cf743 100644 --- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlConfiguration.java +++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlDdlParser.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlDdlParser.java index 87242135c..71ab2a67a 100644 --- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlDdlParser.java +++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlDdlParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/Module.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/Module.java index 1568c3f48..80e47372b 100644 --- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/Module.java +++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/Module.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlChangeDetector.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlChangeDetector.java index 5d62f3ba0..7a354b5b9 100644 --- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlChangeDetector.java +++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlChangeDetector.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlConnector.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlConnector.java index 847087b03..b5211723a 100644 --- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlConnector.java +++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlConnector.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/SourceInfo.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/SourceInfo.java index bc4b1982c..1c3cc510a 100644 --- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/SourceInfo.java +++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/SourceInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TableConverters.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TableConverters.java index 77f120942..4e68e294c 100644 --- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TableConverters.java +++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TableConverters.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TopicSelector.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TopicSelector.java index b6d25ebf0..e8f5c3f90 100644 --- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TopicSelector.java +++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TopicSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ConnectionIT.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ConnectionIT.java index 3fafb1d10..72a72904b 100644 --- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ConnectionIT.java +++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ConnectionIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySQLConnection.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySQLConnection.java index 4b373c792..b8cadebdc 100644 --- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySQLConnection.java +++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySQLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySqlDdlParserTest.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySqlDdlParserTest.java index 5a4c733e3..1b036e9de 100644 --- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySqlDdlParserTest.java +++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySqlDdlParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/MetadataIT.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/MetadataIT.java index 5387cc45e..c4541f5b0 100644 --- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/MetadataIT.java +++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/MetadataIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/ReadBinLogIT.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/ReadBinLogIT.java index 4018b04bd..024ec8e07 100644 --- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/ReadBinLogIT.java +++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/ReadBinLogIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-postgres/src/main/java/io/debezium/ingest/postgres/PostgresConnection.java b/debezium-ingest-postgres/src/main/java/io/debezium/ingest/postgres/PostgresConnection.java index ec183d9bc..577bd6e86 100644 --- a/debezium-ingest-postgres/src/main/java/io/debezium/ingest/postgres/PostgresConnection.java +++ b/debezium-ingest-postgres/src/main/java/io/debezium/ingest/postgres/PostgresConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/debezium-ingest-postgres/src/test/java/io/debezium/ingest/postgresql/ConnectionIT.java b/debezium-ingest-postgres/src/test/java/io/debezium/ingest/postgresql/ConnectionIT.java index b39d8565c..4cd80a814 100644 --- a/debezium-ingest-postgres/src/test/java/io/debezium/ingest/postgresql/ConnectionIT.java +++ b/debezium-ingest-postgres/src/test/java/io/debezium/ingest/postgresql/ConnectionIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/ExcludeTestPackages.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/ExcludeTestPackages.java index d6a5aae68..5145d6f69 100644 --- a/support/checkstyle/src/main/java/io/debezium/checkstyle/ExcludeTestPackages.java +++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/ExcludeTestPackages.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/Header.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/Header.java index c1ae46aa9..f7a1c1612 100644 --- a/support/checkstyle/src/main/java/io/debezium/checkstyle/Header.java +++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/Header.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ @@ -13,19 +13,15 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.function.Predicate; import java.util.regex.Pattern; public class Header extends com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck { - private static final String YEAR_MATCHING_PATTERN = "${YYYY}"; - private Set excludedFileSet; private String excludedFilesRegex; private Pattern excludedFilesPattern; private final String workingDirPath = new File(".").getAbsoluteFile().getParentFile().getAbsolutePath(); private final int workingDirPathLength = workingDirPath.length(); - private Predicate yearLineMatcher; public Header() { } @@ -63,11 +59,6 @@ public void setHeaderFile( String aFileName ) { if (l == null) { break; } - if (l.contains(YEAR_MATCHING_PATTERN)) { - String prefix = l.substring(0, l.indexOf(YEAR_MATCHING_PATTERN)); - String suffix = l.substring(l.indexOf(YEAR_MATCHING_PATTERN)+YEAR_MATCHING_PATTERN.length()); - yearLineMatcher = (line)->line.startsWith(prefix) && line.endsWith(suffix); - } sb.append(l).append("\\n"); } super.setHeader(sb.toString()); @@ -100,19 +91,4 @@ protected void processFiltered( File aFile, if (isExcluded(aFile)) return; super.processFiltered(aFile, aLines); } - - /** - * Checks if a code line matches the required header line. - * @param lineNumber the line number to check against the header - * @param line the line contents - * @return true if and only if the line matches the required header line - */ - @Override - protected boolean isMatch(int lineNumber, String line) { - if ( super.isMatch(lineNumber, line)) return true; - // Otherwise it does not match, so see if the line contain our "${year}" string - if ( yearLineMatcher != null && yearLineMatcher.test(line) ) return true; - return false; - } - } \ No newline at end of file diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/IllegalImport.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/IllegalImport.java index 990bc2d7e..6afe3d73c 100644 --- a/support/checkstyle/src/main/java/io/debezium/checkstyle/IllegalImport.java +++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/IllegalImport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/JavaDocUtil.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/JavaDocUtil.java index 24ea38611..cf59d3e58 100644 --- a/support/checkstyle/src/main/java/io/debezium/checkstyle/JavaDocUtil.java +++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/JavaDocUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/UnusedImports.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/UnusedImports.java index 816b609fb..fc30a5b46 100644 --- a/support/checkstyle/src/main/java/io/debezium/checkstyle/UnusedImports.java +++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/UnusedImports.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/support/checkstyle/src/main/resources/debezium.header b/support/checkstyle/src/main/resources/debezium.header index db8ced55b..9421e0aa4 100644 --- a/support/checkstyle/src/main/resources/debezium.header +++ b/support/checkstyle/src/main/resources/debezium.header @@ -1,5 +1,5 @@ /* - * Copyright ${YYYY} Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ diff --git a/support/ide-configs/eclipse/debezium-templates.xml b/support/ide-configs/eclipse/debezium-templates.xml index e80a9c67a..c50f7457e 100644 --- a/support/ide-configs/eclipse/debezium-templates.xml +++ b/support/ide-configs/eclipse/debezium-templates.xml @@ -7,7 +7,7 @@ id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment"> /* - * Copyright 2016 Debezium Authors. + * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */