Skip Headers

Oracle® Application Server 10g Concepts
10g (9.0.4)
Part No. B10375-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous Next  

2 J2EE, Web Services, and Internet Applications

This chapter describes the Java 2 Platform, Enterprise Edition (J2EE), Web Services, and Internet application development and deployment environment in Oracle Application Server, explaining its features and concepts. The topics include:

Application Development and Deployment in Oracle Application Server

Oracle Application Server provides an integrated, standards-based environment that provides for both developing applications and then deploying them, reliably delivering the applications to users across an enterprise. The following sections describe how this environment aids application development and deployment.

What Types of Applications Can Be Developed for Deployment in Oracle Application Server?

Oracle Application Server allows Web application developers to develop their sites in a variety of languages and technologies:

Table 2-1 lists the different technologies and programming languages that you can use to build applications for deployment with Oracle Application Server.

Table 2-1 Supported Technologies and Programming Languages

Java and J2EE XML PL/SQL Web Services
  • JavaServer Pages (JSP) v. 1.2
  • Java Servlets v. 2.3

  • Enterprise JavaBeans (EJB) v. 2.0

  • Java Database Connectivity (JDBC) v. 2.0 Extensions

  • Java Transaction API (JTA) v. 1.0

  • Java Naming and Directory Interface (JNDI) v. 1.2

  • Java Message Service (JMS) v. 1.0.2b

  • Java Authentication and Authorization Service (JAAS) v. 1.0

  • J2EE Connector Architecture v. 1.0

  • Java API for XML Parsing (JAXP) v. 1.1

  • Java Mail v. 1.0

  • XML v. 1.0
  • XML Namespaces v. 1.0

  • Document Object Model (DOM) v. 1.0/2.0

  • Extensible Stylesheet Language Transformations (XSLT) v. 1.0

  • XML Schemas v. 1.0

  • Simple API for XML (SAX) v. 1.0/2.0 + Extensions

  • XML Path Language (XPath) v. 1.0

  • XSQL

  • Internet Data Access Presentation (IDAP)

  • PL/SQL Server Pages v. 9.0.4
  • PL/SQL Web Toolkit v. 9.0.4

  • Oracle Application Server Forms Services v. 9.0.4

  • Web Services Description Language (WSDL) v. 1.1
  • Universal Description, Discovery, and Integration (UDDI) v. 2.0

  • Simple Object Access Protocol (SOAP) v. 1.1


The following sections explain how Oracle Application Server supports these technologies and programming languages.

Oracle HTTP Server

Oracle HTTP Server is the underlying deployment platform for all programming languages and technologies that Oracle Application Server supports. It provides a Web listener for Oracle Application Server Containers for J2EE (OC4J) and the framework for hosting static and dynamic pages and applications over the Web. Based on the proven technology of the Apache HTTP Server, Oracle HTTP Server includes significant enhancements that facilitate load balancing, administration, and configuration. It also includes a number of enhanced modules, or mods, which are extensions to the HTTP server that extend its functionality for other enterprise applications and services.

Oracle HTTP Server allows developers to program their sites in a variety of languages and technologies, such as Java, Perl, C, C++, PHP, and PL/SQL. Additionally, it can serve as either a forward or reverse proxy server. The following sections describe how Oracle HTTP Server provides a robust deployment platform for dynamic Web sites and applications.

Oracle HTTP Server Components

Oracle HTTP Server consists of several components that run within the same process. These components provide the extensive list of features that Oracle HTTP Server offers when handling client requests. Major components include the following:

  • HTTP listener: Oracle HTTP Server is based on an Apache HTTP listener to serve client requests.

  • Modules (mods): Many of the standard Apache mods are included with Oracle HTTP Server. Oracle also includes several internal modules that are specific to Oracle HTTP Server components. Table 2-2 lists some of the Oracle HTTP Server modules.

Table 2-2 Prominent Oracle HTTP Server Modules

Module Description
mod_fastcgi Supports FastCGI, which allows C, C++, and Java CGI programs to run in a performant environment
mod_perl Routes requests to the Perl Interpreter
mod_plsql Routes requests for stored procedures to the database server
mod_oc4j Supports communication with Oracle Application Server Containers for J2EE and also performs some load balancing tasks
mod_oradav Supports file as well as database distributed authoring and versioning
mod_ossl Supports Secure Sockets Layer (SSL) and certificate sharing
mod_osso Routes requests to Oracle Application Server Single Sign-On server


See Also:

Oracle HTTP Server Administrator's Guide for a complete list of modules

Figure 2-0 shows the path of various requests through Oracle HTTP Server components.

Figure 2-1 Oracle HTTP Server Request Flow

Description of ascon016.gif follows
Description of the illustration ascon016.gif

Oracle HTTP Server Features

In addition to the standard Web server functionality of serving client requests to other Oracle Application Server components, Oracle HTTP Server provides the necessary features for both creating dynamic applications and implementing enterprise support. It also contains security enhancements that help protect important business resources. Key features of Oracle HTTP Server include the following:

  • Dynamic monitoring services (DMS): These services automatically measure runtime performance statistics for both Oracle HTTP Server and Oracle Application Server Containers for J2EE (OC4J) processes. As applications run, DMS collects detailed performance statistics. This data allows you to monitor the duration of important request processing phases and status information. With this information, you can locate performance bottlenecks and tune the application server to maximize throughput and minimize response time.

  • Request ID: To enhance request tracking through various components, a request ID is now attached to each request. This provides more detailed tracking information, allowing you to see how much time a particular request spends in any component or layer.

  • External API for performance monitoring: This API allows you to use external, third-party performance monitoring tools to monitor Oracle Application Server-based J2EE components, such as servlets and JSPs, as well as J2EE containers.

  • Proxy Plug-In for Using Non-Oracle HTTP Listeners: To accommodate requirements for non-Oracle HTTP listeners, Oracle HTTP Server provides a proxy plug-in that can be plugged directly into Sun ONE or Microsoft Internet Information Server (IIS). This proxy plug-in is used to forward requests for Oracle Application Server component services to Oracle HTTP Server, which is placed behind the non-Oracle listener.

  • OC4J Plug-In for IIS and Sun ONE: The OC4J Plug-In provides a way for you to use the IIS and Sun ONE third-party listeners to access servlets running in OC4J without having to use OHS as a proxy. The OC4J Plug-In routes requests directly from the third-party HTTP listener to OC4J.

  • Oracle Application Server Single Sign-On Plug-in: This plug-in is the Oracle single sign-on solution for third-party listeners such as Sun ONE and IIS. The plug-in is designed to protect native third-party listener applications using the single sign-on infrastructure. Using this plug-in, you can be authenticated to different third-party listener applications using only one password. You can integrate these protected third-party listener applications with other single sign-on enabled applications as long as they are all protected by the same single sign-on server.

Oracle HTTP Server Architecture

At startup, the Web server parent process loads the entire configuration and the associated mods, and spawns a preconfigured number of child processes.


Note:

On Windows systems, the Web server main process is a child process that spawns multiple threads.

Figure 2-2 shows the process architecture of Oracle HTTP Server in a UNIX environment.

Figure 2-2 Oracle HTTP Server Process Architecture

Description of ohsarch.gif follows
Description of the illustration ohsarch.gif

The parent process does not listen to HTTP requests. Its sole job is to ensure that the child processes are running or that new ones are started when the load requires it.

On UNIX platforms, each child process handles a single HTTP request. The child processes determine who should take the next request based on a mutex mechanism that you can configure.


Note:

On Windows platforms, threads handle HTTP requests instead of child processes.

Modular Architecture

The architecture of Oracle HTTP Server is modular. The core HTTP listener is very small, and all capabilities are implemented as modules that plug in and are invoked at the appropriate place during the HTTP request lifecycle. Figure 2-3 shows the lifecycle of an HTTP request in Oracle HTTP Server.

Figure 2-3 Oracle HTTP Server HTTP Request–Response Cycle

Description of ascon017.gif follows
Description of the illustration ascon017.gif

A child process guides the request through this entire lifecycle. The modules register their application programming interfaces (APIs), which are then either invoked automatically when the request reaches a certain stage in its lifecycle, or can be configured to be invoked only in certain situations.

Common Gateway Interface (CGI) Support

Requests that are sent to a common gateway interface (CGI) program may invoke two new processes—the child process that handles the HTTP request and the CGI program itself. It is possible to avoid this overhead by configuring Oracle HTTP Server to pre-start child processes and keep them running, leveraging the Perl module to run the CGI programs in memory, or using the FastCGI mechanism.

The following Oracle HTTP Server features support CGI:

  • FastCGI: FastCGI supports applications written with Perl, C, C++, and Java. Each CGI application runs in a single child process of the Web server. This improves server performance because it eliminates the need to start a new process for every application request.

  • Perl Interpreter: The Perl Interpreter supports Perl applications and runs them inside of the Web server process. This allows for greater performance because running applications does not start new processes. Since the interpreter runs inside of the Web server process, it has access to Web server services such as log files.

Oracle Application Server Containers for J2EE

Oracle Application Server Containers for J2EE (OC4J) is a fast, lightweight, and scalable J2EE 1.3 certified server implementation that is written in Java and runs on a standard Java Virtual Machine (JVM). It has been designed to support the standard APIs in Table 2-3.

Table 2-3 Oracle Application Server Containers for J2EE Supported APIs

API Version
JavaServer Pages (JSP) 1.2
Java Servlet 2.3
Enterprise JavaBeans (EJB) 2.0
Java Database Connectivity (JDBC) 2.0 Extensions
Java Transaction API (JTA) 1.0
Java Message Service (JMS) 1.0.2b
JavaMail 1.2
JavaBeans Activation Framework 1.0
Java API for XML (JAXP) 1.1
J2EE Connector Architecture 1.0
Java Authentication and Authorization Service (JAAS) 1.0

