Package org.forgerock.audit.retention
Class TimeStampFileNamingPolicy
java.lang.Object
org.forgerock.audit.retention.TimeStampFileNamingPolicy
- All Implemented Interfaces:
FileNamingPolicy
Creates a time stamp based file naming policy. Rotated files are renamed with a given prefix and a timestamp suffix.
-
Constructor Summary
ConstructorDescriptionTimeStampFileNamingPolicy
(File initialFile, String timeStampFormat, String prefix) Constructs a TimeStampFileNaming policy with a given initial file, a timestamp format, and a prefix string. -
Method Summary
Modifier and TypeMethodDescriptionGets the initial file.Gets the next name for thisFileNamingPolicy
.List the files in the initial file directory that match the prefix, name and suffix format.
-
Constructor Details
-
TimeStampFileNamingPolicy
Constructs a TimeStampFileNaming policy with a given initial file, a timestamp format, and a prefix string.- Parameters:
initialFile
- The initial file that will be archived.timeStampFormat
- The timestamp format to append to the archived files. Should be a format that is understood byDateTimeFormatter
.prefix
- The prefix to prefix to the archived files.
-
-
Method Details
-
getInitialName
Gets the initial file.- Specified by:
getInitialName
in interfaceFileNamingPolicy
- Returns:
- The initial file.
-
getNextName
Gets the next name for thisFileNamingPolicy
. The next name will be formatted with prefix first, then the initial filename and finally the timestamp will be appended.- Specified by:
getNextName
in interfaceFileNamingPolicy
- Returns:
- The next archived file according to this
FileNamingPolicy
.
-
listFiles
List the files in the initial file directory that match the prefix, name and suffix format. Lists all the archived files, from oldest to newest.- Specified by:
listFiles
in interfaceFileNamingPolicy
- Returns:
- Not-null, All the archived files.
-