Skip Headers
Oracle® Application Server Application Developer's Guide
10g Release 2 (10.1.2)
Part No. B14000-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

1 Creating Applications: Overview

When you create applications to be deployed on Oracle Application Server, you might think of different ways to design them. This guide walks you through the design and implementation of three sample applications, and in the process of doing so, it discusses the available options and the advantages and disadvantages of each option.

The resulting applications are modular and extensible: you can easily add features, add different client types (including wireless devices), and change the implementation of a feature with minimal impact on other features.

The sample applications enable users to view data such as employee name, phone, email, and job ID. Users can add or remove their benefit elections. The applications retrieve and update data in an Oracle database. The sample applications use many technologies, including JavaServer Pages, servlets, Enterprise JavaBeans, JDBC, portals, wireless devices, Web cache, Web services, JNDI, and JAAS.

Contents of this chapter:

1.1 Overview of OracleAS

OracleAS supports many technologies. As a result, you have many choices when you design and create your applications. The following sections describe some of the key technologies.

1.1.1 J2EE

The J2EE support includes:

  • Enterprise JavaBeans, which enable applications to use entity, session, and message-driven beans. EJB comes with an EJB container that provides services for you. Services include transaction, persistence, and lifecycle management.

  • Servlets, which can generate dynamic responses to Web requests.

  • JavaServer Pages (JSP), which enable you to mix Java and HTML to author Web applications easily. JSPs also enable you to generate dynamic responses to Web requests. Servlets and JSPs run within a "Web container", which also provides services similar to those provided by the EJB container.

  • Java Authentication and Authorization Service (JAAS), which enables you to authenticate users (that is, it ensures that users are who they claim to be) and authorizes users (that is, it checks that the user has access to an object before executing or returning the object).

  • Java Message Service (JMS), which enables you to send and receive data and events asynchronously.

  • Java Transaction API (JTA), which enables your applications to participate in distributed transactions and access transaction services from other components.

  • J2EE Connector Architecture, which enables you to connect and perform operations on enterprise information systems.

For complete J2EE details (including specifications), see:

http://java.sun.com/j2ee

1.1.2 Enterprise Portals

Portals in OracleAS enable you to aggregate, or group, your applications on a single Web page. When users visit the page, they get a centralized location where they can see only the applications to which they have access with single sign-on capabilities. These applications, when displayed within a portal framework, are called portlets.

Figure 1-1 shows a picture of a portal.

1.1.3 Wireless Support

Browser clients do their rendering based on HTML tags, and there is more or less a standard set of tags and attributes that you can use. Wireless clients, on the other hand, understand different sets of tags and attributes, depending on the wireless device, and speak different protocols.

To make it easy for application developers, the wireless feature in OracleAS comes with adaptors and transformers. This enables you to write your application once, and provide access to it from any wireless device. The way this works is that you write the presentation data in XML according to a standard DTD (document type definition), and the adaptors convert the XML on the fly to a markup language understood by the client.

You can write your application such that it supports both browsers and wireless devices. Your application can check if a request is coming from a wireless client and return the appropriate response (HTML or XML). The first sample application shows how to do that.

Figure 1-2 shows the application running on a cell phone:

Figure 1-2 An Application Running on a Cell Phone

Description of intr_wireless.gif follows
Description of the illustration intr_wireless.gif

1.2 Sample Applications

This guide describes three sample applications. Table 1-1 lists the operations, technologies, and design patterns associated with each application:

Table 1-1 Comparing the Sample Applications


First Sample Application Second Sample Application Web Services Client Sample Application
Design Pattern Used Model-View-Controller (MVC) Session facade MVC
Supported Operations Users can perform the following operations:
  • Enter an employee ID and view data such as first name, last name, phone, email, and benefits for the specified employee.

  • Add benefits for the employee.

  • Remove benefits for the employee.