Introduction to J2EE Application Development

The following sections provide introductory definitions and summaries of application programming technologies that Oracle Application Server supports. For detailed information on the technologies introduced in this section, refer to the following information sources.


See Also:


What Is a J2EE Application?

A J2EE application is an application that is written in Java using the J2EE APIs. It can be deployed, managed, and executed on a J2EE-compatible server. The J2EE application itself is composed of a set of components, such as Web presentation modules, business logic modules, and data access modules. Each component is assembled into the overall application with all of its related classes and XML deployment descriptors.

J2EE Distributed Multi-tiered Application Model

The J2EE platform provided in Oracle Application Server uses a multi-tiered distributed application model. A multi-tiered distributed application model divides application logic into components according to function, and the various application components that make up J2EE applications can be installed on different machines, depending on which tier in the multi-tiered J2EE environment the application component belongs. Figure 2-4 shows two multi-tiered J2EE applications divided into the client, Web, business logic, and enterprise data tiers.

Figure 2-4 J2EE Distributed Multi-tiered Application Architecture

Description of ascon005.gif follows
Description of the illustration ascon005.gif

You can distribute J2EE applications across the four tiers shown in this figure, but generally they are considered to be three-tier applications because they are usually distributed over the following machine locations:

  • client machines

  • J2EE Server machines hosting presentation services, like JSPs and servlets, and business logic components, like EJBs

  • database servers or legacy machines at the back end

Three-tiered applications that run in this way extend the standard two-tiered client and server model by placing an application server between the client and the back-end storage.

Types of J2EE Clients

J2EE applications support the following clients:

  • Application Clients: Applications running on a client machine that directly access enterprise beans that are running in the business logic tier. Application clients can also open an HTTP connection to establish communication with a servlet running on the Web tier if a J2EE application requires it.

  • Dynamic HTML and XML Pages: In the context of J2EE applications, dynamic HTML and XML pages are either generated by servlets or created with JavaServer Pages technology running in the Web tier. These pages can be extensions to traditional static HTML pages, allowing application developers to offer customized and personalized pages to the client.

Types of J2EE Application Components

You can use the following components in J2EE applications:

  • Servlets: A servlet is a Java class that executes behind a Web server and can extend the capability of the Web server to provide services for dynamic page creation or application logic. The servlet works in the standard HTTP request-response model.

  • JavaServer Pages: JavaServer Pages (JSPs) are text files that contain two types of information: static template data, which can be expressed in any text-based format, such as HTML, XML, or WML (Wireless Markup Language); and JSP elements, which construct dynamic content.

  • Enterprise Beans: Enterprise beans are server-side components that encapsulate the business logic of an application.

Types of J2EE Containers

A container provides the runtime support for J2EE application components. Containers provide a federated view of the underlying J2EE APIs to the application components. J2EE application components never interact directly with other J2EE application components. They use the protocols and methods of the container for interacting with each other and with platform services. Interposing a container between the application components and the J2EE services allows the container to transparently inject the services defined by the components’ deployment descriptors, such as declarative transaction management, security checks, resource pooling, and state management.

Before a Web or enterprise bean component can run, it must be assembled into a J2EE application and deployed into a J2EE container. The assembly process involves specifying container settings for each component, which customize the underlying support provided by the J2EE server. These settings can be standard J2EE settings or container-specific settings, depending on your application requirements. Some of the container settings that you can specify include security services, transaction model, naming and directory lookup, and remote connectivity model.

There are two primary types of J2EE container:

  • Enterprise JavaBeans Container: The Enterprise JavaBeans container (EJB container) manages the execution of all enterprise beans for J2EE applications. Enterprise beans and their container run on the J2EE server.

  • Web Container: Web components such as JSP pages and servlets are managed and executed in the servlet container. The container provides services such as request dispatching, security, concurrency, and life cycle management. The Web container also gives Web components, typically JSPs and servlets, access to the J2EE APIs such as naming, transactions, and JDBC.

J2EE Application Packaging Concepts

J2EE components are packaged separately and bundled into a J2EE application. Each component, with its related files such as GIF and HTML files or server-side utility classes, are packaged together with a deployment descriptor (DD), and are assembled into a module that is added to the J2EE application. Typically, a J2EE application is composed of one or more enterprise beans and Web or application client component modules.

Oracle Application Server Containers for J2EE Features

Oracle Application Server Containers for J2EE (OC4J) has the following features.

Oracle Application Server Containers for J2EE Containers

OC4J supplies the following J2EE containers:

  • A servlet container that complies with the servlet 2.3 specification

  • A JSP container that complies with the Sun JSP 1.2 specification

  • An EJB container that complies with the EJB 2.0 specification

Oracle Application Server Containers for J2EE Servlet Container

A servlet is a Java program that runs on a J2EE server, such as OC4J. A servlet is one of the application component types of a J2EE application. It must execute under the control of a servlet container, which is part of the OC4J Web container. The servlet container calls the servlet’s methods and provides services that the servlet needs when running.


About the Servlet Container

The servlet container executes and manages servlets. It provides the servlet with access to properties of the HTTP request, such as headers and parameters. Also, the container provides the servlet with access to other Java APIs, such as JDBC to access a database, remote method invocation (RMI) to call remote objects, or JMS to perform asynchronous messaging.


How the Servlet Container Works

When a request is mapped to a servlet, the servlet container performs the following steps:

  1. If an instance of the servlet does not exist, the container does the following:

    1. Loads the servlet class

    2. Instantiates an instance of the servlet class

    3. Initializes the servlet instance

  2. The container then invokes the servlet, passing request and response objects. The request object contains information about the client, request parameters, and HTTP headers. The response object returns the servlet’s output to the client.

The servlet extracts information from the client request, accesses external resources, and then populates the response based on that information.

Oracle Application Server Containers for J2EE JavaServer Pages Container

JavaServer Pages provide a convenient way to generate dynamic content in Web pages. JSP technology, which is closely coupled with servlet technology, allows you to include Java code fragments and make calls to external Java components (in the form of tags and directives) from within your Web pages. Typically, the markup code used to compose your Web pages is HTML or XML. JSPs work well as a front-end for business logic and dynamic functionality in JavaBeans or Enterprise JavaBeans (EJBs).

A JSP is translated into a Java servlet before being run, and it processes HTTP requests and generates responses like any servlet. However, JSP technology provides a more convenient way to code a servlet. Translation occurs the first time the application is run. A JSP translator is triggered by the .jsp file name extension in a URL.

JSPs are fully interoperable with servlets. You can include output from a servlet or forward the output to a servlet, and a servlet can include output from a JSP or forward output to a JSP.


About the JSP Translator

The JSP translator has a translator and a compiler. The JSP translator translates a JSP into a Java source file. The container compiles the source file into a Java bytecode (.class) file, which executes as a servlet in the servlet container using the JSP runtime library. The servlet container provides access to Java APIs and other services.


How the JSP Translator Works

When a user requests a URL that maps to a JSP file, such as http://host/Hello.jsp, the following steps occur:

  1. The Web server invokes the JSP translator, which translates Hello.jsp and produces the file Hello.java.

  2. The Java compiler is invoked, creating a Hello.class servlet.

  3. Hello.class runs, using the JSP runtime library, which contains the supporting files to interpret the tags and directives from the JSP.

  4. If the Hello class requires information from a database, then the servlet container provides JDBC access to the class so it can retrieve the information and return its output to the client browser.

Oracle Application Server Containers for J2EE Enterprise JavaBeans Container

The OC4J EJB container manages the execution of enterprise beans for J2EE applications. Like the OC4J Web container, the EJB container uses the J2SE virtual machine. The following sections describe what services the EJB container provides to J2EE applications and how it works.

Enterprise beans are the J2EE components that implement Enterprise JavaBeans technology. Enterprise beans run in the EJB container. An enterprise bean is a portable server-side component that encapsulates the business logic of an application. There are three types of EJBs: session beans, entity beans, and message-driven beans.


About the Oracle Application Server Containers for J2EE EJB Container

The OC4J EJB container provides system-level services to EJBs similar to the services that the Web container provides to servlets and JSPs. The container has configurable settings that customize the underlying support provided by OC4J, the J2EE server. The configurable settings include security, transaction management, Java Naming and Directory Interface (JNDI) lookups, and remote connectivity. In addition to the configurable settings, the container also manages EJB life cycles, database connection resource pooling, data persistence, and access to the J2EE APIs.


How the EJB Container Works

How the EJB container works depends on what type of enterprise bean you are using. The container manages the execution of the enterprise bean for one J2EE application.

For session beans, the EJB container provides all of the services that the Web container provides to Web components, such as access to APIs and the virtual machine, transaction services like Container Managed Transactions (CMTs), and secure and authorized EJB method invocation.

For entity beans, which represent business objects in a persistent storage mechanism, there are models for how the persistence is performed. You can have either bean-managed persistence (BMP) beans or container-managed persistence (CMP) beans. With bean-managed persistence, the entity bean code contains the calls that access the database and the EJB container triggers callback methods on your code. Entity beans with bean-managed persistence execute in the EJB container with the typical container support and services. However, if you are using container-managed persistence, then the EJB container automatically generates the necessary database access calls. The EJB methods do not require any JDBC code to manage EJB data persistence.

J2EE Services

