Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • WebSphere Portal Family wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category IBM Redbooks: Building a Sample Website Using IBM Web Content Manager 7.0 IBM Redbooks: Building and Implementing a Social Portal IBM Redbooks: Developing Exceptional Multi-Channel Web Experiences V7: IBM Web Content Manager Product Documentation V7: IBM WebSphere Portal Enable for z/OS Product Documentation V7: IBM WebSphere Portal Express Product Documentation V7: WebSphere Portal Product Documentation V8: IBM Web Content Manager Product Documentation V8: IBM WebSphere Portal Express Product Documentation V8: IBM WebSphere Portal Product Documentation (includes z/OS) Custom Search Scope...
Search
Community Articles > WebSphere Portal > Understanding the IBM Eclipse HelpAdvisor Service in IBM WebSphere Portal Server
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

IBM contributorDeepak Gupta1
Contribution Summary:
  • Articles authored: 1
  • Articles edited: 0
  • Comments Posted: 0

Recent articles by this author

Understanding the IBM Eclipse HelpAdvisor Service in IBM WebSphere Portal Server

The IBM Eclipse HelpAdvisor Service in IBM WebSphere Portal Server can be consumed by any portlet application to enable a Help mode, for example, WebSphere Portal Help documents. In this article, we discuss how this service works and how it can be used by any WebSphere Portal Server ...

Community articleUnderstanding the IBM Eclipse HelpAdvisor Service in IBM WebSphere Portal Server

Added by IBM contributor Deepak Gupta1 | Edited by IBM contributor Leslie Gallo on June 19, 2012 | Version 3
  • Edit
  • More Actions Show Menu▼
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars
expanded Abstract
collapsed Abstract
The IBM Eclipse HelpAdvisor Service in IBM WebSphere Portal Server can be consumed by any portlet application to enable a Help mode, for example, WebSphere Portal Help documents. In this article, we discuss how this service works and how it can be used by any WebSphere Portal Server application.
Tags:
ShowTable of Contents
HideTable of Contents
  • 1 Overview of IBM Eclipse HelpAdvisor Service
  • 2 How IEHS works when a portlet calls its Help
  • 3 How IEHS can be integrated by an application
  • 4 Conclusion
  • 5 Tell us what you think
  • 6 Resources
  • 7 About the author

Overview of IBM Eclipse HelpAdvisor Service


IBM® Eclipse HelpAdvisor Service (IEHS) is a customized portlet service in IBM® WebSphere® Portal Server. The service displays a Help topic in a pop-up window by using the Eclipse Help System Web Infocenter UI for JavaTM Specification Request (JSR) portlets. The topic is shown by use of the user's preferred locale from their WebSphere Portal user profile.

IEHS is composed of the following components:

HelpAdvisor Service interface. Defines the functionality that the service will provide and extends the com.ibm.portal.service.PortletService interface (see listing 1). This service ensures there is only one HelpAdvisor instance, shared among all portlets.

Listing 1. HelpAdvisor Service interface

import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import com.ibm.portal.portlet.service.PortletService;

import com.ibm.wkplc.helpadvisor.*;

     public interface HelpAdvisorService extends PortletService
{

	/**
	 * Locate the HelpAdvisor singleton
	 */
	public HelpAdvisor getHelpAdvisor();

	/**
	 * Display a help topic in the pop-up window 
	 */
	public void showHelpTopic(RenderRequest request, RenderResponse response, String topic_ref);

}


HelpAdvisor Service implementation. Implements the PortletServiceProvider interface of com.ibm.portal.portlet.service.spi package to enable use of the portlet service lifecycle methods in addition to its own service interface (see listing 2).

Listing 2. HelpAdvisor Service implementation

