Deploying Toro Portlets with uPortal 3

Knowledge Base: uPortal, uPortal 3.0
Updated: August 19, 2008
How do I deploy Toro portlets with uPortal 3?
For With the release of uPortal 3.0.0-GA, the Toro project made a change in how the portlets are deployed. Going forward, deployment will take on the deployment methodologies employed by uPortal 3. This article outlines this procedure.


It is assumed that Ant 1.6.5 or greater, Java 1.5, Subversion, Maven 2, Tomcat 5.5.x or greater is installed.


Note the Gateway SSO Portlet is not compatible with CAS. CAS will need to be disabled in lieu of the standard uPortal security context configuration. See the section below on Gateway SSO Portlet.


Set JAVA_HOME

Set the JAVA_HOME environment variable to the location of the installed Java home directory.

export JAVA_HOME=/home/unicon/deuce/java  or for Windows set JAVA_HOME = c:\java

Check out a tagged release of uPortal 3.

Build uPortal-impl

There needs to be a built uportal-impl artifact available to build the Toro Portlets.
From the uportal-impl directory execute

uportal-impl> mvn -Dmaven.test.skip=true install

Check out a tagged release of Toro

Configure Toro

Copy toro-portal-2.0.0-rc-3/build.properties.sample to toro-portal-2.0.0-rc-3/build.properties and edit build.properties appropriately.

datasource=PortalDb
db.platform=postgres   # postgres, oracle, sqlserver
portal.webappName=uPortal
portal.server.hostname=localhost
portal.server.http.protocol=http
portal.server.port=:8080
smtp.server.hostname=mail.net
smtp.server.password=
smtp.server.port=25
smtp.server.username=
admin.email=admin@unicon.net
tomcat.home=/Users/deuce/dev/src/uportal/up3/tomcat
toro.data.home=/Users/deuce/dev/src/uportal/up3/data

Set the version of uportal-impl that was built.
Edit pom.xml and set uportal-impl.version appropriately

<uportal-impl.version>3.0.1</uportal-impl.version>

Set jdbc library dependencies in pom.xml

<jdbc.groupId>postgresql</jdbc.groupId>
<jdbc.artifactId>postgresql</jdbc.artifactId>
<jdbc.version>8.2-504.jdbc3</jdbc.version>

Set hibernate.properties.

hibernate.connection.url=jdbc:postgresql://localhost:5432/up3
hibernate.connection.username=uni
hibernate.connection.password=uni
hibernate.connection.driver_class=org.postgresql.Driver
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

Install Toro Artifacts

toro-portal-2.0.0-rc-3> mvn -Dmaven.test.skip=true install

Initialize Toro Database

Invoke hibernate loading tool

toro-portal-2.0.0-rc-3> mvn hibernate3:hbm2ddl

Add functions for Oracle

This section is only applicable if installing with an Oracle database. The following function will need to be added:

--/
CREATE OR replace FUNCTION bitor( x IN NUMBER, y IN NUMBER ) RETURN
NUMBER  AS
BEGIN
     RETURN x + y - bitand(x,y);
END;

--/
create or replace function bitxor(p_dec1 in number, p_dec2 in number) return number is
begin
 return bitor(p_dec1,p_dec2)-bitand(p_dec1,p_dec2);
end;
/

--/
create or replace function bitremove(p_dec1 in number, p_dec2 in number) return
number is
begin
 return p_dec1-bitand(p_dec1,p_dec2);
end;
/

Configure uPortal 3

Set build.properties

server.home=/home/unicon/deuce/tomcat

Set uportal-impl/src/main/resources/properties/rdbm.properties. Be sure to use the same configuration as before. This example shows how to configure uPortal 3 to use a Postgres database. See the rdbm.properties file for examples of other database platforms.

hibernate.connection.driver_class=org.postgresql.Driver
hibernate.connection.url=jdbc:postgresql://localhost:5432/up3
hibernate.connection.username=uni
hibernate.connection.password=uni
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

Patch uPortal 3

For the Linux platform, the attached patch can be used which will patch uPortal rel-3-0-1-GA. To manually patch uPortal 3 to support Toro Portlets please follow this article.

From the toplevel of uPortal 3 execute

patch -p1 < toro-up3-0-1-GA-linux.patch

The remaining configuration is only to edit pom.xml and change

<jdbc.groupId>hsqldb</jdbc.groupId>
<jdbc.artifactId>hsqldb</jdbc.artifactId>
<jdbc.version>${hsqldb.version}</jdbc.version>

to (or the appropriate JDBC platform/version)

<jdbc.groupId>postgresql</jdbc.groupId>
<jdbc.artifactId>postgresql</jdbc.artifactId>
<jdbc.version>8.2-504.jdbc3</jdbc.version>

And add the following property with the appropriate toro version

<toro.version>2.0.0-rc-3</toro.version>

Gateway SSO Portlet

This is necessary if deploying the Gateway SSO Portlet

  • Edit uportal-impl/src/main/resources/properties/security.properties and comment out the entire "CAS & Local Authentication" section then uncomment the section the matches what you want to do.
  • Add a cached security context downstream from each security SimpleSecurityContextFactory context configured above. (i.e. root.simple.cache=org.jasig.portal.security.provider.CacheSecurityContextFactory)
  • Replace all the org.jasig.portal.security.provider.SimpleLdapSecurityContextFactory entries with org.jasig.portal.security.provider.CacheLdapSecurityContextFactory
  • Edit uportal-war/src/main/webapp/WEB-INF/web.xml and remove all CAS related init params, filters and filter mappings.