Java 2 Platform Enterprise Edition (J2EE) provides core services for writing J2EE components. The J2EE containers manage access to these services for the application components. The services are as follows:

  • Java Database Connectivity (JDBC): This service lets you invoke SQL commands from Java programming methods. You use the JDBC API in an enterprise bean when you override the default container-managed persistence or have a session bean access the database. You can also use the JDBC API from a servlet or a JSP to access a database directly without going through an enterprise bean.

    Oracle Application Server includes the following drivers to provide highly scalable and reliable connectivity to both Oracle and non-Oracle data sources:

    • Oracle JDBC drivers: The Oracle JDBC drivers, in addition to providing standard JDBC API support, have extensions to support Oracle-specific datatypes and to enhance their performance. They are meant to be used with the Oracle database.

    • J2EE Connectors: The J2EE Connector architecture, part of the J2EE platform, provides a Java-based solution for connecting various application servers and enterprise information systems that are already in place.

    • DataDirect Connect Type 4 JDBC drivers: DataDirect JDBC drivers are meant specifically for connecting to non-Oracle databases, such as Microsoft SQL Server and Sybase.

  • Java Message Service (JMS): This service is a messaging standard that allows J2EE application components to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous.

    For this release, JMS support has been enhanced by the addition of a lightweight JMS provider in addition to the Oracle JMS offered in previous versions. The new lightweight JMS is fully JMS 1.0 compatible and can support durable messaging through a file-based persistence mechanism, which provides improved stability and performance. Support for Message Driven Beans is also now available for both Oracle JMS (AQ) and the lightweight OC4J JMS.

  • Java Transaction API (JTA): This service provides a standard demarcation interface for demarcating transactions. Typically, it is used in J2EE applications that use two or more separate database access operations that depend on each other to demarcate where the entire transaction begins, rolls back, and commits.

    OC4J provides additional support for two-phase commits for applications that require commit coordination across machines and containers. The two-phase commit engine is responsible for ensuring that when a distributed transaction ends, changes to all participating databases are all either committed or rolled back.

  • Java Naming and Directory Interface (JNDI): This service provides a standard interface to naming and directory services. J2EE applications use JNDI to find other distributed objects. The JNDI Interface has two parts: an application-level interface used by application programs to access naming and directory services, and a service provider interface to attach a provider of naming and directory services.

  • JavaMail Technology: This service provides J2EE applications with a JavaMail API and a JavaMail service provider with which to send e-mail notifications.

  • Java API for XML (JAXP): This service provides support for the industry standard SAX and DOM APIs for parsing XML documents, as well as support for XSLT transform engines. It enables applications running in a J2EE container to make use of XML.

  • J2EE Connector Architecture: This service provides an interface for resource adapters that allow J2EE applications to access and interact with databases and other enterprise information systems (EIS). Oracle Application Server provides several out-of-the box adapters, and also allows you to build your own.

  • Java Authentication and Authorization Service (JAAS): This service provides a way for a J2EE application to authenticate users against different security provider systems and authorize a specific user or group of users to run J2EE applications under role permission and control enforcement.

    Oracle Application Server provides an implementation of Java Authentication and Authorization Service (JAAS) that integrates with the Oracle Application Server J2EE security infrastructure to enforce security constraints for Web components (servlets and JSPs) and EJB components. The Oracle Oracle Application Server Java Authentication and Authorization Service implementation does the following:

    • Integrates Java-based applications with Oracle Application Server Single Sign-On, including authentication, thereby giving you extensible security for Java-based applications

    • Manages access control policies centrally in Oracle Internet Directory, controls access by role, and partitions security policy by subscriber

    • Supports impersonation of a specific user, allowing an enterprise bean, servlet, or JSP to run with the permissions associated with the current client or a specified user


      See Also:

      The Sun Microsystems, Inc. published specifications for these services, and The J2EE Tutorial for instructions on how to use them in J2EE applications, at:
      http://java.sun.com
      

Oracle J2EE Services

In addition to the standard J2EE Services, Oracle also provides the following services to Java developers:

  • Java Object Cache stores frequently accessed or resource-intensive objects in memory or on disk. It is a low-level object caching API, supporting generic object types such as memory objects, disk objects, pooled objects, and StreamAccess objects. Java Object Cache uses distributed object management to coordinate updates and invalidations of Java objects.

    Objects are loaded using a user-defined CacheLoader object and accessed through the easy-to-use API. This eliminates the need to repeatedly create and load information within a Java application. The Java Object Cache retrieves content quickly and greatly reduces the load on Oracle Application Server.

    Java Object Cache provides caching for expensive or frequently used Java objects when the application servers use a Java program to supply their content. Cached Java objects may contain generated pages, or they may provide support objects within the program to assist in creating new content. Java Object Cache automatically loads and updates objects as specified by the Java applications and includes APIs to manage the cached Java objects. The generic nature of Java Object Cache makes it an ideal cache repository for higher level caches such as Web Object Cache, easing the development effort and reducing complexity.

  • Oracle Business Components for Java (BC4J) is a Java and XML framework that enables productive development, portable deployment, and flexible customization of multi-tier database applications from reusable business components. BC4J is an application component framework that provides developers with a set of intelligent software building-blocks that cooperate to manage all of the common facilities required to do the following:

    • Productively author and test business logic in components that automatically integrate with relational databases

    • Flexibly reuse business logic through multiple SQL-based views of data, supporting different application tasks

    • Efficiently access and update the views from servlets, JavaServer Pages (JSPs), XML clients and thin-Java Swing clients

    • Easily customize application functionality in layers without requiring modification of the delivered application


See Also:

"Oracle Business Components for Java" in this chapter

Oracle Application Server Containers for J2EE Architecture

Figure 2-5 shows the architecture of OC4J within Oracle Application Server.

Figure 2-5 Oracle Application Server Containers for J2EE Architecture

Description of ascon006.gif follows
Description of the illustration ascon006.gif

OC4J is supported by the Java 2 Platform, Standard Edition (J2SE) infrastructure as shown in Figure 2-5. This means that the OC4J Web container and OC4J EJB container use the J2SE virtual machine. J2EE applications are modularized for reuse of application components, such as:

  • User interfaces, which can be composed of JavaServer Pages (JSPs), dynamic HTML, and so on

  • Business logic, which is usually contained in an Enterprise JavaBean (EJB) or normal Java classes

The J2EE containers also perform services for applications, such as providing access to the APIs and lifecycle management.

Oracle Application Server TopLink

Oracle Application Server TopLink is an advanced object-to-relational persistence framework, suitable for a wide range of Java 2 Enterprise Edition (J2EE) and Java application architectures. OracleAS TopLink development tools and runtime capabilities reduce development and maintenance efforts, and increase enterprise application functionality. Use OracleAS TopLink to build high-performance applications that store persistent data in a relational database.

The following sections introduce OracleAS TopLink and include discussions on these topics:

Advantages of OracleAS TopLink

Enterprise applications rely on Java-to-database integration to implement objects and logic. OracleAS TopLink enables developers to efficiently develop and refine enterprise applications. To fully understand OracleAS TopLink, you must understand the problems that enterprise application developers face and how OracleAS TopLink resolves them.

The OracleAS TopLink Problem Space

Java-to-database integration is a widely underestimated problem in enterprise Java applications. This complex problem involves more than reading from and writing to a database. The database world includes elements such as tables, rows, columns, and primary and foreign keys; the Java and J2EE world contains entity classes (regular Java classes or Enterprise JavaBeans (EJB) entity beans), business rules, complex relationships, and inheritance. Bridging these two fundamentally different technologies is a challenging and resource-intensive problem.

The process of translating object-oriented data into relational data is referred to as object-relational (O-R) mapping. To enable an O-R solution, developers must resolve the following O-R bridging issues:

  • Fundamentally different technologies

  • Different skill sets

  • Different staff and ownership for each of the technologies

  • Different modeling and design principles

Application developers need a product that enables them to integrate Java applications and relational databases, without compromising ideal application design or database integrity. In addition, Java developers need the ability to store (or persist) and retrieve business domain objects using a relational database as a repository.

The OracleAS TopLink solution is a persistence framework that manages O-R mapping in a seamless manner and enables developers to rapidly build applications that combine the best aspects of object technology and relational databases.

The OracleAS TopLink Solution

OracleAS TopLink provides a mature and powerful solution that addresses the disparity between Java objects and relational databases. OracleAS TopLink enables developers to:

  • Persist Java objects in virtually any relational database supported by a JDBC 2.0 compliant driver

  • Map any object model to any relational schema, using the Oracle Application Server TopLink Mapping Workbench graphical mapping tool

  • Use OracleAS TopLink successfully, even if they are unfamiliar with SQL or JDBC, because OracleAS TopLink provides a clean, object-oriented view of relational databases

Other OracleAS TopLink Advantages

In addition to providing industry-leading O-R mapping capabilities, OracleAS TopLink provides flexibility, increases performance and maximizes the productivity of your applications. OracleAS TopLink provides the following features:

  • Advanced object caching that improves performance by minimizing database access.

  • Rich query support that provides easy access to sophisticated, dynamic query languages and tools such as query by example, Java expression-based queries, EJB QL, and SQL.

  • A transactional framework that enables developers to easily create and modify mapped objects. This framework integrates the complexities of a shared memory space and caches, and provides scalability that supports multiple server instances (clustering). Although the mechanisms involved are complex, OracleAS TopLink makes it easy to leverage this functionality by simplifying the task of writing transactional code that complies with database referential integrity and optimal access patterns.

OracleAS TopLink Components

At its core, OracleAS TopLink is a runtime engine that provides Java or J2EE applications with access to persistent entities stored in a relational database. In addition to runtime capabilities, the Oracle Application Server TopLink Foundation Library includes the OracleAS TopLink Application Programming Interface (API). This API enables applications to access OracleAS TopLink runtime features, as well as development tools that simplify application development. The tools capture mapping and runtime configuration information in metadata files that TopLink passes to the runtime.

Figure 2-6 shows how the OracleAS TopLink components relate to one another throughout the development cycle.

Figure 2-6 TopLink Components in the Development Cycle

Description of under01.gif follows
Description of the illustration under01.gif

OracleAS TopLink Development Components

OracleAS TopLink application development comprises three elements: the development environment, the OracleAS TopLink runtime, and the metadata that ties them together.

Development

