Future renamedRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { String parentsRawFile = getParentsRawFileProperty(); String tmpTarget = parentsRawFile + System.nanoTime() + ".tmp"; renameUtil.rename(parentsRawFile, tmpTarget); return asyncCompress(tmpTarget, nameOfCompressedFile, innerEntryName); }
/** * * The active log file is determined by the value of the parent's filename * option. However, in case the file name is left blank, then, the active log * file equals the file name for the current period as computed by the * <b>FileNamePattern</b> option. * * <p>The RollingPolicy must know whether it is responsible for changing the * name of the active file or not. If the active file name is set by the user * via the configuration file, then the RollingPolicy must let it like it is. * If the user does not specify an active file name, then the RollingPolicy * generates one. * * <p> To be sure that the file name used by the parent class has been * generated by the RollingPolicy and not specified by the user, we keep track * of the last generated name object and compare its reference to the parent * file name. If they match, then the RollingPolicy knows it's responsible for * the change of the file name. * */ public String getActiveFileName() { String parentsRawFileProperty = getParentsRawFileProperty(); if (parentsRawFileProperty != null) { return parentsRawFileProperty; } else { return timeBasedFileNamingAndTriggeringPolicy .getCurrentPeriodsFileNameWithoutCompressionSuffix(); } }
void computeCurrentPeriodsHighestCounterValue(final String stemRegex) { File file = new File(getCurrentPeriodsFileNameWithoutCompressionSuffix()); File parentDir = file.getParentFile(); File[] matchingFileArray = FileFilterUtil .filesInFolderMatchingStemRegex(parentDir, stemRegex); if (matchingFileArray == null || matchingFileArray.length == 0) { currentPeriodsCounter = 0; return; } currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex); // if parent raw file property is not null, then the next // counter is max found counter+1 if (tbrp.getParentsRawFileProperty() != null || (tbrp.compressionMode != CompressionMode.NONE)) { // TODO test me currentPeriodsCounter++; } }
public void rollover() throws RolloverFailure { // when rollover is called the elapsed period's file has // been already closed. This is a working assumption of this method. String elapsedPeriodsFileName = timeBasedFileNamingAndTriggeringPolicy .getElapsedPeriodsFileName(); String elapsedPeriodStem = FileFilterUtil.afterLastSlash(elapsedPeriodsFileName); if (compressionMode == CompressionMode.NONE) { if (getParentsRawFileProperty() != null) { renameUtil.rename(getParentsRawFileProperty(), elapsedPeriodsFileName); } // else { nothing to do if CompressionMode == NONE and parentsRawFileProperty == null } } else { if (getParentsRawFileProperty() == null) { future = asyncCompress(elapsedPeriodsFileName, elapsedPeriodsFileName, elapsedPeriodStem); } else { future = renamedRawAndAsyncCompress(elapsedPeriodsFileName, elapsedPeriodStem); } } if (archiveRemover != null) { archiveRemover.clean(new Date(timeBasedFileNamingAndTriggeringPolicy.getCurrentTime())); } }
public void start() { DateTokenConverter dtc = tbrp.fileNamePattern.getPrimaryDateTokenConverter(); if (dtc == null) { throw new IllegalStateException("FileNamePattern [" + tbrp.fileNamePattern.getPattern() + "] does not contain a valid DateToken"); } rc = new RollingCalendar(); rc.init(dtc.getDatePattern()); addInfo("The date pattern is '" + dtc.getDatePattern() + "' from file name pattern '" + tbrp.fileNamePattern.getPattern() + "'."); rc.printPeriodicity(this); setDateInCurrentPeriod(new Date(getCurrentTime())); if (tbrp.getParentsRawFileProperty() != null) { File currentFile = new File(tbrp.getParentsRawFileProperty()); if (currentFile.exists() && currentFile.canRead()) { setDateInCurrentPeriod(new Date(currentFile.lastModified())); } } addInfo("Setting initial period to " + dateInCurrentPeriod); computeNextCheck(); }
Future<?> renameRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { String parentsRawFile = getParentsRawFileProperty(); String tmpTarget = nameOfCompressedFile + System.nanoTime() + ".tmp"; renameUtil.rename(parentsRawFile, tmpTarget); return compressor.asyncCompress(tmpTarget, nameOfCompressedFile, innerEntryName); }
Future<?> renameRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { String parentsRawFile = getParentsRawFileProperty(); String tmpTarget = nameOfCompressedFile + System.nanoTime() + ".tmp"; renameUtil.rename(parentsRawFile, tmpTarget); return compressor.asyncCompress(tmpTarget, nameOfCompressedFile, innerEntryName); }
Future renamedRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { String parentsRawFile = getParentsRawFileProperty(); String tmpTarget = parentsRawFile + System.nanoTime() + ".tmp"; renameUtil.rename(parentsRawFile, tmpTarget); return asyncCompress(tmpTarget, nameOfCompressedFile, innerEntryName); }
Future renamedRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { String parentsRawFile = getParentsRawFileProperty(); String tmpTarget = parentsRawFile + System.nanoTime() + ".tmp"; renameUtil.rename(parentsRawFile, tmpTarget); return asyncCompress(tmpTarget, nameOfCompressedFile, innerEntryName); }
Future<?> renameRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { String parentsRawFile = getParentsRawFileProperty(); String tmpTarget = nameOfCompressedFile + System.nanoTime() + ".tmp"; renameUtil.rename(parentsRawFile, tmpTarget); return compressor.asyncCompress(tmpTarget, nameOfCompressedFile, innerEntryName); }
Future renamedRawAndAsyncCompress(String nameOfCompressedFile) throws RolloverFailure { String parentsRawFile = getParentsRawFileProperty(); String tmpTarget = parentsRawFile + System.nanoTime() + ".tmp"; renameUtil.rename(parentsRawFile, tmpTarget); return asyncCompress(tmpTarget, nameOfCompressedFile); }
Future<?> renameRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { String parentsRawFile = getParentsRawFileProperty(); String tmpTarget = nameOfCompressedFile + System.nanoTime() + ".tmp"; renameUtil.rename(parentsRawFile, tmpTarget); return compressor.asyncCompress(tmpTarget, nameOfCompressedFile, innerEntryName); }
Future renamedRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { String parentsRawFile = getParentsRawFileProperty(); String tmpTarget = parentsRawFile + System.nanoTime() + ".tmp"; renameUtil.rename(parentsRawFile, tmpTarget); return asyncCompress(tmpTarget, nameOfCompressedFile, innerEntryName); }
void computeCurrentPeriodsHighestCounterValue(final String stemRegex) { File file = new File(getCurrentPeriodsFileNameWithoutCompressionSuffix()); File parentDir = file.getParentFile(); File[] matchingFileArray = FileFilterUtil.filesInFolderMatchingStemRegex(parentDir, stemRegex); if (matchingFileArray == null || matchingFileArray.length == 0) { currentPeriodsCounter = 0; return; } currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex); // if parent raw file property is not null, then the next // counter is max found counter+1 if (tbrp.getParentsRawFileProperty() != null || (tbrp.compressionMode != CompressionMode.NONE)) { // TODO test me currentPeriodsCounter++; } }
void computeCurrentPeriodsHighestCounterValue(final String stemRegex) { File file = new File(getCurrentPeriodsFileNameWithoutCompressionSuffix()); File parentDir = file.getParentFile(); File[] matchingFileArray = FileFilterUtil .filesInFolderMatchingStemRegex(parentDir, stemRegex); if (matchingFileArray == null || matchingFileArray.length == 0) { currentPeriodsCounter = 0; return; } currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex); // if parent raw file property is not null, then the next // counter is max found counter+1 if (tbrp.getParentsRawFileProperty() != null || (tbrp.compressionMode != CompressionMode.NONE)) { // TODO test me currentPeriodsCounter++; } }
void computeCurrentPeriodsHighestCounterValue(final String stemRegex) { File file = new File(getCurrentPeriodsFileNameWithoutCompressionSuffix()); File parentDir = file.getParentFile(); File[] matchingFileArray = FileFilterUtil.filesInFolderMatchingStemRegex(parentDir, stemRegex); if (matchingFileArray == null || matchingFileArray.length == 0) { currentPeriodsCounter = 0; return; } currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex); // if parent raw file property is not null, then the next // counter is max found counter+1 if (tbrp.getParentsRawFileProperty() != null || (tbrp.compressionMode != CompressionMode.NONE)) { // TODO test me currentPeriodsCounter++; } }
void computeCurrentPeriodsHighestCounterValue(final String stemRegex) { File file = new File(getCurrentPeriodsFileNameWithoutCompressionSuffix()); File parentDir = file.getParentFile(); File[] matchingFileArray = FileFilterUtil .filesInFolderMatchingStemRegex(parentDir, stemRegex); if (matchingFileArray == null || matchingFileArray.length == 0) { currentPeriodsCounter = 0; return; } currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex); // if parent raw file property is not null, then the next // counter is max found counter+1 if (tbrp.getParentsRawFileProperty() != null || (tbrp.compressionMode != CompressionMode.NONE)) { // TODO test me currentPeriodsCounter++; } }
void computeCurrentPeriodsHighestCounterValue(final String stemRegex) { File file = new File(getCurrentPeriodsFileNameWithoutCompressionSuffix()); File parentDir = file.getParentFile(); File[] matchingFileArray = FileFilterUtil .filesInFolderMatchingStemRegex(parentDir, stemRegex); if (matchingFileArray == null || matchingFileArray.length == 0) { currentPeriodsCounter = 0; return; } currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex); // if parent raw file property is not null, then the next // counter is max found counter+1 if (tbrp.getParentsRawFileProperty() != null || (tbrp.compressionMode != CompressionMode.NONE)) { // TODO test me currentPeriodsCounter++; } }
void computeCurrentPeriodsHighestCounterValue(final String stemRegex) { File file = new File(getCurrentPeriodsFileNameWithoutCompressionSuffix()); File parentDir = file.getParentFile(); File[] matchingFileArray = FileFilterUtil .filesInFolderMatchingStemRegex(parentDir, stemRegex); if (matchingFileArray == null || matchingFileArray.length == 0) { currentPeriodsCounter = 0; return; } currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex); // if parent raw file property is not null, then the next // counter is max found counter+1 if (tbrp.getParentsRawFileProperty() != null || (tbrp.compressionMode != CompressionMode.NONE)) { // TODO test me currentPeriodsCounter++; } }
void computeCurrentPeriodsHighestCounterValue(final String stemRegex) { File file = new File(getCurrentPeriodsFileNameWithoutCompressionSuffix()); File parentDir = file.getParentFile(); File[] matchingFileArray = FileFilterUtil.filesInFolderMatchingStemRegex(parentDir, stemRegex); if (matchingFileArray == null || matchingFileArray.length == 0) { currentPeriodsCounter = 0; return; } currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex); // if parent raw file property is not null, then the next // counter is max found counter+1 if (tbrp.getParentsRawFileProperty() != null || (tbrp.compressionMode != CompressionMode.NONE)) { // TODO test me currentPeriodsCounter++; } }