Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
embulk-input-filename
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Klaus Wölfel
embulk-input-filename
Commits
298d94fc
Commit
298d94fc
authored
Dec 14, 2017
by
Eteri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
embulk-input-filename: get last_change_time from last_path if not defined. Use long.
parent
26fb4ecf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
src/main/java/org/embulk/input/filename/FilenameFileInputPlugin.java
...va/org/embulk/input/filename/FilenameFileInputPlugin.java
+19
-6
No files found.
src/main/java/org/embulk/input/filename/FilenameFileInputPlugin.java
View file @
298d94fc
...
...
@@ -145,7 +145,7 @@ public class FilenameFileInputPlugin implements FileInputPlugin
@Config
(
"last_modified"
)
@ConfigDefault
(
"null"
)
Optional
<
Stri
ng
>
getLastModified
();
Optional
<
Lo
ng
>
getLastModified
();
List
<
String
>
getFiles
();
...
...
@@ -311,7 +311,20 @@ public class FilenameFileInputPlugin implements FileInputPlugin
final
Integer
fileSize
=
task
.
getFileSize
().
orNull
();
final
String
fileNameSuffix
=
task
.
getFileNameSuffix
().
orNull
();
final
String
lastModified
=
task
.
getLastModified
().
orNull
();
final
Long
lastModified
;
if
(
task
.
getLastModified
().
orNull
()
!=
null
)
{
lastModified
=
task
.
getLastModified
().
orNull
();
}
else
if
(
lastPath
!=
null
)
{
FileTime
lastPathTime
;
try
{
lastPathTime
=
(
FileTime
)
Files
.
getAttribute
(
Paths
.
get
(
lastPath
),
"unix:ctime"
);
lastModified
=
lastPathTime
.
toMillis
();
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
String
.
format
(
"Cannot get the last changed time of lastpath '%s'"
,
lastPath
),
e
);
}
}
else
{
lastModified
=
null
;
}
final
boolean
useLastModified
=
task
.
getUseLastModified
();
/* final Path yyy = Paths.get("/mic/L0444-001/syscom/syscom004-14360007/events/2017/12/04/17338004.XMR");
...
...
@@ -346,7 +359,7 @@ public class FilenameFileInputPlugin implements FileInputPlugin
return
FileVisitResult
.
CONTINUE
;
}
else
if
(
firstPath
!=
null
&&
path
.
toString
().
compareTo
(
firstPath
.
substring
(
0
,
path
.
toString
().
length
()))
<
0
)
{
return
FileVisitResult
.
SKIP_SUBTREE
;
}
else
if
(
lastModified
!=
null
&&
Long
.
parseLong
(
lastModified
)
>
fileChangeTime
)
{
//if file is older then lastModified
}
else
if
(
lastModified
!=
null
&&
lastModified
>
fileChangeTime
)
{
//if file is older then lastModified
return
FileVisitResult
.
SKIP_SUBTREE
;
}
else
if
(
path
.
getFileName
().
toString
().
startsWith
(
"."
))
{
return
FileVisitResult
.
SKIP_SUBTREE
;
...
...
@@ -410,9 +423,9 @@ public class FilenameFileInputPlugin implements FileInputPlugin
// log.info ("file = {}", path);
// log.info("last_Modified = {}, files time = {}", lastModified, fileChangeTime);
if
(
lastModified
!=
null
&&
Long
.
parseLong
(
lastModified
)
>
fileChangeTime
)
{
if
(
lastModified
!=
null
&&
lastModified
>
fileChangeTime
)
{
return
FileVisitResult
.
CONTINUE
;
}
else
if
(
lastModified
!=
null
&&
Long
.
parseLong
(
lastModified
)
==
fileChangeTime
&&
lastPath
!=
null
&&
path
.
toString
().
compareTo
(
lastPath
)
<=
0
)
{
}
else
if
(
lastModified
!=
null
&&
lastModified
==
fileChangeTime
&&
lastPath
!=
null
&&
path
.
toString
().
compareTo
(
lastPath
)
<=
0
)
{
return
FileVisitResult
.
CONTINUE
;
}
else
if
(
path
.
getFileName
().
toString
().
startsWith
(
"."
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment