Appendix A – Command Response Protocol

A typical command response protocol sequence client> command [argument] james> response code and description client> command [argument] james> response code client> message and message terminator james> response code

Breaking the steps of in-protocol handling: 1. As soon as the client initiates connection, apply connection rules and terminate session upon violation. 2. Get the corresponding command handler for the command. 3. Apply Command rules for validating the arguments. 4. If all necessary validations succeed, continue. 5. If a message is expected, read the whole message. 6. Apply Message rules for verifying the message content. 7. If all the message validations succeed, hand over the mail to spooler for further processing.

Appendix B – Interface details

A set of framework classes placed under a new package org.apache.james.protocol

ProtocolHandler {


public interface CommandHandler {


public interface Rule {


Appendix C – SMTPHandler implementation example

SMTPHandler implements the ProtocolHandler interface.

///initialization steps
read config.xml
create and configure command objects
create and configure connection rules
create and configure command and message rules

////processing commands and messages
//get all connection rules and apply
Rules[] connectionRules = getConnectionRules();
for(int i = 0; i < connectionRules.length; i++) {


while(true) {

Anagha_Mudigonda_fast-fail (last edited 2009-09-20 23:35:48 by localhost)