Friday, August 23, 2019

Develop IBM Content Navigator PlugIn

How to use Eclipse to develop Plugin JAR

Visit https://github.com/ibm-ecm/ibm-content-navigator-samples/tree/master/eclipsePlugin
download project and compile it to get the next two JARs

com.ibm.ecm.icn.facet.EDSPlugin.202.jar 
com.ibm.ecm.icn.plugin.202.jar

Copy jars to the “dropins” directory inside the main eclipse install location


Once you’ve added the Eclipse Plugins you can create an ICN Plugin or EDS project in Eclipse. 






Plugin project consists of 
1) One PlugIn Name which will be the entry point
2)  Plugin Services: it is a group of classes each class will do a functionality to the client

Normally, when user call a plugin, he should provide two input parameters (Plugin Name, Service Name)




Plugin class should have
1) getID( ) function : return the plugin name
2) PluginServices (): return array of services that this class will support








Create New Service Class





Change the "Supper class" by click on Browse and choose "PluginService"




Now we have one plugin contains only one service




Service class contains two functions
1) getID( ) : return service name
2) execute () : contains two parameters
                        a) HttpServletRequest : read data from client
                        b) HttpServletResponse : send response to client



Write sample response to return string to client


Add service to the Plugin using PluginService function inside plugin class



Build application by right click on build.xml and choose "Run AS" > "Ant Build"



Console will show the build jar location, this jar show defined as Plugin in Navigator





Login to IcmAdmin desktop and administration






From Plug-ins choose "New Plug-in"



Define jar location through http or hard disk location



Set JAR location the click "load" button




Call this plugin from Script Adapter code 

this sample code show how to send and receive data from plugin in

var reqParams = {};
reqParams.endorsementId = 'myDataSend2Server';
request.invokePluginService("my_Plugin_Name", "my_Service_Name", {
requestParams: reqParams,
synchronous: true,
requestCompleteCallback: lang.hitch(this, function(response) {
var result = response;
})
});







No comments: