TIBCO Adapter SDK C++ Reference
|
Defining a Plugin
To define a plugin, create a subclass of MPlugin, implement a C function and the following C++ methods.
CreateNewPlugin() C Function | Calls the plugin constructor with a C interface. |
MPlugin::MPlugin() method | Plugin constructor. |
MPlugin::~MPlugin() method | Plugin destructor. |
MPlugin::onInitialization() method | Initializes the plugin. |
MPlugin::onTermination() method | Terminates the plugin. |
-system:plugin your_plugin_shared_library
Several plugins can be loaded by a single adapter. Before using this feature, call MAppProperties::setCommandLine().
CreateNewPlugin() provides a C interface to the plugin constructor. It must create an instance of the plugin and returns a pointer to it as the second argument. The function itself should return NULL if the plugin was successfully created or return an MException in case of failure.
At this point, the plugin does not yet have access to any useful configuration information, the constructor work should therefore be kept to a minimum. The CreateNewPlugin() function declaration and an example follows.
typedef MException* (* MCreateNewPlugin)(MApp* pMApp, MPlugin*&);
For example:
MException* CreateNewPlugin(MApp* pMApp, MPlugin*& pPlugin) { try { NativeUserExitImplPlugin* pNativeUserExitImplPlugin = new NativeUserExitImplPlugin(pMApp); pPlugin = pNativeUserExitImplPlugin; } catch (MException m) { return new MException(m); } return NULL; }
class MPlugin : public MComponent;
MObject MComponent MPlugin