-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NIFI-12709 Added ability to get more attributes for zip files as well as created new attributes to get for both tar and zip files. #9122
Conversation
… as created new attributes to get for both tar and zip files.
…ion time of an encrypted zip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the improvements @dan-s1. The changes look straightforward in general, I just noted one recommendation to make the code a bit clearer.
One additional note, it looks like it should be possible to update the unit test to check for additional attributes, such as file.size
, and some of the TAR attributes.
...ifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
Outdated
Show resolved
Hide resolved
…s and added more testing to ensure the presence of added attributes.
…ing tar file times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates @dan-s1. This looks closer to completion. In the course of closer review, it seems worth reconsidering the introduction of the new record
for metadata. Instead of creating a new object for every entry, what do you think about creating separate methods for creating the new Map
of attributes? Common properties could be passed as arguments, and then the standard ZipEntry
could set additional values, like file mode and access time, avoiding the intermediate object creation for every entry.
...ifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
Outdated
Show resolved
Hide resolved
… methods to add zip entry attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the adjustments @dan-s1, the latest version looks good. +1 merging
@exceptionfactory Thanks for accepting this PR and merging. I just wanted to note I was careful to make sure to instantiate one java.util.Map for creating attributes for both tar and zip entries to be mindful of the issue brought up in NIFI-13288 |
Thanks, I noted that when reviewing the implementation, that's helpful. |
Summary
Three attributes
file.lastMetadataChange
,file.lastAccessTime
andfile.size
have been added and other values for existing attributes have been made available (file.creationTime
andfile.permissions
) . Below is a chart of all attributes the UnpackContent processor now has and the ones in bold are the ones which have been added. For tar files thefile.creationTime
before this PR used thefile.lastModifiedTime
but now if the actualfile.creationTime
is available it is used and only defaults to using thefile.lastModifiedTime
if thefile.creationTime
is not available (this same logic is now employed for unencrypted zip files). For enrypted zip files the value forfile.lastModifiedTime
is used for the attributefile.lastModifiedTime
andfile.creationTime
.Currently Zip4j the implementation used for encrypted zip files does not have access methods for
file.permissions
file.creationTime
andfile.lastAccessTime
. A request has been made to add these.NIFI-12709
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000
NIFI-00000
Pull Request Formatting
main
branchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-check
Licensing
LICENSE
andNOTICE
filesDocumentation