Compiling Plugins

Last Updated: 31 Dec 2018

One of the ways to integrate the Cloud Alert Messaging Gateway with your databases is by writing plugins. Plugins are Java class files that are loaded by the gateway, and can thus extract data from any data source, including databases.

Plugin development is a lot simpler than it sounds - you can simply use the sample plugin provided and replace the sql statements and field names to make a working plugin. The code in the sample plugin is production-ready.

Once you have created your plugin's .java file as per the instructions in the Plugin Developers Guide , you need to compile it to create a .class that can be loaded by the gateway. The javacplugin.bat file in the \cag\dbc\plugins directory will help in the compilation process.

  • Open a command prompt, and cd to the \cag\dbc\plugins directory.
  • Enter javacplugin myjavafile.java, replacing myjavafile.java with the actual name of your java file.
  • The compilation process will either display errors, warnings, or nothing if the compilation was successful. Ensure that the .class file is now present.
  • The name of the .class file, without its extension, can now be entered into the Administration Console - Configure Plugins - Add - Plugin Class Name. Click Save.
  • The gateway must now be restarted for the plugin to be loaded. The View Logs section displays any errors during the loading of the plugin.

Note that your plugin can comprise of multiple classes. In this case, compile all of the java files into classes, but enter the name of only the main file in the Configure Plugins section. The main file is the file that extends DBCDBPlugin or DBCGenericPlugin.

If you wish to use a third-party IDE (for example, Eclipse or Idea) to create your plugins, ensure that the \cag\dbc\pluginstubs directory is added or copied into your project. The database drivers in \cag\lib\jdbc may also need to be added.