embulk-output-ftp 0.1.3 → 0.1.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: 5dc75d041719981674d7fae9fa33063917cbb78b
4
- data.tar.gz: 10b76c0ea6377bfbc4e7843102380ef939bc803e
3
+ metadata.gz: 99f92ff252075824f860a2929aa8dc90609b3760
4
+ data.tar.gz: ae7284ac04e110cb17b02f5830a2bdc52c5e309c
5
5
  SHA512:
6
- metadata.gz: 54f5d91122ba11013591355303f7ff57930a7f952998ee3bdb7d4d189b5b94b3a8062cbe2f75cebdd93a14ce91e257e116a19e38a9ceef6e11b85618634274d9
7
- data.tar.gz: 60ec552f6383b58521f8f1054d4045664a71a0aa6c6d97531449eb87a513ffb7558912c9129ec6f5f9a98280da96d24b46d2f5658738d95988139aefe88d7dc4
6
+ metadata.gz: 6f867e7103b201e4ddbab093001d6fa657d4932c469bae0baca717ce618b45d6e72521ffae58f0aab43c93d171250e366cf3666b204be31b7906fdbd00505c92
7
+ data.tar.gz: 36e2127321a3cef31515fe3b037c35db61c3187afdf5fd7010e8de2e64c9eca48f6eb1eee83f55498f79f86b7ed232d4c1e54c9e06ef487ecdd5a64e9b7d7382
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.4 - 2016-07-29
2
+
3
+ * [maintenance] Fix default port number generation logic [#7](https://github.com/embulk/embulk-output-ftp/pull/7)
4
+
1
5
  ## 0.1.3 - 2016-07-21
2
6
 
3
7
  * [new feature] Support both of FTPS(explicit) and FTPS(implicit). [#4](https://github.com/sakama/embulk-output-ftp/pull/4)
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # FTP file output plugin for Embulk
2
- [![Build Status](https://travis-ci.org/sakama/embulk-output-ftp.svg?branch=master)](https://travis-ci.org/sakama/embulk-output-ftp)
2
+ [![Build Status](https://travis-ci.org/embulk/embulk-output-ftp.svg?branch=master)](https://travis-ci.org/embulk/embulk-output-ftp)
3
3
 
4
4
  This plugin support **FTP**, **FTPES(FTPS explicit)**, **FTPS(FTPS implicit)** and doesn't support **SFTP**.
5
5
 
@@ -14,7 +14,7 @@ If you want to use SFTP, please use [embulk-output-sftp](https://github.com/civi
14
14
  ## Configuration
15
15
 
16
16
  - **host**: FTP server address (string, required)
17
- - **port**: FTP server port number (integer, default: `21`.)
17
+ - **port**: FTP server port number (integer, default: `21`. `990` if `ssl` is true and `ssl_explicit` is false)
18
18
  - **user**: user name to login (string, optional)
19
19
  - **password**: password to login (string, default: `""`)
20
20
  - **path_prefix** prefix of target files (string, required)
@@ -173,4 +173,4 @@ Then start your applications.
173
173
 
174
174
  ## Acknowledgement
175
175
 
176
- This program is forked from [embulk-input-ftp](https://github.com/embulk/embulk-input-ftp) and originally written by @frsyuki, modified by @sakama.
176
+ This program is forked from [embulk-input-ftp](https://github.com/embulk/embulk-input-ftp) and originally written by @frsyuki, modified by @sakama.
data/build.gradle CHANGED
@@ -14,7 +14,7 @@ configurations {
14
14
  provided
15
15
  }
16
16
 
17
- version = "0.1.3"
17
+ version = "0.1.4"
18
18
 
19
19
  sourceCompatibility = 1.7
20
20
  targetCompatibility = 1.7
@@ -68,7 +68,7 @@ Gem::Specification.new do |spec|
68
68
  spec.description = %[Store files using FTP.]
69
69
  spec.email = ["satoshiakama@gmail.com"]
70
70
  spec.licenses = ["Apache 2.0"]
71
- spec.homepage = "https://github.com/sakama/embulk-output-ftp"
71
+ spec.homepage = "https://github.com/embulk/embulk-output-ftp"
72
72
 
73
73
  spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
74
74
  spec.test_files = spec.files.grep(%r"^(test|spec)/")
@@ -32,10 +32,8 @@ import java.io.BufferedInputStream;
32
32
  import java.io.BufferedOutputStream;
33
33
  import java.io.File;
34
34
  import java.io.FileInputStream;
35
- import java.io.FileNotFoundException;
36
35
  import java.io.FileOutputStream;
37
36
  import java.io.IOException;
38
- import java.net.URISyntaxException;
39
37
  import java.nio.file.Path;
40
38
  import java.nio.file.Paths;
41
39
  import java.util.List;
@@ -48,7 +46,7 @@ public class FtpFileOutputPlugin implements FileOutputPlugin
48
46
  String getHost();
49
47
 
50
48
  @Config("port")
51
- @ConfigDefault("21")
49
+ @ConfigDefault("null")
52
50
  Optional<Integer> getPort();
53
51
  void setPort(Optional<Integer> port);
54
52
 
@@ -95,6 +93,9 @@ public class FtpFileOutputPlugin implements FileOutputPlugin
95
93
  }
96
94
 
97
95
  private static final Logger log = Exec.getLogger(FtpFileOutputPlugin.class);
96
+ private static final Integer FTP_DEFULAT_PORT = 21;
97
+ private static final Integer FTPS_DEFAULT_PORT = 990;
98
+ private static final Integer FTPES_DEFAULT_PORT = 21;
98
99
  private static final long TRANSFER_NOTICE_BYTES = 100 * 1024 * 1024;
99
100
 
100
101
  @Override
@@ -315,19 +316,26 @@ public class FtpFileOutputPlugin implements FileOutputPlugin
315
316
  private static FTPClient newFTPClient(Logger log, PluginTask task)
316
317
  {
317
318
  FTPClient client = new FTPClient();
319
+ Integer defaultPort = FTP_DEFULAT_PORT;
318
320
  try {
319
321
  if (task.getSsl()) {
320
322
  client.setSSLSocketFactory(SSLPlugins.newSSLSocketFactory(task.getSSLConfig(), task.getHost()));
321
323
  if (task.getSslExplicit()) {
322
324
  client.setSecurity(FTPClient.SECURITY_FTPES);
325
+ defaultPort = FTPES_DEFAULT_PORT;
323
326
  log.info("Using FTPES(FTPS/explicit) mode");
324
327
  }
325
328
  else {
326
329
  client.setSecurity(FTPClient.SECURITY_FTPS);
330
+ defaultPort = FTPS_DEFAULT_PORT;
327
331
  log.info("Using FTPS(FTPS/implicit) mode");
328
332
  }
329
333
  }
330
334
 
335
+ if (!task.getPort().isPresent()) {
336
+ task.setPort(Optional.of(defaultPort));
337
+ }
338
+
331
339
  client.addCommunicationListener(new LoggingCommunicationListner(log));
332
340
 
333
341
  // TODO configurable timeout parameters
@@ -345,9 +353,13 @@ public class FtpFileOutputPlugin implements FileOutputPlugin
345
353
  //client.setDataTimeout
346
354
  //client.setAutodetectUTF8
347
355
 
348
- log.info("Connecting to {}", task.getHost());
349
356
  if (task.getPort().isPresent()) {
350
357
  client.connect(task.getHost(), task.getPort().get());
358
+ log.info("Connecting to {}:{}", task.getHost(), task.getPort().get());
359
+ }
360
+ else {
361
+ client.connect(task.getHost());
362
+ log.info("Connecting to {}", task.getHost());
351
363
  }
352
364
 
353
365
  if (task.getUser().isPresent()) {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-ftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Akama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -69,9 +69,9 @@ files:
69
69
  - src/test/resources/sample_02.csv
70
70
  - classpath/bcpkix-jdk15on-1.52.jar
71
71
  - classpath/bcprov-jdk15on-1.52.jar
72
- - classpath/embulk-output-ftp-0.1.3.jar
72
+ - classpath/embulk-output-ftp-0.1.4.jar
73
73
  - classpath/ftp4j-1.7.2.jar
74
- homepage: https://github.com/sakama/embulk-output-ftp
74
+ homepage: https://github.com/embulk/embulk-output-ftp
75
75
  licenses:
76
76
  - Apache 2.0
77
77
  metadata: {}