Customizing Content With Oracle XML DB and J2EE features
Overview and Architecture
December 2002
|
|
Overview
Dynamic News extracts news items (headlines)
from the database to build customized HTML pages and presents
to the user. The news content may be either customized or
non-customized. The customized news will be based on user
preferences unlike the non-customized pages.
Each news item is stored in an XMLTYPE column
in the Oracle database and will essentially fall under a category
(such as Sports or Technology), a subcategory (such as Baseball
or Software), and type (such as Feature or Review). Dynamic
News uses these attributes to offer two levels of customization:
Static(or Batch) and Dynamic (the terms refer to the page's content,
not its behavior).
The application uses a few Oracle
XML DB and J2EE features at each level to pull items from the database,
build an XML document, and apply XSLT transformation to generate
an HTML page formatted for the end-user.
This article describes how XML Dynamic News has
been implemented.
|
Architecture Details
OTN XML News, a multi-tiered
application consists of components communicating across tiers to
access and change data standardizing on the Java 2 Platform, Enterprise
Edition (J2EE) and leverages technologies like:
- Java and XML for
platform-neutral application logic and data exchange
- JDBC for accessing
enterprise data in relational databases using SQL
- Java Servlets and
JavaServer Pages for building dynamic, browser-based interfaces
- Enterprise
JavaBeans for implementing transactional business components.
The above image depicts the architecture of
XMLNews application. It consists of different layers viz. Client,
View, Controller, Model and Data Access Layer. The
basic MVC framework is adopted from OTN sample application VSM and has
been customized for XMLNews.
View:
The request to the View comes from clients like
a browser. The View layer of the application uses JSPs for building
dynamic, browser-based interfaces.
Controller Layer:
In the Controller Layer, the RouterServlet
functions as the controller which dispatches browser requests to other
controller objects. The request comes from the JSPs that form the view
to the RouterServlet - the main Controller for XMLNews. RouterServlet
begins processing the request. It invokes RequestMap( For more
details on RequestMap, please refer VSM
document.) to get the appropriate Controller class/object
to be called for every request. These controller objects will call the
required services layer objects which are essentially the session beans.
Service Locators are used to look up the right kind of service layer
component for every request. Some of the controller classes in the application
for example are: NewsController, UserController, FeedbackController,
CategoryController etc.
The Model layer of the XMLNews application
is divided into two as Service Layer and Business Layer.
Services Layer:
The Services Layer presents a set of services for
different business objects. Basically it is implemented as a set
of stateless session beans and web services, which expose the business
functionality of XML News application to the clients. The services layer
cleanly separates the presentation layer such as JSP/servlets and the
application logic. Another advantage is that the layer makes the application
distributed, with the capability of having remote clients, including non-java
clients [say, using CORBA or Web service consumers]. The stateless
session beans talk to the underlying Business Layer objects i.e EJBs.
The lookup to the EJBs is done using Service Locators.
News Export Web
service:
One of the important services - the News WebService,
is implemented in the services layer. The Web Service will enable
users to export news from the current application. In the services layer,
the NewsService session bean exposes the method – getAllNews()
as a Web Service. Any client can consume this web service by invoking
getAllNews() method of the Web Service stub to get the news.
Business Layer:
Business layer mainly corresponds to a set of Domain
Objects comprising of EJBs used for implementing transactional business
components along with Value objects and Reader Classes. There are five
domain objects i.e. EJBs for implementation business logic in the application
viz.. Category, Type, Feedback, User which are implemented as CMPs. Oracle
XMLTYPE datatype is used for managing news items. The business logic for
managing news items is implemented in NewsItemSessionBean which is a stateless
session bean. Oracle XML DB features are used in NewsItemSessionBean.
DB Access Layer:
The DB Access Abstraction Layer is a re-useable
library through which database connections are managed. It is an abstraction
of database which provides centralized database access with different
implementations of connection mechanisms. The NewsItemSessionBean and
Reader Classes use this layer where as the EJB Container takes care of
managing database connections for the other CMPs.
|