Wednesday, October 16, 2013

Customizing UI elements of the Authoring Template


Wow, its quite useful feature!!!. Now we have a ability to change the UI of the authoring field using custom JSP.


Benefits:-

1. Change the UI look and feel as per customer input
2. Restriction on the input value
3. Opportunity to write business logic on fly


Steps to do:-

1. Edit authoring template
2. Go to Default Content Properties
3. Click on "page icon"(properties) next to the field for which you need to customize the UI
4. Give the JSP path in the Custom JSP field. For ex: "/jsp/html/customUIField.jsp"
5. Place the custom jsp at "/wcm/wp_profile/installedApps/node/PA_WCM_Authoring_UI.ear/ilwwcm-authoring.war/jsp/html"

Ref: http://publib.boulder.ibm.com/infocenter/wpdoc/v6r0/index.jsp?topic=/com.ibm.wp.zos.doc/wcm/wcm_dev_custom_jsp.html

Tuesday, October 15, 2013

WCM API online reference


WCM API online reference

http://public.dhe.ibm.com/software/dw/lotus/portal_javadoc/80/wcm/api-javadoc/index.html

Saturday, October 12, 2013

workspace.getById() throws AuthorisationException

Recently came across a requirement to migrate JSP component scripts from 6.1 to 8. In the process of migration found that workspace.getById() WCM API call is not functioning. 

Looking at the logs one could see following kind of error

