Wednesday, 23 September 2009

Using Sametime Links within a simple portlet

Whilst helping a colleague prepare for a Portal demo, we had one final hurdle to climb; how to enable Sametime awareness for a generic user e.g. Customer Services Rep, without needing to deploy the normal Sametime Contact List or Who Is Here portlets.

I knew this was possible, and think I'd actually done it in the past - however, I couldn't find any notes or blog postings, so had to start again.

Having previously set up Portal and Sametime integration, it was a relatively simple matter - I chose to use the Q&D approach of creating a JavaServer Page (JSP) file, and then rendering it on the portal page using the out-of-the-box Blurb portlet.

This is the portlet that IBM uses throughout WebSphere Portal to present simple messages, including the "Welcome to WebSphere Portal" portlet that has been deployed in WebSphere Portal for the past few releases.

To achieve this, I created a file called sametime.jsp and deployed it in the Blurb portlet's JSP directory: -

\IBM\WebSphere\wp_profile\installedApps\starg\PA_Blurb.ear\Blurb.war\jsp\html\en

Here's the source of sametime.jsp: -

<html>
<head>
<link rel="stylesheet" href="http://stargate.uk.ibm.com/sametime/stlinks/stlinks.css" type="text/css" />
<script type="text/javascript" src="http://stargate.uk.ibm.com/sametime/stlinks/stlinks.js">
</script>
<script type="text/javascript" >
setSTLinksURL('http://stargate.uk.ibm.com/sametime/stlinks/', 'en');
STHost = 'stargate.uk.ibm.com';
writeSTLinksApplet('ibm','',false);
</script>
</head>
<body>
<script type="text/javascript">
writeSametimeLink('CN=domadmin,O=ibm', 'Portal Admin', false, 'icon:yes;');
</script>
</body>
</html>

As you can see, we're using JavaScript tags to specify the Sametime server ( in order to get both the Cascading Style Sheet and JavaScript code for the Sametime Links API, as well as to actually connect to Sametime ).

The value specified in the writeSTLinksApplet() call sets the domain from which the outgoing Sametime chat will be displayed e.g. when clicking on the Sametime link, a chat session will be opened up FROM ibm/Guest.

Finally, the value specified in the writeSametimeLink() call sets the Sametime user to whom we want to send the ST message - in our demo, this will a user such as Customer Services Rep or something similar.

Make sense ?

I have to admit that I borrowed much of the above JS coding from Daniele Vistali's most excellent blog post here: -

3 comments:

Daniele Vistalli said...

I love my post helped :) there.

Since where at it. Don't you think the whole Domino integration thing is a bit outdated.

We still rely on the old API from portal 4.1 to access domino / st / quickr etc.

The api is old, limited and could be improved a lot with some new ideas:

- Support for multiple domino servers not necessarily sharing a domino directory (currently you can only browser servers with a shared domino directory)
- Better documentation for the API
- Better configuration (move from CSEnvironment.properties to WAS properties)
- Better design as a set of portal service that allow for access of pre-configured and on demand backend servers.
- Exploitation of the credential vault API to create domino sessions using shared slots.

Can you see anything happen in the future of portal ?

Elmo said...

What's the best practice to deploy this portlet? Should I copy the PA_Blurb.ear (if I can find it) import it into eclipse, add the files, re-export it and upload it to portal? Or even better, how can I create my own PA_Blurb that does just that, display text. I want to keep it separate from the distribution because my custom content might get clobbered when patches are applied.

Dave Hay said...

@Elmo, it's really up to you, I only suggested using Blurb because it's a quick way to get JSP/HTML files displayed via an existing portlet. You could create your own custom portlet, using Eclipse / RAD etc., or simply export/rename/install PA_Blurb.ear.

It really depends upon your longer term requirements, but my approach was more about how STLinks could be used than a lesson on portlet development.

Since I wrote the original post, Sametime has moved on, and STLinks may no longer be the right solution for the job, especially since the Sametime Web Proxy was released - http://portal2portal.blogspot.co.uk/2011/04/ibm-lotus-sametime-proxy-server-upgrade.html

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...