CentraSite 10.7 | CentraSite Developer's Guide | Customizing CentraSite | Customization of CentraSite Control | Creating a Sample Customized Plug-in for Content Pages | Plugging into CentraSite Control
 
Plugging into CentraSite Control
You have to plug-in into CentraSite Control to let it know the presence of the plug-in configuration file. The plug-in configuration file contains the information about where a plug-in plugs into CentraSite Control. The CentraSite Control software provides 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.
1. Convert the Java project to a CentraSite Control plug-in folder by providing a plug-in configuration file
a. In the context menu of DemoPlugIn01 in the package explorer, select New > File.
b. Type plugin.xml as the file name and click Finish.
c. Type 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>
d. Save the file using Ctrl+S.
A plug-in must have an identifier (here demo.plugin01) which has to be unique among all plug-ins. It is recommended 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 have to declare the plug-in as being dependent on the com.softwareag.cis.plugin because we use an extension point provided by this plug-in. This dependency is indicated through the requiredPlugin XML element. The extension XML element in the 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 is demo.plugin01. Select ext as the subpackage name for the implementing class to denote that code that extends CentraSite Control resides here.
2. Implement the extension, that is, provide a Java class called demo.plugin01.ext.PlugInInfo, which implements a specific interface required by the extension point.
a. In the context menu of DemoPlugIn01/src in the package explorer, select New > Class.
b. 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 can use the Browse button to avoid typing).
c. Make sure that the check box labeled with Inherited abstract methods is selected and click Finish.
Eclipse now opens the file PlugInInfo.java in the Java editor.
d. 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";
}
}
e. Save the modified file and ensure that no compilation 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 the project is suppressed from displaying). The resulting class file is now accessible for the pluggable user interface of CentraSite Control.
3. Check if CentraSite Control is aware of the plug-in.
a. Restart the Windows service Software AG Runtime.
b. Start the CentraSite Control application from the Windows Start > All Programs > Software AG menu, and log in using your credentials for ID and password.
c. Click the About button at the top of the page and click Plug-Ins.
If everything works fine, a dialog box whose contents look quite similar to the following figure appears. In particular, the line that represents the sample plug-in DemoPlugIn01 should be visible: