-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now FlowFile have parent values. Fixed SourceFile (for real).
- Loading branch information
Showing
4 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package com.yelloowstone.nf2t.cli; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.UUID; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public class SourceFile { | ||
@JsonProperty("parent") | ||
private final SourceFile parent; | ||
|
||
@JsonProperty("absolutePath") | ||
private final String absolutePath; | ||
|
||
@JsonProperty("filename") | ||
private final String filename; | ||
|
||
@JsonProperty("size") | ||
private final long size; | ||
|
||
@JsonProperty("uuid") | ||
private final UUID uuid; | ||
@JsonCreator | ||
public SourceFile(@JsonProperty("parent") SourceFile parent, @JsonProperty("absolutePath") String absolutePath, @JsonProperty("filename") String filename, @JsonProperty("size") long size, @JsonProperty("uuid") UUID uuid) { | ||
this.parent = parent; | ||
this.absolutePath = absolutePath; | ||
this.filename = filename; | ||
this.size = size; | ||
this.uuid = uuid; | ||
} | ||
|
||
public SourceFile(SourceFile parent, String absolutePath, String filename, long size) { | ||
this(parent, absolutePath, filename, size, UUID.randomUUID()); | ||
} | ||
|
||
/** | ||
* @see org.apache.nifi.flowfile.attributes.CoreAttributes#ABSOLUTE_PATH | ||
* | ||
* @return | ||
*/ | ||
public String getAbsolutePath() { | ||
return absolutePath; | ||
} | ||
|
||
/** | ||
* @see org.apache.nifi.flowfile.attributes.CoreAttributes#FILENAME | ||
* | ||
* @return | ||
*/ | ||
public String getFilename() { | ||
return filename; | ||
} | ||
|
||
public long getSize() { | ||
return size; | ||
} | ||
|
||
/** | ||
* @see org.apache.nifi.flowfile.attributes.CoreAttributes#UUID | ||
* | ||
* @return | ||
*/ | ||
public UUID getUuid() { | ||
return uuid; | ||
} | ||
|
||
|
||
public static SourceFile fromPath(SourceFile parent, Path inputPath) { | ||
final String absolutePath = inputPath.toAbsolutePath().toString(); | ||
final String filename = inputPath.getFileName().toString(); | ||
long size = -1; | ||
|
||
try { | ||
size = Files.size(inputPath); | ||
} catch (IOException e) { | ||
|
||
} | ||
|
||
return new SourceFile(parent, absolutePath, filename, size); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
mvn versions:set -DnewVersion=0.0.6-SNAPSHOT | ||
mvn versions:set -DnewVersion=0.0.6 | ||
mvn versions:commit |