Tuesday, February 28, 2012

IBM Rational Floating License on Network Servers

When install IBM Rational floating license on a network server that resides behind firewall, it is importatnt to note in the license.dat file, we must specify individual port numbers on not only the SERVER line, but also each VENDOR or DAEMON line, as shown in below.

SERVER    <hostname>   <host or NIC ID>   <lmgrd port>

VENDOR ibmratl PORT=<ibmratl port>

The <lmgrd port> in SERVER line defines the port number used by the license manager daemon (lmgrd), and the <ibmratl port> defines the port number used by the vendor daemon (ibmratl). Once firewall is configured to allow access to these port numbers, desktop IBM Rational applicaitons can now access the license on network server.

Friday, February 24, 2012

Setup a Portlet Development Environment With IBM Rational Application Developer 8

This is a walkthrough for setting up a portlet development environment With IBM Rational Application Developer (RAD) 8.

Step 1 - Verify you meet the System requirements for Rational Application Developer 8.
Reference: http://www-01.ibm.com/support/docview.wss?rs=2042&uid=swg27019500

Step 2 - Download RAD 8 install package
Trial version can be found from http://www.ibm.com/developerworks/downloads/r/rad/?S_CMP=rnav

Step 3 - Install RAD 8
Lunch the IBM Installation Manager to install Rational Application Developer for WebSphere, in Features screen, select Portlet and Portal development tool. If you don't have a local portal server installed, make sure the "Tools for developing applications without a local server installation" option is selected, as shown in below.

Step 4 - Setup a Portal Server in RAD
1) From the RAD menu, Window -> Show View -> Servers
2) Right-click the server view and click New -> Server.
3) On the Define a New Server page, select WebSphere Portal Server
4) Follow the New Server wizard and provide the WebSphere Settings, WebSphere Portal Settings and Properties Publishing Settings.

Step 5 - Verify the setup
Right-click the Portal server in the server view then do a start and stop to verify the server setup.

Congratulations! Now you have set up a portlet development environment in RAD, and you are ready to start portlet development.

Thursday, February 23, 2012

Maven substitution and Freemarker template

If you're using Freemarker template in Maven projects, double check to be sure your templates are not alerted by Maven filtering during build process.

During Maven build, the Maven filtering process will scan all resources for property references surrounded by ${ and }. When it finds these references it will replace them with the appropriate value. If any Freemarker templates are in Maven resource directory (e.g. src/main/resources), and contains Freemarker variable names (surrounded by ${ and } as well) that are also maven property names, then these references will be replaced with maven property values.

An example is shown in below

<tr>
  <td class="label">Name:</td>
  <td>${name}</td>
</tr>

Where the ${name} variable is meant to a Freemarker variable name and should be replaced during application runtime using model values, however, during Maven build, it is replaced to the Maven project name and the final package file will have the template file with the variable substituted, as shown in below.

<tr>
  <td class="label">Name:</td>
  <td>My Maven project</td>
</tr>

Simple way to fix this is to use a different variable name that maven doesn't aware, or a better way is to disable the maven filtering for all Freemarker template files in the pom file. In order to do so, you need to declare two mutually exclusive resource sets, the first resource set execludes Freemark templates from the filtering, and the other resource set copies Freemark templates unaltered, as shown in below.

<resources>
  <resource>
    <directory>src/main/resources</directory>
    <filtering>true</filtering>
    <excludes>
      <exclude>**/*.ftl</exclude>
    </excludes>
  </resource>
  <resource>
    <directory>src/main/resources</directory>
    <filtering>false</filtering>
    <includes>
      <include>**/*.ftl</include>
    </includes>
  </resource>
</resources>