embulk-input-sftp 0.2.12 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aee50a24af4aefe560e866185b937b75fd55c6de
4
- data.tar.gz: 89a75e4a81249fb7b72a94843da40c3f46884dba
3
+ metadata.gz: 4ecd76a142c68e404815a711cd75fec1008886ac
4
+ data.tar.gz: 413a21694151b03433eb693fd464c8a0076d3c1e
5
5
  SHA512:
6
- metadata.gz: 4d6ff3b1f944e43d293c1354b671f0b7e888a67c8b5375ba199ef717a5236cae3f192803f120ce267447fb10b1a11ade82cafee9b7b675f0bb5f440a3619df37
7
- data.tar.gz: 33974b8d4d2746a0a731d0afaf72604a36ee6804fccda0ddfaea36bd79b0f1d0a44ca5e0f255b78c0ef693d9cb583d9acc7a9d028cd1f129515e6cd0f722cb8a
6
+ metadata.gz: a5f6178a67723b6858195893b75e1d225c7672e72349c83cbf3b8c1c0312103cbad37d417fbbdaa320934968617cf34f39b8d15dc6e43630574ff2596d6f143b
7
+ data.tar.gz: 2d828addac6bdb0b1dd8a3953303729b76b250f6c7de324ff20df4d0378398aa617e07bfd627a223eb2850684639c07ebe9c641cbc31e0566d06e06249ac1b13
@@ -1,3 +1,6 @@
1
+ ## 0.3.0 - 2018-12-26
2
+ [new feature] Use file name output feature in Embulk core to show file name in cmdout [#37](https://github.com/embulk/embulk-input-sftp/pull/37)
3
+
1
4
  ## 0.2.12 - 2018-10-05
2
5
  * [maintenance] Give up processing and throw ConfigException when "Auth fail" first appears [#33](https://github.com/embulk/embulk-input-sftp/pull/33)
3
6
 
data/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
 
4
4
  Reads files stored on remote server using SFTP
5
5
 
6
+ embulk-input-sftp v0.3.0+ requires Embulk v0.9.12+
7
+
6
8
  ## Overview
7
9
 
8
10
  * **Plugin type**: file input
@@ -16,20 +16,20 @@ configurations {
16
16
  }
17
17
 
18
18
  group = "org.embulk.input.sftp"
19
- version = "0.2.12"
19
+ version = "0.3.0"
20
20
 
21
- sourceCompatibility = 1.7
22
- targetCompatibility = 1.7
21
+ sourceCompatibility = 1.8
22
+ targetCompatibility = 1.8
23
23
 
24
24
  dependencies {
25
- compile "org.embulk:embulk-core:0.8.6"
26
- provided "org.embulk:embulk-core:0.8.6"
25
+ compile "org.embulk:embulk-core:0.9.12"
26
+ provided "org.embulk:embulk-core:0.9.12"
27
27
  compile "org.apache.commons:commons-vfs2:2.2"
28
28
  compile "commons-io:commons-io:2.6"
29
- compile "com.jcraft:jsch:0.1.54"
29
+ compile "com.jcraft:jsch:0.1.55"
30
30
  testCompile "junit:junit:4.+"
31
- testCompile "org.embulk:embulk-core:0.8.6:tests"
32
- testCompile "org.embulk:embulk-standards:0.8.6"
31
+ testCompile "org.embulk:embulk-core:0.9.12:tests"
32
+ testCompile "org.embulk:embulk-standards:0.9.12"
33
33
  testCompile "org.apache.sshd:apache-sshd:1.1.0"
34
34
  testCompile "org.littleshoot:littleproxy:1.1.0-beta1"
35
35
  testCompile "io.netty:netty-all:4.0.34.Final"
@@ -3,7 +3,6 @@ package org.embulk.input.sftp;
3
3
  import com.fasterxml.jackson.annotation.JsonCreator;
4
4
  import com.fasterxml.jackson.annotation.JsonIgnore;
5
5
  import com.fasterxml.jackson.annotation.JsonProperty;
6
- import com.google.common.base.Optional;
7
6
  import com.google.common.base.Throwables;
8
7
  import org.embulk.config.Config;
9
8
  import org.embulk.config.ConfigDefault;
@@ -24,6 +23,7 @@ import java.nio.charset.StandardCharsets;
24
23
  import java.util.AbstractList;
25
24
  import java.util.ArrayList;
26
25
  import java.util.List;
26
+ import java.util.Optional;
27
27
  import java.util.regex.Pattern;
28
28
  import java.util.zip.GZIPInputStream;
29
29
  import java.util.zip.GZIPOutputStream;
@@ -181,7 +181,7 @@ public class FileList
181
181
  catch (IOException ex) {
182
182
  throw Throwables.propagate(ex);
183
183
  }
184
- return new FileList(binary.toByteArray(), getSplits(entries), Optional.fromNullable(last));
184
+ return new FileList(binary.toByteArray(), getSplits(entries), Optional.ofNullable(last));
185
185
  }
186
186
 
187
187
  private List<List<Entry>> getSplits(List<Entry> all)
@@ -1,6 +1,5 @@
1
1
  package org.embulk.input.sftp;
2
2
 
3
- import com.google.common.base.Optional;
4
3
  import org.embulk.config.Config;
5
4
  import org.embulk.config.ConfigDefault;
6
5
  import org.embulk.config.ConfigInject;
@@ -8,6 +7,8 @@ import org.embulk.config.Task;
8
7
  import org.embulk.spi.BufferAllocator;
9
8
  import org.embulk.spi.unit.LocalFile;
10
9
 
10
+ import java.util.Optional;
11
+
11
12
  public interface PluginTask
12
13
  extends Task, FileList.Task
13
14
  {
@@ -2,7 +2,6 @@ package org.embulk.input.sftp;
2
2
 
3
3
  import com.fasterxml.jackson.annotation.JsonCreator;
4
4
  import com.fasterxml.jackson.annotation.JsonValue;
5
- import com.google.common.base.Optional;
6
5
  import org.apache.commons.vfs2.FileSystemOptions;
7
6
  import org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder;
8
7
  import org.embulk.config.Config;
@@ -11,6 +10,7 @@ import org.embulk.config.ConfigException;
11
10
  import org.embulk.config.Task;
12
11
 
13
12
  import java.util.Locale;
13
+ import java.util.Optional;
14
14
 
15
15
  interface ProxyTask
16
16
  extends Task
@@ -1,7 +1,5 @@
1
1
  package org.embulk.input.sftp;
2
2
 
3
- import com.google.common.base.Function;
4
- import com.google.common.base.Optional;
5
3
  import com.google.common.base.Throwables;
6
4
  import org.apache.commons.io.FilenameUtils;
7
5
  import org.apache.commons.lang3.StringUtils;
@@ -29,6 +27,8 @@ import java.io.IOException;
29
27
  import java.net.URI;
30
28
  import java.net.URISyntaxException;
31
29
  import java.util.Arrays;
30
+ import java.util.Optional;
31
+ import java.util.function.Function;
32
32
  import java.util.regex.Pattern;
33
33
 
34
34
  import static org.embulk.spi.util.RetryExecutor.retryExecutor;
@@ -100,11 +100,11 @@ public class SftpFileInput
100
100
 
101
101
  if (task.getSecretKeyFile().isPresent()) {
102
102
  IdentityInfo identityInfo = new IdentityInfo(
103
- new File((task.getSecretKeyFile().transform(localFileToPathString()).get())),
103
+ new File((task.getSecretKeyFile().map(localFileToPathString()).get())),
104
104
  task.getSecretKeyPassphrase().getBytes()
105
105
  );
106
106
  builder.setIdentityInfo(fsOptions, identityInfo);
107
- log.info("set identity: {}", task.getSecretKeyFile().get());
107
+ log.info("set identity: {}", task.getSecretKeyFile().get().getPath());
108
108
  }
109
109
 
110
110
  if (task.getProxy().isPresent()) {
@@ -7,13 +7,13 @@ import org.apache.commons.vfs2.FileSystemOptions;
7
7
  import org.apache.commons.vfs2.impl.StandardFileSystemManager;
8
8
  import org.embulk.spi.Exec;
9
9
  import org.embulk.spi.util.InputStreamFileInput;
10
+ import org.embulk.spi.util.InputStreamFileInput.InputStreamWithHints;
10
11
  import org.embulk.spi.util.RetryExecutor.RetryGiveupException;
11
12
  import org.embulk.spi.util.RetryExecutor.Retryable;
12
13
  import org.slf4j.Logger;
13
14
  import static org.embulk.spi.util.RetryExecutor.retryExecutor;
14
15
 
15
16
  import java.io.IOException;
16
- import java.io.InputStream;
17
17
  import java.io.InterruptedIOException;
18
18
  import java.util.Iterator;
19
19
 
@@ -36,7 +36,7 @@ public class SingleFileProvider
36
36
  }
37
37
 
38
38
  @Override
39
- public InputStream openNext() throws IOException
39
+ public InputStreamWithHints openNextWithHints() throws IOException
40
40
  {
41
41
  if (opened || !iterator.hasNext()) {
42
42
  return null;
@@ -49,12 +49,13 @@ public class SingleFileProvider
49
49
  .withRetryLimit(maxConnectionRetry)
50
50
  .withInitialRetryWait(500)
51
51
  .withMaxRetryWait(30 * 1000)
52
- .runInterruptible(new Retryable<InputStream>() {
52
+ .runInterruptible(new Retryable<InputStreamWithHints>() {
53
53
  @Override
54
- public InputStream call() throws FileSystemException
54
+ public InputStreamWithHints call() throws FileSystemException
55
55
  {
56
56
  FileObject file = manager.resolveFile(key, fsOptions);
57
- return file.getContent().getInputStream();
57
+ return new InputStreamWithHints(
58
+ file.getContent().getInputStream(), key);
58
59
  }
59
60
 
60
61
  @Override
@@ -1,6 +1,5 @@
1
1
  package org.embulk.input.sftp;
2
2
 
3
- import com.google.common.base.Optional;
4
3
  import com.google.common.base.Throwables;
5
4
  import com.google.common.collect.ImmutableList;
6
5
  import com.google.common.collect.ImmutableMap;
@@ -55,6 +54,8 @@ import java.util.Arrays;
55
54
  import java.util.Collections;
56
55
  import java.util.List;
57
56
 
57
+ import java.util.Optional;
58
+
58
59
  import static org.junit.Assert.assertEquals;
59
60
  import static org.junit.Assert.fail;
60
61
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-sftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Akama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-05 00:00:00.000000000 Z
11
+ date: 2018-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -70,10 +70,10 @@ files:
70
70
  - src/test/resources/sample_01.csv
71
71
  - src/test/resources/sample_02.csv
72
72
  - classpath/commons-logging-1.2.jar
73
- - classpath/embulk-input-sftp-0.2.12.jar
73
+ - classpath/embulk-input-sftp-0.3.0.jar
74
74
  - classpath/commons-vfs2-2.2.jar
75
75
  - classpath/commons-io-2.6.jar
76
- - classpath/jsch-0.1.54.jar
76
+ - classpath/jsch-0.1.55.jar
77
77
  homepage: https://github.com/embulk/embulk-input-sftp
78
78
  licenses:
79
79
  - Apache-2.0