IBM Content Navigator plugin

Here we go with the first article on this site ! It’s about creating / modifying a Content Navigator plugin.

The plugin main class

Each IBM Content Navigator plugin will define it’s own main class, defining several methods inherited from com.ibm.ecm.extension.Plugin java class. The first thing to do after declaring a new class is to modify the “applicationInit” method.

Just a precision about this class. The based java package related to this class must be the same with the WebContent resource folder !

The applicationInit method…

@Override
public void applicationInit(HttpServletRequest request,
        PluginServiceCallbacks callbacks) throws Exception {
    // TODO specify some instantiation here
}

This method will be called after loading the plugin in the IBM Content Navigator administration page.

This method provides 2 parameters :

  • a basic HttpServletRequest object, from any applicative server “javax.servlet.http” package,
  • a PluginServiceCallbacks object, from Content Navigator API “com.ibm.ecm.extension” package (more informations about this specific object in the official IBM Content Navigator API documentation

In this specific method, you can do anything related to your plugin initialization (loading configuration, initializing cached objects, and so on…).

… The generic methods…

The gedId method

This method define the plugin Identifier name.

@Override
public String getId() {
    return "PluginID";
}

 getName, getVersion and getCopyright methods

Those methods are only used in the Content Navigator administrative view, when you load the plugin.

@Override
public String getVersion() {
    return "1.0";
}

@Override
public String getCopyright() {
    return "Some copyright here";
}

@Override
public String getName(Locale locale) {
    return "Plugin name";
}

 … And the useful methods !

Quick introduction

This part defines each “functionality” provided by the Content Navigator API to tune your plugin. I will specify some of these, and write some other posts next weeks.

The request filter

A request filter is a specific development triggered before executing an action. For example, if I add a request filter listening to “/p8/addItem” Content Navigator event, this code will be executed before handling the default action process.

Sample

@Override
public PluginRequestFilter[] getRequestFilters() {
    return new PluginRequestFilter[0];
}

The response filter

Same spirit as the request filter, but executed after the default action process, and before handling data on Content Navigator side.

Sample

@Override
public PluginResponseFilter[] getResponseFilters() {
    return new PluginResponseFilter[0];
}

The plugin action

This method returns a specific list of actions that this plugin will add to the main toolbar of the web client

sample

@Override
public PluginAction[] getActions() {
    return new PluginAction[0];
}

There is a lot more of customisation, I will write down other papers in the next days !

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.