To create an OracleAS TopLink application, map the object and relational models using the OracleAS TopLink Mapping Workbench, and capture the resulting mappings and additional runtime configurations in the OracleAS TopLink project file (the project.xml file). Then build a session configuration file (the sessions.xml file) in the OracleAS TopLink Sessions Editor. These files together represent your entire OracleAS TopLink project.

During development, developers leverage the OracleAS TopLink API to define query and transaction logic. When developers use EJB entity beans, there is generally little or no direct use of the OracleAS TopLink API.

Runtime

The OracleAS TopLink Foundation Library provides the OracleAS TopLink runtime component. Access the runtime component either directly through the OracleAS TopLink API, or indirectly through a J2EE container when using EJB entity beans. The runtime engine is not a separate or external process; instead, it is embedded within the application. Application calls invoke OracleAS TopLink to provide persistence behavior. This function allows for transactional and thread-safe access to shared database connections and cached objects.

Metadata

OracleAS TopLink metadata is the bridge between the development of an application and its deployed runtime. Capture the metadata using the OracleAS TopLink Mapping Workbench and OracleAS TopLink Sessions Editor, and pass the metadata to the runtime using deployment project.xml and sessions.xml files. It is also possible to hand-code these files using Java and the OracleAS TopLink API, but this approach is more labor-intensive.

The metadata, encapsulated in the project.xml file and the sessions.xml file, allows developers to pass configuration information into the runtime environment. The runtime uses the information in conjunction with the persistent entities (Java objects or EJB entity beans), and the code written with the OracleAS TopLink API, to complete the application.

Oracle Application Server TopLink Mapping Workbench

The OracleAS TopLink Mapping Workbench is a graphical development tool that enables developers to map between the object and relational models, and configure many of the OracleAS TopLink Foundation Library features. The OracleAS TopLink Mapping Workbench creates an OracleAS TopLink project, the primary object in the OracleAS TopLink metamodel. Export the project as a single deployment XML file (the project.xml file), which OracleAS TopLink uses in conjunction with the OracleAS TopLink runtime to provide the application-specific persistence capabilities. Figure 2-7 shows how the OracleAS TopLink Mapping Workbench fits into the OracleAS TopLink environment.

Figure 2-7 The OracleAS TopLink Mapping Workbench in a TopLink Environment

Description of under03.gif follows
Description of the illustration under03.gif

The OracleAS TopLink Mapping Workbench can import compiled entity classes (Java objects or EJB entity beans), as well as relational schema through a JDBC driver that the developer configures. Because OracleAS TopLink imports the object and relational models for mapping, developers can develop the two models relatively independently from the O-R mapping phase of project development.

Oracle Application Server TopLink Sessions Editor

Most OracleAS TopLink applications include a session configuration file, the sessions.xml file, to simplify the application deployment process. The OracleAS TopLink Sessions Editor provides a graphical environment in which to configure the sessions.xml file.

Use the sessions.xml file to configure one or more sessions for the OracleAS TopLink project, and associate the sessions with the project. This approach allows developers to specify individual configurations for each session and to add or modify the following:

  • Database (JDBC) login information different from the login information used during development (for example, external data sources for the host application server’s connection pools)

  • JTA/JTS transaction usage

  • Cache synchronization

  • Session broker (enables client applications to view multiple databases and projects as a single OracleAS TopLink session)

Oracle Application Server TopLink Foundation Library

The Oracle Application Server TopLink Foundation Library includes a Java library that forms the runtime component of the product. It provides support and the API for the components that make up an OracleAS TopLink application. The API enables developers to interact with OracleAS TopLink to retrieve and modify their application persistent entities. Figure 2-8 shows the interaction of the parts of an OracleAS TopLink application.

Figure 2-8 OracleAS TopLink Application Components

Description of under02.gif follows
Description of the illustration under02.gif


Note:

Although this section describes how these components fit into J2EE architectures, note that OracleAS TopLink also supports non-J2EE solutions. The Oracle Application Server TopLink Application Developer’s Guide describes these solutions in more detail.

Sessions

A session is the primary interface between the client application and OracleAS TopLink, and represents the connection to the underlying relational database. OracleAS TopLink offers several different session types, each optimized for different design requirements and architectures. The session manager configures and manages the session as a singleton within the application.

The most commonly-used session is the server session, a singleton session that clients access on the server through a client session. The server session provides a shared cache and shared JDBC connection resources. OracleAS TopLink also supports sessions for two-tier architectures, distributed applications, and multiple databases.

Data Access

The OracleAS TopLink data access component provides access to JDBC connections through connection pooling, provided either by OracleAS TopLink or a host application server. This component manages the SQL generation required by the various query operations and reconciles any differences between JDBC drivers and SQL dialects. OracleAS TopLink offers many performance tuning options that optimize its data access capabilities.

Caching

OracleAS TopLink supplies an object level cache that guarantees object identity and provides performance enhancement. Developers can configure the OracleAS TopLink cache and maximize the application efficiency by reducing the number of times the application accesses the database. In a clustered environment, developers can configure OracleAS TopLink to synchronize changes with other instances of the deployed application.

Queries

The OracleAS TopLink query framework provides developers with the flexibility necessary to manage the complex persistence requirements of enterprise applications. The key features of this query framework include:

  • A rich set of query types to allow object retrieval, summary results, and raw data retrieval

  • The ability to specify the search criteria using OracleAS TopLink Expressions (for object model based queries), EJB QL, SQL, stored procedures, or query by example

  • Configuration options that enable developers to specify how the query is executed, and customize many of its performance optimizing features

Developers can define OracleAS TopLink queries using the OracleAS TopLink Mapping Workbench, in Java code using the OracleAS TopLink API, or, in the case of EJB entity beans, through EJB Finders.

Transactions

OracleAS TopLink provides the ability to write transactional code isolated from the underlying database and schema. OracleAS TopLink achieves this functionality through the Unit of Work.

The Unit of Work isolates changes in a transaction from other threads until it successfully commits the changes to the database. Unlike other transaction mechanisms, the Unit of Work automatically manages changes to the objects in the transaction, the order of the changes, and changes that might invalidate other OracleAS TopLink caches. The Unit of Work manages these issues by calculating a minimal change set, ordering the database calls to comply with referential integrity rules and deadlock avoidance, and merging changed objects into the shared cache. In a clustered environment, the Unit of Work also synchronizes changes with the other servers in the cluster.

If an application uses EJB entity beans, developers do not access the Unit of Work API directly, but they still benefit from its features: the integration between the OracleAS TopLink runtime and the J2EE container leverages the Unit of Work automatically.

JTA/JTS Integration: By default, OracleAS TopLink allows the application to create transaction boundaries for all object-level changes. OracleAS TopLink explicitly manages the database transaction, and if it encounters problems, safely rolls back both the database changes and the object-level changes.

In the case of a J2EE application, developers can configure OracleAS TopLink to synchronize with the JTA/JTS subsystem of the host application server. This feature allows an application to use container-managed transactions, rather than the default user-managed transactions.

Note that this functionality is not limited to EJB architectures. Developers can configure any OracleAS TopLink architecture to use container-managed transactions.

OracleAS TopLink Metadata

The OracleAS TopLink approach to persistence is based on metadata that defines the class structure (objects) and relational schema, along with other configuration information used by OracleAS TopLink at runtime. Developers can use the OracleAS TopLink Mapping Workbench to define this metadata, and the OracleAS TopLink runtime component uses the metadata to provide the necessary persistence capabilities, using Java's reflective and introspective capabilities.

The TopLink application metadata model is based around the OracleAS TopLink project. The project includes descriptors, mappings, and various policies that customize the runtime capabilities. Figure 2-9 shows this metadata model.

Figure 2-9 OracleAS TopLink Metadata

Description of under04.gif follows
Description of the illustration under04.gif

Sessions XML

Use the sessions.xml file to configure sessions for the project. Developers can build and edit these files with the OracleAS TopLink Sessions Editor. The session manager uses the sessions.xml configuration file during application initialization.

Project

The OracleAS TopLink deployment project is the primary container for the metadata. A project generally represents an application and contains the mapping information for all persistent classes and their relationships. Each session (excluding the session broker) in the deployed application references a single project. Although developers can build a project by coding it using the OracleAS TopLink API, we recommend that developers create and manage the project in the OracleAS TopLink Mapping Workbench, and use the OracleAS TopLink Mapping Workbench to generate either an XML or Java source version of the project for use at runtime.

Descriptor

A descriptor represents the association between a persistent Java class and a relational table or tables. The descriptor contains configuration information for the class level within a project, as well as a set of mappings for each of its persistent attributes. Many of the more advanced configuration options are set at the descriptor level. The OracleAS TopLink Mapping Workbench supports most of these options, but there are a few that developers must set using the OracleAS TopLink API.

Mappings

Mappings describe how the attributes of a mapped class are associated with columns in the database. OracleAS TopLink provides a sophisticated set of flexible and customizable mappings that allow for complex mapping scenarios between the object and relational models.

There are two types of mappings: direct mappings and relationship mappings.

  • Direct Mappings: Direct mappings relate an attribute or attributes to a column or columns in the relational schema. OracleAS TopLink provides several direct mappings that allow for conversions between the types from the database and the object model's attribute types. Here are the direct mappings and their functions:

    • Direct-to-field mappings map a Java attribute directly to a value database column.

    • Type conversion mappings explicitly map a database type to a Java type.

    • Object type mappings match a fixed number of database values to Java objects.

    • Serialized object mappings store large data objects, such as multimedia files and BLOBs, in the database.

    • Transformation mappings offer specialized translations between how a value is represented in Java and in the database, such as when developers map multiple fields into a single attribute.

  • Relationship Mappings: OracleAS TopLink offers sophisticated relationship mapping, which enables developers to represent object relationships based on the database table columns and foreign keys. Here are the relationship mappings and their functions:

    • One-to-one mappings represent simple pointer references between two Java objects. The references use any of foreign keys, target foreign keys, or variable classes to define the pointer.

    • Aggregate object mappings represent the relationship between a given object and a target object. The objects have a strict one-to-one relationship, and all the attributes of the second object are retrievable from the same table as the owning object.

    • Aggregate collection mappings represent the relationship between a single-source object and a collection of target objects. Unlike one-to-many mappings, in which there must be a one-to-one back reference mapping from the target objects to the source object, there is no back reference required for the aggregate collection mappings, because the foreign key relationship is resolved by the aggregation (object and collection).

    • One-to-many mappings represent the relationship between a single source object and a collection of target objects.

    • Many-to-many mappings represent the relationships between a collection of source objects and a collection of target objects. They require an intermediate table for managing the associations between the source and target records.

    • Object-relational mappings are mappings that leverage databases that support object-relational entity storage within tables.

