Portal Guide

CHAPTER 11

Developing a Wireless Application

This chapter describes how to build exteNd Director portal applications that support wireless devices. It contains the following sections:

 
Top of page

About wireless applications

exteNd Director allows you to easily extend your applications to the constantly expanding variety of devices used by the mobile community, such as handheld computers and cellular telephones. Any portlet that produces XML output can use exteNd Director's wireless capabilities to produce output suitable for wireless devices. You do not need to modify portlet output according to the size or type of display when implementing a portlet class.

The process of enabling applications for wireless devices consists of two steps: device-specific rendering and device-specific pagination. Although the steps are intended to work together, either one can be used separately. For example, a search engine can use device-specific pagination to present a specific number of hits per page for Web browsers on personal computers as well as wireless devices.

 
Top of section

Device-specific rendering

You can designate any XML portlet in your exteNd Director application as wireless-enabled, which allows the Portal Aggregator to automatically identify wireless client devices and render the portlet's XML output in device-specific formats such as WML, cHTML, or Web Clipping.

The Portal uses a list of profiles for various devices that is stored in the portal's resource set. Updates to the list will be made available for download from the Novell Web site as new devices and formats appear on the market.

Application content that is already small enough to fit on a single page may require nothing more than rendering in the appropriate device-specific format. In other words, reducing the width of a page by increasing the length may or may not be acceptable. You must decide how much vertical scrolling (if any) you consider acceptable for a single page.

 
Top of section

Device-specific pagination

Some portlet content is too large to fit on a single page. Thus, you can designate any XML portlet in your exteNd Director application for device-specific pagination, which slices the portlet's XML output into smaller blocks and adds navigational aids such as tables of contents and previous-next buttons.

Using a graphical editor integrated with development environment, you can drag and drop pieces of a sample portlet content file into a data definition that models both layout and navigation. As you work, you can instantaneously preview the output produced by your data definition.

At runtime, the device transcoding engine applies the data definition to the portlet's output before sending it to the Portal Aggregator.

 
Top of section

Sample portlet

Your exteNd Director software includes a sample wireless-enabled portlet named StockQuotePortlet that uses device-specific rendering. You can use this portlet to begin learning about how to provide wireless support in your applications.

 
Top of page

Creating a wireless-enabled portlet

You can create a wireless-enabled portlet using the Portlet Wizard, which does much of the work for you.

Procedure To create a new wireless portlet:

  1. Invoke the Portlet Wizard, as described in the section on using the Portlet Wizard.

    transcode component

  2. Under Content Types, select XML and WML.

  3. If you already have a device transcoding data definition for the portlet, specify it here. Otherwise, click Finish and turn to Creating a device transcoding data definition.

 
Top of page

Wireless-enabling an existing portlet

To wireless-enable an existing portlet, you will need to modify and/or create several files as described in the following procedures.

Procedure To modify the portlet source file:

  1. Edit the portlet source file.

  2. In the doView() method, set the MIME type to MIME_TYPE_XML, as shown below:

      response.setContentType(com.novell.afw.portlet.api.EbiPortletConstants.MIME_TYPE_XML);
    

    NOTE:   If you want to develop a wireless portlet that supports transcoding, you would need to set the MIME type to MIME_TYPE_DEVICE_PROFILING.

Procedure To modify the portlet descriptor:

  1. Open the portlet descriptor.

  2. In the style section, enter the name of the Data Definition file, if you plan to support transcoding. The data definition file does not have to exist at this point.

      <style>
       <name>MyPortletDefault</name>
       <display-name>MyPortlet Default Style</display-name>
       <user-agent>
        <device-name>Generic_HTML</device-name>
        <file-name>
         $RESOURCE_SET$/portal-style/MyPortlet_HTML.xsl
        </file-name>
       </user-agent>
       <user-agent>
        <device-name>Generic_WML</device-name>
        <file-name>
         $RESOURCE_SET$/portal-style/MyPortlet_WML.xsl
        </file-name>
       </user-agent>
       <data-definition>
        $RESOURCE_SET$/portal-data-definition/PhoneList
       </data-definition>
          </style>
    
  3. In the style section, examine the selected styles. If the portlet already has a portal style, proceed to To modify the portal style descriptor:. Otherwise, choose one of the following:

  4. In the auto-register section, add the category Wireless.

      <auto-register enabled="true">
        <category>Wireless</category>
      </auto-register>
    

    You can also set the category in the Portlet Management section of the DAC.

  5. If you choose to create a new portal style descriptor at this point, invoke the Portal Style Descriptor Wizard.

    transcode new portal style

  6. Name the descriptor and proceed to To modify the portal style descriptor:.

