package bvyy.command; // Copyright(C)1998 Brian Yap // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the // Free Software Foundation; either version 2 of the License, or (at your // option) any later version. // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for // more details. // You should have received a copy of the GNU General Public License along with // this program; if not, write to the Free Software Foundation, Inc., 675 Mass // Ave, Cambridge, MA 02139, USA. import bvyy.util.GeneralEvent; /** * All commands are types of general events. This allows them to be transported * across the model using the listener interfaces in addition to the RMI and * data bus transport.

* * As you can see the commands closely match the Java beans standard commands * and those used by Sun generally inside Java. This is deliberate. There needs * to be a 1:1 mapping between these commands and their implementation inside * the objects and beans. This will greatly add to readability and reliability. *

* * A command has an ordered set of argument objects. Initially these objects * are sent by the user interface. Latter in the processing of the command, * these objects are replaced with the actual database objects where the * command action is processed. * * @version 0.0.1 27 October 1998 * @author (c)1998 Brian Voon Yee Yap */ public abstract class Command extends GeneralEvent{ private java.util.Hashtable arguments; /** * Creates a new command. */ public Command(){ super(); } /** * Creates a new command with a description of S. * * @param s the event description. */ public Command(String S) { super(S); } /** * execure this command. * * @param arguments This is a hash table of the arguments. */ public abstract void execute(java.util.Hashtable theArguments) throws CommandCompletelyFailedException, CommandPartlyFailedException; /** * Returns the current command arguments list. The command arguments list is * a vector and this allows modification this list using the normal vector * functions.

* * For example: comand.getArguments.addElement(ArgumentX);

* * @see java.util.vector */ public java.util.Hashtable getArguments() { return arguments; } /** * Allows replacement of the current command argument list with a new command * argument list. All current arguments are lost.

* * Note: The command comes with it's own command srgument list so it will not * normally be necessary to call this function.

* * It a null command srgument list is supplied it will be ignored. * * @param newArguments the list that replaces the current list. */ public void setArguments(java.util.Hashtable newArguments) { arguments = newArguments; } }