Load plugin based on Nx Witness version
AnsweredHi,
I had a plugin for Nx Witness 4.2. And because the release of Nx Witness 5.0 and SDK, I made some modifications and build a plugin for 5.0. Now I have two plugins - A for 4.2, and B for 5.0. The case is that user copy both plugins to the "plugins" folder.
Is it feasible that for Nx Witness Server 4.2, it can load A plugin, and do not load B plugin?
And for Nx Witness Server 5.0, it load B plugin, and ignore A plugin.
Do you have any suggestion for this scenario? How can I achieve it?
Thanks.
-
Hello,
The case is that user copy both plugins to the "plugins" folder.
In this case, since the binary filename is the same, the only file remains.
Is it feasible that for Nx Witness Server 4.2, it can load A plugin, and do not load B plugin?
No, it's not. Most probably, the plugin for the v5 won't be loaded into v4.2 Server. V5.0 feature won't work in v4.2. Anyway, we don't recommend doing that.
You could refactor your plugin code in two ways.
1. Detect server version and organize computation flow depending on the Server version.Server version can be obtained by the IUtilityProvider::serverSdkVersion() of the Plugin class.
2. Refactor your code into sections designed for v4.2 and v5.0 respectively. When your plugin is being loaded, you could detect server version and select the corresponding code.
Here is how you could be implemented technically.
In the Plugin::doCreateEngine() you detect the Server version and return either v4.2 Engine class instance or v5.0 Engine class instance.
Please sign in to leave a comment.
Comments
1 comment