public class HelpAdvisorServiceImpl
	implements HelpAdvisorService, PortletServiceProvider
{
		
    public void init(Preferences servicePreferences)
    {
		/**
	 * Initialize this service by creating a HelpAdvisor and 
	 * initializing it with the app_context definitions for base Portal
	 */
     }

	private static synchronized void initHelpAdvisor()
	{
		if (s_helpAdvisor == null)
		{
			s_helpAdvisor = HelpAdvisorFactory.makeHelpAdvisor();
		}
	}

	
	private Properties getConfig(Preferences prefs)
	{
	
           /*
	 * Read  initialization parameters
	 * from <wp_profile>/PortalServer/config/config/services/helpadvisorservice.properties
	 * to contribute the app_context.xml files used by base Portal.
	 * The app_context files are listed in helpadvisorservice.properties with 
	 * consecutive keys "appcontext1", "apppcontext2", etc
	 *
	 * Extension products should have their own properties files with the paths(s)
	 * to their app_context.xml files and call addAppContexts() directly.
	 */
		
	}

	
	public HelpAdvisor getHelpAdvisor()
	{
		/**
             	 * Return the HelpAdvisor
	             */
	}

	
	public void showHelpTopic(RenderRequest request, RenderResponse response, String topic_ref)
	{
	    /**
	      * Display a help topic using preferred language from Portal user profile
	      * 
	      * Redirects the Portal Help pop-up window to the Eclipse Help Server
	      */
 	}


	public void showHelpTopic(PortletRequest request, PortletResponse response, String topic_ref)
	{
	  showHelpTopic(APIConverterFactory.getInstance().getRenderRequest(request),
            APIConverterFactory.getInstance().getRenderResponse(response),
            topic_ref);
	}

}

How IEHS works when a portlet calls its Help


The following steps are executed at run time when a portlet launches its Help; in this section, we have used the ManagePages portlet as an example:

1. A portlet is loaded along with configuration settings defined under config-param in portlet.xml file. Here we are more concerned with appId and helpjsp parameters (see listing 3).

Listing 3. portlet.xml file showing the config params

	      <config-param>
	               <param-name>helpjsp</param-name>
	                <param-value>WEB-INF/help/pageManagerHelp.jsp</param-value>
	            </config-param>
	            
	           <config-param>
	                <param-name>appId</param-name>
	                <param-value>com.ibm.wp.admin.help.managing_pages</param-value>
	           </config-param>

2. A user pulls down the portlet menu and clicks Help, the portlet turns into Help ,mode and call its doHelp() method to take the necessary actions. In doHelp(), the portlet calls AbstractAdminPortlet.java's do Help(). This class is available at:
ui\wp\code\wp.admin.common\src\com\ibm\wps\portlets\admin\AbstractAdminPortlet.java
3. AbstractAdminPortlet.java calls helpAdvisor.getHelpContextRef(appId), which is retrieved from Step 1 (com.ibm.wp.admin.help.managing_page).

4. IEHS refers to a configuration file, com.ibm.wp.admin.help.managing_pages, which is available under the directory, \PortalServer\config\config\service. This file contains key value pairs corresponding to appId and help html files. HelpAdvisor returns the corresponding context-ref (com.ibm.wp.admin.help/admin/h_main_managing_pages.html), as shown in listing 4.

Listing 4. Mapping between appId and context-ref

<?xml version="1.0" encoding="utf-8" ?>

<app-contexts>
    
    <app-context app-id="com.ibm.wp.admin.help.managing_pages" context- ref="com.ibm.wp.admin.help/admin/h_main_managing_pages.html"/>

<more entries....>

</app-contexts>


5. AbstractAdminPortlet.java calls helpAdvisorService.showHelpTopic(portletRequest, portletResponse, contextRef).

6. HelpAdvisor Service redirects to the Help window, which displays on clicking over Help in the portlet menu, to the URL:
http://server.host.name:portNo./wps/iehs/topic/com.ibm.wp.admin.help/admin/h_main_managing_pages.html
Note that:
  • wps/iehs is a separate Web application running under WebSphere Portal Server, which is an Eclipse Help Web application.
  • The document plugin, com.ibm.wp.admin.help, can be found under IEHS_war.ear\IEHS.war\WEB-INF\lib\eclipse\plugins\com.ibm.wp.admin.help.
  • The Help file, admin/h_main_managing_pages.html, can be found inside the doc.zip, inside doc plugin.
Listing 5 shows the doHelp method in the AbstractAdminPortlet.java file
.
Listing 5. doHelp method in AbstractAdminPortlet.java file

