Writing your own tool
It is possible to make your own tools for Wandora. To make your own tool you need to make a Java class that implements the AdminTool interface. Most of the time easiest way to do this is to extend the AbstractAdminTool class which implements AdminTool interface and provides some commonly used methods.
AbstractAdminTool
The simplest way to make your own tool is to extend AbstractAdminTool class and then implement and override a few methods. Following table lists methods that are most often overridden.
Method | Description |
---|---|
execute(WandoraAdmin,Context) | Main method of the tool. In all cases you must implement this method. It should perform all processing of the tool. You can open dialogs for user input if you want to. |
getName() | This method returns the name of the tool. You should override this method to return the name of your tool. |
getDescription() | This method returns a description of what the tool will do. You should override this method to return a proper description of your tool. |
getType() | This method returns the type of the tool which should be one of "generic", "import", "export" or "extract". Default implementation returns "generic" and unless you are making some other kind of tool you don't need to override this method. |
getMenuIcon() | This method returns the icon to use in menus. If you want to use something else than the default icon, override this method. |
Each tool must have a constructor with no parameters. If you need to do some kind of initialization for the tool, you need to override a few more methods.
Method | Description |
---|---|
initialize(...) | Initializes the tool. This is called always after the tool object is created. The method receives as its parameters the WandoraAdmin object, an Options object containing all saved options and a String containing the prefix this tool should use when accessing and saving options. |
isConfigurable() | Tells if this tools provides a dialog where user can configure the tool. Default implementation returns false so you need to override this if you want the user to be able to configure the tool. |
configure(...) | If this tool is configurable, this method must be overridden to show the configuration dialog. After user closes the dialog, all options should be written in the options using the prefix given as a parameter. Best way to do this is to call the next method after the dialog is closed. |
writeOptions(...) | If this tool is configurable, this method must be overridden to write all current options using the prefix given as parameter. Unlike previous method, this method shouldn't open any dialogs or expect user interaction. |
More detailed description of methods and a few more methods that you can override can be found in the AbstractAdminTool page.