In this section, we will see a brief overview of the UCW Daemon plugin. The UCW Daemon plugin is a JAR file that has a mandatory plugin descriptor and some optional Java classes. The plugin descriptor, the only mandatory part of a plugin, is an XML file which must be named nsys-plugin.xml. The file is located at the root of the plugin. The nsys-plugin.xml file defines the various modules in a plugin.
Following is a sample nsys-plugin.xml file without any plugin modules in it:
<?xml version="1.0" encoding="UTF-8"?> <nsys-plugin key="com.unitycloudware.daemon.tutorial.plugins.ucwdemo" name="UCW Daemon Demo Plugin" plugin-version="1"> <!—- Plugin Info --> <plugin-info> <description>This is a UCW Daemon Demo Plugin</description> <version>220.127.116.11</version> <vendor name="UCW Industries Ltd." url="https://www.unitycloudware.com" /> </plugin-info> <!—- Plugin modules goes here --> </nsys-plugin>
The plugin, as you can see, has details such as descriptor, version, vendor-details, and so on. When the plugin is loaded, all the unique modules in it are also loaded. The plugin classes can override the system classes. The version is in following format X.Y.Z.B where X is a major version, Y is a minor version, Z is a revision and B is a build number.
The daemon can extend its functionality with new subsystems which are representing as plugin modules. For instance, we want to add to the daemon new module Collector which is for data gathering from the remote systems. At first, has to be implemented the org.nsys.daemon.plugin.ManagementAgentPlugin interface.
In nsys-plugin.xml file it will look as follows:
<management-agent key="ucw-demo-collector" name="UCW Demo Collector" class="com.unitycloudware.daemon.tutorial.plugins.ucwdemo.plugin.CollectorPlugin"> <dependency>org.nsys.daemon:scheduler</dependency> </management-agent>
The module, as you can see, has details such as key, name, class, and dependency. The key should be unique within the plugin. The name is the Human-readable name of the plugin. The class must implement the org.nsys.daemon.plugin.ManagementAgentPlugin interface. The element dependency defines the dependency on the other modules/plugins. It should be defined as pluginKey:resourceModuleKey. The daemon at first loads all management-agent resources and then loads all resources related to particular modules.