Level: Intermediate Tim Buczak (tvb@us.ibm.com), IT Specialist, IBM Global Services
10 Mar 2003 This article describes how to use advanced XML Access routines to update portal properties and deploy portlet services in WebSphere Portal 4.1.
Introduction
With IBM ® WebSphere® Portal Version 4.1, you can use XML files to update Portal configurations. The Portal configuration client enables you to:
- Automatically set up portal servers
- Test deployment
- Backup portal installations
This article describes how to use advanced XML Access routines to update portal properties and deploy portlet services. It uses the example in
Modeling WebSphere Portal Portlets with UML, Part 3: Portlet Services
. This article assumes you are familiar with basic XML Access syntax and basic WebSphere Portal administration.
Background
Modelling Web Portal Portlets with UML, Part 3
describes an implementation of a portlet service that allows two portlets to use a user management portlet service to access a backend user profile database. The portlet application defines two portlets: a change password portlet and a user administration portlet. The change password portlet uses the portlet service to change, reset, or edit the user profile, whereas the user administration portlet resets or edits any user's profile. The user management service is abstractly defined and independent of the implementation of the portlet service.
This article shows how to use the portal configuration client XML Access tool to set up a first implementation of the user manager server using a Lightweight Directory Access Protocol (LDAP) implementation. Later, it shows how to use different configuration values using the Tivoli® Access Manager (TAM).
Portal configuration client XML Access
WebSphere Portal configuration client XML Access allows the Portal administrator to update and maintain a portal application installation and to easily maintain settings without having to remember which Portal administration portlet to use. For example, you can install a portlet, set security, and change parameters in one easy step using the Portal configuration client XML Access tool.
Use the Portal configuration client to update global WebSphere Portal settings, such as portlet services settings that are found in the
PortletServices.properties
file. This also allows you to change the portlet services implementation. In a well-defined portlet service, a developer can change the portlet service implementation without changing the portlet service interface. The portlet view layer is independent of any changes to the underlying model layer.
Another advantage of using XML Access scripts is that in a production environment with several portal servers instances for development, staging, quality assurance, and production, the portal administrator can maintain one set of scripts for each installation. The administrator can also make any server dependent changes in the deploy scripts without having to change the base code.
Deploying with XML Access scripts
WebSphere Portal provides an XML configuration client with WebSphere Portal version 4.x. The script is in the
Portal/bin
directory. To execute the XML Access client:
xmlaccess XMLfile user:password PortalConfigURL |
XMLfile
is location of the XMLFile to run.
user:password
is the userid and password that you use to login to WebSphere Portal.
PortalConfigURL
is the location of the Portal configuration servlet on the host, usually in
host/wps/config
. An example of the command is:
xmlaccess DeployPortlet.xml wpsadmin:wpsadmin myhost.ibm.com/wps/config |
When you invoke this command, it sends any output to the standard output. It is a good idea to pipe standard output to a file for later viewing. For more information, see the
Portal configuration interface section
in the WebSphere Portal InfoCenter.
Using XML Access tags for Portal parameters
The Portal configuration client XML Access defines tags you can use to update global Portal parameters, themes, skins, markups, and client device definitions.
The script elements are:
-
<global-settings>
sets global portal setting, such as component tracing. The parameters are generally referred to in the
PortalServer\app\wps.ear\wps.war\WEB-INF\conf\PortalSettingsLocation.properties
file.
-
<services-settings>
sets Portal service parameters. These parameters are generally native to the
PortalServer\app\wps.ear\wps.war\WEB-INF\conf\PortletServices.properties
file.
-
<skin>
sets portlet skins. These skins refer to resource JSPs in the
wps.ear\wps.war\skins
directory.
-
<theme>
sets portal themes. These themes refer to resource JSPs in the
wps.ear\wps.war\theme
directory.
Deploying portlet services
To enable the Portal Web application to use a particular portlet service, update the following files:
- PortletServices.properties
- Portlet service class
Deploying the first portlet service, LDAP implementation
This consist of three steps:
-
Install the LDAP UserManagement PortletService jar file in the WebSphere Portal Server application class path, such as
websphere/appserver/lib/app
.
- Run the XML script to set up the portlet services settings.
- Restart the Portal application server to pick up the changes for the portlet services settings.
LDAPUserManagementServiceImpl settings
To use the LDAP implementation, update the
PortletService.properties
file with the following values:
# --Setup the User Management Service and declare the necessary factory
mypackage.UserManagementService=mypackage.LDAPUserManagementServiceImpl
mypackage.LDAPUserManagementServiceImpl.factory=
org.apache.jetspeed.portletcontainer.service.PortletServiceCacheFactory |
In the LDAP user manager implementation, you can set basic parameters to connect the portlet service to the LDAP server as follows:
#-------- User Management Service Parameters --------------
mypackage.LDAPUserManagementImpl.ADMIN_DN=cn=User-Admin,o=mycompany
mypackage.LDAPUserManagementImpl.ADMIN_PWD=YjJicG9ydGFs
mypackage.LDAPUserManagementImpl.LDAP_HOST=ldap.mycompany.com
mypackage.LDAPUserManagementImpl.UserBase=ou=users,o=mycompany |
With XML Access, you can use the following script:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE request PUBLIC "-//IBM//DTD Portal Configuration 1.0//EN" "PortalConfig.dtd">
<:!--
This sample sets the parameters need to use the LDAP UserManagement portlet service implementation.
-->
<request>
<portal action="locate">
<services-settings action="update">
<parameter name="mypackage.UserManagementService" type="string"
update="set">mypackage.LDAPUserManagementServiceImpl</parameter>
<parameter name="mypackage.LDAPUserManagementServiceImpl.factory"
type="string" update="set">
org.apache.jetspeed.portletcontainer.service.PortletServiceCacheFactory
</parameter>
<parameter name="mypackage.LDAPUserManagementServiceImpl.ADMIN_DN"
type="string" update="set">cn=User-Admin,o=mycompany</parameter>
<parameter name="mypackage.LDAPUserManagementServiceImpl.ADMIN_PWD"
type="string" update="set">YjJicG9ydGFs</parameter>
<parameter name="mypackage.LDAPUserManagementServiceImpl.LDAP_HOST"
type="string" update="set">ldap.mycompany.com</parameter>
<parameter name="mypackage.LDAPUserManagementServiceImpl.USERBASE"
type="string" update="set">ou=users,o=mycompany</parameter>
</services-settings>
</portal>
</request> |
To run this XML Access script, execute the following command:
Xmlaccess.bat LDAPPortletService.xml wpsadmin:wpsadmin
tbuczak.boulder.ibm.com/wps/config |
Figure 1. Results of XML Access script
After you execute the script, the <status> tag indicates the results as shown in Figure 1. If errors occur, check this output. After you run the script, restart the WebSphere Portal application for the change to take effect.
Turning on XML Access tracing
If you have problems with XML Access, you can set XML Access tracing on by updating the
Websphere\Appserver\lib\app\config\jlog.properties
file, or you can run the following script.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE request PUBLIC "-//IBM//DTD Portal Configuration 1.0//EN" "PortalConfig.dtd">
<!--
This sample sets turns tracing on for XML Access via XML Access.
-->
<request>
<portal action="locate">
<global-settings action="update">
<parameter name="baseGroup.XMLAccessMessageLogger.isLogging" type="string" update="set">true
</parameter>
<parameter name="baseGroup.XMLAccessTraceLogger.isLogging" type="string" update="set">true
</parameter>
</global-settings>
</portal>
</request>
|
You can set any component listed in the
jlog.properties
file with XML Access. After changing these global settings, restart the Portal server for the change to take effect.
Deploying the second portlet service, TAM implementation
After the TAM implementation of the user management is unit tested and ready to be deployed, you can perform the following to migrate to the new portlet service:
-
Install the TAM User Management portlet service jar file in the Portal Server application class path, such as
websphere/appserver/lib/app
.
- Run the following XML script below to set up the portlet services settings.
- Restart the Portal application server to pick up the changes for the portlet services settings.
TAMUserManagementImpl settings
Run the following XML script to set up the portlet services settings:
#-- Setup the User Management Service and declare the necessary factory
mypackage.UserManagement=mypackage.TAMUserManagementImpl
mypackage.TAMUserManagementImpl.factory =
org.apache.jetspeed.portletcontainer.service.PortletServiceCacheFactory |
The main difference in the new parameter settings is that the User Management service is now referring to the
TAMUserManagementImpl
as its implementation class.
#-------- User Management Service Parameters--------------
mypackage.TAMUserManagementImpl.PD.ADMIN= sec_master
mypackage.TAMUserManagementImpl.PD.PASSWORD = wpsadmin
mypackage.TAMUserManagementImpl.PD.PROGRAM =Portal User Management Service
mypackage.TAMUserManagementImpl.PD.PROPFILE =
file:///C:/WebSphere/AppServer/java/jre/PdPerm.properties
mypackage.TAMUserManagementImpl.PD.HOSTNAME=tam.mycompany.com
|
Next, the Tivoli Access Management dependent service parameters are configured for the portal.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE request PUBLIC "-//IBM//DTD Portal Configuration 1.0//EN" "PortalConfig.dtd">
<!--
This sample sets the parameters need to use the TAM User Management portlet service implementation.
-->
<request>
<portal action="locate">
<services-settings action="update">
<parameter name="mypackage.UserManagementService"
type="string" update="set">mypackage.TAMUserManagementServiceImpl</parameter>
<parameter name="mypackage.portletservice.TAMUserManagementServiceImpl.factory"
type="string" update="set">
org.apache.jetspeed.portletcontainer.service.PortletServiceCacheFactory</parameter>
<parameter name="mypackage.TAMUserManagementServiceImpl.PD.ADMIN"
type="string" update="set">sec_master</parameter>
<parameter name="mypackage.TAMUserManagementServiceImpl.PD.PASSWORD"
type="string" update="set">wpsadmin</parameter>
<parameter name="mypackage.TAMUserManagementServiceImpl.PD.PROGRAM"
type="string" update="set">Portal User Management Service</parameter>
<parameter name="mypackage.TAMUserManagementServiceImpl.PD.PROPFILE"
type="string" update="set">file:///C:/WebSphere/AppServer/java/jre/PdPerm.properties
</parameter>
<parameter name="mypackage.TAMUserManagementServiceImpl.PD.HOSTNAME"
type="string" update="set">tam.mycompany.com</parameter>
</services-settings>
</portal>
</request> |
Note that you cannot remove PortletServices settings using XMLAccess. You can modify the existing settings in
mypackage.UserManagement
. This points to the new implementation of the User Management portlet service.
To change the global portal settings, restart the portal application for the change to take effect.
Conclusion
This article describes how to update global WebSphere Portal settings by using advanced XML Access tags. The example demonstrates how to use XML Access tags to configure portal wide settings. A developer or administrator can use these XML Access scripts to efficiently update WebSphere Portal settings repeatedly without moving or updating files. By using the methods and concepts mentioned in this article, you can extend these scripts to manage whole WebSphere Portal installations.
Top of page
Resources
About the author  | 
|  | Tim Buczak
is an IT Specialist with the AMS/eBI: Portals and Content Management in IBM Global Services. His interests include knowledge management, portals, and open source. You can reach him at
tvb@us.ibm.com
. |
Rate this page
|