Sun Java logo     Previous      Contents      Index      Next     

Sun logo
Sun Java System Portal Server 6 2004Q2 Desktop Customization Guide 

Chapter 14
Customizing the Service Providers

This chapter provides common customization tasks for modifying the Search provider and Discussion provider.

This chapter contains the following sections:

Overview of Customizing the Service Providers

The Sun Java System Portal Server software includes a search service and discussion service provider.

Overview of Customizing the Search Provider

The Search provider (SearchProvider) furnishes a basic reference user interface that contains both search and browse functionality. Search functionality includes basic search mode, and advanced search for more complex searches. You can perform specific field searches in advanced search mode. For example, while in advanced mode, you can search within the title, URL, last modified date, author, and so on.

SearchProvider provides a link for category browsing. In addition, you can create a taxonomy for the Search Engine along with category filter rules. You can browse through the taxonomy tree and view documents within a category through the Search provider interface.

Search Provider Design

The Search provider uses JSPProvider to access the Portal Server back end services. The Search provider users JavaServer Pages™ (JSP™) helper tag libraries to avoid using Java™ scriptlets. The searchServer is a global service list type attribute that is configured and updated at installation time. The Search provider is responsible for directing the search request to the appropriate back end Search Engine server.

See Chapter 2, "Display Profile Properties" for the display profile properties you can set for the provider.

Search JavaServer Pages and Tag Libraries

The Search provider consists of two stages—input form and results—and the JSPs used by the Search provider fall into one of those two stages.

Figure 14-1 explains the JSP layout for searchContent.jsp. In the input stage (Stage 1), searchContent.jsp makes use of searchMenu.jsp and psSearch.jsp to set up the initial interface. The basicSearch.jsp file is used for a basic search and advancedSearch.jsp file for an advanced search. The description menu— that is, the Full, Brief, and Title menus—is displayed for both basic and advanced searches by descMenu.jsp file. The browseHeader.jsp file defines the browse interface.

In the results stage (Stage 2), one of three JSPs is used: browseOnly.jsp file sets and executes the parameters for category browsing using the Search tag library, and includes the browseResults.jsp page; browseSearch.jsp file sets and executes the parameters for searching and browsing within categories using the Search tag library and includes browseSearchResults.jsp; and searchOnly.jsp file sets and executes the parameters for search using search the Search tag library and includes results.jsp and score.jsp for the match relevance. The pageFooter.jsp file displays the list of pages, Next, and Previous links.

Figure 14-1  JSP Layout for searchContent.jsp

See Appendix C, "JavaServer Pages Reference" for more information on the Search JSP files.

The Search JSPs use the following tag libraries, which ship with the Portal Server software:

See Appendix D, "JavaServer Pages Tag Library Reference" for more information.

Overview of Customizing the Discussion Provider

The DiscussionProvider is JSPProvider based and hence customizable. It uses the Desktop themes. It retrieves data from the back end Search service using search taglibs and API. The discussions and comments are stored as separate Resource Descriptors (RDs) in the discussion database.

The DiscussionProvider includes features such as discussion threads, starting discussions based on documents or new topics, searching discussions, and rating discussions. By default, the Discussions channel is available on the sample portal for anonymous users. However, an anonymous user cannot subscribe to a discussion or edit the Discussion channel.

The DiscussionProvider supports a full view (via the Discussions channel) and a lite view (via the DiscussionLite channel.) It has the following main functions:

A Discussion Lite view retrieves main posts sorted by last-modified date and has pagination so users can access older discussions. View discussion displays each discussion subtree. The main item is displayed in detail and the subtree is displayed below the main item. View discussion includes:

Expansion threshold helps to control displayed items in the subtree. The users can choose to expand only highly rated documents, or expand all or collapse all. Default value is collapse all. Expand all will expand all the filtered comments. It will also show a description of the discussion, provide a menu for rating the discussion, and allow the user to post a reply.

Discussion Service Channels

The DiscussionLite channel and the Discussions channel are based on the DiscussionProvider.

DiscussionLite Channel

The DiscussionLite channel displays the top twenty discussion titles (which can be reconfigured) and the date. The discussions are sorted by creation date (last modified) and the newest discussion is displayed first. The DiscussionLite channel view has links to view each discussion, view all discussions, and start a new discussion. All these links target the Discussions channel which gets displayed in the JSPDynamicSingleContainer.

Properties for this channel can be configured from the administration console. By default, there are no user editable properties for this channel.

Discussions Channel

The Discussions channel includes a full view that:

Discussion JavaServer Pages and Tag Libraries

Similar to the search channel JSPs, the discussion channel JSPs have a query portion, a display portion, and use Desktop themes.

For more information on the channel specific JSP files, see Appendix C, "JavaServer Pages Reference."

Tips for Customizing the Service Providers

