Creating a basic HATS project

Your company has application programs that run on a host computer. Your company has decided to "Web-enable" those applications-in other words, create new applications that exchange data with the host but can be accessed by users through a Web browser. HATS protects your company's investment in its host applications while customers, business partners, and employees can access them easily on the Web.

You've been assigned the task of Web-enabling an application program. HATS gives you the tools you need to do the job.

The information in this chapter gets you started. By following the procedure in this chapter, you'll create a simple, working HATS application that uses default values provided with the product. This chapter contains:

After completing this chapter, you can update, or customize the application to make it fit the specific needs of your business.

Introducing the Rational Studio environment

All of the steps in developing a HATS application are performed using the Rational Studio workbench. The workbench is the user interface and integrated development environment (IDE) from which you launch wizards to create resources, view lists of resources, and use editors to modify resources. It also contains help information about both HATS and Rational Studio.

When you start Rational Studio, you see a single window in which one or more perspectives are displayed. A perspective is a collection of views and editors that allow you to create, edit, view, and run resources which belong to a specific type of project--in this case a HATS project. More than one perspective can be open at a time, although you can only view and work with one at a time.

At the far right of the Rational Studio window is a shortcut bar that allows you to open new perspectives and move between perspectives that are already open. The name of the active perspective appears in the title of the window, and the toolbar contains icons associated with the active perspective.

If you are not familiar with the Rational Studio environment, it is recommended that you refer to the Rational Studio tutorial to learn about the above aspects and other features of the Rational Studio environment. Refer to the following link for the Rational Studio tutorials.

Starting HATS Studio and perspective

The command to start the HATS Studio differs according to your operating system:

This starts Rational Studio with the HATS perspective open. The HATS perspective includes two main areas:

The Navigator View, which is a default view in Rational Studio, provides a hierarchical view of the resources in the workbench including project .ear files and other local artifacts.

The first time you start the HATS Studio, you will see a HATS tip, welcoming you to HATS and giving pointers about getting started. You can use the check boxes on the tip windows to control how many tips you see.

If you start Rational Studio and the HATS perspective does not appear, you can open the HATS perspective by clicking Window > Open Perspective > Other and selecting Host Access Transformation Services from the list of available perspectives. If you close or rearrange some of the windows in the HATS perspective, your arrangement is saved. When you return to HATS Studio later, it will be restarted the way you left it. To restore the original HATS windows, click Window > Reset Perspective.

Introducing the HATS Welcome page

The HATS Welcome page tutorial guides you through the process of developing a Web application using HATS. As you develop the application and customize it, it is known as a project. A project is packaged in a J2EE web module (.war file) and one or more projects are packaged in a J2EE Enterprise Application (.ear file), which is a WebSphere application. The application is transferred to the WebSphere Application Server and installed on a user specified server.

Each section on the Welcome page can be expanded by clicking the plus sign

Twistie circle icon. Each section contains links that start HATS functions, as well as links to relevant information in Getting Started and represents a stage in the process:

  1. Create your first project links to the Create a Project wizard and introduces the Run on Server function, which enables you to preview the project. The preview screen is described in detail in Previewing your project.

  2. Modify the template helps you update the template you chose as your project default.

  3. Edit the default rendering and global rules describes the conversion rules used by the default transformation, and provides information on the related function, global rules.

  4. Customize a screen introduces the host terminal screen and the Create a Screen Customization wizard. You can create a simple transformation to see how it changes your host screen.

  5. Work with macros and Integration Objects explains how macros can be used in your projects, and introduces Integration Objects. Integration Objects are also macros, but they are in a Java wrapper. You can create Integration Objects from macros in your projects.

  6. Explore advanced functions of HATS deepens your knowledge about basic HATS concepts and introduces the project editor.

  7. Prepare your project for production shows you how to assemble the project into a WebSphere application and transfer it to WebSphere Application Server.

  8. View the library of online information for HATS provides links to the HATS Information Center and documentation as well as the HATS Web site.

As you use other HATS functions, the Welcome page is covered by editors or other tools. Each page in the editor window is given a tab at the top to enable you to move from one page to another. You can return to the Welcome page by clicking the Welcome to HATS tab, or by clicking the Welcome page icon in the main toolbar. You can double-click any tab to toggle that tab's page between its initial size and a full-screen view.

Starting HATS functions

HATS Studio provides several ways to start each HATS function. You can:

In many cases, you can start a HATS function in a way that creates linkage between HATS resources. For example, you can create a screen customization based on a screen capture by right-clicking on the screen capture and selecting New HATS > Screen Customization. The screen customization's properties will default to those of the screen capture.

Using HATS icons

This table shows the HATS icons that are placed in the Rational Studio main toolbar.

Table 5. HATS toolbar icons

Create HATS Project

Create a new HATS project

Open host terminal

Open the host terminal for the selected HATS project

Create HATS Screen Customization

Create a new HATS screen customization in the current project

Create HATS Transformation

Create a new HATS transformation in the current project

Create HATS Template

Create a new HATS template in the current project

Run on Server

Use the Run on Server function to preview the selected HATS project

Assemble a project

Assemble a project into a HATS application

Create a Java file for custom Business Logic

Create a Java file to run custom business logic

Create a HATS Connection

Create a HATS Connection

HATS welcome page

Return to the HATS Welcome page

Other icons are available from certain windows, such as the host terminal window. Those icons will be identified in the sections that describe those windows.

HATS tips

To guide new users through the flow of creating a project and its resources, HATS provides tips when you do certain tasks. After using HATS for a while, you might decide that you do not want to see these tips. You can use the check boxes at the bottom of the tip window to specify whether you want to see that particular tip in the future and whether you want to see any tips. You can also control whether or not tips are shown by following these steps:

  1. From the main menu, click Window > Preferences.

  2. In the Preferences window, click HATS in the tree on the left.

  3. On the right panel, locate the check box labeled Show HATS tips. Check this box if you want tips to appear, or clear it if you do not want tips.

  4. Click OK at the bottom of the Preferences window.

Developing your HATS project

There are different paths a developer can take when building a HATS application. A developer might want to build an application that allows an end-user to navigate the host screens in an emulator-like fashion, or a developer might want to build an application that uses Integration Objects to collect data from the host and present that data on a Web page. You can even combine host screen navigation in the browser with host data collection via Integration Objects in one application.

Step-by-step examples:

The following examples guide you through the process of developing a HATS project using default values. As you follow the examples, you will perform these steps:

  1. You'll create a HATS project, with default values, using a wizard in the HATS Studio.

  2. You'll preview the project by using the Run on Server function.

  3. After creating the HATS project and previewing it, you'll want to make changes. This process is known as customization. Common customization tasks are described in Customizing your HATS project.

  4. You'll preview the project again, and do more customization.

  5. Finally, when you're satisfied with the project, you'll assemble it into an application and transfer the application to a server. These steps are described in Preparing your HATS project for use as a Web application.

Creating a HATS project

Begin on the Welcome page. If the Welcome page is not displayed, click the Welcome to HATS tab at the top of the editor pane.

Table 6. HATS Welcome page icon

HATS welcome page icon

HATS welcome page icon

  1. Click the link to launch the Create HATS Project wizard.

  2. In the New Project window:

    1. Type the name of the application you are creating.

    2. Type a description of the application. This is optional; you can keep notes here or use it however you want.

    3. Select the target server you want to use for your application

    4. Leave the Use default location, the Use default Enterprise Application project, and Add administration support boxes checked.

    5. Click Next.

  3. In the Connection Settings window:

    1. Type the name of the telnet server you will use to access the host application. This can be a hostname, a domain name (such as myhost.mycompany.com), an alias, or an IP address.

    2. If your host is a zSeries machine, select the 3270 or 3270E connection type depending on your host. If your host is an iSeries machine, select the 5250 connection type.

    3. Select your port, code page and screen size.

    4. Click Next.

  4. In the Template window, you will see all of the templates that are provided with HATS. Choose one to use as a starting point for your project. Click Finish. You will see a progress bar as HATS creates the project.

You have created a simple HATS project. Next we will preview a Web page generated by your HATS project.

Previewing your project

Begin on the Welcome page. If the Welcome to HATS page is not displayed, click the Welcome to HATS tab at the top of the editor pane.

  1. In the HATS Project View on the left side of the screen, single-click the name of the project you just created.

  2. In the Welcome page, click Preview your HATS project using the Run On Server.

  3. You are given the option to display the terminal while running your application. Select Yes so you can watch the application navigation in the background.

  4. The Server Selection window opens, where you select the server on which to run your application. Select the WebSphere Test Environment server for either a V5.1 or V6.0 server. Click Finish to complete the run on server process.
    Note:
    The server selection needs to match the server you chose when creating your HATS project.

Rational Studio creates an internal server to show your project. You will see a progress bar as the server is established. When you preview your project, you are using the Rational Studio Run on Server function. This function runs your project on your local machine, on a copy of the WebSphere Application Server product that is embedded in Rational Studio. This server is also called the WebSphere Test Environment.

When using the Run on Server function in the HATS Studio to preview your application, the Rational Studio console displays messages with the following information during runtime:

The messages are displayed by default. If you want to disable the messages, locate and double-click the web.xml file in the Web Content/WEB-INF/ path in the Navigator view to edit it. Select the Parameters tab, highlight the showStudioRuntimeMessages parameter, and change the value to false.

HATS displays a Web page on which you can see what your application will look like. The Web page is divided into two main areas:

When you preview a newly created HATS project, you see what your host application looks like when the default transformation is applied. This transformation is part of each project and uses default rendering to provide an automatic conversion of your host application screens into Web pages. Part of what you will do with the HATS Studio is to design transformations that will improve the conversion of your host application screens into meaningful, usable Web pages.

When you preview your project, the Web browser opens in the HATS perspective. If you make changes to your project, do not open another Run on Server window to view the updates; instead, click the Refresh button on the Web page that is already displayed.

Some of the changes you make may not appear when you use the Run on Server function until you rebuild the project or restart the server. You can turn on the workbench preference by clicking Window > Preferences > Workbench > Build automatically. This will cause your project to be rebuilt when you make changes, so that the changes will appear immediately when you use the Run on Server function.

To view the application as the end user would see it, copy the URL from the HATS browser into an external browser. The Web browser in the HATS Studio opens with a URL similar to the following: http://localhost:9080/myapp/. To enable other users to see the Web page from a different machine, give them a URL containing the TCP/IP address of the machine that is running HATS Studio. For example, change the URL http://localhost:9080/myapp/ to http://myworkstation.mycompany.com:9080/myapp/.

Next, you'll want to modify your HATS project. For example, you'll want to put your own company name into the template, and you'll want to define widgets (fields, input areas, and other GUI controls) in the application area. As you develop your HATS application, you can use the preview screen to test it and to see how it will look to an end user. Here's the sequence of steps you'll typically follow:

  1. Create the HATS project.

  2. Preview it.

  3. Make changes based on what you saw in the preview.

  4. Refresh the preview screen.

  5. Repeat until you're satisfied.

Continue with the instructions in Customizing your HATS project.