embulk-input-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: 0acbad097efd3f667a4ca8dafedb204826b513f2
4
- data.tar.gz: b225f6ee1a38a587566717bdfc59ab24198afb43
3
+ metadata.gz: 14c9dbe5aaed1c2ff8e3e48ac58aa331a6b59370
4
+ data.tar.gz: 390c47334bce6509c343229f1ac43625b05923e3
5
5
  SHA512:
6
- metadata.gz: 3b7e32fdaeb95bafb8205338e5d40e37325ca4a8846392670260a96f860fef33a2b879ef52d83722ec7a03991a05b78e5adc2b0e9b3bc3f0dddf8b1fdb61116b
7
- data.tar.gz: 621c453bce9718b49bd7970a31cfba66391fb3e85755a6ca921a3f02697b212518ed211c6cef085d155b69fbbd2ce2e445da9e8cf15f8fd68d691fc225d1974c
6
+ metadata.gz: 632782394767ea3b3fccb39ac1b2cfed6904b360c159a339a81e047edc348301584b07e5d40267a124e0b20b1259149c192aa758c15a6073906c97f7947b5021
7
+ data.tar.gz: e8e221d03695924300cea6ae91fe70ed77b82a7f0760f0ce90208cda887842e1e0aa853bf660ab7a021edef68e81395dcfd029a4785a29c100af68130712a2da
@@ -0,0 +1,5 @@
1
+ language: java
2
+ jdk:
3
+ - oraclejdk8
4
+ script:
5
+ - ./gradlew --info check jacocoTestReport
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Release 0.1.4 - 2016-11-16
2
+
3
+ * Added support for FTPES(FTPS explicit)
4
+ * Added support for incremental option
1
5
 
2
6
  Release 0.1.3 - 2015-08-18
3
7
 
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Overview
4
4
 