This section provides some basic tips for customizing the search and discussion providers.

Debugging the Service Providers

The Portal Server software provides files to help debug the Search and Discussion providers.

The following directory contains various search log files:


The following search log file records the search query sent to the Search Engine by the Search server:


See the Portal Server Administration Guide for more information about the Search log files.

Location of JavaServer Pages

JavaServer Pages for the Search channel are in the /etc/opt/SUNWps/desktop/default/Search directory.

JavaServer Pages for the DiscussionLite channel are in the /etc/opt/SUNWps/desktop/default/DiscussionLite directory.

JavaServer Pages for the Discussions channel are in the /etc/opt/SUNWps/desktop/default/Discussions directory.

Modifying JavaServer Pages

When you modify statically included JavaServer Pages, be sure to run the touch command, otherwise no changes are reflected. You need to either run the touch command on the top-level JSP file or on all JSP files. For example,

touch searchContent.jsp


touch *.jsp

See also JavaServer Page Caching Information and Recompiling JSPs.

Accessing Channels Directly

You can access the search channel directly at the following URL:

http://server:port/portal/dt?provider=JSPDynamicSingleContainer&JSPDynamicSing leContainer.selectedChannel=Search&last=false&action=content

Modify all the links to use these extra parameters in the URL. For example, edit searchMenu.jsp file as follows:

<nobr>&nbsp;&nbsp;<a class=noUnderline href="<%=dpurl%>?mode=basic">Basic Search</a>&nbsp;&nbsp;</nobr>

Replace the bold portion with:

http://server:port/portal/dt?provider=JSPDynamicSingleContainer&JSPDynamicSing leContainer.selectedChannel=Search&last=false&action=content

You can access the Discussion channel directly at the following URL:

http://server:port/portal/dt?provider=JSPDynamicSingleContainer&JSPDynamicSing leContainer.selectedChannel=Discussions&last=false&action=content

Customizing the Search Provider

This section describes how to perform some common customizations on the Search provider.

    To Modify the Default Search Server

When you install the Portal Server software, the Search provider is linked back to the Search server by default. That is to say, the Search provider can connect to any Search server, but by default the value for the searchServer property is set to the following:


