Tuesday, 7 May 2013

Adding a custom portlet


A portlet is a small, self-contained application page that is designed to be displayed along with other portlets in a portal.

A portlet is very similar to a WDK page. To design a portlet, you have to do the following things:

  1. Create a WDK page for the portlet. This must be a control page (.rdf extension), view page (.xsl), and model page (.xml)
  2. Create a page manager for the portlet. Usually this is done by extending the AbstractPortletPageManager class, providing an init method. This object specifies which WDK page is used for the portlet.
  3. Install the portlet in Saba.


Portlet Control File

A portlet control file is like an application page, with one difference. The cocoon-process node must be of type "portlet" (instead of "wdk" typically used for regular WDK pages). Thus, the first two lines of the file are:


<?xml version="1.0" encoding="UTF-8"?>
<?cocoon-process type="portlet"?>


Portlet View File

A portlet is usually displayed in a small area on a portal page, along with several other portlets. The precise size of a portlet is not known at design time, so make sure you don't use an absolute size in the HTML code; when possible, prefer relative size expressed in percentage, as in the example below.

<xsl:template match="wdk:model">
   <table width="100%" height="100%" border="0" cellspacing="1" cellpadding="0">
    <!-- content of the portlet goes here -->
    </table>
</xsl:template>


Portlet Model File

The model page is exactly like an application page's model page, and indeed the same model page could be used by both a portlet and an application page.


The Portlet Manager

Each portlet has a portlet manager object. The object provides information to Saba about the page to open.

I recommend that you write your portlet manager by extending the AbstractPortletPageManager class, which in turn implements the PortletPageManager interface (you may want to declare the implementation of the interface in your class too, to make it clearer).

public class MySimplePortletManager
   extends AbstractPortletPageManager
   implements PortletPageManager
{
   public void init() throws SabaException
   {
      /* Register the portlet's WDK page */
      registerPage(
         PortletPageManager.kDefaultDisplay,
         "/custom/pages/my_simple_portlet.rdf");
   }
}

The portlet manager class implements only one method: init()
This method needs to simply invoke the registerPage() method my passing two parameters:

  • The display to use for the portlet (currently only the default display is used)
  • The relative path of the WDK control page to display within the portlet

All done!
Salutacions cordials
@stefanotempesta



Sunday, 28 April 2013

Consuming a Web Service in Saba using .NET

Consuming a Web Service in Saba happens in two steps:

1) Authorization of the consumer via a service exposed by Saba and available at the following address:
This service returns a certificate to use in step 2

2) Invoke the web service exposed by your installation of Saba using the certificate

To make life easier with step 1, Saba distributes a .NET assembly that is a wrapper around that service; this wrapper contains two classes in the Saba.Platform namespace:

  • SabaLogin, that you should use for authentication

  • InfoServiceClient, that you should use for invoking your own service
  •  

A quick example of how to use the above classes in C#:

string username = "admin";
string password = "welcome";

// get an authentication certificate
string certificate = SabaLogin.Authenticate(endpointURL, username, password);

// invoke the "updateUsername" service
Hashtable requestParams = new Hashtable();
requestParams["old_username"] = "JSMITH";
requestParams["new_username"] = "HPOTTER";

XmlDocument response = InfoServiceClient.CallService(
   endpointURL,
   "updateUsername",
   certificate,
   requestParams);

requestParams is a map of parameters to pass to the service (no generics yet, Saba is still on the old-fashioned .NET 1.1 code...)
 
Communication is over SOAP, no REST services in Saba yet.
 
Enjoy!
Vriendelike groete
@stefanotempesta
 

Wednesday, 3 April 2013

Welcome to Saba Guru

Hello World :-)

And welcome to my new blog about Saba Software @sabasoftware

My intention is to share years of experience as a Solutions Architect for Saba, covering functional and technical aspects of a variety of solutions that I have implemented in my years working with and for Saba.

A little more about me, more posts will follow in the next days, weeks, months, years...

First of all, I worked with Saba solutions for nearly 15 years, directly for Saba Software in the UK, and also for international partners.

From my LinkedIn profile:


- Designed Web 2.0 applications based on J2EE and .NET frameworks, ensuring the architected design conforms to standards and best practices of Service Oriented Architecture (SOA) and Software as a Service (SaaS) principles

- Delivered technical leadership in software design, quality assurance and deployment, and developed extensive knowledge and experience of the entire project lifecycle using Agile Scrum methodology

- Delivered implementations of the Saba Enterprise system to Fortune companies in 70+ countries and 15+ languages, by integrating the product with Web Portals, Federated Identity Management systems using SAML, and Content Delivery Networks (Akamai)

- Built a portfolio of resalable service offerings, which contributed to the expansion of the Professional Services up to $1.5M per year of consulting revenue

- Managed, monitored and reviewed all programme economics to include project costs, staffing requirements, resources and risks, including contracts with suppliers to meet key performance indicators and agreed targets

 - Managed teams of business and technical consultants in the EMEA region, the US and India


I'm now preparing a plan of posts for this blog, that I'll share shortly. I'll try to blend a little of functional aspects of the Saba solution (how-tos, but not from a guide perspective, but rather real world cases), with technical tips & tricks learnt after years of battle on the field...

And in commemoration of the multiple locales supported by Saba, I'll end each post with a greeting in a different language!

Saluti,
Saba Guru