TIBCO Adapter SDK C++ Reference
MPlugin
Class Hierarchy | C++ Classes and Methods | Members | Methods
Class that allows plug-ins for the SDK. MPlugin allows applications to add extra functionality to an adapter at runtime without needing recompiling of an adapter. Possible uses of the MPlugin class are:

  • userExit plugin

  • loading new MApp components

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.

Configuring a Plugin
Configure a plugin by using the TIBCO Designer to add a custom plugin object to the adapter instance description stored in TIBCO Repository.
Running an Adapter with a Plugin
To load the plugin into the adapter, you must specify the system:plugin command-line argument, as follows:

-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;

}
Declaration
class MPlugin : public MComponent;
Class Hierarchy
MObject
    MComponent
        MPlugin
File
MPlugin.h
Links
Copyright (c) 2010 TIBCO Software Inc. All rights reserved.