DBZ-1 Renamed the connector modules and packages

This commit is contained in:
Randall Hauch 2016-02-02 16:58:48 -06:00
parent 44b5139ebf
commit 0e58dba9d6
36 changed files with 56 additions and 82 deletions

View File

@ -13,8 +13,8 @@
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>debezium-ingest-jdbc</artifactId>
<name>Debezium Ingest from Generic JDBC</name>
<artifactId>debezium-connector-jdbc</artifactId>
<name>Debezium Connector for Generic JDBC</name>
<packaging>jar</packaging>
<dependencies>
<dependency>

View File

@ -13,8 +13,8 @@
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>debezium-ingest-mysql</artifactId>
<name>Debezium Ingest from MySQL</name>
<artifactId>debezium-connector-mysql</artifactId>
<name>Debezium Connector for MySQL</name>
<packaging>jar</packaging>
<dependencies>
<dependency>

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql.source;
package io.debezium.connector.mysql;
import java.io.IOException;
import java.util.ArrayList;
@ -36,8 +36,6 @@
import io.debezium.annotation.NotThreadSafe;
import io.debezium.config.Configuration;
import io.debezium.mysql.Module;
import io.debezium.mysql.MySqlDdlParser;
import io.debezium.relational.Tables;
import io.debezium.relational.ddl.DdlParser;
import io.debezium.relational.history.DatabaseHistory;
@ -45,7 +43,7 @@
/**
* A Kafka Connect source task reads the MySQL binary log and generate the corresponding data change events.
*
* @see Connector
* @see MySqlConnector
* @author Randall Hauch
*/
@NotThreadSafe
@ -101,36 +99,36 @@ public String version() {
public void start(Map<String, String> props) {
// Validate the configuration ...
final Configuration config = Configuration.from(props);
if ( config.validate(ConnectorConfig.ALL_FIELDS,logger::error) ) {
if ( config.validate(MySqlConnectorConfig.ALL_FIELDS,logger::error) ) {
return;
}
// Create and configure the database history ...
this.dbHistory = config.getInstance(ConnectorConfig.DATABASE_HISTORY, DatabaseHistory.class);
this.dbHistory = config.getInstance(MySqlConnectorConfig.DATABASE_HISTORY, DatabaseHistory.class);
if ( this.dbHistory == null ) {
this.logger.error("Unable to instantiate the database history class {}",config.getString(ConnectorConfig.DATABASE_HISTORY));
this.logger.error("Unable to instantiate the database history class {}",config.getString(MySqlConnectorConfig.DATABASE_HISTORY));
return;
}
Configuration dbHistoryConfig = config.subset(ConnectorConfig.DATABASE_HISTORY.name() + ".", true);
Configuration dbHistoryConfig = config.subset(MySqlConnectorConfig.DATABASE_HISTORY.name() + ".", true);
this.dbHistory.configure(dbHistoryConfig);
// Read the configuration ...
final String user = config.getString(ConnectorConfig.USER);
final String password = config.getString(ConnectorConfig.PASSWORD);
final String host = config.getString(ConnectorConfig.HOSTNAME);
final int port = config.getInteger(ConnectorConfig.PORT);
final Long serverId = config.getLong(ConnectorConfig.SERVER_ID);
final String serverName = config.getString(ConnectorConfig.SERVER_NAME.name(), host + ":" + port);
final boolean keepAlive = config.getBoolean(ConnectorConfig.KEEP_ALIVE);
final int maxQueueSize = config.getInteger(ConnectorConfig.MAX_QUEUE_SIZE);
final long timeoutInMilliseconds = config.getLong(ConnectorConfig.CONNECTION_TIMEOUT_MS);
final boolean includeSchemaChanges = config.getBoolean(ConnectorConfig.INCLUDE_SCHEMA_CHANGES);
maxBatchSize = config.getInteger(ConnectorConfig.MAX_BATCH_SIZE);
pollIntervalMs = config.getLong(ConnectorConfig.POLL_INTERVAL_MS);
final String user = config.getString(MySqlConnectorConfig.USER);
final String password = config.getString(MySqlConnectorConfig.PASSWORD);
final String host = config.getString(MySqlConnectorConfig.HOSTNAME);
final int port = config.getInteger(MySqlConnectorConfig.PORT);
final Long serverId = config.getLong(MySqlConnectorConfig.SERVER_ID);
final String serverName = config.getString(MySqlConnectorConfig.SERVER_NAME.name(), host + ":" + port);
final boolean keepAlive = config.getBoolean(MySqlConnectorConfig.KEEP_ALIVE);
final int maxQueueSize = config.getInteger(MySqlConnectorConfig.MAX_QUEUE_SIZE);
final long timeoutInMilliseconds = config.getLong(MySqlConnectorConfig.CONNECTION_TIMEOUT_MS);
final boolean includeSchemaChanges = config.getBoolean(MySqlConnectorConfig.INCLUDE_SCHEMA_CHANGES);
maxBatchSize = config.getInteger(MySqlConnectorConfig.MAX_BATCH_SIZE);
pollIntervalMs = config.getLong(MySqlConnectorConfig.POLL_INTERVAL_MS);
if (maxQueueSize <= maxBatchSize) {
maxBatchSize = maxQueueSize / 2;
logger.error("The {} value must be larger than {}, so changing {} to {}", ConnectorConfig.MAX_QUEUE_SIZE,
ConnectorConfig.MAX_BATCH_SIZE, ConnectorConfig.MAX_QUEUE_SIZE, maxBatchSize);
logger.error("The {} value must be larger than {}, so changing {} to {}", MySqlConnectorConfig.MAX_QUEUE_SIZE,
MySqlConnectorConfig.MAX_BATCH_SIZE, MySqlConnectorConfig.MAX_QUEUE_SIZE, maxBatchSize);
}
// Create the queue ...

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql;
package io.debezium.connector.mysql;
import java.util.Properties;
@ -16,7 +16,7 @@
*/
public class Module {
private static final Properties INFO = IoUtil.loadProperties(Module.class, "io/debezium/mysql/build.properties");
private static final Properties INFO = IoUtil.loadProperties(Module.class, "io/debezium/connector/mysql/build.properties");
public static String version() {
return INFO.getProperty("version");

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql.source;
package io.debezium.connector.mysql;
import java.util.Collections;
import java.util.HashMap;
@ -16,24 +16,23 @@
import org.slf4j.LoggerFactory;
import io.debezium.config.Configuration;
import io.debezium.mysql.Module;
/**
* A Kafka Connect source connector that creates tasks that read the MySQL binary log and generate the corresponding
* data change events.
* <h2>Configuration</h2>
* <p>
* This connector is configured with the set of properties described in {@link ConnectorConfig}.
* This connector is configured with the set of properties described in {@link MySqlConnectorConfig}.
*
*
* @author Randall Hauch
*/
public class Connector extends SourceConnector {
public class MySqlConnector extends SourceConnector {
private final Logger logger = LoggerFactory.getLogger(getClass());
private Map<String, String> props;
public Connector() {
public MySqlConnector() {
}
@Override
@ -49,7 +48,7 @@ public Class<? extends Task> taskClass() {
@Override
public void start(Map<String, String> props) {
this.props = props;
Configuration.from(props).validate(ConnectorConfig.ALL_FIELDS, logger::error);
Configuration.from(props).validate(MySqlConnectorConfig.ALL_FIELDS, logger::error);
}
@Override

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql.source;
package io.debezium.connector.mysql;
import java.util.Collection;
import java.util.function.Consumer;
@ -17,7 +17,7 @@
* The configuration properties.
*/
@SuppressWarnings("unchecked")
public class ConnectorConfig {
public class MySqlConnectorConfig {
public static final Field USER = Field.create("database.user")
.withDescription("Name of the database user to be used when connecting to the database.")
@ -57,7 +57,7 @@ public class ConnectorConfig {
public static final Field MAX_QUEUE_SIZE = Field.create("max.queue.size")
.withDescription("Maximum size of the queue for change events read from the database log but not yet recorded or forwarded. Defaults to 2048, and should always be larger than the maximum batch size.")
.withDefault(2048)
.withValidation(ConnectorConfig::validateMaxQueueSize);
.withValidation(MySqlConnectorConfig::validateMaxQueueSize);
public static final Field MAX_BATCH_SIZE = Field.create("max.batch.size")
.withDescription("Maximum size of each batch of source records. Defaults to 1024.")

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql;
package io.debezium.connector.mysql;
import java.sql.Types;
import java.util.ArrayList;

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql.source;
package io.debezium.connector.mysql;
import java.util.Map;

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql.source;
package io.debezium.connector.mysql;
import java.io.Serializable;
import java.util.BitSet;
@ -27,7 +27,6 @@
import com.github.shyiko.mysql.binlog.event.WriteRowsEventData;
import io.debezium.annotation.NotThreadSafe;
import io.debezium.mysql.MySqlDdlParser;
import io.debezium.relational.Table;
import io.debezium.relational.TableId;
import io.debezium.relational.TableSchema;

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql.source;
package io.debezium.connector.mysql;
import io.debezium.annotation.ThreadSafe;

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql;
package io.debezium.connector.mysql;
import java.sql.ResultSet;
import java.sql.SQLException;

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql.source;
package io.debezium.connector.mysql;
import java.sql.SQLException;
import java.sql.Types;
@ -12,7 +12,6 @@
import static org.fest.assertions.Assertions.assertThat;
import io.debezium.mysql.MySQLConnection;
import io.debezium.relational.Column;
import io.debezium.relational.Table;
import io.debezium.relational.Tables;

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql;
package io.debezium.connector.mysql;
import io.debezium.config.Configuration;
import io.debezium.jdbc.JdbcConfiguration;

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql;
package io.debezium.connector.mysql;
import static org.junit.Assert.fail;

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.mysql.source;
package io.debezium.connector.mysql;
import static org.junit.Assert.fail;
@ -45,7 +45,6 @@
import static org.fest.assertions.Assertions.assertThat;
import io.debezium.jdbc.JdbcConfiguration;
import io.debezium.mysql.MySQLConnection;
public class ReadBinLogIT {

View File

@ -13,8 +13,8 @@
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>debezium-ingest-postgres</artifactId>
<name>Debezium Ingest from PostgreSQL</name>
<artifactId>debezium-connector-postgres</artifactId>
<name>Debezium Connector for PostgreSQL</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
@ -157,33 +157,13 @@
<configuration>
<systemPropertyVariables>
<!-- Make these available to the tests via system properties -->
<database.hostname>${dockerhost.ip}</database.hostname>
<database.hostname>${docker.host.address}</database.hostname>
<database.port>${database.port}</database.port>
<database.user>${database.user}</database.user>
<database.password>${database.password}</database.password>
</systemPropertyVariables>
</configuration>
</plugin>
<!-- Extract from $DOCKER_HOST the IP address of the host that will run our Docker images -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>regex-property</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>dockerhost.ip</name>
<value>${env.DOCKER_HOST}</value>
<regex>.*://(\d+)\.(\d+)\.(\d+)\.(\d+):.*</regex>
<replacement>$1.$2.$3.$4</replacement>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<!-- Apply the properties set in the POM to the resource files -->

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.postgresql;
package io.debezium.connector.postgres;
import java.sql.SQLException;

View File

@ -3,7 +3,7 @@
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.postgresql;
package io.debezium.connector.postgres;
import io.debezium.config.Configuration;
import io.debezium.jdbc.JdbcConfiguration;

16
pom.xml
View File

@ -84,9 +84,9 @@
<module>support/checkstyle</module>
<module>debezium-core</module>
<module>debezium-embedded</module>
<module>debezium-ingest-mysql</module>
<!--module>debezium-ingest-jdbc</module-->
<!--module>debezium-ingest-postgres</module-->
<module>debezium-connector-mysql</module>
<!--module>debezium-connector-jdbc</module-->
<!--module>debezium-connector-postgres</module-->
<!--module>debezium-kafka-connect</module-->
</modules>
<dependencyManagement>
@ -185,22 +185,22 @@
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-ingest-jdbc</artifactId>
<artifactId>debezium-connector-jdbc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-ingest-postgres</artifactId>
<artifactId>debezium-connector-postgres</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-ingest-postgres-test</artifactId>
<artifactId>debezium-connector-postgres-test</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-ingest-mysql</artifactId>
<artifactId>debezium-connector-mysql</artifactId>
<version>${project.version}</version>
</dependency>
@ -214,7 +214,7 @@
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-ingest-jdbc</artifactId>
<artifactId>debezium-connector-jdbc</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>