Next Topic

Previous Topic

Book Contents

Writing The Plugin Class

Your plugin class should be able to be run under Sun JRE 1.5. Your plugin class must implement the [NetvigilSimplePlugin] interface, or the [NetvigilBatchPlugin] interface. See the javadoc for more information. The [NetvigilSimpleInterface] should be used when only small amounts of plugin tests will be provisioned, or for tests with long testing intervals. The [NetvigilBatchPlugin] should be used when large sets of tests can be run at one time, and where the tests require some expensive operation before they run, such as opening a connection.

Plugin tests can then be created in the web application or Traverse socket interface. Once created, the plugin tests are stored in the provisioning database, with each of the testField values for that test, with the fieldName as a key. The DGE loads the tests from the database, and after it has determined that the testing interval has passed, adds the test to a test queue, indicating that the test should be run.

If the plugin implements the [NetvigilSimplePlugin] interface, the DGE creates a new instance of your [NetvigilSimplePlugin] subclass and calls the doTest method for each plugin test in its test queue, passing a java.util.Properties object with the testField values. The value returned by doTest is stored in the DGE database, and used for reports and status. If the value returned is RESULT_UNKNOWN or RESULT_FAILED, the DGE calls getErrorMessage and puts any returned error message in the Traverse error log, so the web application user can determine the reason for a failed test.

If the plugin implements the [NetvigilBatchPlugin] interface, the DGE creates one instance of the plugin when it starts up, and calls addTest on that instance for each plugin test in its test queue, again passing a java.util.Properties object with the testField values. The DGE calls addTest until the test queue has no more tests of the plugin type, or until the number of tests specified by getMaxBatchSize has been reached. After this, the DGE calls the runBatch method of the plugin object. When runBatch returns, the DGE calls getTestResults to get the results of the batch test. The order of results returned in the array by getTestResults must match the order that the DGE called addTest. The DGE takes the results and stores them in the DGE database, where they are used in reports and status displays. If any of the results has a value of RESULT_UNKNOWN or RESULT_FAILED, the DGE calls getErrorMessage with the index of the result in the array returned by getTestResults. If the error message returned is not empty, it is logged in the Traverse error log.