public void doHelp(PortletRequest portletrequest, PortletResponse portletresponse)
        throws PortletException, IOException

    {
        String helpJSP = portletrequest.getPortletSettings().getAttribute(CONFIG_PARAM_HELPJSP);
        String appId = portletrequest.getPortletSettings().getAttribute(CONFIG_PARAM_APPID);

        if(Product.isEclipseEnabled())
        {
            LoadISCHelp loadischelp = new LoadISCHelp();
            loadischelp.ISCAdminHelp(portletrequest, portletresponse, helpJSP);
        } else
        if(appId != null && !appId.trim().equals(""))
            try
            {
                HelpAdvisorService helpadvisorservice = (HelpAdvisorService)getPortletConfig().getContext().getService(com/ibm/wkplc/helpadvisorservice/HelpAdvisorService);
                if(helpadvisorservice == null)
                {
                    if(logger.isLogging())
                        logger.text("doHelp", "HelpAdvisorService is not found.");
                    getPortletConfig().getContext().include(helpJSP, portletrequest, portletresponse);
                } else
                {
                    HelpAdvisor helpadvisor = helpadvisorservice.getHelpAdvisor();
                    String contextRef = helpadvisor.getHelpContextRef(appId);
                    helpadvisorservice.showHelpTopic(portletrequest, portletresponse, contextRef);
                }
            }
            catch(Exception exception)
            {
                if(logger.isLogging())
                    logger.text("doHelp", "An exception is caught.", exception);
                getPortletConfig().getContext().include(helpJSP, portletrequest, portletresponse);
            }
        else
            getPortletConfig().getContext().include(helpJSP, portletrequest, portletresponse);
    }

How IEHS can be integrated by an application


A portlet application in WebSphere Portal Server can follow steps mentioned below to get the help using HelpAdvisorService.

1. Acquire reference to the HelpAdvisor Service, using Java Naming and Directory Interface (JNDI) to get the HelpAdvisorService (see listing 6):
a) First, define a class variable of type PortletServiceHome.
b) Then perform the JNDI lookup.
c) If the HelpAdvisorService is found, then set the PortletServiceHome variable; if PortletServiceHome is not null, then get the HelpAdvisorService.
Listing 6. JNDI lookup for IEHS

  PortletServiceHome helpAdvisorServiceHome=null;                   

try{
                  Context ctx=new InitialContext();
                                                                                               // JNDI lookup for HelpAdvisorService

                 Object home = (PortletServiceHome)   
                                          ctx.lookup("portletservice/com.ibm.wkplc.helpadvisorservice.HelpAdvisorService");

                 if(home!= null){
                     helpAdvisorServiceHome = (PortletServiceHome) home;
                  }
   }catch(javax.naming.NamingException ne){
      ne.printStackTrace();
    }
 
                                                                                               // HelpAdvisorService handler
     if(helpAdvisorServiceHome!=null){ 
        HelpAdvisorService helpAdvisorService =(HelpAdvisorService)  
                                         helpAdvisorServiceHome.getPortletService(HelpAdvisorService.class);
      }
  


2. Get HelpAdvisor Service handler:
a) After getting the references to HelpAdvisorService, obtain HelpAdvisor config object using getHelpAdvisor method:
HelpAdvisor helpadvisor = helpAdvisorService .getHelpAdvisor();
b) Get context references for the portlet application using config. Object, like:
helpadvisor.getHelpContextRef(appId);
c) Finally, call showHelpTopic to get the Help contents in a separate dialog box:
helpAdvisorService.showHelpTopic(portletrequest, portletresponse, contextRef);

Conclusion


This article explained how IEHS works in WebSphere Portal Server to get the Help of a portlet application and how it can be consumed in any application. You can now take advantage of this service to enable your application with Help support.

Tell us what you think


Please visit this link to take a one-question survey about this article:
http://www.surveymonkey.com/s/9Q6ZKGN

Resources


WebSphere Portal product documentation:
http://www-10.lotus.com/ldd/portalwiki.nsf/xpViewCategories.xsp?lookupName=Product%20Documentation

About the author


Deepak Gupta is Staff Software Engineer based at IBM's Delhi, NCR, India, facility, where he works on WebSphere Portal development and customer engagements and is currently the worldwide focal point for People Components for WebSphere Portal. He also is a SME for WebSphere Portal. Deepak holds a Bachelor degree in Computer Science and Eng. from the Indraprastha University, India. He can be reached at deepak.gupta@in.ibm.com.


  • Edit
  • More Actions Show Menu▼


expanded Attachments (0)
collapsed Attachments (0)
Edit the article to add or modify attachments.
expanded Versions (3)
collapsed Versions (3)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (3)Jun 19, 2012 3:26:13 PMLeslie Gallo  IBM contributor
1Jun 19, 2012 2:53:38 PMDeepak Gupta1  IBM contributor
1Jun 19, 2012 3:13:31 PMLeslie Gallo  IBM contributor
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • FacebookIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkIBM Collaboration Solutions
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use