![]() |
|||
![]() ![]() |
![]() |
![]()
|
![]() |
Integration IssuesMany applications call the ODBC interface or the native database drivers interfaces. In much the same way, if these applications were ported to Java, they would use the JDBC API to perform the same operations. Consider these two questions when starting an integration project. First, will the future application, applet, or servlet be used in a trusted environment or on the Internet? Second, is it worth embedding all the applications logic into a separate tier as a hedge against the business rules evolving as fast as technology? The discussion of these issues in the following sections will help you decide which is the best architecture for your applications purpose. Internet or Intranet?If the application will be used within the intranet only, there is no need to worry about untrusted environments. Normally, every user that has access to the application will run a trusted system. According to todays security rules, this user can launch applications that connect to various hosts within various departments of the company to make a connection to applications and servers. Provided that these users run the usual desktop computer and operating system, they can use local file systems as well. In contrast, if the application is deployed across the Internet to thousands or millions of unregistered users, it is mandatory to assume that these users run an untrusted environment. They are usually allowed to connect to your companys World Wide Web (WWW) server, browse pages, fill in forms, activate common gateway interfaces (CGIs), and download Java applets. These applets, while being real applications running on the client side, are usually not able to write to, or read from, local files. Unless the user specified otherwise, the user will not be able to open transmission control protocol (TCP) streams to arbitrary hosts on the Internet or within your company. In such a situation, it is not possible to rely on local resources such as parameters files, registry, or native libraries and drivers. On the contrary, everything must come from the network. In the case of a database application, these restrictions may impact the design of the application. For example, the location of the database server will not be looked up in a local file. No native database driver will be used. Chapter 4 discusses these issues. Also, the application usually connects to the host from which it came. This host is usually a WWW server. Depending on the architecture, this host may be running both the main WWW server and the DBMS server processes, or it may be running a smaller WWW server process that only delivers applets while also running the DBMS server. In this latter case, the main WWW server will present pages that refer to applets located at the uniform resource locator (URL) of the second dedicated WWW server. It is possible, however, not to locate the DBMS on the WWW server. By using a third tier, for example, the DBMS may run on a dedicated machine with an enhanced input/output (I/O) subsystem. Again, it depends on the architecture, but from the software viewpoint, this middleware could provide specific services to the whole system. The Business Logic of an ApplicationThe business logic of an application is the way it operates according to the business rules. But what are these business rules? Are they standard colors? Standard screen layouts? Standard keyboard mappings? Generally, the business rules for the corporate data include:
For the operations allowed on the corporate data, the rules include:
Usually the actions are performed within the SQL language augmented with specifics of the underlying DBMS. These SQL statements are located on the client side and/or on the database side. For example, a SQL SELECT statement may be linked to a PROCEED button of the client graphical user interface (GUI), while other statements may be stored in the database as stored procedures. Whatever these statements will actually do, they will implicitly or explicitly use one or more business rules. What happens if the business rules change? It may be possible to modify the client code and the stored procedure that need modification according to the new rules. In the case of an application deployed to thousands of users, making such modifications may be problematic. There are some companies that need to adapt themselves to very frequent and important changes. Fortunately, there are solutions for such companies. Changing the stored procedures in one or more DBMSs is probably a lot easier than changing and deploying a thousand client applications. Because storing procedures in the DBMS offers a practical solution to well-known problems, the logic within stored procedures is usually kept in the DBMS. That should not be true for the business logic inside client programs. Indeed, a third tier, best defined using an object paradigm, should embed most of the applications logic. In fact, applets solve the deployment problem because they are downloaded automatically each time they are requested, providing that the original versions are newer than those cached in the clients (if the clients support caching of applets). Other SolutionsMany other solutions to the problem of modifying business rules have appeared since Javas early days. The problem concerned database application developers. The CGI ApproachThe CGI is usually implemented behind a World Wide Web server process on the same machine. While such CGIs may perform many tasks, such as sending e-mail or displaying the number of times a particular page was requested (hit count), they may also interact with a Database Management System and format hypertext markup language (HTML) pages on the fly for display in the users browser. Figure 3-8 shows the CGI behind the Web server.
Listing 3-1 is an example of an HTML form containing query fields. Submission of the form launches a CGI application on the Web server. This application opens a connection to a database and sends a SELECT query with the parameters passed as arguments. When the results are retrieved from the database, they are formatted and an HTML page is sent back to the client browser.
|
![]() |
|