embulk-input-remote 0.1.4 → 0.1.5
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.
- checksums.yaml +4 -4
- data/build.gradle +5 -5
- data/classpath/ecc-25519-java-1.0.1.jar +0 -0
- data/classpath/embulk-input-remote-0.1.5.jar +0 -0
- data/classpath/sshj-0.15.0.jar +0 -0
- data/example/csv/sample_01.csv.gz +0 -0
- data/example/example.yml.liquid +29 -0
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +2 -2
- data/gradlew.bat +90 -90
- data/src/main/java/org/embulk/input/RemoteFileInputPlugin.java +20 -47
- data/src/main/java/org/embulk/input/remote/SSHClient.java +17 -3
- metadata +8 -5
- data/classpath/embulk-input-remote-0.1.4.jar +0 -0
- data/classpath/sshj-0.11.0.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 303e89aa29cb5154cae5337a90dae5c3dad30e70
|
4
|
+
data.tar.gz: 0447d693207db43d2f3058139a43d5e9a225e117
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0caa5463e3c5f7573ddc72b5640ab01702e307cf3cd26001f16ea71aa382be58de3c8d6b06c138d4d829d50843125af7cc9996b5a73b5ac08bffa05de5200ecd
|
7
|
+
data.tar.gz: 146c22cf5416e4cd47d059f121b0a054eddad875eeddd30b4af178d7c09e888762aae2875930d01a0f43450afc96e88a2b913895b65f85ebc0bb1dc1de20a1a6
|
data/build.gradle
CHANGED
@@ -13,13 +13,13 @@ configurations {
|
|
13
13
|
provided
|
14
14
|
}
|
15
15
|
|
16
|
-
version = "0.1.
|
16
|
+
version = "0.1.5"
|
17
17
|
|
18
18
|
dependencies {
|
19
|
-
compile "org.embulk:embulk-core:0.
|
20
|
-
compile "com.hierynomus:sshj:0.
|
19
|
+
compile "org.embulk:embulk-core:0.7.10"
|
20
|
+
compile "com.hierynomus:sshj:0.15.0"
|
21
21
|
compile "com.jcraft:jzlib:1.1.3"
|
22
|
-
provided "org.embulk:embulk-core:0.
|
22
|
+
provided "org.embulk:embulk-core:0.7.10"
|
23
23
|
testCompile "junit:junit:4.+"
|
24
24
|
}
|
25
25
|
|
@@ -40,7 +40,7 @@ task gemspec << { file("build/gemspec").write($/
|
|
40
40
|
Gem::Specification.new do |spec|
|
41
41
|
spec.name = "${project.name}"
|
42
42
|
spec.version = "${project.version}"
|
43
|
-
spec.authors = ["Shinichi
|
43
|
+
spec.authors = ["Shinichi Ishimura"]
|
44
44
|
spec.summary = %[Remote file input plugin for Embulk]
|
45
45
|
spec.description = %[Reads files stored on Remote hosts by SCP.]
|
46
46
|
spec.email = ["shiketaudonko41@gmail.com"]
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
in:
|
2
|
+
type: remote
|
3
|
+
hosts:
|
4
|
+
- localhost
|
5
|
+
path: {{ env.PROJECT_ROOT }}/example/csv
|
6
|
+
ignore_not_found_hosts: true
|
7
|
+
auth:
|
8
|
+
user: {{ env.USER }}
|
9
|
+
type: password
|
10
|
+
password: {{ env.PASSWORD }}
|
11
|
+
decoders:
|
12
|
+
- {type: gzip}
|
13
|
+
parser:
|
14
|
+
charset: UTF-8
|
15
|
+
newline: CRLF
|
16
|
+
type: csv
|
17
|
+
delimiter: ','
|
18
|
+
quote: '"'
|
19
|
+
trim_if_not_quoted: false
|
20
|
+
skip_header_lines: 1
|
21
|
+
allow_extra_columns: false
|
22
|
+
allow_optional_columns: false
|
23
|
+
columns:
|
24
|
+
- {name: id, type: long}
|
25
|
+
- {name: account, type: long}
|
26
|
+
- {name: time, type: timestamp, format: '%Y-%m-%d %H:%M:%S'}
|
27
|
+
- {name: purchase, type: timestamp, format: '%Y%m%d'}
|
28
|
+
- {name: comment, type: string}
|
29
|
+
out: {type: stdout}
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#Sun Dec 13 00:26:07 JST 2015
|
2
2
|
distributionBase=GRADLE_USER_HOME
|
3
3
|
distributionPath=wrapper/dists
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
5
5
|
zipStorePath=wrapper/dists
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip
|
data/gradlew.bat
CHANGED
@@ -1,90 +1,90 @@
|
|
1
|
-
@if "%DEBUG%" == "" @echo off
|
2
|
-
@rem ##########################################################################
|
3
|
-
@rem
|
4
|
-
@rem Gradle startup script for Windows
|
5
|
-
@rem
|
6
|
-
@rem ##########################################################################
|
7
|
-
|
8
|
-
@rem Set local scope for the variables with windows NT shell
|
9
|
-
if "%OS%"=="Windows_NT" setlocal
|
10
|
-
|
11
|
-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
12
|
-
set DEFAULT_JVM_OPTS=
|
13
|
-
|
14
|
-
set DIRNAME=%~dp0
|
15
|
-
if "%DIRNAME%" == "" set DIRNAME=.
|
16
|
-
set APP_BASE_NAME=%~n0
|
17
|
-
set APP_HOME=%DIRNAME%
|
18
|
-
|
19
|
-
@rem Find java.exe
|
20
|
-
if defined JAVA_HOME goto findJavaFromJavaHome
|
21
|
-
|
22
|
-
set JAVA_EXE=java.exe
|
23
|
-
%JAVA_EXE% -version >NUL 2>&1
|
24
|
-
if "%ERRORLEVEL%" == "0" goto init
|
25
|
-
|
26
|
-
echo.
|
27
|
-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
28
|
-
echo.
|
29
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
30
|
-
echo location of your Java installation.
|
31
|
-
|
32
|
-
goto fail
|
33
|
-
|
34
|
-
:findJavaFromJavaHome
|
35
|
-
set JAVA_HOME=%JAVA_HOME:"=%
|
36
|
-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
37
|
-
|
38
|
-
if exist "%JAVA_EXE%" goto init
|
39
|
-
|
40
|
-
echo.
|
41
|
-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
42
|
-
echo.
|
43
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
44
|
-
echo location of your Java installation.
|
45
|
-
|
46
|
-
goto fail
|
47
|
-
|
48
|
-
:init
|
49
|
-
@rem Get command-line arguments, handling Windowz variants
|
50
|
-
|
51
|
-
if not "%OS%" == "Windows_NT" goto win9xME_args
|
52
|
-
if "%@eval[2+2]" == "4" goto 4NT_args
|
53
|
-
|
54
|
-
:win9xME_args
|
55
|
-
@rem Slurp the command line arguments.
|
56
|
-
set CMD_LINE_ARGS=
|
57
|
-
set _SKIP=2
|
58
|
-
|
59
|
-
:win9xME_args_slurp
|
60
|
-
if "x%~1" == "x" goto execute
|
61
|
-
|
62
|
-
set CMD_LINE_ARGS=%*
|
63
|
-
goto execute
|
64
|
-
|
65
|
-
:4NT_args
|
66
|
-
@rem Get arguments from the 4NT Shell from JP Software
|
67
|
-
set CMD_LINE_ARGS=%$
|
68
|
-
|
69
|
-
:execute
|
70
|
-
@rem Setup the command line
|
71
|
-
|
72
|
-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
73
|
-
|
74
|
-
@rem Execute Gradle
|
75
|
-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
76
|
-
|
77
|
-
:end
|
78
|
-
@rem End local scope for the variables with windows NT shell
|
79
|
-
if "%ERRORLEVEL%"=="0" goto mainEnd
|
80
|
-
|
81
|
-
:fail
|
82
|
-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
83
|
-
rem the _cmd.exe /c_ return code!
|
84
|
-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
85
|
-
exit /b 1
|
86
|
-
|
87
|
-
:mainEnd
|
88
|
-
if "%OS%"=="Windows_NT" endlocal
|
89
|
-
|
90
|
-
:omega
|
1
|
+
@if "%DEBUG%" == "" @echo off
|
2
|
+
@rem ##########################################################################
|
3
|
+
@rem
|
4
|
+
@rem Gradle startup script for Windows
|
5
|
+
@rem
|
6
|
+
@rem ##########################################################################
|
7
|
+
|
8
|
+
@rem Set local scope for the variables with windows NT shell
|
9
|
+
if "%OS%"=="Windows_NT" setlocal
|
10
|
+
|
11
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
12
|
+
set DEFAULT_JVM_OPTS=
|
13
|
+
|
14
|
+
set DIRNAME=%~dp0
|
15
|
+
if "%DIRNAME%" == "" set DIRNAME=.
|
16
|
+
set APP_BASE_NAME=%~n0
|
17
|
+
set APP_HOME=%DIRNAME%
|
18
|
+
|
19
|
+
@rem Find java.exe
|
20
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
21
|
+
|
22
|
+
set JAVA_EXE=java.exe
|
23
|
+
%JAVA_EXE% -version >NUL 2>&1
|
24
|
+
if "%ERRORLEVEL%" == "0" goto init
|
25
|
+
|
26
|
+
echo.
|
27
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
28
|
+
echo.
|
29
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
30
|
+
echo location of your Java installation.
|
31
|
+
|
32
|
+
goto fail
|
33
|
+
|
34
|
+
:findJavaFromJavaHome
|
35
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
36
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
37
|
+
|
38
|
+
if exist "%JAVA_EXE%" goto init
|
39
|
+
|
40
|
+
echo.
|
41
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
42
|
+
echo.
|
43
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
44
|
+
echo location of your Java installation.
|
45
|
+
|
46
|
+
goto fail
|
47
|
+
|
48
|
+
:init
|
49
|
+
@rem Get command-line arguments, handling Windowz variants
|
50
|
+
|
51
|
+
if not "%OS%" == "Windows_NT" goto win9xME_args
|
52
|
+
if "%@eval[2+2]" == "4" goto 4NT_args
|
53
|
+
|
54
|
+
:win9xME_args
|
55
|
+
@rem Slurp the command line arguments.
|
56
|
+
set CMD_LINE_ARGS=
|
57
|
+
set _SKIP=2
|
58
|
+
|
59
|
+
:win9xME_args_slurp
|
60
|
+
if "x%~1" == "x" goto execute
|
61
|
+
|
62
|
+
set CMD_LINE_ARGS=%*
|
63
|
+
goto execute
|
64
|
+
|
65
|
+
:4NT_args
|
66
|
+
@rem Get arguments from the 4NT Shell from JP Software
|
67
|
+
set CMD_LINE_ARGS=%$
|
68
|
+
|
69
|
+
:execute
|
70
|
+
@rem Setup the command line
|
71
|
+
|
72
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
73
|
+
|
74
|
+
@rem Execute Gradle
|
75
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
76
|
+
|
77
|
+
:end
|
78
|
+
@rem End local scope for the variables with windows NT shell
|
79
|
+
if "%ERRORLEVEL%"=="0" goto mainEnd
|
80
|
+
|
81
|
+
:fail
|
82
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
83
|
+
rem the _cmd.exe /c_ return code!
|
84
|
+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
85
|
+
exit /b 1
|
86
|
+
|
87
|
+
:mainEnd
|
88
|
+
if "%OS%"=="Windows_NT" endlocal
|
89
|
+
|
90
|
+
:omega
|
@@ -16,20 +16,20 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
|
16
16
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
17
17
|
import com.google.common.base.Optional;
|
18
18
|
import com.google.common.collect.ImmutableList;
|
19
|
-
import org.embulk.config.CommitReport;
|
20
19
|
import org.embulk.config.Config;
|
21
20
|
import org.embulk.config.ConfigDefault;
|
22
21
|
import org.embulk.config.ConfigDiff;
|
23
22
|
import org.embulk.config.ConfigInject;
|
24
23
|
import org.embulk.config.ConfigSource;
|
25
24
|
import org.embulk.config.Task;
|
25
|
+
import org.embulk.config.TaskReport;
|
26
26
|
import org.embulk.config.TaskSource;
|
27
27
|
import org.embulk.input.remote.SSHClient;
|
28
28
|
import org.embulk.spi.BufferAllocator;
|
29
29
|
import org.embulk.spi.Exec;
|
30
30
|
import org.embulk.spi.FileInputPlugin;
|
31
31
|
import org.embulk.spi.TransactionalFileInput;
|
32
|
-
import org.embulk.spi.util.
|
32
|
+
import org.embulk.spi.util.InputStreamTransactionalFileInput;
|
33
33
|
import org.slf4j.Logger;
|
34
34
|
|
35
35
|
import javax.annotation.Nullable;
|
@@ -183,64 +183,37 @@ public class RemoteFileInputPlugin
|
|
183
183
|
@Override
|
184
184
|
public void cleanup(TaskSource taskSource,
|
185
185
|
int taskCount,
|
186
|
-
List<
|
186
|
+
List<TaskReport> successTaskReports) {
|
187
187
|
}
|
188
188
|
|
189
189
|
@Override
|
190
190
|
public TransactionalFileInput open(TaskSource taskSource, int taskIndex) {
|
191
|
-
PluginTask task = taskSource.loadTask(PluginTask.class);
|
191
|
+
final PluginTask task = taskSource.loadTask(PluginTask.class);
|
192
192
|
final Target target = task.getTargets().get(taskIndex);
|
193
193
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
public static class PluginFileInput
|
202
|
-
extends InputStreamFileInput
|
203
|
-
implements TransactionalFileInput {
|
204
|
-
// TODO create single-file InputStreamFileInput utility
|
205
|
-
private static class RemoteFileProvider
|
206
|
-
implements InputStreamFileInput.Provider {
|
207
|
-
private boolean opened = false;
|
208
|
-
private final InputStream input;
|
209
|
-
|
210
|
-
public RemoteFileProvider(InputStream input) {
|
211
|
-
this.input = input;
|
212
|
-
}
|
213
|
-
|
214
|
-
@Override
|
215
|
-
public InputStream openNext() throws IOException {
|
216
|
-
if (opened) {
|
217
|
-
return null;
|
194
|
+
return new InputStreamTransactionalFileInput(
|
195
|
+
task.getBufferAllocator(),
|
196
|
+
new InputStreamTransactionalFileInput.Opener() {
|
197
|
+
@Override
|
198
|
+
public InputStream open() throws IOException {
|
199
|
+
return download(target, task);
|
200
|
+
}
|
218
201
|
}
|
219
|
-
|
220
|
-
|
202
|
+
) {
|
203
|
+
@Override
|
204
|
+
public void abort() {
|
205
|
+
|
221
206
|
}
|
222
207
|
|
223
208
|
@Override
|
224
|
-
public
|
209
|
+
public TaskReport commit() {
|
210
|
+
return Exec.newTaskReport();
|
225
211
|
}
|
226
|
-
}
|
227
|
-
|
228
|
-
public PluginFileInput(PluginTask task, InputStream input) {
|
229
|
-
super(task.getBufferAllocator(), new RemoteFileProvider(input));
|
230
|
-
}
|
231
|
-
|
232
|
-
@Override
|
233
|
-
public void abort() {
|
234
|
-
}
|
235
|
-
|
236
|
-
@Override
|
237
|
-
public CommitReport commit() {
|
238
|
-
return Exec.newCommitReport();
|
239
|
-
}
|
212
|
+
};
|
240
213
|
}
|
241
214
|
|
242
215
|
private boolean exists(Target target, PluginTask task) throws IOException {
|
243
|
-
try (SSHClient client =
|
216
|
+
try (SSHClient client = SSHClient.getInstance()) {
|
244
217
|
client.connect(target.getHost(), task.getAuth());
|
245
218
|
|
246
219
|
final String checkCmd = "ls " + target.getPath(); // TODO: windows
|
@@ -257,7 +230,7 @@ public class RemoteFileInputPlugin
|
|
257
230
|
}
|
258
231
|
|
259
232
|
private InputStream download(Target target, PluginTask task) throws IOException {
|
260
|
-
try (SSHClient client =
|
233
|
+
try (SSHClient client = SSHClient.getInstance()) {
|
261
234
|
client.connect(target.getHost(), task.getAuth());
|
262
235
|
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
263
236
|
client.scpDownload(target.getPath(), stream);
|
@@ -1,6 +1,11 @@
|
|
1
1
|
package org.embulk.input.remote;
|
2
2
|
|
3
|
+
import com.hierynomus.sshj.signature.SignatureEdDSA;
|
4
|
+
import net.schmizz.sshj.DefaultConfig;
|
3
5
|
import net.schmizz.sshj.connection.channel.direct.Session;
|
6
|
+
import net.schmizz.sshj.signature.SignatureDSA;
|
7
|
+
import net.schmizz.sshj.signature.SignatureECDSA;
|
8
|
+
import net.schmizz.sshj.signature.SignatureRSA;
|
4
9
|
import net.schmizz.sshj.xfer.InMemoryDestFile;
|
5
10
|
import net.schmizz.sshj.xfer.LocalDestFile;
|
6
11
|
|
@@ -15,8 +20,18 @@ public class SSHClient implements Closeable {
|
|
15
20
|
|
16
21
|
private final net.schmizz.sshj.SSHClient client;
|
17
22
|
|
18
|
-
public SSHClient() {
|
19
|
-
|
23
|
+
public static SSHClient getInstance() {
|
24
|
+
return new SSHClient(new net.schmizz.sshj.SSHClient(new DefaultConfig(){
|
25
|
+
@Override
|
26
|
+
protected void initSignatureFactories() {
|
27
|
+
setSignatureFactories(
|
28
|
+
new SignatureRSA.Factory(),
|
29
|
+
new SignatureECDSA.Factory(),
|
30
|
+
new SignatureDSA.Factory(),
|
31
|
+
new SignatureEdDSA.Factory()
|
32
|
+
);
|
33
|
+
}
|
34
|
+
}));
|
20
35
|
}
|
21
36
|
|
22
37
|
/* package for test */
|
@@ -26,7 +41,6 @@ public class SSHClient implements Closeable {
|
|
26
41
|
|
27
42
|
public void connect(String host, Map<String, String> authConfig) throws IOException {
|
28
43
|
client.loadKnownHosts();
|
29
|
-
|
30
44
|
client.connect(host);
|
31
45
|
|
32
46
|
final String type = authConfig.get("type") != null ? authConfig.get("type") : "public_key";
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Shinichi
|
7
|
+
- Shinichi Ishimura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,6 +49,8 @@ files:
|
|
49
49
|
- LICENSE.txt
|
50
50
|
- README.md
|
51
51
|
- build.gradle
|
52
|
+
- example/csv/sample_01.csv.gz
|
53
|
+
- example/example.yml.liquid
|
52
54
|
- gradle/wrapper/gradle-wrapper.jar
|
53
55
|
- gradle/wrapper/gradle-wrapper.properties
|
54
56
|
- gradlew
|
@@ -59,9 +61,10 @@ files:
|
|
59
61
|
- src/test/java/org/embulk/input/TestRemoteFileInputPlugin.java
|
60
62
|
- classpath/bcpkix-jdk15on-1.51.jar
|
61
63
|
- classpath/bcprov-jdk15on-1.51.jar
|
62
|
-
- classpath/
|
64
|
+
- classpath/ecc-25519-java-1.0.1.jar
|
65
|
+
- classpath/embulk-input-remote-0.1.5.jar
|
63
66
|
- classpath/jzlib-1.1.3.jar
|
64
|
-
- classpath/sshj-0.
|
67
|
+
- classpath/sshj-0.15.0.jar
|
65
68
|
homepage: https://github.com/kamatama41/embulk-input-remote
|
66
69
|
licenses:
|
67
70
|
- MIT
|
Binary file
|
data/classpath/sshj-0.11.0.jar
DELETED
Binary file
|