You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2009/08/14 14:27:31 UTC
svn commit: r804189 - in /james/server/sandbox/active/smtp_refactor:
avalon-socket-library/src/main/java/org/apache/james/socket/
avalon-socket-library/src/main/java/org/apache/james/util/
smtpserver-function/src/main/java/org/apache/james/smtpserver/
Author: norman
Date: Fri Aug 14 12:27:31 2009
New Revision: 804189
URL: http://svn.apache.org/viewvc?rev=804189&view=rev
Log:
Start to fix compile errors
Added:
james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/util/CRLFDelimitedByteBuffer.java
james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPRetCode.java
Modified:
james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesHandler.java
james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/CommandHandler.java
james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/HandlersPackage.java
james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java
james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java
Modified: james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesHandler.java?rev=804189&r1=804188&r2=804189&view=diff
==============================================================================
--- james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesHandler.java (original)
+++ james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesHandler.java Fri Aug 14 12:27:31 2009
@@ -30,6 +30,7 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.james.api.dnsservice.DNSService;
+import org.apache.james.util.CRLFDelimitedByteBuffer;
import org.apache.james.util.InternetPrintWriter;
import org.apache.james.util.watchdog.Watchdog;
import org.apache.james.util.watchdog.WatchdogTarget;
@@ -81,6 +82,12 @@
protected InputStream in;
/**
+ * Manage inputstream as a bytebuffer
+ */
+ private CRLFDelimitedByteBuffer bytebufferHandler;
+
+
+ /**
* The reader associated with incoming characters.
*/
protected CRLFTerminatedReader inReader;
@@ -166,7 +173,8 @@
outs = new SplitOutputStream(outs, new FileOutputStream(tcplogprefix+"out"));
in = new CopyInputStream(in, new FileOutputStream(tcplogprefix+"in"));
}
-
+ bytebufferHandler = new CRLFDelimitedByteBuffer(in);
+
// An ASCII encoding can be used because all transmissions other
// that those in the message body command are guaranteed
// to be ASCII
@@ -505,4 +513,18 @@
public String toString() {
return name;
}
+
+
+ public final byte[] readInputLine() throws IOException {
+ return bytebufferHandler.read();
+ }
+
+ public final String readInputLineAsString() throws IOException {
+ String line = bytebufferHandler.readString();
+ if (line != null && line.length() >= 2) {
+ return line.substring(0,line.length()-2);
+ } else {
+ return line;
+ }
+ }
}
Added: james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/util/CRLFDelimitedByteBuffer.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/util/CRLFDelimitedByteBuffer.java?rev=804189&view=auto
==============================================================================
--- james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/util/CRLFDelimitedByteBuffer.java (added)
+++ james/server/sandbox/active/smtp_refactor/avalon-socket-library/src/main/java/org/apache/james/util/CRLFDelimitedByteBuffer.java Fri Aug 14 12:27:31 2009
@@ -0,0 +1,331 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * 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 *
+ * *
+ * 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 *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+
+package org.apache.james.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/*
+ * A simple, synchronized, queue of CRLF-delimited lines.
+ *
+ * NOTA BENE: as bytes arrive, they are buffered internally up to a
+ * configured maximum. The maximum is intended to reflect a line length
+ * limiter, but there is a potential corner case that should be
+ * understood. If the working buffer is almost full, and a new packet
+ * arrives with enough data to overflow the buffer, the code will
+ * consider that an error and discard the entire working buffer, even
+ * though the beginning of the new packet might have terminated the
+ * currently accumulating line. And the reported position of the
+ * overflow is based upon the buffer position before scanning for lines,
+ * not an actualy line length (perhaps we need not even report the
+ * position). Since the purpose for this maximum is to prevent memory
+ * flooding attacks, this does not appear to be a particularly critical
+ * corner case. We simply need to make sure that the working buffer is
+ * at least twice the size of the maximum desired line length.
+ *
+ * After buffering the incoming data, it is scanned for CRLF. As each
+ * line is found, it is moved to an ArrayList of Line objects. When all
+ * data has been scanned, any remaining bytes are shifted within the
+ * working buffer to prepare for the next packet.
+ *
+ * The code enforces CRLF pairing (RFC 2821 #2.7.1). The Line object,
+ * which is for internal use only, can hold the bytes for each line or
+ * record an exception (line termination or line length) associated
+ * with processing the data that would otherwise have. The exceptions
+ * are rethrown during the read operation, rather than during the write
+ * operation, so that the order of responses perserves the order of
+ * input.
+ *
+ * This code does not handle dot stuffing. Dot Stuffing, Message size
+ * limiting, and buffering of the message in a file are all expected to
+ * be performed by the I/O handler associated with the DATA accumulation
+ * state.
+ */
+
+public class CRLFDelimitedByteBuffer {
+ static public class TerminationException extends java.io.IOException {
+ private int where;
+ public TerminationException(int where) {
+ super();
+ this.where = where;
+ }
+
+ public TerminationException(String s, int where) {
+ super(s);
+ this.where = where;
+ }
+
+ public int position() {
+ return where;
+ }
+ }
+
+ static public class LineLengthExceededException extends java.io.IOException {
+ public LineLengthExceededException(String s) {
+ super(s);
+ }
+ }
+
+ private InputStream input;
+
+ public CRLFDelimitedByteBuffer(InputStream input) {
+ this(input, 2048);
+ }
+
+ public CRLFDelimitedByteBuffer(InputStream input, int maxLineLength) {
+ this.input = input;
+ lines = new java.util.ArrayList();
+ workLine = new byte[maxLineLength];
+ }
+
+ synchronized public boolean isEmpty() {
+ return lines.isEmpty();
+ }
+
+ synchronized public byte[] read() throws IOException, LineLengthExceededException, TerminationException {
+ byte[] buffer = new byte[1000];
+ int length;
+ while (lines.isEmpty() && isEmpty() && (length = input.read(buffer))!=-1) {
+ write(buffer, length);
+ }
+ return lines.isEmpty() ? null : ((Line) lines.remove(0)).getBytes();
+ }
+
+ synchronized public String readString() throws IOException, LineLengthExceededException, TerminationException {
+ byte[] buffer = new byte[1000];
+ int length;
+ while (lines.isEmpty() && isEmpty() && (length = input.read(buffer))!=-1) {
+ write(buffer, length);
+ }
+ if (lines.isEmpty()) return null;
+ else {
+ byte[] bytes = ((Line) lines.remove(0)).getBytes();
+ try {
+ return new String(bytes, "US-ASCII");
+ } catch (java.io.UnsupportedEncodingException uee) {
+ return new String(bytes);
+ }
+ }
+ }
+
+ synchronized public void write(byte[] data, int length) {
+ if (canFit(length)) {
+ System.arraycopy(data, 0, workLine, writeindex, length);
+ writeindex += length;
+ buildlines();
+ }
+ }
+
+ synchronized public void write(byte data) {
+ if (canFit(1)) {
+ workLine[writeindex++] = data;
+ buildlines();
+ }
+ }
+
+ synchronized public void write(String s) {
+ write(s.getBytes(), s.getBytes().length);
+ }
+
+ private boolean canFit(int length) {
+ if (writeindex + length > workLine.length) {
+ reset();
+ lines.add(new Line(new LineLengthExceededException("Exceeded maximum line length")));
+ return false;
+ } else return true;
+ }
+
+ static private class Line {
+ java.io.IOException e;
+ byte[] bytes;
+
+ public Line(byte[] data) {
+ bytes = data;
+ }
+
+ public Line(String data) {
+ bytes = data.getBytes();
+ }
+
+ public Line(java.io.IOException e) {
+ this.e = e;
+ }
+
+ public Line(byte[] data, int offset, int length) {
+ bytes = new byte[length];
+ System.arraycopy(data, offset, bytes, 0, length);
+ }
+
+ public byte[] getBytes() throws LineLengthExceededException, TerminationException {
+ if (e != null) {
+ if (e instanceof LineLengthExceededException) throw (LineLengthExceededException) e;
+ else throw (TerminationException) e;
+ }
+ return bytes;
+ }
+ }
+
+ private java.util.ArrayList lines;
+
+ private byte[] workLine;
+ private int writeindex = 0;
+ private int readindex = 0;
+ private int scanindex = 0; // current index for matching within the working buffer
+
+ private void reset() {
+ writeindex = 0;
+ readindex = 0;
+ scanindex = 0;
+ }
+
+ private void shift() {
+ System.arraycopy(workLine, readindex, workLine, 0, writeindex - readindex);
+ writeindex -= readindex;
+ scanindex -= readindex;
+ readindex = 0;
+ }
+
+ private void buildlines() {
+ for (; scanindex < writeindex; scanindex++) {
+ if (workLine[scanindex] == '\n') {
+ final int pos = scanindex;
+ reset();
+ lines.add(new Line(new TerminationException("\"bare\" LF in data stream.", pos)));
+ break;
+ } else if (workLine[scanindex] == '\r') {
+ if (scanindex+1 == writeindex) break;
+ else if (workLine[++scanindex] == '\n') {
+ lines.add(new Line(workLine, readindex, scanindex - readindex + 1));
+ readindex = scanindex + 1;
+ } else {
+ final int pos = scanindex - 1;
+ reset();
+ lines.add(new Line(new TerminationException("\"bare\" CR in data stream.", pos)));
+ break;
+ }
+ }
+ }
+
+ if (readindex != 0) shift();
+ }
+
+ /*** THE CODE BELOW IS PURELY FOR TESTING ***/
+ /*
+ synchronized private void status() {
+ System.out.println("\n--------------------------------------------------\n");
+ if (lines.isEmpty()) System.out.println("Lines: None");
+ else {
+ System.out.println("Lines:");
+ java.util.Iterator i = lines.iterator();
+ while (i.hasNext()) {
+ Line line = (Line) i.next();
+ try {
+ System.out.println("\tData[" + line.getBytes().length + "]: " + new String(line.getBytes(), 0, line.getBytes().length, "US-ASCII"));
+ } catch (java.io.UnsupportedEncodingException uee) {
+ } catch (TerminationException te) {
+ System.out.println("\tSyntax error at character position " + te.position() + ". CR and LF must be CRLF paired. See RFC 2821 #2.7.1.");
+ } catch (LineLengthExceededException llee) {
+ System.out.println("\tLine length exceeded. See RFC 2821 #4.5.3.1.");
+ }
+ }
+ }
+
+ System.out.println("Buffer Status:");
+ System.out.println("\tworkline length: " + workLine.length);
+ System.out.println("\tnext read index: " + readindex);
+ System.out.println("\tnext scan index: " + scanindex);
+ System.out.println("\tnext write index: " + writeindex);
+
+ try {
+ System.out.println("\tOld data: " + new String(workLine, 0, readindex, "US-ASCII"));
+ System.out.println("\tData: " + new String(workLine, readindex, writeindex - readindex, "US-ASCII"));
+ } catch (java.io.UnsupportedEncodingException uee) {
+ System.err.println(uee);
+ }
+ System.out.println("\n--------------------------------------------------\n");
+ }
+
+
+ static public void main(String[] args) throws java.io.IOException {
+ CRLFDelimitedByteBuffer dbb = new CRLFDelimitedByteBuffer();
+ dbb.status();
+ dbb.write("Hello"); dbb.status();
+ dbb.write(" "); dbb.status();
+ dbb.write("World."); dbb.status();
+ dbb.write("\r"); dbb.status();
+ dbb.write("\n"); dbb.status();
+ dbb.write("\r\n"); dbb.status();
+ dbb.write("\n"); dbb.status();
+ dbb.write("\r\r"); dbb.status();
+ dbb.write("stuff\n"); dbb.status();
+ dbb.write("morestuff\r\r"); dbb.status();
+ for (int i = 0; i < 2500; i++) dbb.write("\0"); dbb.status();
+
+ while (!dbb.isEmpty()) {
+ try {
+ byte[] line = dbb.read();
+ System.out.println("Read line[" + line.length + "]: " + new String(line, 0, line.length, "US-ASCII"));
+ } catch (java.io.UnsupportedEncodingException uee) {
+ } catch (TerminationException te) {
+ System.out.println("Syntax error at character position " + te.position() + ". CR and LF must be CRLF paired. See RFC 2821 #2.7.1.");
+ } catch (LineLengthExceededException llee) {
+ System.out.println("Line length exceeded. See RFC 2821 #4.5.3.1.");
+ }
+ }
+ dbb.status();
+
+ dbb.write("This is a test.\015\012.... Three dots\015\012.\015\012");
+ dbb.status();
+
+ while (!dbb.isEmpty()) {
+ try {
+ byte[] line = dbb.read();
+ System.out.println("Read line[" + line.length + "]: " + new String(line, 0, line.length, "US-ASCII"));
+ } catch (java.io.UnsupportedEncodingException uee) {
+ } catch (TerminationException te) {
+ System.out.println("Syntax error at character position " + te.position() + ". CR and LF must be CRLF paired. See RFC 2821 #2.7.1.");
+ } catch (LineLengthExceededException llee) {
+ System.out.println("Line length exceeded. See RFC 2821 #4.5.3.1.");
+ }
+ }
+ dbb.status();
+
+ dbb.write("This is"); dbb.status();
+ dbb.write(" a tes"); dbb.status();
+ dbb.write("t.\015"); dbb.status();
+ dbb.write("\012..."); dbb.status();
+ dbb.write(". Three dot"); dbb.status();
+ dbb.write("s\015\012.\015\012"); dbb.status();
+
+ while (!dbb.isEmpty()) {
+ try {
+ String text = dbb.readString();
+ System.out.println ("read : " + text);
+ dbb.status();
+ } catch (TerminationException te) {
+ System.out.println("Syntax error at character position " + te.position() + ". CR and LF must be CRLF paired. See RFC 2821 #2.7.1.");
+ } catch (LineLengthExceededException llee) {
+ System.out.println("Line length exceeded. See RFC 2821 #4.5.3.1.");
+ }
+ }
+ }
+ */
+}
Modified: james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/CommandHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/CommandHandler.java?rev=804189&r1=804188&r2=804189&view=diff
==============================================================================
--- james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/CommandHandler.java (original)
+++ james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/CommandHandler.java Fri Aug 14 12:27:31 2009
@@ -42,6 +42,6 @@
*
* @return Collection which contains implemented commands
*/
- Collection getImplCommands();
+ Collection<String> getImplCommands();
}
Modified: james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/HandlersPackage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/HandlersPackage.java?rev=804189&r1=804188&r2=804189&view=diff
==============================================================================
--- james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/HandlersPackage.java (original)
+++ james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/HandlersPackage.java Fri Aug 14 12:27:31 2009
@@ -35,6 +35,6 @@
*
* @return Map
*/
- List getHandlers();
+ List<CommandHandler> getHandlers();
}
Modified: james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java?rev=804189&r1=804188&r2=804189&view=diff
==============================================================================
--- james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java (original)
+++ james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java Fri Aug 14 12:27:31 2009
@@ -21,8 +21,8 @@
package org.apache.james.smtpserver;
+import org.apache.james.api.user.UsersRepository;
import org.apache.james.services.MailServer;
-import org.apache.james.services.UsersRepository;
/**
* Provides a number of server-wide constant values to the
Added: james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPRetCode.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPRetCode.java?rev=804189&view=auto
==============================================================================
--- james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPRetCode.java (added)
+++ james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPRetCode.java Fri Aug 14 12:27:31 2009
@@ -0,0 +1,138 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * 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 *
+ * *
+ * 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 *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.smtpserver;
+
+/**
+ * Result code defined in RFC 2821
+ */
+public class SMTPRetCode {
+ // System status, or system help reply
+ public static final String SYSTEM_STATUS = "211";
+
+ // Help message
+ // (Information on how to use the receiver or the meaning of a
+ // particular non-standard command; this reply is useful only
+ // to the human user)
+ public static final String HELP_MESSAGE = "214";
+
+ // <domain> Service ready
+ public static final String SERVICE_READY = "220";
+
+ // <domain> Service closing transmission channel
+ public static final String SYSTEM_QUIT = "221";
+
+ // Auth ok
+ public static final String AUTH_OK = "235";
+
+ // Requested mail action okay, completed
+ public static final String MAIL_OK = "250";
+
+ // 251 User not local; will forward to <forward-path>
+ // (See section 3.4)
+ public static final String MAIL_FORWARDING = "251";
+
+ // Cannot VRFY user, but will accept message and attempt
+ // delivery
+ // (See section 3.5.3)
+ public static final String MAIL_UNDEFINDED = "252";
+
+ public static final String AUTH_READY = "334";
+
+ // Start mail input; end with <CRLF>.<CRLF>
+ public static final String DATA_READY = "354";
+
+ // <domain> Service not available, closing transmission channel
+ // (This may be a reply to any command if the service knows it
+ // must shut down)
+ public static final String SERVICE_NOT_AVAILABLE = "421";
+
+ //This response to the AUTH command indicates that the user needs to
+ // transition to the selected authentication mechanism. This typically
+ // done by authenticating once using the PLAIN authentication mechanism.
+ public static final String AUTH_PASSWORD_TRANSITION_ERROR = "432";
+
+ // Requested mail action not taken: mailbox unavailable
+ // (e.g., mailbox busy)
+ public static final String MAILBOX_TEMP_UNAVAILABLE = "450";
+
+ // Requested action aborted: local error in processing
+ public static final String LOCAL_ERROR = "451";
+
+ // Requested action not taken: insufficient system storage
+ public static final String SYSTEM_STORAGE_ERROR = "452";
+
+ //This response to the AUTH command indicates that the authentication
+ // failed due to a temporary server failure.
+ public static final String AUTH_TEMPORARY_ERROR = "454";
+
+ // Syntax error, command unrecognized
+ // (This may include errors such as command line too long)
+ public static final String SYNTAX_ERROR_COMMAND_UNRECOGNIZED = "500";
+
+ // Syntax error in parameters or arguments
+ public static final String SYNTAX_ERROR_ARGUMENTS = "501";
+
+ // Command not implemented (see section 4.2.4)
+ public static final String UNIMPLEMENTED_COMMAND = "502";
+
+ // Bad sequence of commands
+ public static final String BAD_SEQUENCE = "503";
+
+ // Command parameter not implemented
+ public static final String PARAMETER_NOT_IMPLEMENTED = "504";
+
+ // This response may be returned by any command other than AUTH, EHLO,
+ // HELO, NOOP, RSET, or QUIT. It indicates that server policy requires
+ // authentication in order to perform the requested action.
+ public static final String AUTH_REQUIRED = "530";
+
+ // Auth failed
+ public static final String AUTH_FAILED = "535";
+
+ // This response to the AUTH command indicates that the selected
+ // authentication mechanism is weaker than server policy permits for
+ // that user.
+ public static final String AUTH_MECHANISM_WEAK = "534";
+
+ // This response to the AUTH command indicates that the selected
+ // authentication mechanism may only be used when the underlying SMTP
+ // connection is encrypted.
+ public static final String AUTH_ENCRYPTION_REQUIRED = "538";
+
+ // Requested action not taken: mailbox unavailable
+ // (e.g., mailbox not found, no access, or command rejected
+ // for policy reasons)
+ public static final String MAILBOX_PERM_UNAVAILABLE = "550";
+
+ // User not local; please try <forward-path> (See section 3.4)
+ public static final String USER_NOT_LOCAL = "551";
+
+ // Requested mail action aborted: exceeded storage allocation
+ public static final String QUOTA_EXCEEDED = "552";
+
+ // Requested action not taken: mailbox name not allowed
+ // (e.g., mailbox syntax incorrect)
+ public static final String SYNTAX_ERROR_MAILBOX = "553";
+
+ // Transaction failed (Or, in the case of a connection-opening
+ // response, "No SMTP service here")
+ public static final String TRANSACTION_FAILED = "554";
+
+}
Modified: james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java?rev=804189&r1=804188&r2=804189&view=diff
==============================================================================
--- james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java (original)
+++ james/server/sandbox/active/smtp_refactor/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java Fri Aug 14 12:27:31 2009
@@ -27,11 +27,12 @@
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.james.Constants;
-import org.apache.james.core.AbstractJamesService;
-import org.apache.james.services.DNSServer;
+import org.apache.james.api.dnsservice.util.NetMatcher;
+import org.apache.james.api.user.UsersRepository;
+import org.apache.james.dnsserver.DNSServer;
import org.apache.james.services.MailServer;
-import org.apache.james.services.UsersRepository;
-import org.apache.james.util.NetMatcher;
+import org.apache.james.socket.AbstractJamesService;
+import org.apache.james.socket.ProtocolHandler;
import org.apache.mailet.MailetContext;
/**
@@ -381,4 +382,13 @@
protected Object getConfigurationData() {
return theConfigData;
}
+
+ @Override
+ public ProtocolHandler newProtocolHandlerInstance() {
+ SMTPHandler theHandler = new SMTPHandler();
+ //pass the handler chain to every SMTPhandler
+ theHandler.setHandlerChain(handlerChain);
+ return theHandler;
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org