*/
public void init() throws MailetException {
patternString = getInitParameter(PATTERN_PARAMETER_NAME);
notpatternString = getInitParameter(NOTPATTERN_PARAMETER_NAME);
if (patternString == null && notpatternString == null) {
throw new MailetException("No value for " + PATTERN_PARAMETER_NAME
+ " parameter was provided.");
}
directoryName = getInitParameter(DIRECTORY_PARAMETER_NAME);
attributeName = getInitParameter(ATTRIBUTE_PARAMETER_NAME);
removeAttachments = getInitParameter(REMOVE_ATTACHMENT_PARAMETER_NAME,
REMOVE_NONE).toLowerCase();
if (!REMOVE_MATCHED.equals(removeAttachments)
&& !REMOVE_ALL.equals(removeAttachments)) {
removeAttachments = REMOVE_NONE;
}
try {
// if (patternString != null) regExPattern = new
// Perl5Compiler().compile(patternString);
if (patternString != null)
regExPattern = Pattern.compile(patternString);
} catch (Exception e) {
throw new MailetException("Could not compile regex ["
+ patternString + "].");
}
try {
// if (notpatternString != null) notregExPattern = new
// Perl5Compiler().compile(notpatternString);
if (notpatternString != null)
notregExPattern = Pattern.compile(notpatternString);
} catch (Exception e) {
throw new MailetException("Could not compile regex ["
+ notpatternString + "].");
}
if (directoryName != null) {
try {
File saveDirectory = null;
saveDirectory = new File(directoryName);
if (!saveDirectory.exists()) {
saveDirectory.mkdirs();
}
} catch (Exception e) {
throw new MailetException("Could not create directory ["
+ directoryName + "].", e);
}
}
decodeFilename = getBooleanParameter(