embulk-input-sftp 0.2.6 → 0.2.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b8b4aab224c69ba312142fbe2670aa8c54d7554
|
4
|
+
data.tar.gz: 1273126ed13973cd72c0ddf60d6eb1bcfe010344
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 155d7ce767e29ef9dbba5fd310d9b8e08d2e9f3441989f1099c8cf26aaec078ba2a36bede8a489c28e7d0313c4dc38efa921c9f955488a29f3d659c7206cf9e9
|
7
|
+
data.tar.gz: bb1a68a8c84189a69d01f17f2b3f6e812eff60abd66a3781e063065ebda7a8aa28d414612347284fae1f66fb25c94c9828aca349c6f2dde31e245857033feacd
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 0.2.7 - 2018-03-02
|
2
|
+
* [maintenance] Fix SFTP connection remaining problem [#27](https://github.com/sakama/embulk-input-sftp/pull/27)
|
3
|
+
|
1
4
|
## 0.2.6 - 2018-01-15
|
2
5
|
- [maintenance] Upgrade "commons-vfs2", "com.jcraft:jsch" and "commons-io:commons-io"
|
3
6
|
- https://github.com/embulk/embulk-input-sftp/pull/25
|
data/build.gradle
CHANGED
@@ -56,6 +56,7 @@ public class SftpFileInput
|
|
56
56
|
@Override
|
57
57
|
public void close()
|
58
58
|
{
|
59
|
+
super.close();
|
59
60
|
}
|
60
61
|
|
61
62
|
private static StandardFileSystemManager initializeStandardFileSystemManager()
|
@@ -189,43 +190,49 @@ public class SftpFileInput
|
|
189
190
|
{
|
190
191
|
String lastKey = null;
|
191
192
|
log.info("Getting to download file list");
|
192
|
-
StandardFileSystemManager manager =
|
193
|
-
|
193
|
+
StandardFileSystemManager manager = null;
|
194
|
+
try {
|
195
|
+
manager = initializeStandardFileSystemManager();
|
196
|
+
FileSystemOptions fsOptions = initializeFsOptions(task);
|
194
197
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
+
if (task.getLastPath().isPresent() && !task.getLastPath().get().isEmpty()) {
|
199
|
+
lastKey = manager.resolveFile(getSftpFileUri(task, task.getLastPath().get()), fsOptions).toString();
|
200
|
+
}
|
198
201
|
|
199
|
-
|
202
|
+
FileObject files = manager.resolveFile(getSftpFileUri(task, task.getPathPrefix()), fsOptions);
|
200
203
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
204
|
+
if (files.isFolder()) {
|
205
|
+
//path_prefix is a folder, we add everything in that folder
|
206
|
+
FileObject[] children = files.getChildren();
|
207
|
+
Arrays.sort(children);
|
208
|
+
for (FileObject f : children) {
|
209
|
+
if (f.isFile()) {
|
210
|
+
addFileToList(builder, f.toString(), f.getContent().getSize(), "", lastKey);
|
211
|
+
}
|
212
|
+
}
|
213
|
+
} else if (files.isFile()) {
|
214
|
+
//path_prefix is a file then we just need to add that file
|
215
|
+
addFileToList(builder, files.toString(), files.getContent().getSize(), "", lastKey);
|
216
|
+
} else {
|
217
|
+
// path_prefix is neither file or folder, then we scan the parent folder to file path
|
218
|
+
// that match the path_prefix basename
|
219
|
+
FileObject parent = files.getParent();
|
220
|
+
FileObject[] children = parent.getChildren();
|
221
|
+
Arrays.sort(children);
|
222
|
+
String fileName = FilenameUtils.getName(task.getPathPrefix());
|
223
|
+
for (FileObject f : children) {
|
224
|
+
if (f.isFile()) {
|
225
|
+
addFileToList(builder, f.toString(), f.getContent().getSize(), fileName, lastKey);
|
226
|
+
}
|
208
227
|
}
|
209
228
|
}
|
229
|
+
return builder.build();
|
210
230
|
}
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
}
|
215
|
-
else {
|
216
|
-
// path_prefix is neither file or folder, then we scan the parent folder to file path
|
217
|
-
// that match the path_prefix basename
|
218
|
-
FileObject parent = files.getParent();
|
219
|
-
FileObject[] children = parent.getChildren();
|
220
|
-
Arrays.sort(children);
|
221
|
-
String fileName = FilenameUtils.getName(task.getPathPrefix());
|
222
|
-
for (FileObject f : children) {
|
223
|
-
if (f.isFile()) {
|
224
|
-
addFileToList(builder, f.toString(), f.getContent().getSize(), fileName, lastKey);
|
225
|
-
}
|
231
|
+
finally {
|
232
|
+
if (manager != null) {
|
233
|
+
manager.close();
|
226
234
|
}
|
227
235
|
}
|
228
|
-
return builder.build();
|
229
236
|
}
|
230
237
|
|
231
238
|
@Override
|
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.
|
4
|
+
version: 0.2.7
|
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-01
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,7 +72,7 @@ files:
|
|
72
72
|
- classpath/commons-io-2.6.jar
|
73
73
|
- classpath/commons-logging-1.2.jar
|
74
74
|
- classpath/commons-vfs2-2.2.jar
|
75
|
-
- classpath/embulk-input-sftp-0.2.
|
75
|
+
- classpath/embulk-input-sftp-0.2.7.jar
|
76
76
|
- classpath/jsch-0.1.54.jar
|
77
77
|
homepage: https://github.com/embulk/embulk-input-sftp
|
78
78
|
licenses:
|