Application Development with OracleAS TopLink

Using OracleAS TopLink to build an application does not affect the choice of development tools or the creative process. However, OracleAS TopLink does influence how developers approach development. This section highlights some of the key areas in which using OracleAS TopLink affects application development. These areas exist, regardless of whether developers are building an application to support Java objects, EJB entity beans, or both.

Mapping

OracleAS TopLink maps the application’s persistent entities to the database, using the descriptors and mappings developers build with the OracleAS TopLink Mapping Workbench. The OracleAS TopLink Mapping Workbench supports several approaches to project development, including:

  • Importing classes and tables for mapping

  • Importing classes and generating tables and mappings

  • Importing tables and generating classes and mappings

  • Creating both class and table definitions with mapping creation and model generation

The OracleAS TopLink Mapping Workbench supports all these options; however, the most common solution is to develop the persistent entities using a development tool, such as an integrated development environment (IDE) or modeling tool, and to develop the relational model through appropriate relational design tools. Developers then use the OracleAS TopLink Mapping Workbench to construct mappings that relate these two models.

The OracleAS TopLink Mapping Workbench does offer some facilities for generating persistent entities or the relational model components for an application; however, these utilities are intended only to assist in rapid initial development strategies, rather than complete round-trip application development.


See Also:

Oracle Application Server TopLink Mapping Workbench User's Guide

Session Management

Sessions are the primary interface between the application and OracleAS TopLink persistence capabilities. When developing an OracleAS TopLink application, developers must ensure that they properly initialize and manage the sessions.

When using EJB entity beans with container-managed persistence (CMP) or bean-managed persistence (BMP), the client code that modifies the entity beans does not access the OracleAS TopLink session directly. Instead, changes occur transparently, through integration with the container or through EJB callbacks.

Well-designed applications that employ Java objects as persistent entities use the session manager provided in the OracleAS TopLink API. This class initializes and manages the singleton session. Developers configure the session manager in the sessions.xml file, which allows for easy configuration and customization of the deployed application.

Querying

OracleAS TopLink furnishes several object and data query types, and offers flexible options for query selection criteria, including:

  • OracleAS TopLink expressions

  • EJB QL

  • SQL

  • Stored procedures

  • Query by example

With these options, developers can build any type of query. We recommend that developers use predefined queries to define application queries. Predefined queries are held in the project metadata and referenced by name. This simplifies application development and encapsulates the queries to reduce maintenance costs.

The OracleAS TopLink Mapping Workbench provides the simplest way to define queries. Developers can also build queries in code, using the OracleAS TopLink API.

If the application includes EJB entity beans, developers can code finders completely using EJB QL, which enables the application to comply with the J2EE specification. Alternatively, developers can use any of the other OracleAS TopLink query options. All querying options are available, regardless of the architecture or persistent entity type.

Transactions

In an OracleAS TopLink application, the Unit of Work ensures that OracleAS TopLink transactions comply with the transactional requirements of the application.

The Unit of Work is one of the most sophisticated and powerful components of the OracleAS TopLink Foundation Library. Although developers that use CMP or BMP entity beans do not use the OracleAS TopLink API to apply transactional changes to their persistent entities, the Unit of Work is used behind the scenes. Understanding how the Unit of Work behaves, and developing simple coding patterns to use it, are the keys to building efficient, maintainable applications.

Packaging and Deployment

Application packaging (for deployment in the host Java or J2EE environment) influences OracleAS TopLink use and configuration. For example, developers package a J2EE enterprise application in an Enterprise Archive (EAR) file. Within the EAR file, there are several ways to package persistent entities within Web Application (WAR) and Java libraries (JAR). How developers configure OracleAS TopLink depends, in part, on how they package the application and how they use the host application server class loader.

Monitoring and Performance Tuning

OracleAS TopLink enables developers to monitor functionality and performance throughout application development, testing, and quality assurance cycles. OracleAS TopLink offers many textual logging features, as well as the API required to implement custom logging strategies. Developers can use these features to ensure that the application behaves and performs as they expect.

OracleAS TopLink includes a performance profiler feature, available through the OracleAS TopLink Foundation Library API. This runtime feature tracks query execution time, which developers can use for performance analysis. This tool provides the information necessary to identify bottlenecks that hinder application performance.

OracleAS TopLink also offers a rich set of performance enhancement features. Understanding how to configure these features can have a strong influence on application performance, especially in the later phases of application development.

OracleAS TopLink Architectures Overview

OracleAS TopLink is designed to work in both Java and J2EE applications. Since it was first introduced, the flexibility OracleAS TopLink provides has led to its use in many architectural styles. This section introduces the five most common architectures associated with OracleAS TopLink. Although this section describes the architectures in relation to J2EE, OracleAS TopLink continues to fully support non-J2EE and Java applications as well.

Three-Tier

The three-tier (or J2EE Web) application is one of the most common OracleAS TopLink architectures. This architecture is characterized by a server-hosted environment in which the business logic, persistent entities, and the OracleAS TopLink Foundation Library all exist in a single Java virtual machine (JVM).

The most common example of this architecture is a simple three-tier application in which the client browser accesses the application through servlets, Java Server Pages (JSPs), and HTML. The presentation layer communicates with OracleAS TopLink through other Java classes in the same JVM, to provide the necessary persistence logic. This architecture supports multiple servers in a clustered environment, but there is no separation across JVMs from the presentation layer and the code that invokes the persistence logic against the persistent entities using OracleAS TopLink.

EJB Session Bean Facade

A popular variation on the three-tier application involves wrapping the business logic, including the OracleAS TopLink access, in EJB session beans. This architecture provides a scalable deployment and includes integration with transaction services from the host application server. Communication from the presentation layer occurs through calls to the EJB session beans. This architecture separates the application into different tiers for the deployment.

The session bean architecture can persist either Java objects or EJB entity beans.

EJB Entity Beans with CMP

OracleAS TopLink provides CMP support for applications that require the use of EJB entity beans. This support is available on the leading application servers. OracleAS TopLink CMP support provides the developer with an EJB 1.1 and 2.1 CMP solution transparent to the application code, but still offers all the OracleAS TopLink runtime benefits.

Applications can access OracleAS TopLink-enabled EJB entity beans using CMP directly from the client, or from within a session bean layer. OracleAS TopLink also offers the ability to use regular Java objects in relationships with EJB entity beans.

EJB Entity Beans with BMP

Another option for using EJB entity beans is to leverage OracleAS TopLink BMP in the application. This architecture enables developers to access the persistent data through the EJB API, but is platform-independent.

The BMP approach is portable—that is, after a developer creates an application, you can move it from one application server platform to another.

Two-Tier

A two-tier (or client-server) application is one in which the OracleAS TopLink application accesses the database directly. Although less common than the other architectures discussed here, OracleAS TopLink supports this architecture for smaller or embedded data processing applications.

Oracle JDeveloper

Oracle JDeveloper is a J2EE and XML development environment with end-to-end support for developing, debugging, and deploying business applications and Web services. To maximize developer productivity, JDeveloper provides a comprehensive set of integrated tools to support the complete development life cycle, including the industry’s fastest Java debugger and innovative profiler, and CodeCoach tools for code performance analysis and improvement. JDeveloper simplifies J2EE development by providing wizards, editors, visual design tools, and deployment tools to create high-quality, standard J2EE components, including applets, JavaBeans, JavaServer pages, servlets, and Enterprise JavaBeans.

To simplify the development of scalable, high-performance J2EE applications, JDeveloper offers an open and extensive J2EE framework called Oracle Business Components for Java (BC4J). BC4J is an object-relational mapping tool that implements the Sun J2EE design patterns, allowing developers to quickly build sophisticated J2EE applications.

Oracle JDeveloper Features

Oracle JDeveloper is written entirely in Java and is certified for use with all major platforms, including Windows, Solaris, and Unix. The following some key features of Oracle JDeveloper.

  • CodeCoach Utility and Profiling Tools: To assist developers with optimizing Java code, JDeveloper provides a code coaching utility and three integrated profiling tools. With CodeCoach, you can increase the robustness of your code by optimizing system resources. The three profiling modes enable you to create a statistical analysis of the performance of your application with respect to it functionality, both at compile time and runtime. You can also analyze your application’s memory use in the Java heap, and the occurrence and duration of various events.

  • Extensible and Pluggable Integrated Development Environment: JDeveloper provides a public Extension SDK, enabling its development environment to be extended and customized. Using this SDK, customers and partners can develop extensions and integrate them directly into the JDeveloper IDE. Developers can also share the technologies written with the Extension SDK at the JDeveloper Extensions Exchange at:

    http://otn.oracle.com/products/jdev/htdocs/partners/addins/exchange/content.html

  • Support for SQL, PL/SQL, and XML: In addition to Java, JDeveloper provides native support for SQL, PL/SQL, and XML. This support includes syntax highlighting and code insight, as well as PL/SQL development, PL/SQL debugging, and SQL tuning. Additionally, JDeveloper provides direct access to the database, allowing you to view, create, modify, and delete tables, views, triggers, indexes, sequences, and more.

  • Debugging Support: JDeveloper offers robust debugging support for both Java and PL/SQL. Debugging in these two environments is seamlessly integrated when using an Oracle database, providing the ability to step from Java code directly into PL/SQL code within the same debugging session. Other features include remote debugging, debugging multiple processes on multiple servers, tracking relevant data members in a smart data window, and a count of instantiations per class.

  • Business Intelligence Beans: To allow the development of highly analytical business intelligence applications, JDeveloper has integrated Oracle Business Intelligence Beans (BI Beans) into its environment. BI Beans enable developers to build applications that take advantage of the new analytic capabilities available in the Oracle database. Using modular components and intuitive wizards, developers can build sophisticated BI applications quickly and easily.

