james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Noel J. Bergman" <n...@devtech.com>
Subject RE: Notes from ApacheCon
Date Mon, 03 Jul 2006 20:11:29 GMT
> attached are notes for Norman

Below ...

	--- Noel

-------------------------------------------------------------------------

loop:
handler.call(session)
if (session.responseCode != 0) break;
endloop

while handler.call(session) != false handler = next();


interface CommandsHandler {
    Map getCommands();
}


MyHandler implements ConnectionHandler, CommandsHandler, MessageHandler {

	onConnection(...) { do onConnection processing }
	onMessage(...) { do onMessage processing }
	Map getCommands(...) {
		mailFromCmd = new CommandHandler() {
			onCommand(...) {
				do MAIL FROM processing
			}
		}
		rcptCmd = new CommandHandler() {
			onCommand(...) {
				do RCPT TO processing
			}
		}

		map.add("MAIL", mailFromCmd);
		map.add ("RCPT", rcptCmd);
		return map;
	}

}


NormanHeloFilter implements CommandHandler {
	onCommand(...) {
		if (session.getCurrentCommand() == "HELO") { do HELO processing}
		else if (session.getCurrentCommand() == "EHLO") { do slighly different
EHLO processing }
		else log ("This command handler does not IMPLEMENT " +
session.getCurrentCommand() + ".  Please fix.");
        }
}


SPFHandler implements CommandHandler, MessageHandler {
	onCommand(SMTPSession) { ...
session.getState().put("org.apache.james.jspf.header", ...); }
	onMessage(SMTPSession) { ... add header to message ... }
}


<handlerClain>

  <maxmessagesize>
  <verifyIdentity>

  <attribute name="maxmessagesize" value"0"/>
  <attribute name="heloEhloEnforcement" value="true"/>
  <attribute name="verifyIdentity" value="true" />

  <handler class="org.apache.james.smtpserver.SyntaxChecker"/>
  <handler.class="org.apache.james.smtpserver.rbldnschecker">
     <rblservers>
        <whitelist> query.bondedsender.org </whitelist>
        <blacklist> sbl-xbl.spamhaus.org </blacklist>
        <blacklist> list.dsbl.org </blacklist>
        <blacklist> dul.dnsbl.sorbs.net </blacklist>
        <blacklist> relays.ordb.org </blacklist>
     </rblservers>
  </handler>
  <handler class="de.norman.NormanHeloFilter" onCommand="HELO,EHLO"/>
  <handler class="org.apache.james.smtpserver.spfHandler" onCommand="MAIL">
     <attribute name="softfail" value="true"/>
  </handler>
  <handler class="org.apache.james.smtpserver.basecommands"/>
</handlerChain>




chainBuilder:

aHandler = class.newInstance();

if (aHandler instanceof ConnectionHandler) add to connection handler chain
if (aHandler instanceof MessageHandler) add to message handler chain
if (aHandler instanceof CommandsHandlers) {
	get commands
	loop through commands
	for each command, add to that command's handler chain
}
if (aHandler instance of CommandHandler) {
	get list of commands
	add handler to each chain
}


MyHandler implements ConnectionHandler, CommandHandlers {

	onConnection(...) { INIT THE SESSION }
	Map getCommands(...) { ... }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message