5
+ This plugin support **FTP**, **FTPES(FTPS explicit)**, **FTPS(FTPS implicit)** and doesn't support **SFTP**.
6
+
7
+ If you want to use SFTP, please use [embulk-input-sftp](https://github.com/embulk/embulk-input-sftp).
8
+
9
+
5
10
  * **Plugin type**: file input
6
11
  * **Resume supported**: yes
7
12
  * **Cleanup supported**: yes
@@ -9,18 +14,34 @@
9
14
  ## Configuration
10
15
 
11
16
  - **host**: FTP server address (string, required)
12
- - **port**: FTP server port number (integer, default: `21`. `990` if `ssl` is true)
17
+ - **port**: FTP server port number (integer, default: `21`. `990` if `ssl` is true and `ssl_explicit` is false)
13
18
  - **user**: user name to login (string, optional)
14
19
  - **password**: password to login (string, default: `""`)
15
20
  - **path_prefix** prefix of target files (string, required)
21
+ - **incremental** enables incremental loading(boolean, optional. default: true. If incremental loading is enabled, config diff for the next execution will include last_path parameter so that next execution skips files before the path. Otherwise, last_path will not be included.
16
22
  - **passive_mode**: use passive mode (boolean, default: true)
17
23
  - **ascii_mode**: use ASCII mode instead of binary mode (boolean, default: false)
18
24
  - **ssl**: use FTPS (SSL encryption). (boolean, default: false)
25
+ - **ssl_explicit** use FTPS(explicit) instead of FTPS(implicit). (boolean, default:true)
19
26
  - **ssl_verify**: verify the certification provided by the server. By default, connection fails if the server certification is not signed by one the CAs in JVM's default trusted CA list. (boolean, default: true)
20
27
  - **ssl_verify_hostname**: verify server's hostname matches with provided certificate. (boolean, default: true)
21
28
  - **ssl_trusted_ca_cert_file**: if the server certification is not signed by a certificate authority, set path to the X.508 certification file (pem file) of a private CA (string, optional)
22
29
  - **ssl_trusted_ca_cert_data**: similar to `ssl_trusted_ca_cert_file` but embed the contents of the PEM file as a string value instead of path to a local file (string, optional)
23
30
 
31
+ ### FTP / FTPS default port number
32
+
33
+ FTP and FTPS server usually listens following port number(TCP) as default.
34
+
35
+ Please be sure to configure firewall rules.
36
+
37
+ | | FTP | FTPS(explicit) = FTPES | FTPS(implicit) = FTPS |
38
+ |:------------------------|----:|-----------------------:|----------------------:|
39
+ | Control channel port | 21 | 21 | 990 (\*1) |
40
+ | Data channel port (\*2) | 20 | 20 | 989 |
41
+
42
+ 1. If you're using both of FTPS(implicit) and FTP, server may also listen 21/TCP for unecnrypted FTP.
43
+ 2. If you're using `passive mode`, data channel port can be taken between 1024 and 65535.
44
+
24
45
  ## Example
25
46
 
26
47
  Simple FTP:
@@ -2,6 +2,7 @@ plugins {
2
2
  id "com.jfrog.bintray" version "1.1"
3
3
  id "com.github.jruby-gradle.base" version "0.1.5"
4
4
  id "java"
5
+ id "jacoco"
5
6
  }
6
7
  import com.github.jrubygradle.JRubyExec
7
8
  repositories {
@@ -12,7 +13,7 @@ configurations {
12
13
  provided
13
14
  }
14
15
 
15
- version = "0.1.3"
16
+ version = "0.1.4"
16
17
 
17
18
  dependencies {
18
19
  compile "org.embulk:embulk-core:0.7.0"
@@ -51,6 +51,9 @@ public class FtpFileInputPlugin
51
51
  implements FileInputPlugin
52
52
  {
53
53
  private final Logger log = Exec.getLogger(FtpFileInputPlugin.class);
54
+ private static final int FTP_DEFULAT_PORT = 21;
55
+ private static final int FTPS_DEFAULT_PORT = 990;
56
+ private static final int FTPES_DEFAULT_PORT = 21;
54
57
 
55
58
  public interface PluginTask
56
59
  extends Task, SSLPlugins.SSLPluginTask
@@ -62,6 +65,10 @@ public class FtpFileInputPlugin
62
65
  @ConfigDefault("null")
63
66
  public Optional<String> getLastPath();
64
67
 
68
+ @Config("incremental")
69
+ @ConfigDefault("true")
70
+ public boolean getIncremental();
71
+
65
72
  @Config("host")
66
73
  public String getHost();
67
74
 
@@ -89,6 +96,10 @@ public class FtpFileInputPlugin
89
96
  @ConfigDefault("false")
90
97
  public boolean getSsl();
91
98
 
99
+ @Config("ssl_explicit")
100
+ @ConfigDefault("true")
101
+ public boolean getSslExplicit();
102
+
92
103
  public List<String> getFiles();
93
104
  public void setFiles(List<String> files);
94
105
 
@@ -130,15 +141,17 @@ public class FtpFileInputPlugin
130
141
  ConfigDiff configDiff = Exec.newConfigDiff();
131
142
 
132
143
  // last_path
133
- if (task.getFiles().isEmpty()) {
134
- // keep the last value
135
- if (task.getLastPath().isPresent()) {
136
- configDiff.set("last_path", task.getLastPath().get());
144
+ if (task.getIncremental()) {
145
+ if (task.getFiles().isEmpty()) {
146
+ // keep the last value
147
+ if (task.getLastPath().isPresent()) {
148
+ configDiff.set("last_path", task.getLastPath().get());
149
+ }
150
+ } else {
151
+ List<String> files = new ArrayList<String>(task.getFiles());
152
+ Collections.sort(files);
153
+ configDiff.set("last_path", files.get(files.size() - 1));
137
154
  }
138
- } else {
139
- List<String> files = new ArrayList<String>(task.getFiles());
140
- Collections.sort(files);
141
- configDiff.set("last_path", files.get(files.size() - 1));
142
155
  }
143
156
 
144
157
  return configDiff;
@@ -156,10 +169,21 @@ public class FtpFileInputPlugin
156
169
  {
157
170
  FTPClient client = new FTPClient();
158
171
  try {
172
+ int defaultPort = FTP_DEFULAT_PORT;
159
173
  if (task.getSsl()) {
160
174
  client.setSSLSocketFactory(SSLPlugins.newSSLSocketFactory(task.getSSLConfig(), task.getHost()));
161
- client.setSecurity(FTPClient.SECURITY_FTPS);
175
+ if (task.getSslExplicit()) {
176
+ client.setSecurity(FTPClient.SECURITY_FTPES);
177
+ defaultPort = FTPES_DEFAULT_PORT;
178
+ log.info("Using FTPES(FTPS/explicit) mode");
179
+ }
180
+ else {
181
+ client.setSecurity(FTPClient.SECURITY_FTPS);
182
+ defaultPort = FTPS_DEFAULT_PORT;
183
+ log.info("Using FTPS(FTPS/implicit) mode");
184
+ }
162
185
  }
186
+ int port = task.getPort().isPresent()? task.getPort().get() : defaultPort;
163
187
 
164
188
  client.addCommunicationListener(new LoggingCommunicationListner(log));
165
189
 
@@ -178,10 +202,8 @@ public class FtpFileInputPlugin
178
202
  //client.setDataTimeout
179
203
  //client.setAutodetectUTF8
180
204
 
181
- log.info("Connecting to "+task.getHost());
182
- if (task.getPort().isPresent()) {
183
- client.connect(task.getHost(), task.getPort().get());
184
- }
205
+ client.connect(task.getHost(), port);
206
+ log.info("Connecting to {}:{}",task.getHost(),port);
185
207
 
186
208
  if (task.getUser().isPresent()) {
187
209
  log.info("Logging in with user "+task.getUser().get());
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-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
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
11
+ date: 2016-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - ~>
23
17
  - !ruby/object:Gem::Version
24
18
  version: '1.0'
19
+ name: bundler
25
20
  prerelease: false
26
21
  type: :development
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - '>='
24
+ - - ~>
32
25
  - !ruby/object:Gem::Version
33
- version: '10.0'
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
30
  - - '>='
37
31
  - !ruby/object:Gem::Version
38
32
  version: '10.0'
33
+ name: rake
39
34
  prerelease: false
40
35
  type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
41
  description: Reads files stored on a FTP server.
42
42
  email:
43
43
  - frsyuki@gmail.com
@@ -46,6 +46,7 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - .gitignore
49
+ - .travis.yml
49
50
  - ChangeLog
50
51
  - README.md
51
52
  - build.gradle
@@ -62,7 +63,7 @@ files:
62
63
  - src/test/java/org/embulk/input/TestFtpFileInputPlugin.java
63
64
  - classpath/bcpkix-jdk15on-1.52.jar
64
65
  - classpath/bcprov-jdk15on-1.52.jar
65
- - classpath/embulk-input-ftp-0.1.3.jar
66
+ - classpath/embulk-input-ftp-0.1.4.jar
66
67
  - classpath/ftp4j-1.7.2.jar
67
68
  homepage: https://github.com/embulk/embulk-input-ftp
68
69
  licenses: