Enterprise J2ME Developing Mobile Java Applications [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Enterprise J2ME Developing Mobile Java Applications [Electronic resources] - نسخه متنی

Michael Juntao Yuan

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


14.4 Using Simplicity for Legacy Databases


Screen scraping relies on the recorder tool and code generator. Now, let's take a detour to check out the tool we are going to use: the Simplicity IDE (v1.5) from Data Representations.

The Simplicity IDE is an all-visual Rapid Application Development (RAD) tool. Many IDEs have visual builders for UI components, but Simplicity allows you to build application logic components through the drag-and-drop model as well. Simplicity is written entirely in Java and supports application development for both J2ME and part of J2EE (mostly gateway servlets for mobile clients). We use the Simplicity IDE to demonstrate how to integrate legacy back ends in your mobile enterprise solutions.

Note

This book is not intended to be a comprehensive Simplicity IDE tutorial. The Simplicity software is distributed with sample applications and step-by-step tutorial books.


14.4.1 Simplicity Mobile


The central part of the Simplicity IDE is its visual composer. Figure 14.3 illustrates a fully assembled MIDP application in the Simplicity for Mobile Devices IDE. Besides nodes representing normal MIDlet life cycle methods, you should pay attention to two nodes Transactions and Display. Modules under those two nodes are dragged and dropped from modules palettes, which are also shown on the figure. One strength of the Simplicity IDE is that it provides a lot of preconfigured modules that we can directly use. There are roughly two kinds of modules.


Figure 14.3. An example Simplicity project.


Modules such as TextBox and Form take care of the view logic. In this composer, Form presents application information to users using MIDP UI components; TextBox maps user input to internal variables. The view modules have functionalities similar to visual UI components found in other IDE RAD tools.

The Transactions module is part of the business logic. It contains a micro XML parser and can talk with Simplicity Enterprise server via a proprietary XML protocol. It also has a built-in, configurable RMS cache for transactional data. The business logic modules are linked to the view logic modules through internal variables.

Now, we can use the Simplicity Enterprise IDE to build the gateway servlet for a demo legacy mainframe application. The gateway servlet contains a module that is designed to talk with the MIDlet's Transaction module.

Note

Simplicity Enterprise also allows you to construct JDBC gateway servlets that bridge mobile clients to JDBC remote databases using the same MIDP Transaction module.


14.4.2 Simplicity Enterprise Legacy Rejuvenation


Simplicity Enterprise is a separate IDE from Simplicity for Mobile Devices. Simplicity Enterprise runs its own built-in HTTP server and servlet engine for development. It also bundles a PointBase embedded database for internal use. The application composer in the Simplicity Enterprise IDE looks very similar to the one in Simplicity for Mobile Devices. Legacy Rejuvenation is a palette of enterprise modules that help us write legacy gateways. The legacy palette is shown in Figure 14.4.


Figure 14.4. The legacy palette in Simplicity Enterprise.


Figure 14.5 shows the structure of a legacy gateway servlet. The modules are the following.


Figure 14.5. Structure of the Simplicity legacy gateway servlet.


The Form module processes HTTP requests from clients. It holds references to all the important interval variables.

The XML Exporter module exports interval variables to an XML stream that is understood and parsed by the MIDlet side Transaction module.

We use the HostConnection module to specify the IP address and connection port of the legacy server. We should also specify the serial terminal type that the legacy server supports.

The Recorder module is the user interaction recorder of the screen scraper. It contains an emulated serial terminal that connects to the server according to parameters set in the HostConnection module. Figure 14.6 shows such a screen. The row of buttons above the emulator window specify emulated user interactions. For example, we need to wait for the Enter Search String text to appear on a certain screen position before we send in the search string. We can highlight the Enter Search String text in the emulator, click the Wait button, and then assign the appropriate wait action (Figure 14.7). Then, we can use the Send Text button to send in the search string from an internal variable in the Form module.


Figure 14.6. The legacy recorder, screen 1.


Figure 14.7. The legacy recorder, screen 2.

The Field Reader module reads information from the emulated screen. For example, if we need to read out the product number, we can highlight the Product Number text; it becomes a textbox, and we assign it a variable name varProdNum (Figure 14.8) for use in other modules (e.g., the XML Exporter module).


Figure 14.8. The screen reader.


Your legacy gateway servlet is now ready.


Code Generation from Simplicity


The Simplicity IDE generates the source code for you. If you study the source code, you can find out how the modules in Simplicity libraries are used. Then, you can separate the code segments for screen scraping and mobile client interaction. This way, you might be able to use Simplicity Legacy Rejuvenation technology outside of the Simplicity IDE.


/ 204