1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.mercury.smtp.command;
14
15 import org.abstracthorizon.danube.connection.Connection;
16 import org.abstracthorizon.danube.connection.ConnectionHandler;
17 import org.abstracthorizon.danube.support.RuntimeIOException;
18 import org.abstracthorizon.mercury.common.command.CommandException;
19 import org.abstracthorizon.mercury.smtp.SMTPSession;
20 import org.abstracthorizon.mercury.smtp.exception.ParserException;
21
22 import java.io.IOException;
23
24
25
26
27
28
29 public abstract class SMTPCommand implements ConnectionHandler {
30
31
32
33
34 public SMTPCommand() {
35 }
36
37
38
39
40
41 public void handleConnection(Connection connection) {
42 SMTPSession smtpConnection = (SMTPSession)connection;
43 try {
44 execute(smtpConnection);
45 } catch (IOException e) {
46 throw new RuntimeIOException(e);
47 }
48 }
49
50
51
52
53
54
55
56
57 protected abstract void execute(SMTPSession connection) throws CommandException, IOException, ParserException;
58
59 }