Procedure To modify the portal style descriptor:

  1. Open the descriptor and click the User Agents tab.

    transcode PhoneListStyle

  2. If there is not already a user agent named Generic_WML, click the Add button.

  3. A user agent specifies how the portal style is rendered for a particular user environment by mapping a device profile to an XSL style sheet.

    Set the Device Name (<device-name>) to Generic_WML. The device name is the name of a device profile that defines the user environment.

    Set the Data Definition (<dp-file-name>) to an XSL style sheet.

    NOTE:   The Data Definition column in the portal style descriptor GUI should not be confused with a device transcoding data definition.

    If you do not have a style sheet for the portlet, use one of the generic style sheets provided in the portal-style directory such as Generic_WML.xsl.

      <user-agent>
          <device-name>Generic_WML</device-name>
          <dp-file-name>Generic_WML.xsl</dp-file-name>
      </user-agent>
    

    For more information    For more information about device profiles, see Using the device profile editor.

 
Top of page

Using the Wireless Layout Manager

The Wireless Layout Manager allows you to define a wireless profile. Using a Web browser, you can select from the available wireless-enabled portlets and set the order in which they are displayed. The list contains portlets that have the category Wireless.

Procedure To define a wireless profile:

  1. Open the Portal Personalizer, scroll to the Portal Wireless Layout section and click Edit Wireless Layout.

    transcode profile0010

    NOTE:   The Edit Wireless Layout link is not visible unless the Show Wireless Layout preference for the Personalizer portlet is set to True. To set this preference, you need to modify the portlet registration for the Personalize portlet in the DAC.

    The Wireless Layout Manager opens in your browser.

  2. In the Wireless Layout Manager, select any available portlet and click Add Portlet.

    transcode layout

  3. To see the wireless portlets in action, click Save Portlets, go to MyPortal, and click MyWirelessProfile.

 
Top of page

Using the device profile editor

exteNd Director provides a graphical editor in development environment for creating or editing device profiles.

Procedure To start the device profile editor:

Procedure To use the device profile editor:

 
Top of page

Creating a device transcoding data definition

 
Top of section

About transcoding data definitions

A transcoding data definition is an XML file that identifies certain tags in portlet output that can be used to specify how to slice the output data and add navigational aids. The first step is to capture a representative sample of portlet output, as described in Creating a reference file.

Once you have an output sample to work from, consider it to be a table with columns and rows. The next step is to identify which tag is the row separator. When you have defined the row separator, you can map the output data onto the following objects:

Object

Description

List block

A view that includes all rows

Content block

A view that includes only one row

Element

A column

Link

Connects a list block to a content block

 
Top of section

Creating a reference file

To create a reference file, you need to capture a sample of your actual XML portlet output in a file. Any XML-based portlet can print its XML to the console by doing the following:

  // Create the XML Document
  Document newDoc = EboXmlHelper.getNewDocument();
  
  // Add elements to the document
  ...
  
  // Print the document to the console
  com.sssw.fw.util.EboXmlHelper.printDOMTree(newDoc);

Save the text file in the portal-data-definition folder using a name that does not conflict with the actual data definition file. For example, some XML output from the PhoneList portlet is shown below. For convenience, you can copy this output and paste it into a text file named PhoneListReference.xml.

  <?xml version="1.0"?>
  <phonelist compInstance="a63974dcac7e4f28bd2c49ab7b1921d2"
   compid="PhoneList" post-url=
   "http://localhost/ExpressPortal/portal/portlet/PhoneListPortlet">
   <results querystring="c">
    <employee>
     <first-name>Samuel</first-name>
     <last-name>Craddock</last-name>
     <phone-number>(617) 343-6505</phone-number>
     <email>scraddock@silverdemo.com</email>
    </employee>
    <employee>
     <first-name>John</first-name>
     <last-name>Chester</last-name>
     <phone-number>(617) 343-6506</phone-number>
     <email>jchester@silverdemo.com</email>
    </employee>
    <employee>
     <first-name>Lynn</first-name>
     <last-name>Campbell</last-name>
     <phone-number>(617) 343-6507</phone-number>
     <email>lcampbell@silverdemo.com</email>
    </employee>
   </results>
  </phonelist>

 
