util.setContext(this.context);
compress.setContext(this.context);
// find out period from the filename pattern
if (fileNamePatternStr != null) {
fileNamePattern = new FileNamePattern(fileNamePatternStr, this.context);
determineCompressionMode();
} else {
addWarn(FNP_NOT_SET);
addWarn(SEE_FNP_NOT_SET);
throw new IllegalStateException(FNP_NOT_SET + SEE_FNP_NOT_SET);
}
DateTokenConverter dtc = fileNamePattern.getDateTokenConverter();
if (dtc == null) {
throw new IllegalStateException(
"FileNamePattern [" + fileNamePattern.getPattern()
+ "] does not contain a valid DateToken");
}
int len = fileNamePatternStr.length();
switch(compressionMode) {
case Compress.GZ:
activeFileNamePattern =
new FileNamePattern(fileNamePatternStr.substring(0, len - 3), this.context);
break;
case Compress.ZIP:
activeFileNamePattern =
new FileNamePattern(fileNamePatternStr.substring(0, len - 4), this.context);
break;
case Compress.NONE:
activeFileNamePattern = fileNamePattern;
}
addInfo("Will use the pattern "+activeFileNamePattern+" for the active file");