We have now created a Java project inside the PluggableUI web application. However, there is one missing piece that tells CentraSite Control that this folder contains a plug-in: the plug-in configuration file. Amongst other things, the plug-in configuration file contains the information about where a plug-in plugs into in CentraSite Control.
The idea of using plug-ins to extend an application's functionality is quite simple and meanwhile well established by the Eclipse platform. The CentraSite Control software provides so-called extension points. These are positions in the program logic of the CentraSite Control program where functionality can be added by a plug-in. Every time the program flow comes to such an extension point, a search for plug-ins that extend CentraSite Control at this point takes place and the code provided by the plug-ins is invoked.
Let's convert our arbitrary Java project to a CentraSite Control plug-in folder by providing a plug-in configuration file. To do so, follow the steps below:
In the context menu of DemoPlugIn01 in the package explorer, choose
.Type plugin.xml as the file name and click
.Enter the following XML code:
<plugin id="demo.plugin01" order="101"> <requiredPlugin id="com.softwareag.cis.plugin" /> <!-- PlugInInfo --> <extension point="com.softwareag.cis.plugin.plugInInfo" id="DemoPlugIn01Info" class="demo.plugin01.ext.PlugInInfo"> </extension> </plugin>
Save the file using <Ctrl>+S.
First of all a plug-in must have an identifier (here "demo.plugin01") which has to be unique among all plug-ins. We recommend you to use naming conventions similar to Java package names.
The order number of a plug-in (here "101") gives CentraSite Control a priority for the sequence in which the plug-ins have to be loaded at startup. The higher the number, the later a plug-in is loaded.
We need to declare our plug-in as being dependent on the plug-in
com.softwareag.cis.plugin because we use an extension
point provided by this plug-in. This dependency is indicated through the
requiredPlugin
XML element.
For a list of all supported extension points, see the section Extension Points.
The extension
XML element in our file
DemoPlugIn01/plugin.xml denotes that our plug-in extends
the user interface at a point where information about a plug-in can be
contributed. The string that looks like a Java package name is the name of the
extension point
(com.softwareag.cis.plugin.plugInInfo).
The extension identifier (here "DemoPlugIn01Info") must be unique among all extension identifiers of a plug-in.
The class
attribute specifies the fully
qualified name of the class that implements the extension (here
demo.plugin01.ext.PlugInInfo). The top level package name
for all of our Java code will be demo.plugin01. We choose
ext as the subpackage name for the implementing class to
denote that code that extends CentraSite Control resides here.
Now we have to implement the extension, i.e. we have to provide a Java class called demo.plugin01.ext.PlugInInfo which implements a specific interface required by the extension point.
In the context menu of DemoPlugIn01/src in the package explorer, choose
.Specify demo.plugin01.ext for the package name, PlugInInfo for the class name and com.softwareag.cis.plugin.extpt.util.AbstractPlugInInfo for the superclass (you may uses the
button to save some typing).Make sure that the check box labeled with Inherited abstract methods is checked and click .
Eclipse now opens the file PlugInInfo.java in the Java editor.
Modify PlugInInfo.java in the Java editor as follows:
package demo.plugin01.ext; import com.softwareag.cis.plugin.extpt.util.AbstractPlugInInfo; public class PlugInInfo extends AbstractPlugInInfo { public String getImageURL() { return "../DemoPlugIn01/images/star-16x16.gif"; } public String getLayout() { return null; } public String getTitle() { return "DemoPlugIn01"; } public String getVendor() { return "Software AG"; } public String getVersion() { return "0.0.0.1"; } }
Save the modified file and make sure that no compile errors occur.
When you save the file, the Java file is automatically compiled into the folder classes of the project DemoPlugIn01. (Remember: the classes subfolder of our project is suppressed from displaying). The resulting class file is now accessible for the pluggable user interface of CentraSite Control.
Finally, let's check if CentraSite Control is aware of our minimalist plug-in:
Restart the Windows service "Software AG Runtime".
Start the CentraSite Control application from the Windows Start menu, using
, and log in using your usual ID and password.Click the
button at the top of the page. In the subsequent dialog, click .If everything works fine, you should see a dialog box whose contents look quite similar to the following screenshot. In particular, the line that represents our sample plug-in DemoPlugIn01 should be visible.