The searchServer property is normally initialized to the default portal server instance during the sample portal installation but this property is not set when you create a new organization or a new custom search channel. See Portal Server Administration Guide for information on configuring the searchServer property for the Search provider.

  1. Log in to the Sun Java System Identity Server software administration console as administrator.
  2. Choose Organizations from the Show menu in User Management.
  3. All created organizations display in the navigation pane.

  4. Navigate to the organization or sub-organization that you want to configure Search for.
  5. Choose Services from the Show menu.
  6. Click the properties arrow next to Desktop in the Navigation pane.
  7. Click Channel and Container Management.
  8. The Channels page appears.

  9. In the Channels section, click the Edit link for Search.
  10. The Edit Channel page appears for the Search channel.

  11. Edit the searchServer property with the Search server’s name.
  12. Click Save.
    To Add last-modified to the Search Result Display
  1. Modify searchOnly.jsp file by adding last-modified to the list of viewAttributes.
  2. For example:

    <search:setViewAttributes viewAttributes="hl-url,hl-title,hl-description,score,content-length,hl-clas sification,last-modified"/>

  3. Modify results.jsp file to display the last-modified date for document results using the SOIF getValue tag.
  4. For example:

    <% if (formbean.getDescription().equals("full")) { %>

        <FONT color=<%=tFontColor%> face=<%=tFontFace%>><search:getValue soifAttribute="description" escape="false"/></FONT><BR>

        <FONT color=#707070 face=<%=tFontFace%>><search:getURL escape="true"/><BR>

        <search:getValue soifAttribute="content-length" id="sz"/>

        <search:getValue soifAttribute="last-modified"/><BR>

    <% } %>

  5. Run the touch command.
  6. For example, type touch *.jsp.

  7. Reload the Desktop to verify the change.
    To Remove content-length from Search Results
  1. (Optional) Modify searchOnly.jsp file by removing content-length from the list of viewAttributes.
  2. The line to modify is the following:

    <search:setViewAttributes viewAttributes= "hl-url,hl-title,hl-description,score,content-length,classification   hl-classification"/>

    Remove content-length from this line.

  3. Modify results.jsp file by removing the line that displays the content-length.
  4. The line to modify is the following:

    <% } else if (formbean.getDescription().equals("full")) { %>

        <FONT size=-1 color=<%=tFontColor%> face=<%=tFontFace%>><search:getValue soifAttribute="hl-description" escape="false"/></FONT><BR>

        <FONT size=-1 color=#707070 face=<%=tFontFace%>><search:getValue soifAttribute="hl-url" escape="false"/><BR>

        <search:getValue soifAttribute="content-length" id="sz"/>

  5. Remove <search:getValue soifAttribute="content-length" id="sz"/> from this file.
  6. Run the touch command.
  7. For example, type touch *.jsp.

  8. Reload the Desktop to verify the change.
    To Display the Total Number of Documents in the Search Result Status Message

In this procedures, Steps 1 and 2 are independent of each other. If desired, run the touch command after Step 1 to see the results.

  1. Modify results.jsp by changing the search status line to add the <search:getTotalDocuments/> tag.
  2. For example:

    <NOBR><B>Document matches <search:getFirstHit/> - <search:getToHit/> (of <search:getHitCount/>)</B> out of <search:getTotalDocuments/></NOBR><BR>

    This results in the following display:

    Document matches 1 - 6 (of 6) out of 37

  3. Change browseResults.jsp by adding the <search:getTotalDocuments/> tag to the search status.
  4. For example:

    <FONT color="<%=tFontColor%>" face="<%=tFontFace%>" size="-1"><b>Subcategories <search:getFirstHit/> - <search:getToHit/> (of <search:getHitCount/>)</B> out of <search:getTotalDocuments/></FONT><br>

  1. Run the touch command.
  2. For example, type touch *.jsp.

  3. Reload the Desktop to verify the change.
    To Remove author from the Advanced Search Interface
  1. Comment our or remove the author related HTML from the advancedSearch.jsp file.
  2. For example:

    <!-- -->

    <!-- To disclude the "author" row, remark out the following section -->

    <!-- -->


        <td valign=middle align=right height=40><FONT color=<%=tFontColor%> face=<%=tFontFace%>><nobr> <LABEL FOR="advAuthor">Author</LABEL>

        <SELECT NAME="authorOp">

        <OPTION VALUE=<%=SearchContext.CONTAIN%> <%=formbean.authorOpSelection(SearchContext.CONTAIN)%>>does</OPTION>

        <OPTION VALUE=<%=SearchContext.NOTCONTAIN%> <%=formbean.authorOpSelection(SearchContext.NOTCONTAIN)%>>does not</OPTION>


        <td valign=middle align=left height=40><INPUT TYPE="text" NAME="authorVal" id="advAuthor" VALUE= "<%=SearchContext.htmlEncode(formbean.getAuthorVal())%>"></TD>


  3. Comment out author- related lines in advQuery.jsp file.
  4. // h = new HashMap();

        // h.put(SearchContext.OPERAND, "author");

        // h.put(SearchContext.OPERATION, formbean.getAuthorOp());

        // h.put(SearchContext.VALUE, formbean.getAuthorVal());

        // l.add(h);

        h = new HashMap();

        h.put(SearchContext.OPERAND, "title");

  5. Run the touch command.
  6. For example, type touch *.jsp.

  7. Reload the Desktop to verify the change.
    To Add a New Field to Advanced Search
  1. Uncomment the keywords section in advancedSearch.jsp file.
  2. <!-- -->

    <!-- To Include the "Keywords" row, unremark the following section -->



    <td valign=middle align=right height=40><FONT color=<%=tFontColor%> face=<%=tFontFace%>><nobr> <LABEL FOR="advKeywords">Keywords</LABEL>

    <SELECT NAME="keywordsOp">

    <OPTION VALUE=<%=SearchContext.CONTAIN%> <%=formbean.keywordsOpSelection(SearchContext.CONTAIN)%>>does</OPTION>

    <OPTION VALUE=<%=SearchContext.NOTCONTAIN%> <%=formbean.keywordsOpSelection(SearchContext.NOTCONTAIN)%>>does not</OPTION>


    <td valign=middle align=left height=40><INPUT TYPE="text" NAME="keywordsVal" id="advKeywords" VALUE= "<%=SearchContext.htmlEncode(formbean.getKeywordsVal())%>"></TD>



    Remove the <!-- and --> comment marks from this section.

  3. Add the keywords to advQuery.jsp file.
  4. h = new HashMap();

    h.put(SearchContext.OPERAND, "keywords");

    h.put(SearchContext.OPERATION, formbean.getKeywordsOp());

    h.put(SearchContext.VALUE, formbean.getKeywordsVal());


  5. Run the touch command.
  6. For example, type touch *.jsp.

  7. Reload the Desktop to verify the change.

Customizing the Discussion Channels

Customizing DiscussionLite Channel

    To Customize the DiscussionLite Channel Link Display Window
  1. Change directory to /etc/opt/SUNWps/desktop/default/DiscussionLite directory and edit the following JSP files.
    • display.jsp - In this file, comment out or delete the following line:
    • <a href="<%=desktopPathInfo%>?last=false&Discussions_dmode=vl&did=<%=Encoder.u rlEncode(url)%>"><B><search:getValue soifAttribute="title" escape="true" truncate="28"/></B></a>

    • discussionLiteContent.jsp - In this file, comment out or delete the following lines. :
    • Map pathInfo = new HashMap();

      pathInfo.put("action", "content");

      pathInfo.put("provider", "JSPDynamicSingleContainer");

      pathInfo.put("JSPDynamicSingleContainer.selectedChannel", "Discussions");

      pathInfo.put("last", "false");

      pageContext.setAttribute("pathInfo", pathInfo);

      <dtpc:getDesktopURL id="desktopPathInfo" pathinfo="$pathInfo"/>

  2. Replace all occurrences of desktopPathInfo with dt.
  3. The desktopPathInfo ensures that links are always displayed in the Discussions channel in a JSPDynamicSingleContainer. Remove this if you want links to be displayed in the Discussions Channels on the same tab. For example, replace the following line:

    <td align=center><font size="-1"><a target="ps_main" href= "<%=desktopPathInfo%>?Discussions_dmode=cmt">New Discussion</a></font>

This procedure will work only if Discussions and DiscussionLite are displayed on the same tab as in the sample portal. DiscussionLite links will be displayed in the Discussions channel on the right side on the collaboration tab.

    To Display DiscussionLite on the Front tab
  1. Modify MyFrontPageTabContainer and add DiscussionLite to the available and selected lists. For example:
  2. In the administration console:

    1. Log in and select Services (from the View pull-down menu) for your organization.
    2. Select Portal Desktop.
    3. Select Channel and Container Management link and MyFrontPageTabContainer from the list of containers.
    4. The page to edit the MyFrontPageTabContainer is displayed.

    5. Select DiscussionLite from the Existing Channels list and select the Add arrow pointing towards Available and Visible list.
    6. Select Save and log out.
    7. From the command line, edit dp-org.xml file to include DiscussionLite in the available and selected list. For example, add the text shown below in bold:

      <Container name="MyFrontPageTabPanelContainer" provider="PredefinedFrontPageTabPanelContainerProvider">

          <Properties> ...</Properties>


              <Reference value="DiscussionLite"/>



              <Reference value="DiscussionLite"/>




  3. Modify the DiscussionLite channel display profile isEditable property and set it to true.
  4. Log in and verify.

Customizing Discussions Channel

    To Display Additional Fields in the List View of Discussions
  1. Change directories to /etc/opt/SUNWps/desktop/default/Discussions.
  2. Modify query.jsp file and add xxx field to viewAttributes.
  3. For example, add content-length as follows:

    <search:setViewAttributes viewAttributes= "url,title,description,rd-rating,author,last-modified,rd-last-changed,rd-re ference-id, rd-num-rating,rd-sum-rating,rd-peak-rating,rd-reference-url,content-lengt h"/>

  4. Add the new fields in fullDiscussionDisplay.jsp file wherever appropriate.
  5. For example:

    <search:getValue soifAttribute="content-length"/>

    To Modify the Sort Order in List All Discussions Page

By default, discussions are sorted by the last-modified date/time. That is, discussions are displayed in a descending order with the latest or most recent discussion shown first.

To modify the sort order in list All Discussions page, modify the viewOrder property in fullDiscussion.jsp file. For example, you can reset the value below to author or rd-last-changed:

<jx:set var="viewOrder" value="-last-modified"/>

    To Modify viewHits in View Discussion Page

<jx:set var="hitNumber" value="500"/>

By default, the viewHits property is set to 500. Make this -1 if you want all the comments to be displayed or reduce this number to improve performance. For example, if the value is 200, only the first 200 comments will be displayed in this case (includes comments and sub-comments.) The hitNumber for view discussion page can be reset in the viewDiscussion.jsp file.

    To Inherit Classification and readACL

If you have classified only the parent discussion manually or modified the access control for the parent discussion, you may want to inherit those values in discussion replies as follows:

  1. Change directories to /etc/opt/SUNWps/desktop/default/Discussions.
  2. Edit feedbackProcess.jsp file and modify the values of inheritClassification and inheritReadACL.
  3. By default, these are set to false. Reset them to true if you want comments to inherit the parent’s classification field and readACL field. Note that comments are automatically protected in this case.

  4. Save the file.
    To Control Access to Discussions

This can be accomplished by one of the following two ways:

  1. Modify the dbname property in the display profile for Discussions and DiscussionLite channel for each role to point to a different database.
  2. In this case users in one role cannot view discussions created by users in a different role.

  3. Or modify the ReadACL of the parent discussion as it gets submitted in the database and set inheritReadACL to true.
  4. That is, you must search for the discussion first or search for rd-reference-id <contains> ROOT and modify the readACL field for discussions.

Previous      Contents      Index      Next     

Copyright 2004 Sun Microsystems, Inc. All rights reserved.