Oracle Business Components for Java

Oracle Business Components for Java (BC4J) is a standards-based, server-side framework for creating scalable, high-performance J2EE applications. The framework provides design-time facilities and runtime services to simplify the task of building, debugging, customizing, and reusing business components. The applications developed with BC4J can be deployed on any J2EE platform and can be accessed from a wide variety of clients, including Web browsers, professional desktop clients, XML clients, and wireless devices.

The J2EE programming model provides developers with a set of core APIs and technologies for developing multi-tier applications that are scalable and portable. In addition to these APIs, developers often find themselves implementing design patterns to address some of the design issues that are common to most multi-tier applications. Understanding these design issues and coming up with solutions for them can be both challenging and time consuming. BC4J steps into this space by providing an application framework for J2EE developers that implements many common design patterns and provides out-of-the-box solutions for tasks like object-relational mapping, validation, data access, network traffic minimization, and user interface binding.

By eliminating the substantial coding and testing work related to these common development issues, BC4J lets application developers focus full-time on implementing business solutions. The benefits of this framework include reduced development cost, lower project risk, and shorter time-to-market.

Additionally, the BC4J framework provides flexibility by allowing application developers to override any of the automatic behaviors the framework provides. Using BC4J, developers can take advantage of built-in behavior while maintaining control over application functionality.

Oracle Business Components for Java Features

The following sections discuss key BC4J features.

Object-Relational Mapping

The Object-Relational (O/R) mapping facilities that BC4J provides make it easy to use Java objects to transparently store and retrieve data in a relational database. Wizards and UML modeling tools make it easy to reverse engineer database tables and views into Java objects. For developers who prefer to work with entity beans, you can also create business components mapped to EJB 2.0 local entity beans.

Validation Model

Enforcing business rules is a critical part of any application, and BC4J provides a framework for consistently developing and enforcing validation rules across your applications. With BC4J, rather than coding business logic into each client, the developer writes it once in a reusable, domain-specific business component. Also, BC4J allows you to perform validation at different levels, depending on the sophistication of your business rules.

Scalability and Performance

The BC4J framework provides features such as resource pooling, network optimization, and disk spillover that are designed to enhance an application’s performance and scalability. Over the standard EJB remoting architecture, BC4J implements additional optimizations to keep the number of network roundtrips between the client tier and the application tier to a minimum. Further, for JSP and servlet-based applications deployed as J2EE Web modules, BC4J provides unique performance and scalability features. These include declarative JDBC connection pooling, application module pooling, session state persistence, and disk spillover for large result sets.

Flexible Deployment

BC4J presents a productive programming model for application development that is tier-independent and completely based on J2EE standards. The framework enforces a strict logical separation of the client tier and the business logic tier, making it possible to deploy the same application in multiple configurations without modifying the application code. BC4J supports the standard J2EE deployment modes: J2EE Web module, EJB session bean, and local mode. With BC4J you do not have to choose your deployment platform beforehand, and you can switch platforms easily without making changes to the application code.

Rich User Interface Support

BC4J makes it easy to bind JSP, Java Swing, wireless, and other XML clients to business components. The tier-independent programming model ensures that the same application can be bound to different user interfaces without changing any code in the business logic tier.

For Java client development, JDeveloper provides JClient, a common client framework for building Java applications and applets for business components. JClient uses the model-view-controller architecture to allow you to bind standard Swing controls or any third party model-based controls to BC4J data sources. JClient also provides a number of composite controls, making it easy to design Java clients with richer functionality than the standard Swing controls provide. Using the JClient design-time wizards, you can quickly generate data-aware forms, which you can then customize with the JDeveloper user interface design tools.

For JSP and servlet applications, JDeveloper provides the BC4J Data Tag Library, and set of JSP 1.1 compliant tags for binding JSP pages to BC4J data sources. The BC4J data tags make it easy to design and build JSP database applications with complete control of both the HTML design and the database access operations. When using the data tags, the developer does not have to write copious amounts of Java code to interact with BC4J data or customize the user interface. The client JSP application can mostly be comprised of HTML and JSP tags, giving JSP developers the flexibility to use their favorite visual HTML editors in conjunction with JDeveloper to design the exact appearance of their JSP applications.

Layered Customization Support

Once you have developed and delivered an enterprise application, the person or company installing the software typically needs to tailor it to fit their needs. BC4J offers a simple, innovative way to do this. All framework components have their Java implementation class cleanly separated from their XML component definition. Developers can extend both the Java class and the XML component definition to customize their applications. Further, the extended components can globally replace the original components across the application.

Tight Integration with JDeveloper

Oracle JDeveloper provides integrated design-time support for the BC4J framework. The wizards, editors, and other integrated design tools in JDeveloper make it easy to model, develop, test, deploy, and debug BC4J applications.

Integration with Oracle interMedia

In addition to standard object datatypes, BC4J now has the ability to bind to the four Oracle interMedia object types to provide multimedia retrieval and upload support. With this integration complete, you can use BC4J to access image, audio, video, and generic media content stored in Oracle interMedia databases, and deliver these digital media through UIX applications on Web browsers.

Oracle Application Server Web Services

To enable e-businesses to work effectively, the Internet needs to support a standards-based infrastructure that enables companies and their enterprise applications to communicate with other companies and their applications more efficiently. These standards should allow discrete business processes to expose and describe themselves on the Internet, allow other services to locate and invoke them, and provide a predictable response.

Web services drive this transformation by promising a fundamental change in the way businesses function and enterprise applications are developed and deployed. A Web service is a discrete business process that does the following:

Web services provide a standards-based infrastructure through which any business can do the following:

Oracle Application Server Web Services Features

Oracle Application Server Web Services provides advanced runtime features and comprehensive support for developing and deploying Web services.

Oracle Application Server Web Services Development Features

Key Oracle Application Server Web Services development features include:

  • Development Environment: Oracle Application Server Web Services allows application developers to implement Web services using J2EE components. In addition, you can use Java classes or PL/SQL stored procedures to implement Web services. Web services inherit all the runtime and lifecycle management elements of J2EE applications.

  • Development Tools and Wizards: Oracle Application Server Web Services developers can use the same set of command line utilities to create, package, and deploy Web services that they use for other Oracle Application Server Containers for J2EE (OC4J) applications. In addition, Oracle Application Server Web Services provides the Web Service HTML/XML Streams Processing Wizard that assists developers in creating an EJB whose methods access and process XML or HTML streams.

  • Automatically Generates WSDL: Oracle Application Server Web Services can generate Web Services Description Language (WSDL) and client-side proxy stubs. This generation occurs when the Web service is assembled using the Web Services Assembly tool or, for a deployed Web service, the first time the WSDL or the client-side stubs are requested. After the first request, the previously generated WSDL or client-side proxy stubs are sent when requested.

  • Registration, Publishing, and Discovery: Oracle Application Server Web Services provides a standards-compliant UDDI registry where Web services can be published and discovered. The Oracle UDDI registry supports both a private and public UDDI registry and can also synchronize information with other UDDI nodes.

  • Developer Simplicity: Using Oracle Application Server Web Services, developers do not need to learn a completely new set of concepts. Web services are developed, deployed, and managed using the same programming concepts and tools as J2EE applications.

  • Business Logic Reuse: Application developers can transparently publish their J2EE applications to new Web services clients with no change in the application itself. The existing business logic developed in J2EE can be transparently accessed from existing J2EE/EJB clients.

  • Common Runtime Services: Oracle Application Server has a common runtime and brokering environment for J2EE applications and Web services. As a result, Web services transparently inherit various services available with the J2EE container, including transaction management, messaging, naming, logging, and security services.

Oracle Application Server Web Services Deployment and Management Features

Key Oracle Application Server Web Services deployment and management features include:

  • Packaging and Assembly: The Web Services Assembly Tool assists with assembling Web services and producing a J2EE .ear file.

  • Deployment: Oracle Enterprise Manager provides a comprehensive set of facilities for deploying Web services to Oracle Application Server through Oracle Enterprise Manager Application Server Control. Application Server Control provides a single, consistent Deploy Applications wizard for deploying Web services to Oracle Application Server. It accepts a J2EE .ear file, and takes you through the steps to specify information about the application you are deploying, and then deploys the application.

  • Register Web Service: The Deploy Applications wizard also provides access to facilities for registering Web services in the UDDI registry.

  • Browse the UDDI Registry: The Oracle UDDI registry provides the UDDI standards-compliant, pre-defined, hierarchical categorization schemes. Oracle Enterprise Manager can drill down through these categories and look up specific Web services registered in any category.

  • Monitoring and Administration: Once deployed, Oracle Enterprise Manager provides facilities to deinstall a Web service, and also to monitor Web service performance as measured by response time and throughput, and to monitor status as measured by up time, CPU consumption, and memory consumption. Oracle Enterprise Manager also provides facilities to identify and list all of the Web services deployed to a specific Oracle Application Server instance.

Oracle Application Server Web Services Architecture

Oracle Application Server Web Services run as servlets in the OC4J servlet container. This gives Web services the same scalability, availability, and load balancing facilities that all J2EE applications have in Oracle Application Server.

