*
* @param mailContext Description of the Parameter
* @return Description of the Return Value
*/
public AbstractMailCommand buildAbstractMailCommand(MailContext mailContext) {
AbstractMailCommand ama = null;
try {
// request parameter say "what"
String cmd = mailContext.getParameter("cmd");
if (cmd == null) {
cmd = (String)mailContext.get( MailContext.MAIL_CURRENT_WORKING_COMMAND_ENTRY );
}
Class clazz = getClassForCommand(cmd);
if (clazz != null) {
ama = (AbstractMailCommand) clazz.newInstance();
// enable logging of the mail command
ama.enableLogging(getLogger());
// contextualize the mail command
if (ama instanceof Contextualizable) {
((Contextualizable) ama).contextualize(mailContext);
}
return ama;