© 2007 IBM Corporation ® Luciano Silva, Robert Loredo 12/20/2007 WDF Applications on BlackBerry...

12
© 2007 IBM Corporation ® Luciano Silva, Robert Loredo 12/20/2007 WDF Applications on BlackBerry devices IBM WebSphere® Dashboard Framework

Transcript of © 2007 IBM Corporation ® Luciano Silva, Robert Loredo 12/20/2007 WDF Applications on BlackBerry...

© 2007 IBM Corporation

®

Luciano Silva, Robert Loredo

12/20/2007

WDF Applications on BlackBerry devices

IBM WebSphere® Dashboard Framework

IBM Software Group | Lotus software

2

The WebSphere Dashboard Framework is an extension of the WebSphere Portlet Factory

Portlet Factory profiling mechanism allows for the creation of multiple application variations from a single source code

WebSphere Portal 6.x ships with default themes for cHTML markup, which can be used to provide content for BlackBerry devices.

WDF on BlackBerry devices – Background Information

Model P1

P2

My ApplicationMy Application

20%

20%

20%20%

20%

Division Results

IT 200,000

Sales 300,000

Finance 200,000

Ops 450,000

My Report

My ApplicationMy Application

My ReportDivision Results

IT 200,000

Sales 300,000

Finance 200,000

Ops 450,000

IBM Software Group | Lotus software

3

By leveraging PF’s profiling features, simplified versions of existing portlets can be created for mobile devices without having to write additional code for such portlets.

WebSphere Portal’s chtml theme can be leveraged to provide content for BlackBerry devices.

WDF on BlackBerry devices

IBM Software Group | Lotus software

4

WDF on BlackBerry – PF project configuration steps

In the PF/WDF Designer, create a PF project and add a new profile to determine the client device to be served.

The following PF wiki article provides sample code for such task:http://www.ibm.com/developerworks/wikis/display/PortletFactoryID/IBM+-+Client+device+profile+selection

For specific support of BlackBerry devices in such profile class, please see Appendix A in the last slide of this presentation file.

IBM Software Group | Lotus software

5

WDF on BlackBerry – PF project configuration steps (2)

In the PF project, profile portlet elements, such as tables and charts, to make them smaller/simpler for mobile devices. Example: making chart dimensions smaller for mobile devices.

Deploy the PF portlet project into WebSphere Portal

IBM Software Group | Lotus software

6

WDF on BlackBerry – WebSphere Portal configuration The WebSphere Portal server needs to be

configured to support BlackBerry device clients.

On the Administration page in the Left Navigation panel select Supported Clients.This will open the Manage Clients portlet.

Click Add new client. This will open a form, type in the following into their respective fields. – User-Agent: .*BlackBerry.*– Markup: chtml– Capabilities: Type in the following individually and press Add for each:

– HTML_2_0– HTML_3_0– HTML_JAVASCRIPT– HTML_4_0– HTML_CSS– HTML_NESTED_TABLE– HTML_TABLE– FRAGMENT_IDENTIFIER– HTML_JAVA– HTML_IFRAME

– Position: Select from the pull down menu, after(.*(B|b)ot.*….)

IBM Software Group | Lotus software

7

WDF on BlackBerry – WebSphere Portal configuration (2)

Create a new page for Mobile Devices Dashboards and enable it to respond to chtml markups.

On the Administration page in the Left Navigation panel select Manage Pages.Then, select “Content Root” and then “Home”.

Add a new page (e.g. Mobile Dashboard) and select the “chtml” markup under the Type of Page section.

IBM Software Group | Lotus software

8

WDF on BlackBerry – WebSphere Portal configuration (3)

After the Mobile Dashboard page is created edit its layout and add the profiled PF portlets for mobile devices to the page.

Set the appropriate Page Permissions for the created page, so the targeted users can reach both the new page and the portlets in it.E.g. add “All Authenticated Portal users” to the User role for both page and portlets.

IBM Software Group | Lotus software

9

WDF on BlackBerry – Portal page navigation

Once WebSphere Portal is configured appropriately, the Mobile Dashboard page can be accessed by BlackBerry devices. For information on how to download and setup BlackBerry device simulators, see Appendix B of this presentation file.

IBM Software Group | Lotus software

10

Resources

WebSphere Dashboard Framework documentationhttp://www.ibm.com/developerworks/workplace/documentation/dashboard/http://publib.boulder.ibm.com/infocenter/wdfhelp/v6r0m0/index.jsp

WebSphere Portlet Factory product pagehttp://www-306.ibm.com/software/genservers/portletfactory/

WPF/WDF external wikihttp://www.ibm.com/developerworks/wikis/display/PortletFactoryID/Home

BlackBerry Developers pagehttp://www.blackberry.com/developers

IBM Software Group | Lotus software

11

Appendix A– Java class for ClientDeviceProfileFor BlackBerry support in the PF profile class, replace the code in the DeviceTypeSelectionHandler.java class with the following:

package com.bowstreet.samples.deviceprofile;

import java.util.ArrayList;

import java.util.Iterator;

import java.util.List;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.bowstreet.profiles.ProfileSet;

import com.bowstreet.profiles.SegmentList;

import com.bowstreet.profiles.SelectionHandlerBase;

import com.bowstreet.webapp.ModelInstanceCreator;

/**

* Selects profile based on client device type.

*/

public class DeviceTypeSelectionHandler extends SelectionHandlerBase implements SegmentList

{

static public final String USERAGENT_PROPNAME = "MobileUserAgentString";

static public final String BROWSER = "Browser";

static public final String MOBILE = "Mobile";

private String userAgentString = "BlackBerry";

public String selectProfile(HttpServletRequest request, ProfileSet profileSet, String modelName, String explicitProfileName, ModelInstanceCreator modelInstanceCreator)

{

if(explicitProfileName != null)

return explicitProfileName;

String profile = BROWSER;

if (request != null)

{

// This code checks the "User-Agent" header from Request

String userAgent = request.getHeader("User-Agent");

System.out.println("selectProfile, User-Agent = " + userAgent);

if (userAgent != null) {

if (userAgent.indexOf(userAgentString) >= 0)

{

profile = MOBILE;

}

// TEMPORARY - if MobileDevice, use MOBILE profile

if (userAgent.indexOf("MobileDevice")>=0 ) {

profile = MOBILE;

}

}

}

return profile;

}

public Iterator getSegments(ProfileSet profileSet)

{

List list = new ArrayList();

list.add(BROWSER);

list.add(MOBILE);

return list.iterator();

}

public void init(Map properties)

{

System.out.println("DeviceTypeSelectionHandler init - properties: " + properties);

}

}

IBM Software Group | Lotus software

12

Appendix B – BlackBerry Device simulators Two packages are required to be installed on the client machine

to access a Portal server from a BlackBerry device simulator:

– BlackBerry MDS Server simulator

– BlackBerry Device simulator

The installer for these simulators can be downloaded from the following website: http://na.blackberry.com/eng/developers/downloads/simulators.jsp

After both packages are installed, initialize the MDS server and then open the device simulator.