Oracle Application Server Web Services support both Remote Procedure Call (RPC) style exchange and message oriented, or Document Style, exchange. Supported RPC Web services include Java classes, stateless session EJBs, and stateless PL/SQL stored procedures. Supported Document Style Web services include Java Class Document Style Web Services and JMS Document Style Web Services.

Oracle Application Server Web Services use a different J2EE standards-compliant servlet for each implementation type to provide an entry point into the Web services implementation. Figure 2-10 illustrates the Oracle Application Server Web Services runtime architecture, including the servlet entry points.

Figure 2-10 Oracle Application Server Web Services Architecture

Description of websvcarc.gif follows
Description of the illustration websvcarc.gif

For a detailed discussion of the Oracle Application Server Web Services architecture, see the Oracle Application Server Web Services Developer's Guide.

Web Services Framework

The following Internet standards provide the Oracle Application Server Web Services framework:

  • Simple Object Access Protocol (SOAP) is a lightweight, XML-based protocol for exchanging information in a decentralized, distributed environment. SOAP supports different styles of information exchange, including Remote Procedure Call style (RPC) and message-oriented exchange. RPC style information exchange allows for request-response processing, where an endpoint receives a procedure-oriented message and replies with a correlated response message. Message-oriented information exchange supports organizations and applications that need to exchange business or other types of documents where a message is sent but the sender may not expect or wait for an immediate response.

  • Web Services Description Language (WSDL) is an XML format for describing network services containing RPC-oriented and message-oriented information. Programmers or automated development tools can create WSDL files to describe a service and can make the description available over the Internet. Client-side programmers and development tools can use published WSDL descriptions to obtain information about available Web services and to build and create proxies or program templates that access available services.

  • Universal Description, Discover, and Integration (UDDI) is an online electronic registry that serves as electronic Yellow Pages, providing an information structure where various business entities register themselves and the services they offer through their WSDL definitions. There are two types of UDDI registries, public UDDI registries that serve as aggregation points for a variety of businesses to publish their services, and private UDDI registries that serve a similar role within organizations.

Oracle Application Server Forms Services

Oracle Forms applications combine interactive graphical interfaces with strong support for data validation. Forms developers can quickly create applications with powerful data manipulation features.

An Oracle Forms application gives you the power of a desktop application deployed in a browser. It provides a very rich and productive user interface by allowing the following:

An Oracle Forms application is analogous to a traditional HTML form application. In the traditional application, the user enters data into a form on a Web page and submits the data. The Web server processes the data from the form in a CGI application. The application then performs any necessary transactions and returns feedback to the user’s browser. JavaScript and the database perform data validation tasks to ensure that the data from the form is correct and complete.

Oracle Application Server Forms Services deploys Forms applications to Java clients in a Web environment. Oracle Application Server Forms Services automatically optimizes class downloads, network traffic, and interactions with the Oracle database. Applications are automatically load-balanced across multiple servers and, therefore, can easily scale to service any number of requests.

Oracle Application Server Forms Services consists of four components:

Oracle Application Server Forms Services Features

Oracle Application Server Forms Services provides the following features to allow a robust and standard deployment of Forms applications on the Internet.

Automatic Internet Scalability and High Performance

Oracle Application Server Forms Services is an optimized framework for deploying Oracle Forms applications to a multi-tiered environment. OracleAS Forms Services delivers out-of-the-box functionality and native services to ensure that Forms applications automatically scale and perform over any network. OracleAS Forms Services allows organizations to re-deploy existing applications to the Internet without changing the application code.

Native Services and Out-of-the-Box Functionality

With OracleAS Forms Services, the scalability and high performance of Internet deployment do not rely on the quality of the application or on the developers’ skills; applications developed with Oracle Forms automatically scale and perform through the use of built-in services that Oracle Forms provides. These services natively deliver the building blocks and the infrastructure of an e-business solution. Business developers do not have to implement complex, low-level infrastructure code and therefore can focus on implementing business requirements. Examples of these native services include record caching and record locking, database management, exception handling, and load balancing.

Application Server Integration

As a fully-integrated component of Oracle Application Server, OracleAS Forms Services utilizes the Oracle Application Server Infrastructure. The deployment architecture of OracleAS Forms Services uses Oracle Application Server Containers for J2EE (OC4J). Codeless integration with Oracle Application Server Single Sign-On Server eliminates the need for users to remember multiple passwords. And leveraging the power of Oracle Enterprise Manager Application Server Control means that system administrators can use a single point of control to start, shutdown, monitor, trace, and diagnose OracleAS Forms Services runtime processes.

Network Traffic Optimizations

OracleAS Forms Services is highly optimized to reduce network traffic and to minimize database response time. For example, OracleAS Forms Services renders application interfaces as highly-optimized generic Java applets and uses mechanisms such as message diffing, message bundling, and JAR file caching to reduce the number of round trips between the client and the middle tier. At the same time, OracleAS Forms Services leverages the capabilities of the Oracle database to minimize interactions with the database server.

HTTP/HTTPS Support

The deployment with OracleAS Forms Services is optimized for corporate intranets, extranets, and for the Internet using socket connections or HTTP/HTTPS communications between the client and the middle tier. The support for HTTP/HTTPS allows Oracle Forms applications to be deployed across industry firewalls in a highly secure and optimized fashion.

Load Management

Ensuring that your application has no single point of failure is essential to guaranteeing your application is highly available. The OracleAS Forms Services runtime architecture is based on standard servlets, meaning you can use standard load balancing techniques such as hardware load balancing, reverse proxy servers, and standard load balancing through Oracle Application Server.

Open Access to Internet Standards

Through code-based integration, OracleAS Forms Services gives you the flexibility to leverage emerging standards, including Java and XML, within your Oracle Forms applications. This gives you the advantages of both the application framework and built-in scalability and performance of OracleAS Forms Services, along with the flexibility to leverage Java and XML to extend your applications.

Server-Side Openness

OracleAS Forms Services gives you the ability to access components written in Java and make use of them from Oracle Forms applications on the middle tier. Using this feature, OracleAS Forms Services is able to communicate and integrate with other applications or technologies, such as Web services, XML, Enterprise JavaBeans, and non-standard devices.

Client-Side Openness

OracleAS Forms Services renders the application presentation as a generic and optimized Java applet. This applet can be extended using Java components (such as JavaBeans and Pluggable Java Components) so that business developers can quickly and easily deliver sophisticated interfaces that maximize end user productivity. The Java client extensibility, along with the new look and feel, leverages the strength of Java without the need for business developers to learn the language.

Oracle Application Server Forms Services Architecture

When a client requests an Oracle Application Server Forms application, the request has the following flow:

  1. The user launches a browser and navigates to the URL for the Forms application.

  2. The HTTP Listener interprets the URL and displays an HTML page containing an <APPLET> tag that describes the Forms Java Client to the browser. The URL calls the Forms servlet to create the HTML page dynamically.

  3. The client receives the HTML file served by the HTTP Listener. The HTML file supplies the information required to locate the Java class files that make up the Forms Java Client. The HTML file also contains information about the requested Forms application, as well as parameters that get passed to the Forms session, such as login information.

  4. The browser downloads the Forms Java Client and the Java applet starts.

  5. The Forms Java Client applet sends a request to start a Forms session through the HTTP Listener to the Forms Listener Servlet.

  6. After receiving the connection request from the Forms Java Client, the Forms Listener Servlet starts a new Forms Runtime process for the client.

  7. The Forms Runtime process allocated to the client loads the module specified in the HTML file and any libraries and menus that are required by that form. All communication between the Forms Java Client and the Forms Runtime process is passed through the Forms Listener Servlet.

  8. The user is prompted for database login information, and the connection to the database server is established.

  9. The user is now ready to work with the Forms application.

Figure 2-11 illustrates this flow in terms of the Oracle Application Server Forms Services architecture.

Figure 2-11 Oracle Application Server Forms Services Request Flow

Description of formsarch.gif follows
Description of the illustration formsarch.gif

Oracle XML Developer Kit

XML makes data portable and interoperable across heterogeneous systems. XML is a metamarkup language that supports markup tags that have been defined by the user to encapsulate and describe data in a Web page. Because it is a self-defined language, it is extremely flexible.

Oracle Application Server includes the Oracle XML Developer Kit (XDK) to support development of any applications that use XML. The XDK provides basic XML infrastructure components for manipulating and transforming XML documents. The XDK contains component libraries and utilities that are based on World Wide Web Consortium (W3C) specifications. You can use these components to generate, manipulate, render, and store XML-formatted data in an Oracle database or to share data between applications written in diverse programming languages.

Oracle XML Developer Kit Tools

The following sections describe the tools included in the Oracle XML Developer Kit.

XML and XSLT Parsers

The XML parser APIs are defined by the W3C specifications so that application developers can use standard programming interfaces. However, if some functionality is not specified, then Oracle Corporation may implement its own enhancements to the specifications.

The Oracle XML and XSLT parsers provide international character set and multithreaded support, allow optional validation, and cache document type definitions (DTDs) and stylesheets for performance.

Oracle XML Developer Kit provides the following APIs:

  • Document Object Model (DOM) APIs: Because an XML document is structured, in the sense that "start" tags have corresponding "end" tags and these tags are nested in an ordered fashion, an XML document can be viewed as a tree whose hosts consist of these tags and information between and corresponding to the tags. When the DOM APIs are used to navigate an XML document, the XML parser parses the document and forms a tree representation of it in memory.

  • Simple APIs for XML (SAX) APIs: SAX APIs are event-based, meaning that notification of certain events and data encountered during the parsing of an XML document can be reported with callback functions to the application program. One advantage over DOM is that an in-memory representation of the parse tree does not have to be built, thus saving memory and improving performance. When application programs are notified of these events, then they must handle them.

  • Namespace APIs: These interfaces resolve namespace prefixes that are used to qualify element and attribute names in XML documents. XML document namespaces are identified by uniform resource identifier (URI) references that qualify element or attribute names and locate resources that may be on different machines or in different XML documents. Namespaces make it possible to have identical names for elements and attributes by qualifying them with URIs that differentiate the names.

  • Parser APIs: Application programmers invoke the parser API to read an XML document and to provide access to its content and structure through DOM or SAX APIs. Typically, initialization and termination functions must also be invoked in association with the parse function. Various flags, such as to discard whitespace and turn on validation, can be set with initialization functions before the application program invokes the parse function.

  • XSLT APIs: These interfaces read the input stylesheet file and transform the input XML document according to the stylesheet. A command-line interface to the integrated XSLT processor is provided. This allows application programmers to specify the number of threads to use to parse and transform XML documents and other useful options. To enhance performance, the XSLT engines allow caching of both stylesheets and Document Type Definitions (DTDs) so they can be reused for multiple XML documents.

