KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jsmtpd > core > common > smtpExtension > ISmtpExtension


1 /*
2  *
3  * Jsmtpd, Java SMTP daemon
4  * Copyright (C) 2005 Jean-Francois POUX, jf.poux@laposte.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  */

21 package org.jsmtpd.core.common.smtpExtension;
22
23 import java.io.IOException JavaDoc;
24
25 import org.jsmtpd.core.common.IGenericPlugin;
26 import org.jsmtpd.core.common.io.BareLFException;
27 import org.jsmtpd.core.common.io.InputSizeToBig;
28
29 /**
30  * A Smtp extension is a plugin that will add or change normal smtp behavior.
31  * smtpPreTrigger method is invoked for every extension loaded, before usual behavior (to change something existing)
32  * smtpTrigger method is invoked after the normal chat (to add new smtp command support)
33  *
34  * @author Jean-Francois POUX
35  */

36 public interface ISmtpExtension extends IGenericPlugin {
37
38     /**
39      * Invoked after normal chat, if the main smtp implementation does not known what to do.
40      * Return true if passed command is handled, false otherwise.
41      * Example of extension relying on this : TLS and authenticator.
42      * When parsing an unkown command, the engine will pass it to this method
43      * ! Use a streamparser from IO package to ensure integrity of what is read.
44      * @param command
45      * @param protocol
46      * @return true if command has been handled
47      */

48     public boolean smtpTrigger(String JavaDoc command, IProtocolHandler protocol) throws SmtpExtensionException, IOException JavaDoc, InputSizeToBig, IOException JavaDoc,
49             BareLFException;
50
51     /**
52      * Exposed during HELO chat
53      * @return the string to expose during HELO Chat
54      */

55     public String JavaDoc getWelcome();
56     
57     /**
58      * Overide normal behavior.
59      * It's executed before normal chat. Return true if handled, false otherwise.
60      * It is used by SPF plugin, by example, to override default RCPT command in some cases.
61      * @param command
62      * @param protocol
63      * @return false : continue with normal behavior ; true : extension overide normal behavior.
64      * @throws SmtpExtensionException
65      * @throws IOException
66      * @throws InputSizeToBig
67      * @throws IOException
68      * @throws BareLFException
69      */

70     public boolean smtpPreTrigger (String JavaDoc command, IProtocolHandler protocol) throws SmtpExtensionException, IOException JavaDoc, InputSizeToBig, IOException JavaDoc,
71     BareLFException;
72 }
Popular Tags