Configuring uPortal's portlet container to convey the password

In uportal-impl/src/main/resources/properties/contexts/portletContainerContext.xml, enhance the existing declaration:

<bean id="userInfoService" class="org.jasig.portal.portlet.container.services.MergingUserInfoService">
    <property name="userInfoServices">
        <list>
            <ref bean="personDirectoryUserInfoService"/>
            <ref bean="casTicketUserInfoService"/>
        </list>
    </property>
</bean>

to replace the cas reference with the cached password service:

<bean id="userInfoService" class="org.jasig.portal.portlet.container.services.MergingUserInfoService">
    <property name="userInfoServices">
        <list>
            <ref bean="personDirectoryUserInfoService"/>
            <ref bean="cachedPasswordUserInfoService"/>
        </list>
    </property>
</bean>

Of course, that reference needs to point at a bean declaration, so introduce a bean like this:

<bean id="cachedPasswordUserInfoService"  class="org.jasig.portal.portlet.container.services.CachedPasswordUserInfoService">
    <property name="portalRequestUtils" ref="portalRequestUtils" />
    <property name="userInstanceManager" ref="userInstanceManager" />
    <property name="portletWindowRegistry" ref="portletWindowRegistry" />
    <property name="portletEntityRegistry" ref="portletEntityRegistry" />
    <property name="portletDefinitionRegistry" ref="portletDefinitionRegistry" />
    <property name="passwordKey" value="password"/>
</bean>

Add Toro Stylings to uPortal 3 Theme

Add the following to the main theme file (the default is ./uportal-war/src/main/resources/layout/theme/universality/universality.xsl)

<link media="all" type="text/css" href="/toro-portlets-common/rendering/css/toro.css" rel="stylesheet"/>

 <xsl:template name="page.css">
    <link media="print" type="text/css" href="{$SKIN_PATH}/print.css" rel="stylesheet"/>
    <link media="all" type="text/css" href="{$MEDIA_PATH}/common/reset-fonts-grids.css" rel="stylesheet"/>
    <link media="all" type="text/css" href="{$MEDIA_PATH}/common/base-min.css" rel="stylesheet"/>
    <link media="all" type="text/css" href="{$SKIN_PATH}/layout.css" rel="stylesheet"/>
    <link media="all" type="text/css" href="{$SKIN_PATH}/jsr168_portlet_spec.css" rel="stylesheet"/>
    <link media="all" type="text/css" href="{$SKIN_PATH}/{$SKIN}.css" rel="stylesheet"/>
    <link media="all" type="text/css" 
        href="/toro-portlets-common/rendering/css/toro.css" rel="stylesheet"/>

    ...

Add Toro Portlet Publications

Copy the channel definition files for the Toro Portlets to the uPortal 3 Cernunnos entities directory.

cp <path-to-toro>/portlets/*/library/src/main/resources/properties/chanpub/*.channel
<path-to-up3>/uportal-impl/src/main/resources/properties/db/entities/channel

Set hostname

Replace http://localhost:8080 with the proper http(s)://hostname:port values and replace 'localhost:8080' with the appropriate hostname:port values in the following files

uportal-impl/src/main/resources/properties/portal.properties
uportal-impl/src/main/resources/properties/security.properties
uportal-impl/src/main/resources/properties/db/entities/channel/tomcat-number-guess.channel
uportal-impl/src/main/resources/properties/db/entities/channel/tomcat-servlet-examples.channel
uportal-impl/src/main/resources/dtd/channelRegistry.xml
uportal-war/src/main/webapp/WEB-INF/web.xml

Deploy uPortal

If you need to initialize the uPortal 3 database, then execute

ant -Dmaven.test.skip=true initportal

Otherwise execute

ant -Dmaven.test.skip=true deploy-ear



If the db target fails, you need to add a mapping to the specific database in the dbloader.xml file and run ant initportal again. Find the version information from the output of the ant initportal command

*************** No  exists for the current configuration. ********************
     [java] <db-type-mapping>
     [java]     <db-name>PostgreSQL</db-name>
     [java]     <db-version>8.1.2</db-version>
     [java]     <driver-name>PostgreSQL Native Driver</driver-name>
     [java]     <driver-version>PostgreSQL 8.2 JDBC3 with SSL (build 504)</driver-version>
     [java] </db-type-mapping>

And add it along with the type mappings that are found from other examples in the uportal-impl/src/main/resources/properties/db/dbloader.xml file

<db-type-mapping>
  <db-name>PostgreSQL</db-name>
  <db-version>8.1.2</db-version>
  <driver-name>PostgreSQL Native Driver</driver-name>
  <driver-version>PostgreSQL 8.2 JDBC3 with SSL (build 504)</driver-version>
  <type><generic>LONGVARCHAR</generic><local>TEXT</local></type>
  <type><generic>VARCHAR</generic><local>VARCHAR</local></type>
  <type><generic>LONGVARBINARY</generic><local>BYTEA</local></type>
  <type><generic>VARBINARY</generic><local>BYTEA</local></type>
  <type><generic>INTEGER</generic><local>integer</local></type>
</db-type-mapping>

Then start Tomcat as usual.

AttachmentSize
toro-up3-0-1-GA-linux.patch9.08 KB