embulk-output-aster 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,60 @@
1
+ package org.embulk.output.aster.jdbc;
2
+
3
+ import com.google.common.base.Optional;
4
+ import org.embulk.output.jdbc.JdbcOutputConnector;
5
+ import org.embulk.spi.Exec;
6
+ import org.slf4j.Logger;
7
+
8
+ import java.sql.DriverManager;
9
+ import java.sql.Statement;
10
+ import java.util.Properties;
11
+ import java.sql.Connection;
12
+ import java.sql.SQLException;
13
+
14
+ public class AsterOutputConnector
15
+ implements JdbcOutputConnector
16
+ {
17
+ private final Logger logger = Exec.getLogger(AsterOutputConnector.class);
18
+ private final String url;
19
+ private final Properties properties;
20
+ private final Optional<String> schema;
21
+ private final Optional<String> distributeKey;
22
+
23
+ public AsterOutputConnector(String url, Optional<String> schema, Optional<String> distributeKey, Properties properties)
24
+ {
25
+ this.url = url;
26
+ this.schema = schema;
27
+ this.distributeKey = distributeKey;
28
+ this.properties = properties;
29
+ }
30
+
31
+ @Override
32
+ public AsterOutputConnection connect(boolean autoCommit) throws SQLException
33
+ {
34
+ try
35
+ {
36
+ Class.forName("com.asterdata.ncluster.Driver");
37
+ } catch (ClassNotFoundException e)
38
+ {
39
+ logger.error("Class not found: " + e.getMessage());
40
+ }
41
+
42
+ Connection con = DriverManager.getConnection(url, properties);
43
+
44
+ try {
45
+ Statement stmt = con.createStatement();
46
+ String sql = "BEGIN;";
47
+ logger.info("SQL: " + sql);
48
+ stmt.execute(sql);
49
+
50
+ AsterOutputConnection c = new AsterOutputConnection(con, schema, distributeKey);
51
+ con = null;
52
+ return c;
53
+ }
54
+ finally {
55
+ if (con != null) {
56
+ con.close();
57
+ }
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,5 @@
1
+ package org.embulk.output.aster;
2
+
3
+ public class TestAsterOutputPlugin
4
+ {
5
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-aster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ebyhr
@@ -45,8 +45,29 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - .DS_Store
48
49
  - .gitattributes
49
- - classpath/embulk-output-aster-0.0.1.jar
50
+ - .gitignore
51
+ - LICENSE.txt
52
+ - README.md
53
+ - build.gradle
54
+ - config/checkstyle/checkstyle.xml
55
+ - config/checkstyle/default.xml
56
+ - embulk-output-aster.iml
57
+ - gradle/wrapper/gradle-wrapper.jar
58
+ - gradle/wrapper/gradle-wrapper.properties
59
+ - gradlew
60
+ - gradlew.bat
61
+ - lib/embulk-output-jdbc-0.7.11.jar
62
+ - lib/embulk/output/aster.rb
63
+ - lib/noarch-aster-jdbc-driver.jar
64
+ - sample/config.yml
65
+ - src/main/java/org/embulk/output/aster/AsterOutputPlugin.java
66
+ - src/main/java/org/embulk/output/aster/jdbc/AsterBatchInsert.java
67
+ - src/main/java/org/embulk/output/aster/jdbc/AsterOutputConnection.java
68
+ - src/main/java/org/embulk/output/aster/jdbc/AsterOutputConnector.java
69
+ - src/test/java/org/embulk/output/aster/TestAsterOutputPlugin.java
70
+ - classpath/embulk-output-aster-0.0.2.jar
50
71
  - classpath/embulk-output-jdbc-0.7.11.jar
51
72
  - classpath/noarch-aster-jdbc-driver.jar
52
73
  homepage: https://github.com/ebyhr/embulk-output-aster