Thursday, March 29, 2007

Oracle Application Server - Intricacies

PL/SQL CARTRIDGE: Runs PL/SQL stored procedures in Oracle databases. It uses a Database Access Descriptor to locatethe database to which to connect. The cartridge can also run files that contain PL/SQL source code; itloads the contents of the file into the database and executes the code. The PL/SQL cartridge comeswith the PL/SQL Web Toolkit, which enables you to get information about the request, specify valuesfor HTTP headers such as the content type and cookies, and generate HTML tags.

JWEB CARTRIDGERuns Java applications: The JWeb cartridge contains a Java Virtual Machine that interprets thebytecodes for the Java application. When you configure the cartridge, you specify where the class filesfor the applications are located.

You can also use the JWeb cartridge to connect to and access data from databases in two differentways:
(1) You can use the pl2java utility, which generates Java methods for procedures and functions in thedatabase. You can then invoke the methods from your Java application just like regular Javamethods;

(2) You can use the JDBC interface, which enables you to execute SQL statements.The JWeb cartridge comes with the JWeb Toolkit, which enables you to get information about therequest, connect to the database, specify values for HTTP headers such as the content type andcookies, and generate HTML tags.

PERL CARTRIDGE Runs : Perl scripts. The Perl cartridge also comes with the oraperl module, which enables you to accessOracle Databases.

SESSIONS SERVICE : The Sessions service allows cartridges to be set up so that successive requests from a particular clientare handled by the same cartridge instance. This allows you to code your cartridge to maintain stateacross requests submitted by a specific client (browser). For example, if you are creating a shoppingcart cartridge, you can enable sessions in the cartridge so that it can remember the items that the clienthas in his shopping cart. Each client would have its own cartridge instance, and cartridge instance datawould not be shared across clients. You can enable and manage sessions in two ways:

1. You can enable sessions for your cartridge using the Oracle Application Server Manager. This iscalled configurable sessions”.

2. You can use the session API to manage sessions. This is called “programmatic sessions”.Programmatic sessions give you more control than configurable sessions.Sessions work with all listeners supported by Oracle Application Server.

CLIENTS : There are three kinds of clients that can use Oracle Application Server:Web browsers-these clients use HTTP to communicate with Oracle Application Server.Java applets-these clients run within web browsers equipped with client ORBs that communicate withthe Oracle Application Server ORB using IIOP.Java applications-these clients also use HTTP to communicate with Oracle Application Server. Butthis communication is limited to JCORBA instantiation and destruction only. To use the JCORBAobjects these clients communicate with the Oracle Application Server ORB directly using IIOP.

DISPATCHERS: A dispatcher manages a pool of cartridge server instances running on one or more nodes; eachcartridge server instance runs one or more cartridge instances. There is one dispatcher associated witheach listener on each node of a web site. When a listener receives an HTTP request that does notidentify a static HTML page or CGI program, it passes the request to its dispatcher, which assigns arequest to a cartridge instance of the appropriate type. This process is described in more detail inRequest Handling below.

REQUEST HANDLING:

Oracle Application Server can handle both HTTP requests from web browser clients, and CORBA/IIOP requests from Java applet and application clients by way of a client ORB.Life Cycle of an HTTP RequestThis diagram shows the sequence of events when a web browser client issues an HTTP request to aserver-side application

HTTP request life cycle.The dispatcher maintains a cache of available cartridge instances for each cartridge. When a requestarrives for a particular cartridge, the dispatcher routes the request to one of its cached cartridgeinstances of the appropriate type.
If the dispatcher has no such cartridge instance available, it requests that the Oracle Application Serverruntime creates a new cartridge server and creates the appropriate cartridge instance within thatcartridge server. The dispatcher then adds this cartridge instance to its cache and assigns the pendingrequest to it. When the request is complete, the new cartridge instance is available to handle a newrequest.