org.moyoman.module
Class ModuleConfigTool

java.lang.Object
  |
  +--org.moyoman.module.ModuleConfigTool

public class ModuleConfigTool
extends Object

This application provides the user with an interface for editing the module configuration files. Specifically, the names and order of module types, and the names and order of module implementions for each module type can be edited.


Field Summary
private  ModuleConfig mc
          The ModuleConfig object.
 
Constructor Summary
ModuleConfigTool()
          Create the ModuleConfigTool object.
 
Method Summary
 void addMode(String newModeName, Mode oldMode)
          Create a new user defined mode.
 ModuleName addModuleName(String simple, String full, ModuleType type)
          Add the module name for the module type.
 ModuleType addModuleType(String simple, String full, int pos)
           
 void cancel()
          Undo all changes since the last call to cancel() or save().
 void deleteMode(Mode mode)
          Delete the specifiec mode.
 void deleteModuleName(ModuleName mn)
          Delete the module name.
 void deleteModuleType(ModuleType mt)
          Delete the module type.
 ModuleType[] getAllModuleTypes()
          Return all ModuleType objects, in ascending order.
 ModuleName[] getModuleNames(ModuleType mt, Mode m)
          Get the module names for a given module type and mode.
 void orderModuleNames(ModuleName[] mn, ModuleType mt, Mode mode)
          Set the order of the module names.
 void orderModuleTypes(ModuleType[] mt)
          Set the order of the module types.
 void save()
          Save all changes since the last call to cancel() or save().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mc

private ModuleConfig mc
The ModuleConfig object.

Constructor Detail

ModuleConfigTool

public ModuleConfigTool()
                 throws InternalErrorException
Create the ModuleConfigTool object.

Throws:
InternalErrorException - Thrown if the operation fails for any reason.
Method Detail

getAllModuleTypes

public ModuleType[] getAllModuleTypes()
Return all ModuleType objects, in ascending order.

Returns:
An array of ModuleType objects.

getModuleNames

public ModuleName[] getModuleNames(ModuleType mt,
                                   Mode m)
Get the module names for a given module type and mode. The elements of the array are in order most highest to lowest in ranking.

Parameters:
mt - The ModuleType.
m - The mode.

addModuleType

public ModuleType addModuleType(String simple,
                                String full,
                                int pos)
                         throws IllegalArgumentException
IllegalArgumentException

deleteModuleType

public void deleteModuleType(ModuleType mt)
                      throws PermissionsException,
                             NoSuchDataException
Delete the module type.

Parameters:
mt - The ModuleType to be deleted.
Throws:
PermissionsException - Thrown if the module type cannot be deleted.
NoSuchDataException - Thrown if the module type does not exist.

addModuleName

public ModuleName addModuleName(String simple,
                                String full,
                                ModuleType type)
Add the module name for the module type. The module name is added as the least preferred module name for the module type.

Parameters:
simple - The simple name of the module name.
full - The full name of the module name.
type - The module type with which this module name is to be associated.
Returns:
The ModuleName object.

deleteModuleName

public void deleteModuleName(ModuleName mn)
Delete the module name.

Parameters:
mn - The module name to be deleted.

orderModuleTypes

public void orderModuleTypes(ModuleType[] mt)
                      throws InternalErrorException
Set the order of the module types.

Parameters:
mt - An array of ModuleType objects in ascending order.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

orderModuleNames

public void orderModuleNames(ModuleName[] mn,
                             ModuleType mt,
                             Mode mode)
                      throws InternalErrorException
Set the order of the module names.

Parameters:
mn - An array of ModuleName objects, ordered from most to least preferred.
mt - The ModuleType to associate them with.
mode - The mode for which the order is being set.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.

addMode

public void addMode(String newModeName,
                    Mode oldMode)
             throws DataAlreadyExistsException,
                    NoSuchDataException,
                    InternalErrorException
Create a new user defined mode. The ordering of modules in the new mode will be exactly the same as in the old mode.

Parameters:
newModeName - The name of the new mode.
oldMode - The old mode.
Throws:
DataAlreadyExistsException - Thrown if the new mode already exists.
NoSuchDataException - Thrown if the old mode does not exist.
InternalErrorException - Thrown if the operation fails for any reason.

deleteMode

public void deleteMode(Mode mode)
                throws PermissionsException,
                       NoSuchDataException
Delete the specifiec mode.

Parameters:
mode - The mode to be deleted.
Throws:
PermissionsException - Thrown if the mode is a standard mode.
NoSuchDataException - Thrown if the mode does not exist.

cancel

public void cancel()
            throws InternalErrorException
Undo all changes since the last call to cancel() or save().

Throws:
InternalErrorException - Thrown if the operation fails for any reason.

save

public void save()
          throws InternalErrorException
Save all changes since the last call to cancel() or save().

Throws:
InternalErrorException - Thrown if the operation fails for any reason.