Examples

Developing plug-ins for the WAT may seem like a daunting task, but this guide seeks to provide simple cases to explain how the plug-in API can be used to accomplish simplified tasks. One major hurdle for developing plug-ins is the ability to debug into the code. Since the typical developer will not have access to the WAT source code, they will be running from a compiled (and obfuscated) set of the executable. This makes debugging the application different, but not impossible. The first tutorial describes the steps to attach a debugger to the plug-in, so that one can step into the plug-in code (and from there into portions of the compiled jars).
For the simple plug-in, we will create a mapping tool in the toolbar for WAT. This will allow users to view and edit the maps in the current active map window of the WAT. This is the simplest plug-in API to implement, and requires only one class to be built. This example takes between two and four hours to complete for someone familiar with developing in Java.
For the simple computable plug-in, we are going to create a plug-in that is part of a WAT compute sequence (specifically the FRA compute sequence), that consumes event information. The plug-in will consume one DSS time series record as input, and produce one time series record as output. For the sake of simplicity, the time series record will be multiplied by a uniform random number provided by the WAT which represents the event random number, in the case of POR events, the time series will simply be multiplied by 2. The plug-in is going to be built from scratch in Java, and can operate within the WAT JVM. These questions help to determine what interfaces must be implemented within the plug-in's main class
For the Hydrologic Event Generator plug-in, we are going to create a single event that is the same length as the analysis period provided by the user. Using the BasicPlugin created using the simple computable plug-in instructions, this tutorial copies the project, changes the required project names and packages, and adds the implementation of the Hydrologic Event Generator interface. This plug-in can now appear as an Event Generator in the FRA program sequence. It shows how to modify the compute options to define the event list and how to provide the compute options to the WAT.

Figure 8 Plugin Decision Logic