XML Schema Processors

Oracle XML schema processors comply with the Structures and Datatypes sections of the W3C XML Schema Working Drafts, except for certain features (such as unique, key and keyref constraints) when the SAX parser is used. XML schemas are a superset of DTDs, except for the support of primitive and complex datatypes in XML schemas. This allows you to validate XML documents, with embedded datatype information, against XML schemas.

XML Class Generators

The XML class generators create a set of Java or C++ classes that create XML documents corresponding to a DTD or to XML schema definitions. This is useful when an application wants to send an XML message to another application based on an agreed-upon DTD, or as the back end of a Web form to construct XML documents. You can use the generated classes to programmatically construct XML documents that comply with the DTD or schema definition.

XSQL Servlet

XSQL Servlet is a tool that processes SQL queries and outputs the result set as an XML document. This processor uses an XML file with embedded SQL queries as its input. You can use XSQL Servlet to perform the following tasks:

  • Build dynamic XML datapages from the results of one or more SQL queries and serve the results over the Web as XML datagrams or HTML pages using server-side XSLT transformations

  • Receive XML posted to your Web server and insert it into your database

XML Transviewer Beans

XML transviewer beans are a set of XML components that constitute XML for Java beans. These are used by Java applications or applets to view and transform XML documents.

These beans are visual and non-visual Java components that are integrated into Oracle JDeveloper to enable the fast creation and deployment of XML-based database applications.

Oracle Application Server PL/SQL Platform

Oracle Application Server provides support for building PL/SQL-based applications on the Web. PL/SQL stored procedures retrieve data from a database and generate HTTP responses containing data and code to display in a Web browser. There are many techniques for coding dynamic pages, but PL/SQL is particularly suited for producing dynamic pages based on database processing. Its support for DML statements, dynamic SQL, cursors, and tight server integration provide both power and flexibility for Web applications. The dynamic pages can contain links and HTML forms that call more stored procedures, for example to drill down on the displayed data. The set of interlinked HTML pages forms the user interface of the Web application. Producing dynamic content using PL/SQL stored procedures gives you the flexibility and interactive behavior of CGI programs, without the memory overhead of starting a new CGI process each time.

Oracle Application Server PL/SQL Tools

Oracle Application Server PL/SQL developers can create applications using either Oracle PL/SQL Server Pages or Oracle PL/SQL Web Toolkit.

mod_plsql

Mod_plsql is an Apache plug-in that provides support for building PL/SQL-based applications on the Web. It maps browser requests into PL/SQL stored procedures, which retrieve data from a database and generate HTTP responses containing data and code to display in a Web browser.

Oracle PL/SQL Server Pages

To include dynamic content inside Web pages, including the results of SQL queries, you can use server-side scripting through PL/SQL Server Pages (PSPs). You can author the Web pages in a script-friendly HTML authoring tool and drop the pieces of PL/SQL code into place. You may find this technique more convenient than using the HTP and HTF packages to write out HTML content line by line.

Because the processing is done on the database server rather than the Web server, the browser receives a plain HTML page with no special script tags, and you can support all browsers and browser levels equally. It also makes network traffic efficient by minimizing the number of server roundtrips.

Embedding the PL/SQL code in the HTML page that you create lets you write content quickly and follow a rapid, iterative development process. You maintain central control of the software, with only a Web browser required on the client machine.

Oracle PL/SQL Web Toolkit

The PL/SQL Web Toolkit contains PL/SQL packages that allow you to create applications that generate dynamic HTML. Using the toolkit, you can access data and insert it into Web pages. The packages remove the need for you to know the specifics of HTML syntax and allow you to focus on writing applications.

Oracle Application Server PL/SQL Architecture

Oracle Application Server PL/SQL leverages the mod_plsql module to deliver Web content, as follows:

  • Visiting a Web page, following a hypertext link, or submitting an HTML form causes the database server to run a stored procedure.

  • Any choices that a user makes on an HTML form are passed as parameters to the stored procedure. Parameters can also be hardcoded in the URL used to invoke the stored procedure.

  • The results of the stored procedure are printed as tagged HTML text and are displayed in the browser as a Web page. Web pages generated this way are dynamic: code runs inside the database server, producing HTML that varies depending on the database contents and the input parameters.

    This kind of dynamic content is different from dynamic HTML (DHTML). With DHTML, the code is downloaded as JavaScript or some other scripting language, and processed by the browser along with the HTML. A PL/SQL Web application can print JavaScript or other script code in its output to produce complex DHTML that would be tedious to produce manually.

Oracle Content Management Software Developer Kit

Oracle Application Server includes the Content Management Software Development Kit (CM SDK), a robust document lifecycle system that is built in Java and integrated with other Oracle content management API products. Oracle customers and partners have built successful solutions on this Java-based platform that leverages the features and capabilities of the Oracle platform.

Oracle Content Management SDK Features

Important features and capabilities of the CM SDK include the following:

  • Integration with Oracle Text, Oracle Workflow, Oracle Ultra Search, Oracle interMedia, and OracleAS Portal

  • Complete document lifecycle API with a variety of options for security, check-in/check-out, versioning, searching, extensible metadata, and other standard content management operations

  • Easy extensibility to help you develop and deploy your content management solutions faster

  • Managed through Oracle Enterprise Manager Application Server Control

  • Synchronous and asynchronous trigger mechanisms to enforce business rules

  • Built-in support for standard protocols such as HTTP/WebDAV, SMB/NTFS, FTP, AFP, NFS, IMAP4, and SMTP

  • Support for standard Oracle performance, scalability, and high availability features

Oracle Content Management SDK Architecture

Oracle Content Management SDK provides, out of the box, the content and metadata repository, protocol servers, and class libraries that allow developers to quickly create content management solutions.

Figure 2-12 shows the basic architecture of Oracle Content Management SDK. Once installed, developers can immediately start storing content into the repository via the Web DAV, SMP, FTP, or IMAP interface. They can then provide the business logic for their specific requirements and create a Web-based user interface. Also included with the CM SDK installation is a Web starter application that demonstrates how to create Web-based content management applications.

Figure 2-12 Oracle Content Management SDK Architecture

Description of ascon049.gif follows
Description of the illustration ascon049.gif

Oracle Application Server MapViewer

The Oracle Application Server MapViewer is a programmable tool for rendering maps using spatial data managed by Oracle Spatial or Oracle Locator. MapViewer provides tools that hide the complexity of spatial data queries and cartographic rendering, while providing customizable options for more advanced users. These tools can be deployed in a platform-independent manner and are designed to integrate with map-rendering applications.

There are five concepts that are fundamental to understanding MapViewer:

When an application uses MapViewer, it applies specific styles, such as colors and patterns, to specific themes, such as cities, rivers, and highways, to render a map. For example, the application might display a map in which state parks appear in green and restaurants are marked by red stars. A map typically has several themes representing political or physical entities, or both. For example, a map might show national and state boundaries, cities, mountain ranges, rivers, and historic sites. When the map is rendered, each theme represents a layer in the complete image.

MapViewer lets you defines styles, themes, and base maps, including the rules for applying one or more styles to each theme. These styles, themes, base maps, and associated rules are stored in the database in map definition tables under the MDSYS schema, and they are visible through metadata views. All styles in a database instance are shared by all users. The mapping metadata that you can access is determined by MapViewer metadata views. The set of map definition objects that a given user can access is sometimes called that user’s mapping profile.

Oracle Application Server MapViewer Features

MapViewer includes the following main components:

  • A rendering engine (Java class library) that provides cartographic capabilities (a map renderer)

  • An XML API that provides a programmable interface to MapViewer

The rendering engine connects to the Oracle database through Java Database Connectivity (JDBC). It also loads the map metadata from the database, and applies it to the retrieved spatial data.

The XML API provides high-level application developers with a convenient interface for submitting a map request to the middle-tier MapViewer and handling its map response.

Oracle Application Server MapViewer Architecture

With MapViewer, the basic flow of action involves two steps, regardless of whether the client requests a map or a MapViewer administrative action.

For a map request, the following occurs:

  1. The client requests a map, passing in the map name, data source, center location, map size, and optional other data to be plotted on top of a map.

  2. The server returns the map image (or a URL for the image), the minimum bounding rectangle (MBR) of the map, and the status of the request.

For a MapViewer administrative request, the following occurs:

  1. The client requests a MapViewer administrative action, passing in the specific type of request and appropriate input values.

  2. The server returns the status of the request and the requested information.

Figure 2-13 shows the MapViewer architecture, which supports this flow of action.

Figure 2-13 MapViewer Architecture

Description of mpvw.gif follows
Description of the illustration mpvw.gif

As shown in Figure 2-13:

  • MapViewer is part of the Oracle Application Server middle tier.

  • MapViewer includes a rendering engine.

  • MapViewer can communicate with a client Web browser or application using the HTTP protocol.

  • MapViewer performs spatial data access (reading and writing Oracle Spatial and Locator data) through JDBC calls to the database.

  • The database includes Oracle Spatial or Locator, as well as mapping metadata.