Users can access the following operations through Web Services:
  • List all the existing benefits.

  • Create a new benefit.

  • Get the total number of employees.

  • Enter an employee ID and view the benefits for the specified employee.

  • Enter a benefit ID and get the number of employees enrolled in the specified benefit.

This is a client application that invokes the operations provided by the second application through Web Services.
Technologies Used
  • Servlets
  • JSPs

  • EJBs, including bean-managed persistence, remote interfaces

  • Portal

  • Wireless

  • Web Cache

  • EJB 2.0, including EJB QL, container-managed persistence, container-managed relationships, and local interfaces
  • Web Services

  • Servlets
  • JSPs

  • Web Services


1.3 Database Schema

The sample applications use the HR schema that comes with Oracle9i database and OracleAS Metadata Repository. The applications use the EMPLOYEES table, plus two additional tables (BENEFITS and EMPLOYEE_BENEFIT_ITEMS) that you need to install. You install these tables in the default tablespace of the HR schema.

Table 1-2 Tables in the HR Schema

Table Description
EMPLOYEES Contains fields such as: employee_id, first_name, last_name, phone, email, and department.
BENEFITS Contains fields such as benefit_id, benefit_name, and benefit_description.
EMPLOYEE_BENEFIT_ITEMS Maps employees with benefits. The table has fields such as employee_id, benefit_id, and election_date. An employee can have multiple benefits. This is the table that the application updates when employees update their benefit elections.

1.4 Development Steps

Designing and developing an application with all these technologies can be a little overwhelming. Here are some high-level steps to guide you (later chapters in this book provide the details):

  1. Determine application requirements.

    Be sure to separate the presentation (or client) tier requirements from the business logic tier requirements. Separating the requirements by tier helps you design your application in a modular fashion. Modularity promotes a clean separation of functionality and enables you to reuse, update, or replace modules without affecting the rest of the application.

  2. In the business logic tier, determine what objects you need and the interfaces of these objects.

    It helps to draw a sketch of the design based on the interfaces. Also determine how the client tier can invoke methods in the objects.

    When you determine what objects you need, you have many implementation choices. For example, you can use servlets, JavaBeans, Enterprise JavaBeans, or plain Java classes to implement your business logic.

  3. In the client tier, create the presentation data for the client.

    The presentation data determine how the application looks to the users. Typically, the presentation data is in HTML (for browsers) or XML (for wireless devices). The HTML or XML tags can come from static files, JSPs, or other Java classes.

    JSPs and other Java classes can output the presentation data programmatically. In JSP files, you embed commands to invoke methods on the Java objects that implement your business logic. You can then display the values that the methods return.

  4. Implement the business logic.You can do this with EJBs, servlets, or other Java classes.

  5. Package, deploy, and run your application.

1.5 Development Tools

To create applications for OracleAS, you can use text editors such as emacs or vi, or you can use IDEs (integrated development environment).

If you use a text editor, you also need additional tools such as a Java compiler (for example, javac), a Java archive tool (for example, jar), and a packaging tool so that you can compile your files and build JAR and EAR files.

If you use IDEs, they can automate the tasks listed above for you. Oracle provides an IDE called Oracle JDeveloper. Oracle JDeveloper supports each stage in the development lifecycle: it contains UML modelling and generation tools, debugging tools, profiling tools, and tuning tools.

Oracle JDeveloper is closely integrated with OracleAS: you can deploy applications on OracleAS from Oracle JDeveloper.

1.6 What This Guide Covers and Does Not Cover

This guide shows two applications, clients (browsers and wireless devices), and database schema. It describes the logic behind the application design. It also shows how to deploy and configure the application.

It does not describe in full the APIs that the application uses.

This guide assumes the reader has some concept of servlets, JSPs, portals, Web services, wireless devices, and introductory knowledge of EJBs. For more information on these topics, see the OracleAS Documentation Library, available on the Documentation CD-ROM. The library is also available on Oracle Technology Network (http://www.oracle.com/technology/).

To read the Java specifications, see:

http://java.sun.com