org.moyoman.helper
Class HelperConfigTool

java.lang.Object
  |
  +--org.moyoman.helper.HelperConfigTool

public class HelperConfigTool
extends Object

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


Field Summary
private  HelperConfig hc
          The HelperConfig object.
 
Constructor Summary
HelperConfigTool()
          Create the HelperConfigTool object.
 
Method Summary
 HelperName addHelperName(String simple, String full, HelperType type)
          Add a helper name for the helper type.
 HelperType addHelperType(String simple, String full, ComponentType parent)
          Add a new helper type.
 void addMode(Mode newMode, Mode oldMode)
          Create entries for the new user defined mode.
 void cancel()
          Undo all operations performed since the last save() or cancel() call.
 void deleteAllHelperTypes(ModuleType mt)
          Delete all the helper types associated with a given module type.
 void deleteHelperName(HelperName hn)
          Delete the helper name.
 void deleteHelperType(HelperType ht)
          Delete the helper type.
 void deleteMode(Mode mode)
          Delete the mode.
 HelperType[] getAllHelperTypes()
          Return all HelperType objects.
 HelperType[] getAllHelperTypes(HelperType ht)
          Return all HelperType objects which have the given helper type as their parent.
 HelperType[] getAllHelperTypes(ModuleType mt)
          Return all HelperType objects which have the given module type as their parent.
 HelperName[] getHelperNames(HelperType ht, Mode m)
          Get the ordered helper names for a specific helper type and mode.
 void orderHelperNames(HelperName[] hn, HelperType ht, Mode mode)
          Set the order of helper names for a given helper type and mode.
 void save()
          Save the results of all operations performed since the last save() or cancel() call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hc

private HelperConfig hc
The HelperConfig object.

Constructor Detail

HelperConfigTool

public HelperConfigTool()
Create the HelperConfigTool object.

Method Detail

getAllHelperTypes

public HelperType[] getAllHelperTypes()
Return all HelperType objects.

Returns:
An array of HelperType objects.

getAllHelperTypes

public HelperType[] getAllHelperTypes(HelperType ht)
Return all HelperType objects which have the given helper type as their parent.

Parameters:
ht - The HelperType for which the associated HelperType objects are being retrieved.
Returns:
An array of HelperType objects.

getAllHelperTypes

public HelperType[] getAllHelperTypes(ModuleType mt)
Return all HelperType objects which have the given module type as their parent.

Parameters:
mt - The ModuleType for which the associated HelperType objects are being retrieved.
Returns:
An array of HelperType objects.

getHelperNames

public HelperName[] getHelperNames(HelperType ht,
                                   Mode m)
Get the ordered helper names for a specific helper type and mode. The array is ordered with most preferred helper names first, and least preferred last.

Parameters:
ht - The HelperType in question.
m - The mode in question.
Returns:
An array of HelperName objects.

addHelperType

public HelperType addHelperType(String simple,
                                String full,
                                ComponentType parent)
                         throws NoSuchDataException,
                                InconsistentStateException
Add a new helper type.

Parameters:
simple - The simple name.
full - The full name
parent - The component type with which this helper type is associated.
Returns:
A HelperType object.
Throws:
NoSuchDataException - Thrown if the parent has been deleted.
InconsistentStateException - Thrown if internal inconsistencies prevent this operation from succeeding.

deleteHelperType

public void deleteHelperType(HelperType ht)
                      throws PermissionsException,
                             NoSuchDataException
Delete the helper type.

Parameters:
ht - The helper type to be deleted.
Throws:
PermissionsException - Thrown if the helper type has helper names associated with it.
NoSuchDataException - Thrown if the helper type has already been deleted.

deleteAllHelperTypes

public void deleteAllHelperTypes(ModuleType mt)
                          throws PermissionsException,
                                 NoSuchDataException
Delete all the helper types associated with a given module type.

Parameters:
mt - The module type.
Throws:
PermissionsException - Thrown if the helper type has helper names associated with it.
NoSuchDataException - Thrown if the module type has already been deleted.

addHelperName

public HelperName addHelperName(String simple,
                                String full,
                                HelperType type)
                         throws NoSuchDataException,
                                DataAlreadyExistsException
Add a helper name for the helper type.

Parameters:
simple - The simple name.
full - The full name.
type - The helper type with which this helper name is associated.
Throws:
NoSuchDataException - Thrown if the helper type has already been deleted.
DataAlreadyExistsException - Thrown if the helper name is not unique.

deleteHelperName

public void deleteHelperName(HelperName hn)
Delete the helper name.

Parameters:
hn - The helper name to delete.

orderHelperNames

public void orderHelperNames(HelperName[] hn,
                             HelperType ht,
                             Mode mode)
Set the order of helper names for a given helper type and mode.

Parameters:
hn - The helper names in order from most to least preferred.
ht - The helper type with which these helper names are associated.
mode - The mode for which the order is being set.

addMode

public void addMode(Mode newMode,
                    Mode oldMode)
             throws NoSuchDataException
Create entries for the new user defined mode. The ordering of modules in the new mode will be exactly the same as in the old mode.

Parameters:
newMode - The new mode.
oldMode - The old mode.
Throws:
Exception - Thrown if the old mode does not exist, or if the new mode already exists.
NoSuchDataException

deleteMode

public void deleteMode(Mode mode)
                throws NoSuchDataException
Delete the mode. This method should only be called by ModuleConfig.deleteMode(). It makes no sense to just delete this mode from helpers without also deleting it from modules.

Parameters:
mode - The mode to be deleted.
Throws:
NoSuchDataException - Thrown if there is no such mode.

cancel

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

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

save

public void save()
          throws InternalErrorException
Save the results of all operations performed since the last save() or cancel() call.

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