public org.apache.mailet.Mailet | getMailet(java.lang.String mailetName, org.apache.avalon.framework.configuration.Configuration configuration)
try {
for (int i = 0; i < packages.size(); i++) {
String className = (String) packages.elementAt(i) + mailetName;
try {
MailetConfigImpl configImpl = new MailetConfigImpl();
configImpl.setMailetName(mailetName);
configImpl.setConfiguration(configuration);
configImpl.setMailetContext(mailetContext);
Mailet mailet = (Mailet) Thread.currentThread().getContextClassLoader().loadClass(className).newInstance();
mailet.init(configImpl);
return mailet;
} catch (ClassNotFoundException cnfe) {
//do this so we loop through all the packages
}
}
StringBuffer exceptionBuffer =
new StringBuffer(128)
.append("Requested mailet not found: ")
.append(mailetName)
.append(". looked in ")
.append(packages.toString());
throw new ClassNotFoundException(exceptionBuffer.toString());
} catch (MessagingException me) {
throw me;
} catch (Exception e) {
StringBuffer exceptionBuffer =
new StringBuffer(128).append("Could not load mailet (").append(mailetName).append(
")");
throw new MailetException(exceptionBuffer.toString(), e);
}
|