001/* ----------------------------------------------------------------------------
002   The Kiwi Toolkit - A Java Class Library
003   Copyright (C) 1998-2004 Mark A. Lindner
004
005   This library is free software; you can redistribute it and/or
006   modify it under the terms of the GNU General Public License as
007   published by the Free Software Foundation; either version 2 of the
008   License, or (at your option) any later version.
009
010   This library is distributed in the hope that it will be useful,
011   but WITHOUT ANY WARRANTY; without even the implied warranty of
012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013   General Public License for more details.
014
015   You should have received a copy of the GNU General Public License
016   along with this library; if not, write to the Free Software
017   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
018   02111-1307, USA.
019 
020   The author may be contacted at: mark_a_lindner@yahoo.com
021   ----------------------------------------------------------------------------
022   $Log: CommandProcessor.java,v $
023   Revision 1.5  2004/05/05 21:22:45  markl
024   Comment header updates.
025
026   Revision 1.4  2003/01/19 09:42:38  markl
027   Javadoc & comment header updates.
028
029   Revision 1.3  2001/03/12 02:57:38  markl
030   Source code cleanup.
031
032   Revision 1.2  1999/01/10 03:41:46  markl
033   added GPL header & RCS tag
034   ----------------------------------------------------------------------------
035*/
036
037package kiwi.util;
038
039/** Helper class for the <code>CommandDispatcher</code>.
040  * <code>CommandProcessor</code> is a minimal interface that declares error
041  * handling methods for the <code>CommandDispatcher</code>; however, the class
042  * that implements this interface should also define all of the actual command
043  * processing methods; reflection is used to analyze this class and compile a
044  * command dictionary.
045  *
046  * @see kiwi.util.CommandDispatcher
047  *
048  * @author Mark Lindner
049  */
050
051public interface CommandProcessor
052  {
053
054  /** Invocation error handler. This method is called by the command dispatcher
055    * when an error occurrs while invoking a command processor method.
056    *
057    * @param cmd The command that was being processed.
058    * @param ex The exception that was thrown.
059    */
060
061  public void invocationError(String cmd, Exception ex);
062
063  /** Argument count error handler. This method is called by the command
064    * dispatcher when a command is invoked with an incorrect number of
065    * arguments.
066    *
067    * @param cmd The command that was being processed.
068    */
069
070  public void argumentCountError(String cmd);
071
072  /** Argument format error handler. This method is called by the command
073    * dispatcher when a command is invoked with one or more incorrect argument
074    * types.
075    *
076    * @param cmd The command that was being processed.
077    * @param arg The offending argument.
078    */
079
080  public void argumentFormatError(String cmd, String arg);
081
082  /** Unknown command error handler. This method is called by the command
083    * dispatcher when an unknown command is received.
084    *
085    * @param cmd The offending command.
086    */
087
088  public void unknownCommandError(String cmd);
089  }
090
091/* end of source file */