Top of section

Creating a data definition file

exteNd Director includes a wizard for creating transcoding data definition files.

  1. In development environment, select File>New from the menu and select the Portal tab.

  2. Select Transcoding Definition (Wireless) and click OK.

    transcode wizard0010

  3. Name your transcoding definition file, specify which resource set to add the files to (if necessary), and click Next.

    transcode wizard0020

  4. Select your reference file. The wizard automatically opens the file and displays the XML tag structure.

    transcode wizard0030

  5. Select the row separator. If you are using the sample portlet reference file (PhoneListReference.xml), select Employee.

  6. Click Finish.

 
Top of section

Editing a data definition file

This section uses the sample portlet data definition file PhoneList.xml and reference file (PhoneListReference.xml) to illustrate the procedure.

Procedure To open a reference file:

  1. In the data definition editor, select the Definition tab. It has two panes: Reference and Definition.

  2. Open a reference document (unless one is already open). Right-click the Reference pane and select Open a reference file.

    transcode definition0010

    NOTE:   The sample portlet reference file is named PhoneListReference.xml.

    The Reference Pane displays the structure of the data using a tree view. You can click plus (+) to expand and minus (-) to collapse branches of the view.

Procedure To define a row separator:

If you have already defined a row separator (as described in Creating a data definition file), skip this procedure.

Procedure To create blocks:

  1. Select any item in the Definition Pane.

  2. Right-click and select Add Block.

    transcode definition0030

    NOTE:   If you are using the sample portlet reference file, create two blocks: a List block named employeeList and a Content block named employeeDetails

  3. Name the new block and set the type to List or Content.

  4. You can specify a Style to override the default style for this block only.

    NOTE:   Click the small triangle (transcode arrow right) to the right of the block name to keep the block open when you move the cursor to another object. The triangle changes color and rotates to point downward (transcode arrow down) to indicate that the block is locked open. By default, the editor closes objects (displays only the name of the object) when you move the cursor elsewhere.

Procedure To create elements:

  1. Select an element in the Reference Pane and drag it onto a block in the Definition Pane.

    transcode definition0050

    NOTE:   If you are using the sample portlet reference file, add the following elements:To employeeList: firstName, lastNameTo employeeDetails: firstName, phoneNumber, email

  2. Name the new element.

  3. The Type field provides a way to pass user defined information to the style sheet.

  4. The XPath expr field is an expression in XPath (XML Path Language) for addressing parts of an XML document. You can use this field to remap the element.

    For more information    For more information about XPath, see the language specification (http://www.w3.org/TR/xpath).

Procedure To create a link:

  1. Select any item in the Definition Pane.

  2. Right-click and select Add Link.

    transcode definition0090

    NOTE:   If you are using the sample portlet reference file, set:From block to employeeListFrom element to firstNameTo block to employeeDetails

  3. Set the From block attribute to a List block.

  4. Set the From element attribute to an element in the List block.

  5. Set the To block attribute to a Content block.

 
Top of section

Testing a data definition

The Test View allows you to view the output produced by the transcoding definition you just created.

Procedure To set up the test view:

  1. In the data definition editor, select the Test definition tab. It has three panes: Setup, Navigation, and Result.

  2. In the Setup Pane, select one of the available user agents from the dropdown list. The list contains all of the registered device types in the portal.

    transcode setup0000

    NOTE:   If you are using the sample portlet data definition, set the User-agent to Generic_WML.

  3. Select one of the available styles from the dropdown list. The list contains all of the styles that support the selected user agent.

    transcode setup0010

    NOTE:   If you are using the sample portlet data definition, set the Style to PhoneListStyle.xml.

Procedure To execute the test:

  1. When you have made your selections, click GO.

    transcode result0000

  2. Examine the Navigation Pane. Click plus (+) to expand and minus (-) to collapse branches of the view.

  3. Click any item to see the transcoding engine output in the Result Pane.

    TIP:   For a graphical view of the rendered data, set up a Wireless Profile (as described in Using the Wireless Layout Manager) and add the PhoneList portlet to your profile.



Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.  more ...