ExtensionsManager

The cube extensionsmanager can be used to create aplugin architecture, similar to eclipse. This is realised using extensionpoints and plugins.

how to use

This tutorial explains how to use the extensionsmanager on the basis of the packages umgt2.ui, umgt2.gui.umgt and umgt2.gui.ktms. A tab-menu is created in umgt2.gui.umgt. The tabs are not located in this package, but are registered at the extensionpoint um umgt.ui.

To define an extensionpoint, simply add a new category in the dependencies.res of the package (in this case umgt2.ui) with the name of the extensionpoint:
[extensionpoint_UmgtModuleExtensionpoint]
id=UmgtModuleExtensionpoint
 
Tabs can now be registered at this extensionpoint.
This, too, is done in the depenencies.res (in this case umgt2.gui.ktms, since there are the tabs implemented). At first, define an interface with the tab (which is a simple php class):
[interfaces]
ktmstab=mmg.ktms ktmstab umgt2_ktmstab NORMAL
Now, register this interface at the extensionpoint:
[extension_testtab]
extensionpointid=umgt2.UmgtModuleExtensionpoint
interface=ktmstab
id=
In the index.php of the web-project (or in any other class, where the plugins are needed), register BOTH dependencies at the extensionsmanager:
$extensionsmanager = &$cube->getServiceObject('cube.core.extensions','extensionsmanager');
$extensionsmanager->addPlugin('umgt2','umgt2.ui profile');
$extensionsmanager->addPlugin('umgt2.ktms','mmg.ktms profile');
The first parameter indicates the id of the plugin, the second consists of the namespace and the filename of the dependencies.res. (In this example, the file "umgt2/ui/dependencies/profile.res" is included)
The extensionpoint and the associated tabs are now registered. To acces these tabs, simply call the "getExtensionObjects("EXTENSIONPOINT-ID")" method of the extensionsmanager:
$extensionsmanager = &$this->getServiceObject('cube.core.extensions','extensionsmanager');
$plugins = $extensionsmanager->getExtensionObjects('umgt2.UmgtModuleExtensionpoint');
The extensionsmanager now returns all plugins (in this case tabs), which are registerd unter the extensionpoint "umgt2.UmgtModuleExtensionpoint".