com.aptrix.pluto.security.AuthorisationException: IWKPY1015X: 
Unauthorised access by {{employeenumber=11111111,ou=people,ou=b2e,ou=ebusiness, 8ef21840-54a0-102c-96c8-950414f94614, fi, Type: User}, 4, {false, {userAccess={}}, {editorAccess={}}, {managerAccess={}}, [all_auth_portal_users%all_auth_portal_users_group_id, anonymous_user%anonymous_user_id, all_users%all_users_group_id


The surprising thing is this happens in-spite of giving "Anonymous user access" 
When looked at the details found following 

In Websphere Portal 8, WCM API calls from custom JSPs by default relies on "Contributor" access to the target content. 

If one wants to override this rule could place following call just before the getById() call.

workspace.useUserAccess(true)


Ref: https://www-304.ibm.com/support/docview.wss?uid=swg21399507


Monday, July 22, 2013

Multilingual Plugin Installation

Hi All,

Recently I had a opportunity to work on MLS plugin that is packaged with WPS. From V7 on-wards it is packaged with the portal. In this blog just I will highlight how to install it.

How to install

1. Go to wkplc.properties(Its located at wp_profile/ConfigEngine/properties) and check WasPassword  and PortalAdminPwd are set.

2. Go to wp_profile/ConfigEngine and run following commands

3. ConfigEngine.bat register-wcm-mls

4. ConfigEngine.bat deploy-wcm-mls

5. Restart Portal


Refer Official documentation: http://infolib.lotus.com/resources/portal/8.0.0/doc/en_us/PT800ACD022/8001/wcm/wcm_mls_install.html

Wednesday, July 3, 2013

JSP Element in Authoring Template


In WPSv8 we have a option to add JSP Element type in the Authoring Template.

Following is the path where .jsp files needs to be placed.

C:\IBM8\WebSphere\wp_profile\installedApps\Cell\PA_WCM_Authoring_UI.ear\ilwwcm-authoring.war\jsp\html 


Friday, June 7, 2013

MongoDB HTTP Interface

I wondered does MongoDB has REST interface (This thought came to be while i was going through CouchDB Futon). Found something interesting with mongoDB also

1. Start your mongod process with command "mongod --rest"

2. Hit http://localhost:28017 in you browser
     ->It should list you some system admin data.

     ->It should have given list of databases as a JSON response. For example I had bellow

{ "databases" : [ 
    { "name" : "blog",
      "sizeOnDisk" : 218103808,
      "empty" : false }, 
    { "name" : "course",
      "sizeOnDisk" : 218103808,
      "empty" : false }, 
    { "name" : "m101",
      "sizeOnDisk" : 218103808,
      "empty" : false }, 
    { "name" : "mydb",
      "sizeOnDisk" : 218103808,
      "empty" : false }, 
    { "name" : "pcat",
      "sizeOnDisk" : 218103808,
      "empty" : false }, 
    { "name" : "school",
      "sizeOnDisk" : 218103808,
      "empty" : false }, 
    { "name" : "students",
      "sizeOnDisk" : 218103808,
      "empty" : false }, 
    { "name" : "test",
      "sizeOnDisk" : 218103808,
      "empty" : false }, 
    { "name" : "local",
      "sizeOnDisk" : 1,
      "empty" : true } ],
  "totalSize" : 1744830464 }

4. You could see list of commands supported over REST at the following location

5. To  lists all documents under "posts" collection in "blog" database

6. To see a specific document in posts collection with query {author="narayan"}

Following link gives some comprehensive note on this HTTP interface. Read and benefit!!!

http://docs.mongodb.org/ecosystem/tools/http-interfaces/

Saturday, June 1, 2013

MongoDB Map-Reduce Example with Code

Today I was learning mongoDB map-Reduce function. To understand the concept I built the following example.

Assume we have the collections called “things” which has following records



[
        {
                "_id" : ObjectId("51a9e753d7a333351958d6be"),
                "id_" : 1234,
                "title" : "Microsoft .Net",
                "tags" : [
                        "dot net",
                        ".net",
                        ". net"
                ]
        },
        {
                "_id" : ObjectId("51a9e7a7d7a333351958d6bf"),
                "id_" : 5678,
                "title" : "J2EE",
                "tags" : [
                        "Java",
                        "Servelet",
                        "JSP"
                ]
        },
        {
                "_id" : ObjectId("51a9ebefd7a333351958d6c0"),
                "id_" : 2,
                "title" : "J2EE",
                "tags" : [
                        "JSF",
                        "Portlet",
                        "REST"
                ]
        },
        {
                "_id" : ObjectId("51a9ec3fd7a333351958d6c1"),
                "id_" : 3,
                "title" : "Microsoft .Net",
                "tags" : [
                        "C#",
                        "VB.net",
                        "ASP.net"
                ]
        }
]


If you see in the above collection, there are 2 records with title “J2EE”. Each record has 3 tags. My objective is to know totally how many tags for each course title(J2EE). For this I am set to use map-Reduce of mongoDB

Map function goes like this:


var mapFun = function(){
var k=this.title;
var v=this.tags.length;
emit(k,v);
};


In the above map function for each record, I am finding the total number of “tags” and emitting (throws) the key value pair as (J2EE, [3,3])

MongoDB map-Reduce function catches the emitted key value pairs from emit function. And it the groups the similar key records and puts the value in a array. Hence the resulting record is of form (“J2EE”, [3,3])

Reduce function goes like this:


var redFun = function(key,values){
            return Array.sum(values);
};


In the above reduce function, it totals the values present in the values array. In out example it would have received input like redFun(“J2EE”,[3,3]). So the return value would be 6 which is total number of tags for J2EE title.

Now our map-Reduce function is written as follows


db.things.mapReduce(
mapFun,
redFun,
{out:"tagcount"}
)


The above mapReduce function, we are outputting the value in “tagcount” collection. When “tagcount” collection is seen, it looks like bellow


[
        {
                "_id" : "J2EE",
                "value" : 6
        },
        {
                "_id" : "Microsoft .Net",
                "value" : 6
        }
]


So now we got the needed collection.


Simple REST Example without Security

I wanted to do one sample project using CouchDB. So I have been looking in to internet for very simple REST example with Java. Could hardly find any. Hope bellow one will help many.

This article is not going to tell what is CouchDB. Assume it as a REST provider. So when I hit a url in browser , it is going to give me a text response.

Following is the REST client which shows how the same url could be fired through JAVA program to obtain the result

------------------------------------------
package course;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;

public class RestClient {

    public final static String endpoint = "http://127.0.0.1:5984/courses/_all_docs";

    public static void main(String[] args) {
        HttpURLConnection request = null;
        BufferedReader reader = null;
        StringBuilder response = null;
        try{
            URL endpointUrl = new URL(endpoint);
            request = (HttpURLConnection)endpointUrl.openConnection();
            request.setRequestMethod("GET");
            request.connect();
            reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
            response = new StringBuilder();
            String line;
            while((line=reader.readLine())!=null){
                response.append(line);
            }
            reader.close();
            request.disconnect();
            System.out.println(response);

         } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (ProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
-----------------------------------------------------------------------------

Wednesday, May 22, 2013

Integrated solution console(Admin console) URL for V8 WPS

Following is the url format for accessing the ISC -Integrated solutions console or admin console of Websphere portal Server V8

https://host:10032/ibm/console/

URL to access WSDL document of WSRP producer


Hi,

I tried to look in to the list of WSRP services in the portal. To do this we need to type the following url

http://host:port/wps/wsdl/wsrp_service.wsdl

By default In V8, you could find 2 version of WSRP services v1 and v2. Each version will by default have

WSRPBaseService
WSRPServiceDescriptionService
WSRPPortletManagementService

Monday, April 15, 2013

Anonymous Search Collection for custom Search Portlet



Introduction

The objective of the task is to create a Portal Search collection, which
could index contents inside specific site area of the WCM. As the client
has specific UI needs, Instead of out of box Search Portlet, the developer
is expected to access the Search services from the custom portal. All
contents thus searched from the custom Portlet should be searchable in
anonymous mode.


Steps to Create Collection


· Go to Administration > Manage Search >Search Collections > Default
Search Collection
· Click "New Collection"



· Click "ok"


Steps to Create Index


· Click "NCCollection"
· Click "New Content Source"
· Under "Content Source type" select "WCM site"
· Under "General Parameters"
o Content Source Name : DataIndex
o Collect documents linked from this URL :
http://hostname:10039/wps/seedlist/myserver?SeedlistId=NC_Contents/Data&Source=com.ibm.workplace.wcm.plugins.seedlist.retriever.WCMRetrieverFactory&Action=GetDocuments
o Stop fetching a document after (sec): 1800

· Under "Schedulers"
o From: Today's Date
o At: Current time
o Update every: 1 days
o Click Create
· Under "Security"
o User Name: wpsadmin
o Password: wpsadmin
o Host Name: hostname
o Click Create

· Click "Save"
· Click Play icon


· After some time click "Refresh" to see no of Documents indexed





Giving Anonymous Access to the Collection Resources



· Go to Administration > Access > Resource Permissions > PSE Sources
· Click on "Assign Access"





· Click on "Edit Role" against User



· Click Add
· Select "Anonymous Portal User"
· Click "ok"


Accessing the Collection Service using contenthandler servlet

It is possible to launch the search over the index thus created using
contenthandler servlet. Following is the example url which caries a query
text as "keyword".

http://hostname:10039/wps/contenthandler/searchfeed/search?queryLang=en&locale=en&resultLang=en&query=keyword&start=0&results=10&index=Default
+Search
+Service%3A%3AC%3A%5CIBM%5CWebSphere%5Cwp_profile%5CPortalServer%5Ccollections%5CDataIndex

For linux/unix based portal environments, the url would be of bellow format

http://hostname:10039/wps/contenthandler/searchfeed/search?queryLang=en&locale=en&resultLang=en&query=keyword&start=0&results=10&index=Default
+Search
+Service%3A%3A%2Fopt%2FIBM%2FWebSphere%2Fwp_profile%2FPortalServer%2Fcollections%2FDataIndex

The above URL could be launched from the custom Portlet and the response
would be in the form of ATOM feed. The developer could parse the ATOM Feed
and build the custom Portlet as per the UI needs given by customer.

Sample Portlet using Web Experience Factory 8

To download Web experience Factory 8, go to
http://www.ibm.com/developerworks/downloads/ws/wpf/. Installation is fairly
simple. Now let's quickly start creating a sample Portlet.

· Create a project by clicking File>New>Web Experience Factory Project.
· In Project Name page, Enter Project Name: SampleProj
· Click Next
· In Feature Set Page, Uncheck all
· Click Finish
· Select No if prompted for "Would you like to publish project now?"
· Right Click "SampleProj"> New> Web Experience Factory Model
· Select "SampleProj"
· Click Next
· In Select Model page, Select "Main and Page"
· Click Next
· In Page Settings page, Select "Simple Page"
· Click Next
· In Save New model page, Select "models" folder and enter Model name
as "SamplePortlet"
· Click Finish
· You will have following Screen

· Now double click "SampleProject.model"
· Select "Application Tree" tab
· Select "page1"
· Click on "Add Builder Call to the Current Model"
· Select "Portlet Adapter"
· Click ok
· In the Portlet Adapter page
· Enter Name: SamplePortlet
· Portlet Title: SamplePortlet
· Portlet Description: SamplePortlet
· Click OK
· Now Right click "SampleProj">Export>Web Experience Factory Portlet
WAR
· Click Finish
· Now you could deploy the war thus obtained through Portal Web
Console.

Thursday, March 14, 2013

Piece of Content Servlet for URI resolution


From Wps 6.0.1 onwards we have URI resolution service that helps to construct preview url of the web content in a most efficient manner.

Assume that you have content in WCM in the following hierarchy.

Testlibrary
|-----Site1
            |---Sitearea1
                        |-----content1

To preview the content we could use following url



In the above /poc or /mpoc is mapped to a servlet which is part of latest URI resolution service.

Now goto the page where you added the JSR286 Web content Viewer Portlet. The beauty of this servlet is it makes use of “web content mappings” defined under the portal page properties “Advanced Options”>”Edit Web content Mappings”

Add “Sitearea1” in to the list. This will inform POC servlet that all contents under the “Sitearea1” will use this page as the target for rendering the Web contents.

Monday, March 4, 2013

Steps to export and import WCM libraries


Export:


  1. Log in to the WAS Integration Solution Console using Administrator id.
  2. Go to Resources>Resource Environment>Resource Environment Providers
  3. Select WCM WCMConfigService > Custom Properties
  4. Update/Create the property "export.libraryname". Set the value as string containing library names separated by semi colon.Example: export.libraryname=library_1;library_2;library_3
  5. Go to directory /IBM/Websphere/wp_profile/ConfigEngine
  6. Enter command ./ConfigEngine.sh export-wcm-data -DWasPassword=password -DPortalAdminPwd=password -Dexport.directory=/home/user/exportdir -Dexport.singledirectory=true
Transfer the file
  1. Compress the above directory using the zip command: zip -r exportdir.zip /exportdir 
  2. Transfer the zip file to the target server
  3. Unzip it in some folder say /home/user/importdir
Import
  1. Ensure target server does not have same libraries created in it. If present kindly delete
  2. Go to /IBM/Websphere/wp_profile/ConfigEngine
  3. Enter command ./ConfigEngine.sh import-wcm-data -DWasPassword=password -DPortalAdminPwd=password -Dimport.directory=/home/user/importdir

This is suitable for Initial setup of Environment where we need to transfer bulky contents. For further updates kindly use Syndication.

Tuesday, February 26, 2013

Configuring Advanced Search in Out of Box authoring portlet of WCM 8




1.        Open  Integration solutions console (having url like https://yourhost:port/ibm/console/logon.jsp)  and login as administrator

2.   Click Resources > Resource Environment > Resource Environment Providers.

3.   Click WCM WCMConfigService > Custom properties 

4.   Search for following entries.
  •  wcm.authoringui.advancedsearch.searchonselection
  • wcm.authoringui.simplesearch.addstar
  • wcm.authoringui.advancedsearch.addstar
If these are not available please create new by clicking on "New"

Now your portal is activated for using "Advanced search feature in OOB WCM authoring portlet"



 



Friday, February 1, 2013

WCM Library Syndication in WPS8

1. Launch the Portal administration of the Subscriber server (Receiver)

2. Creation of Credential Vault Slot: In WPS8, syndication mechanism
requires "Shared Credential slot", so start to create the one by
clicking Administration > Access > Credential Vault

3. Click "Add a Vault Slot" and enter the details


4. Note the check box against "Vault slot is shared". Finally Click "ok"

5. Configuring Subscriber: Now Click on Administration > Portal Content
> Subscribers

6. Click "Subscribe Now"

7. Enter the Syndicator url. Ex: http://sourcehost:port/wps/wcm

8. Enter syndicator name SYNDSOURCE

9. Enter subscriber name SUBDEST

10. Choose the credential vault slot created above

11. Click Next

12. Select the libraries you want to syndicate; select the scope

13. Click Finish

14. To begin syndication, click "Update Subscriber"