Oracle9i Lite Developer's Guide for Web-to-Go
Part No. A97671-01
This chapter provides a conceptual framework for understanding Web-to-Go features and terminology. Topics include:
As part of the Mobile Server, Web-to-Go is a framework for creating and deploying mobile, Web-based, database applications. The Web-to-Go model supports the user being always offline and using synchronization to synchronize the data changes with an Oracle database.
Users run Web-to-Go applications from the Mobile Client for Web-to-Go using a Web browser. Installing and using the Mobile Client for Web-to-Go requires only an HTML browser and access to the Mobile Server.
The Web-to-Go environment is a three-tier Web model that contains a client, an application server, and a database server. Web-to-Go users can access applications and data whether or not the Mobile Client for Web-to-Go is connected to the network. Each tier can reside on a separate machine.
Figure 2-1 The Web-to-Go Environment
Web-to-Go applications are mobile database applications that operate seamlessly between online and offline modes. Developers do not need to create separate versions of Web-to-Go applications for online or offline mode. The difference between the two is transparent to the user because Web-to-Go's runtime environment hides the differences between online and offline.
Users access Web-to-Go applications through a Web browser. Typically, these applications are used to modify data stored in an Oracle database data server. Web-to-Go applications can comprise static components, such as HTML pages and image files, dynamic components, such as Java servlets, and database objects, such as tables and sequences. Web-to-Go manages all of these in both online and offline modes and automatically propagates changes made to any of these components throughout the Web-to-Go system.
Web-to-Go simplifies the creation of dynamic Web pages by using Java servlets. Java servlets are platform-independent, server-side modules that can be used to extend the capabilities of a Web server. Written in Java, these modules are loaded to the Web server.
Web-to-Go supports two types of database components: snapshots and sequences. You must register each component with the application using the Packaging Wizard. This enables Web-to-Go to create the necessary offline support for the snapshots and sequences on the local client. Web-to-Go creates this support for snapshots and sequences the first time a client is in offline mode, and it keeps synchronizing the snapshots and sequences thereafter because snapshots and sequences are dynamic.
In addition, Web-to-Go executes custom DDL (Data Definition Language) statements, enabling the creation of such database objects as views or indexes on the client. This event takes place only once, at the time the client goes offline the first time.
For more information on Web-to-Go application components, see Chapter 3, " Developing Web-to-Go Applications".
The client tier consists of the Mobile Client Web Server and the Oracle Lite database. Installing and using this tier requires only a Web browser and access to the Mobile Server. Once installed, users can then access the Mobile Client Web Server and run Web-to-Go applications through their Web browser.
Web-to-Go creates multiple databases for each user on the Mobile Client for Web-to-Go. For example, if John and Jane are users, then Web-to-Go creates databases for each as follows:
These two databases for John together are called a site. For Jane, Web-to-Go also creates databases as follows:
These two databases for Jane together are also called a site. The Mobile Client for Web-to-Go contains one site per user; however, a user can have a site on several different Mobile Clients for Web-to-Go. Administrators track and manage sites using the Mobile Server Control Center. For more information, see the Oracle9i Lite Administration Guide.
The application server tier contains the Mobile Server, which processes requests from the Mobile Client for Web-to-Go to modify data in the database server. The Mobile Server is a handler that operates with one of the following Web application servers:
Oracle9i Application Server (Oracle9i AS)
Oracle HTTP Server
The standalone Mobile Server, webtogo.exe
The database server tier stores the application data and Web-to-Go files. The Web-to-Go files are stored in the Mobile Server Repository, a virtual file system that resides on an Oracle database. It is a persistent resource repository that contains all application files and definitions of the applications.
Users access Web-to-Go applications from a Web page called the Workspace. Web-to-Go generates the Workspace in the user's browser after the user logs in to Web-to-Go. The Workspace displays icons, links, and descriptions of all applications that are available to the user. An application is available to the user after the administrator publishes it to the Mobile Server and grants access privileges to the user.
Figure 2-2 Workspace
Web-to-Go is managed centrally from the Mobile Server. The Mobile Server Packaging Wizard and Mobile Server Control Center allow administrators to publish and administer applications. Using the Packaging Wizard, developers define the applications that will be published by the administrators, and administrators publish the defined applications to the Mobile Server. Applications can be administered with the Mobile Server Control Center, which allows the administrator to create users and assign privileges.
The Mobile Client for Web-to-Go uses Mobile Sync to replicate the data changes between the local Oracle Lite database and the Oracle database server.
During data synchronization, the Mobile Client for Web-to-Go uploads data changes into the in queues in an Oracle database. The client then downloads the new updates from the out queues and applies these changes to the local Oracle Lite database.
The Consolidator Message Generator and Processor (MGP) is a Java background process that applies the pending transactions from the queues to the Oracle database at set intervals. It also generates new data updates for the Mobile Client for Web-to-Go to download. These updates are stored in out queues from where the Mobile Client for Web-to-Go retrieves them the next time it synchronizes. Data changes uploaded by the Mobile Client for Web-to-Go are not reflected in the Oracle database tables until the MGP has processed the in queue and applied those changes. Similarly, any changes made to the Oracle database tables after the MGP has run are not added to the out queue and are not downloaded when the Mobile Client for Web-to-Go synchronizes.
You can upload changes into the in queue and download updates in your out queue even if the MGP is not running. However, your in queue will not be processed, and your out queue will not receive any new changes. You can start and stop MGP from within the Mobile Server Control Center. For more information on starting MGP, see the Oracle9i Lite Administration Guide.
By controlling the time that MGP is run, applications can implement many different synchronization policies. For example, a corporation may mandate all mobile applications users to synchronize twice, once after close of business and once before open of business the next day. MGP could later be run in between these two sync periods. This will ensure that everyone gets all the updates everyday.
The user runs Web-to-Go applications offline. This is the mode that the Web-to-Go applications can run in without network connections. The Mobile Client Web Server generates the Workspace page, with links to the user's applications. Because these links point to the Mobile Client Web Server, clicking one of them starts the application in the client tier. These applications, which are executed on the client by the Mobile Client Web Server, access data stored in the Oracle Lite database.
After the user finishes working with the application, the user can start synchronization with the Oracle database data server to synchronize the user's applications and data between the Oracle Lite database and the Mobile Server Repository.
The user can also run applications online. In this case, the client needs to be connected to the network. When the user runs applications in the online mode, the Mobile Client for Web-to-Go redirects the user's login request to the Mobile Server module on the Oracle9i Application Server (Oracle9i AS). The Mobile Server module subsequently generates the Workspace pages and returns them to the Web browser. The Workspace contains links to the user's Web-to-Go applications on the Mobile Server. Clicking an application link starts the application. The applications, which are executed in the middle tier, access data stored in the Oracle database data server.
Synchronization of the data and applications can be instituted in one of two ways:
Explicitly by the user in the offline mode
Implicitly by switching between online and offline modes.
When the user synchronizes, Web-to-Go replicates the user's data changes that were made locally to the Oracle database data server. Also, any data changes made to the data in the Oracle database data server are applied to the data in the Oracle Lite DBMS on the Mobile Client for Web-to-Go. In addition, any application changes are downloaded to the Mobile Client for Web-to-Go.
The Mobile Client for Web-to-Go can synchronize in two modes:
You can choose the mode by going to the Web-to-Go Workspace portal and clicking the Configuration tab. A panel appears displaying the options for the client modes.
If you choose the Always Offline mode, the Web-to-Go applications will run on your client while you are disconnected from the network. You can modify your data while you are offline. When you want to synchronize your applications and data, you connect to the network, and then click the Sync tab in the Web-to-Go Workspace portal. The data and applications get synchronized between the client and the Mobile Server.
If you choose the On/Offline mode and you are connected to the network, click the Go Online tab in the Web-to-Go Workspace portal. This puts you in the Online mode and starts the synchronization process automatically. You are now working in the online mode on the Mobile Server and only your data gets synchronized because your application is running on the Mobile Server. In this mode, the Go Online tab that you clicked changes to say Go Offline to give you the option of going offline if you choose to do so at any point.
Note that in both modes, synchronization takes place as described in Section 2.3.4, "Synchronizing the Data and Applications ".
Web-to-Go's Java API simplifies the development of mobile applications, as it frees developers from having to write code for such functions as replication of database tables for more information, see "Building Web-to-Go Applications" in Chapter 3, " Developing Web-to-Go Applications".
You can use the Mobile Development Kit for Web-to-Go to develop and debug Web-to-Go applications. The development kit contains a tutorial, sample programs, custom Workspace, and Web-to-Go API documentation. The development kit allows you to run Web-to-Go applications inside a Java debugger which makes Java servlet development much easier. See "Developing Java Servlets for Web-to-Go" in Chapter 3, " Developing Web-to-Go Applications" for more information.
The Java libraries in the Mobile Development Kit for Web-to-Go provide a number of features to make the development of mobile applications easier and more efficient. Examples of these features are connection pooling and a Java-based HTML library.
Connection pooling is a fast and scalable solution for executing servlets that require data access to a database. Creating new database connections for each new HTTP request is a relatively expensive and slow operation. Pooling connections makes creating these connections unnecessary. Web-to-Go manages the pool of database connections, and applications simply request a database connection from the connection pool. Depending on the Web-to-Go mode, the connection is to either Oracle Lite when the user is offline or the Oracle database when the user is online. The connection pool hides the complexity of connection management from applications.
The Java-based HTML library enables developers to include HTML objects within their Java servlet code. The library can also be used to create dynamic HTML content based on static HTML pages that are stored in the Mobile Server Repository.
After completing the application, you can deploy the application to the Mobile Server using the Packaging Wizard.
You can use the Packaging Wizard to create or modify a Web-to-Go application's definition, and then publish it to the Mobile Server Repository. The application definition specifies the properties of an application, including application name, description, database connectivity information, as well as HTML files, database objects, and Java servlets. The developer of the application typically creates the application definition.
The system administrator uses the Mobile Server Control Center to install the application in the Mobile Server production system. After publishing the application, the administrator can use the Mobile Server Control Center to assign application access privileges to users. See the Oracle9i Lite Administration Guide for more information.
The Mobile Server provides server-side management of all users and applications. Administrators manage Web-to-Go applications using the Mobile Server Control Center.
The Administrator uses the Mobile Server Control Center to install the application in the production system. After publishing the application, the Administrator can use the Mobile Server Control Center to assign application access privileges to users.
Using the Mobile Server Control Center, the Administrator can create and modify access control on an application by granting or revoking access to individual users or groups. The Administrator can also use the Mobile Server Control Center to perform other administration tasks, such as:
View server status.
Start, stop, and review status of MGP, which is the asynchronous replication engine.
View site information.
In addition, the Administrator can use the Mobile Server Control Center to change an application's properties by doing the following:
modifying the number of connections an application manages in its Web-to-Go connection pool.
changing the Oracle database login user name and password.
determining which subset of the data is downloaded to the client.
See the Oracle9i Lite Administration Guide for more information.