View Javadoc

1   /*
2    * Copyright (c) 2004-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.mercury.smtp.command;
14  
15  import java.io.IOException;
16  
17  import org.abstracthorizon.mercury.common.command.CommandException;
18  import org.abstracthorizon.mercury.smtp.SMTPResponses;
19  import org.abstracthorizon.mercury.smtp.SMTPSession;
20  import org.abstracthorizon.mercury.smtp.exception.ParserException;
21  
22  /**
23   * RSET (reset) command
24   *
25   * @author Daniel Sendula
26   */
27  public class ResetCommand extends SMTPCommand {
28  
29      /**
30       * Constructor
31       */
32      public ResetCommand() {
33      }
34  
35      /**
36       * Executed the command
37       * @param connection smtp session
38       * @throws CommandException
39       * @throws IOException
40       * @throws ParserException
41       */
42      protected void execute(SMTPSession connection) throws CommandException, IOException, ParserException {
43          connection.getScanner().check_eol();
44          resetSession(connection);
45          connection.sendResponse(SMTPResponses.OK_RESPONSE);
46      }
47  
48      /**
49       * Resets the session. It is used from <code>ResetCommand</code> and from
50       * <code>EhloCommand</code>
51       */
52      protected void resetSession(SMTPSession connection) {
53  //        if (connection.getState() == SMTPSession.STATE_MAIL) {
54              connection.setState(SMTPSession.STATE_READY);
55  //        }
56      }
57  
58  }