Skip to content
Permalink
Browse files
Remove the hardcoded configuration of the smtphandler as SMTPHandler …
…already define its own default handlerchain if no chain is specified.

git-svn-id: https://svn.apache.org/repos/asf/james/postage/trunk@437374 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Stefano Bagnara committed Aug 27, 2006
1 parent 22fc04c commit fb183241e6f93f901d09b3d8828616c27bc9ba49
Showing 1 changed file with 3 additions and 42 deletions.
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the *
* "License"); you may not use this file except in compliance *
* with the License. You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, *
* software distributed under the License is distributed on an *
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
@@ -22,19 +22,6 @@

import org.apache.avalon.framework.configuration.DefaultConfiguration;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.james.smtpserver.HeloCmdHandler;
import org.apache.james.smtpserver.EhloCmdHandler;
import org.apache.james.smtpserver.AuthCmdHandler;
import org.apache.james.smtpserver.NoopCmdHandler;
import org.apache.james.smtpserver.SendMailHandler;
import org.apache.james.smtpserver.VrfyCmdHandler;
import org.apache.james.smtpserver.ExpnCmdHandler;
import org.apache.james.smtpserver.MailCmdHandler;
import org.apache.james.smtpserver.RcptCmdHandler;
import org.apache.james.smtpserver.DataCmdHandler;
import org.apache.james.smtpserver.RsetCmdHandler;
import org.apache.james.smtpserver.HelpCmdHandler;
import org.apache.james.smtpserver.QuitCmdHandler;

public class SimpleSMTPServerConfiguration extends DefaultConfiguration {
private int m_smtpListenerPort;
@@ -47,31 +34,6 @@ public static Configuration getValuedConfiguration(String name, String value) {
return defaultConfiguration;
}

public static DefaultConfiguration createHandlerChainConfiguration() {
DefaultConfiguration handlerChainConfig = new DefaultConfiguration("handlerchain");
handlerChainConfig.addChild(createCommandHandlerConfiguration("HELO", HeloCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("EHLO", EhloCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("AUTH", AuthCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("VRFY", VrfyCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("EXPN", ExpnCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("MAIL", MailCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("RCPT", RcptCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("DATA", DataCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("RSET", RsetCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("HELP", HelpCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("QUIT", QuitCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("NOOP", NoopCmdHandler.class));
handlerChainConfig.addChild(createCommandHandlerConfiguration("Default SendMailHandler", SendMailHandler.class));
return handlerChainConfig;
}

private static DefaultConfiguration createCommandHandlerConfiguration(String command, Class commandClass) {
DefaultConfiguration cmdHandlerConfig = new DefaultConfiguration("handler");
cmdHandlerConfig.setAttribute("command", command);
String classname = commandClass.getName();
cmdHandlerConfig.setAttribute("class", classname);
return cmdHandlerConfig;
}
public SimpleSMTPServerConfiguration(int smtpListenerPort) {
super("smptserver");

@@ -113,7 +75,6 @@ public void init() {
handlerConfig.addChild(getValuedConfiguration("maxmessagesize", "" + 0));
handlerConfig.addChild(getValuedConfiguration("authRequired", m_authorizingMode));

handlerConfig.addChild(createHandlerChainConfiguration());
addChild(handlerConfig);
}

0 comments on commit fb18324

Please sign in to comment.