src/main/java/org/embulk/input/MySQLInputPlugin.java in embulk-input-mysql-0.8.3 vs src/main/java/org/embulk/input/MySQLInputPlugin.java in embulk-input-mysql-0.8.4
- old
+ new
@@ -10,10 +10,11 @@
import com.google.common.base.Throwables;
import com.mysql.jdbc.TimeUtil;
import org.embulk.config.Config;
import org.embulk.config.ConfigDefault;
import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
+import org.embulk.input.jdbc.Ssl;
import org.embulk.input.jdbc.JdbcInputConnection;
import org.embulk.input.jdbc.getter.ColumnGetterFactory;
import org.embulk.input.mysql.MySQLInputConnection;
import org.embulk.input.mysql.getter.MySQLColumnGetterFactory;
import org.embulk.spi.PageBuilder;
@@ -40,10 +41,14 @@
@ConfigDefault("\"\"")
public String getPassword();
@Config("database")
public String getDatabase();
+
+ @Config("ssl")
+ @ConfigDefault("\"disable\"") // backward compatibility
+ public Ssl getSsl();
}
@Override
protected Class<? extends PluginTask> getTaskClass()
{
@@ -73,24 +78,24 @@
// Enable keepalive based on tcp_keepalive_time, tcp_keepalive_intvl and tcp_keepalive_probes kernel parameters.
// Socket options TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL are not configurable.
props.setProperty("tcpKeepAlive", "true");
- // TODO
- //switch task.getSssl() {
- //when "disable":
- // break;
- //when "enable":
- // props.setProperty("useSSL", "true");
- // props.setProperty("requireSSL", "false");
- // props.setProperty("verifyServerCertificate", "false");
- // break;
- //when "verify":
- // props.setProperty("useSSL", "true");
- // props.setProperty("requireSSL", "true");
- // props.setProperty("verifyServerCertificate", "true");
- // break;
- //}
+ switch (t.getSsl()) {
+ case DISABLE:
+ props.setProperty("useSSL", "false");
+ break;
+ case ENABLE:
+ props.setProperty("useSSL", "true");
+ props.setProperty("requireSSL", "true");
+ props.setProperty("verifyServerCertificate", "false");
+ break;
+ case VERIFY:
+ props.setProperty("useSSL", "true");
+ props.setProperty("requireSSL", "true");
+ props.setProperty("verifyServerCertificate", "true");
+ break;
+ }
if (t.getFetchRows() == 1) {
logger.info("Fetch size is 1. Fetching rows one by one.");
} else if (t.getFetchRows() <= 0) {
logger.info("Fetch size is set to -1. Fetching all rows at once.");