You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Bryan Bende (Jira)" <ji...@apache.org> on 2020/06/17 15:23:00 UTC

[jira] [Created] (NIFI-7546) Allow setting of Last Modified Time from PutHDFS

Bryan Bende created NIFI-7546:
---------------------------------

             Summary: Allow setting of Last Modified Time from PutHDFS
                 Key: NIFI-7546
                 URL: https://issues.apache.org/jira/browse/NIFI-7546
             Project: Apache NiFi
          Issue Type: Improvement
            Reporter: Bryan Bende


In PutFile we have a property like:
{code:java}
public static final PropertyDescriptor CHANGE_LAST_MODIFIED_TIME = new PropertyDescriptor.Builder()
        .name("Last Modified Time")
        .description("Sets the lastModifiedTime on the output file to the value of this attribute.  Format must be yyyy-MM-dd'T'HH:mm:ssZ.  "
                + "You may also use expression language such as ${file.lastModifiedTime}.")
        .required(false)
        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
        .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
        .build(); {code}
And the code will use this and call
{code:java}
setLastModified(fileModifyTime.getTime()); {code}
It looks like the HDFS FileSystem has a call to set the modified time, so we should support this option.
{code:java}
/**
 * Set access time of a file.
 * @param p The path
 * @param mtime Set the modification time of this file.
 *              The number of milliseconds since Jan 1, 1970.
 *              A value of -1 means that this call should not set modification time.
 * @param atime Set the access time of this file.
 *              The number of milliseconds since Jan 1, 1970.
 *              A value of -1 means that this call should not set access time.
 * @throws IOException IO failure
 */
public void setTimes(Path p, long mtime, long atime
    ) throws IOException {
} {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)