embulk-input-jdbc 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a550ebcfbfdf2ffd7224f75e0323e2f2f38d251
|
4
|
+
data.tar.gz: 94fd015df489f76a7ab61f96d8270e41cf835c47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe03d9383723b67c6e7bfad40e846af35e28a6005c23481e8ef3d0371bb32153c3707249251fbd54f3e4dd486127998b7fe331cac86a116d900008e9b6eeb58d
|
7
|
+
data.tar.gz: 36c39dd512041e1191cb18b2b53c7c8b9fe9d2d74546bc39742c2f0da6aaaed4830d89033a21175f44895940febeaa5b1b3baba04bd13baa78af8e5fa5521408
|
Binary file
|
@@ -1,17 +1,25 @@
|
|
1
1
|
package org.embulk.input;
|
2
2
|
|
3
|
+
import java.nio.file.Paths;
|
4
|
+
import java.util.Set;
|
5
|
+
import java.util.HashSet;
|
3
6
|
import java.util.Properties;
|
4
7
|
import java.sql.Connection;
|
5
8
|
import java.sql.Driver;
|
6
9
|
import java.sql.SQLException;
|
10
|
+
import com.google.common.base.Optional;
|
7
11
|
import com.google.common.base.Throwables;
|
12
|
+
import org.embulk.spi.PluginClassLoader;
|
8
13
|
import org.embulk.config.Config;
|
14
|
+
import org.embulk.config.ConfigDefault;
|
9
15
|
import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
|
10
16
|
import org.embulk.input.jdbc.JdbcInputConnection;
|
11
17
|
|
12
18
|
public class JdbcInputPlugin
|
13
19
|
extends AbstractJdbcInputPlugin
|
14
20
|
{
|
21
|
+
private final static Set<String> loadedJarGlobs = new HashSet<String>();
|
22
|
+
|
15
23
|
public interface GenericPluginTask extends PluginTask
|
16
24
|
{
|
17
25
|
@Config("driver_name")
|
@@ -19,6 +27,10 @@ public class JdbcInputPlugin
|
|
19
27
|
|
20
28
|
@Config("driver_class")
|
21
29
|
public String getDriverClass();
|
30
|
+
|
31
|
+
@Config("driver_path")
|
32
|
+
@ConfigDefault("null")
|
33
|
+
public Optional<String> getDriverPath();
|
22
34
|
}
|
23
35
|
|
24
36
|
@Override
|
@@ -32,12 +44,22 @@ public class JdbcInputPlugin
|
|
32
44
|
{
|
33
45
|
GenericPluginTask g = (GenericPluginTask) task;
|
34
46
|
|
47
|
+
if (g.getDriverPath().isPresent()) {
|
48
|
+
synchronized (loadedJarGlobs) {
|
49
|
+
String glob = g.getDriverPath().get();
|
50
|
+
if (!loadedJarGlobs.contains(glob)) {
|
51
|
+
loadDriverJar(glob);
|
52
|
+
loadedJarGlobs.add(glob);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
35
57
|
String url;
|
36
58
|
if (g.getPort().isPresent()) {
|
37
59
|
url = String.format("jdbc:%s://%s:%d/%s",
|
38
60
|
g.getDriverName(), g.getHost(), g.getPort().get(), g.getDatabase());
|
39
61
|
} else {
|
40
|
-
url = String.format("jdbc:%s://%s
|
62
|
+
url = String.format("jdbc:%s://%s/%s",
|
41
63
|
g.getDriverName(), g.getHost(), g.getDatabase());
|
42
64
|
}
|
43
65
|
|
@@ -67,4 +89,11 @@ public class JdbcInputPlugin
|
|
67
89
|
}
|
68
90
|
}
|
69
91
|
}
|
92
|
+
|
93
|
+
private void loadDriverJar(String glob)
|
94
|
+
{
|
95
|
+
// TODO match glob
|
96
|
+
PluginClassLoader loader = (PluginClassLoader) getClass().getClassLoader();
|
97
|
+
loader.addPath(Paths.get(glob));
|
98
|
+
}
|
70
99
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-jdbc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Selects records from a table.
|
14
14
|
email:
|
@@ -18,6 +18,7 @@ extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
20
|
- build.gradle
|
21
|
+
- lib/embulk/input/jdbc.rb
|
21
22
|
- src/main/java/org/embulk/input/JdbcInputPlugin.java
|
22
23
|
- src/main/java/org/embulk/input/jdbc/AbstractJdbcInputPlugin.java
|
23
24
|
- src/main/java/org/embulk/input/jdbc/JdbcColumn.java
|
@@ -26,7 +27,7 @@ files:
|
|
26
27
|
- src/main/java/org/embulk/input/jdbc/getter/ColumnGetter.java
|
27
28
|
- src/main/java/org/embulk/input/jdbc/getter/ColumnGetterFactory.java
|
28
29
|
- src/main/java/org/embulk/input/jdbc/getter/ColumnGetters.java
|
29
|
-
- classpath/embulk-input-jdbc-0.2.
|
30
|
+
- classpath/embulk-input-jdbc-0.2.4.jar
|
30
31
|
homepage: https://github.com/embulk/embulk-input-jdbc
|
31
32
|
licenses:
|
32
33
|
- Apache 2.0
|