Documente Academic
Documente Profesional
Documente Cultură
By Palash Ghosh
Abstract
This paper defines the process of architecting Challenges in today’s business scenario –
and brings out the best practices for architecting
a Java/J2EE solution with a real FileNet-based • Business logic is getting very complex and
project example. agile in nature
It dwells deep into the concepts of layered and • Integration points with different businesses
component-based architecture and provides running on different technology platforms
detailed explanations, guidelines and benefits • Scalability and maintainability
associated with creating enterprise architecture. • Security Issues
• Performance
Introduction
To address these challenges, organizations
The popular consensus is that a good architect today need to build reliable, robust, agile
does not necessarily have to be a good solutions that incorporate a scalable and
programmer. But I do not agree with this. I extensible architecture.
believe that one has to go through the process In order to successfully architect Java/J2EE
of getting her/his hands dirty and work on the solutions, an architect needs to have a thorough
nitty gritties of programming and other understanding of the following:
development related activities before s(he) will
have gained enough knowledge and experience • Methodology (RUP etc)
to conceptualize and create an enterprise-level • UML
architecture that is innovative and practical. • Best Practices (Java/J2EE Design Pattern)
• Technology (Java/2EE)
Today’s business situation is information driven,
with technology being one of the key business There are different architectural views (Process
enabler and in some cases, a business driver. View, Logical View etc) through which an
The whole world is talking about enterprise architecture can be represented. I believe that
solutions and enterprise applications. the logical view and the physical (deployment)
views are the most important architectural
What is an enterprise solution? representations.
FileNet’s eProcess workflow product, along with Benefits of this approach are:
Image Services Resource Adapter (ISRA) was • The Adapter layer encapsulates and provides
used as the basis of this solution. eProcess has a business level interface of Workflow APIs
two sets of Java API – one is for accessing the to the core services in the Business Services
documents in the repository and the other for layer.
mainly managing the workflows. From a • The set of APIs provided by workflow would
Java/J2EE application there was a need to be accessed sitting in this layer to make the
access third-party API that may undergo application easily maintainable.
changes and modifications in course of time. So,
it was decided to introduce two adapters in the
The horizontal layer includes all the The framework will support Resource Bundle for
infrastructure related components, which are persisting the error messages, i18n java
used across the whole spectrum of the solution. internationalization features are being used to
Next let us look into infrastructure components. store and retrieve the error messages based on
Any Java/J2EE solution must have very good an end-user profile.
logging as well as a very robust exception There is a Base Exception Class for the whole
handling strategy, which needs to be i18n application. And each layer has its own
enabled (internationalization). A robust exception, which extends from Base Exception.
mechanism has to be built in which helps to The corresponding exception would be thrown
pass the proper exception across the different from the related layer and would be caught in
layers and display a customized error message the next layer of the hierarchy.
to the user, which has to be i18n enabled too.
Now, lets talk about the Logger. The Logger is
This exception handling strategy provides a
a subsystem that represents an enterprise
base mechanism and guideline for handling
logging mechanism for distributed applications.
exceptions arising out of business conditions,
This component will expose methods which will
and errors arising out of non-business and
help the system to log the messages in text file
system-specific erroneous conditions.
depending on their available severity level as
info, warn, debug, error. With Apache log4j it is
The component will provide the following
possible to enable logging at runtime without
facilities:
modifying the application binary. The log4j
• Implement exception and error handling
package is designed so that these statements
• Support for internationalization
can remain in shipped code without incurring a
• Log exception messages depending on the
heavy performance cost. Editing a configuration
exception severity
file, without touching the application binary, can
• Decide whether an error message should be
control logging behavior. A wrapper over Log4j
shown to the user, or to log an exception
(an Apache open source framework already
message
available) was built for Logger, which is a
• Framework to support storing the error
standard practice.
messages in property files
• Framework to support handling of the return
codes The requirements also demanded an
integration layer to integrate with an Oracle
An Exception can be classified by logging database and MQ Series. For the database
severity level. The framework supports the integration DAO and DAO Factory were used,
following severity levels: which is a very standard approach, suggested
• Debug by J2EE pattern. By using these patterns, the
• Info database/SQL related code will reside in the
• Warn same place, which will help maintain the code
• Error and more importantly, the database can be
ported from Oracle to SQL Server or DB2
without much difficulty and without having to
The Framework provides a loose coupling of modify application logic.
error messages. Every error or exception is There is a need in layered architecture to
referred by a unique identifier know as errorID. transfer data across the layer in terms of Data
Only errorID shall be used in the application Transfer Object. Care needs to be taken to
code base. For each errorID, there exists a determine when the data can be changed and
corresponding error message, which is displayed when it needs to be immutable. This is a very
to the end-user. Since the error messages need crucial decision that needs to be made during
to be shown in the language according the end the time of design.
user’s preference or profile, they are maintained
in each language variant. • This layer consists of the Value Objects,
which are java beans that are used as
transport media while the system is required
to communicate with different layers performed by servlet class
• The Value Object holds the data • This layer takes help of java beans to
• This layer is the Model part of MVC transport the data to the immediate next
(Model/View/Controller) pattern layer, which is the Business Delegate layer
• Controller servlet classes would be packaged
In most cases, the presentation layer is the based on the module
least thought about and most neglected area • This layer is the Controller part of MVC
when architecture is being conceptualized. (Model/View/Controller) pattern
Common practice is to write some JSP pages
and to fit these with the Controller servlet. More
attention on the design of the presentation layer Struts Validator Framework has been used
will make it simple, reusable and maintainable. to avoid too much java script code from the
Special attention must be paid to JSP pages, application with using its configurable xml file.
their navigation and validations. There is a
tendency to write Java code in JSP too. Here, Benefits of Struts Validator Framework
Struts plays a very crucial role by proving its
• The Struts Validator framework allows
own framework. If developers are disciplined in
moving all the validation logic completely in
writing JSP code, they will be able to create
a centralized place and declaratively
clean JSP pages with Struts tags as well as
configuring it for an application through
custom tags.
external xml file.
• The other great benefit of the validator is
Presentation layer has the following
that it’s extensible. It provides many
characteristics
standard validation routines out of the box,
• It is developed using JSP (Java Server Page)
but if additional validation rules are
• Struts Tag and Taglib Directive should be
required, the framework is easy to extend
used to minimize the scriplet code in JSP
and provides the ability to plug in custom
and for enabling i18n
rules (again without modifying the
• The functions performed by this layer need
application)
to take care of presentation of the data to
the user based on the user request
• This layer would communicate with Today’s most enterprise applications that
controllers to put forward the user request support global businesses and processes,
to the service demand Internationalization (i18n). An
• This layer will also take care of the application should have the following
presentation (front end) level validation. characteristics to support i18n
Primarily Struts configurable Validator • Additional languages need to be supported
Component and Java Script (.js) would be without requiring code changes
used for validation • Text elements, messages and images need
• The Presentation layer is the view part of to be stored externally from the source code
MVC (Model/View/Controller) pattern • Culturally dependent data such as date and
• The Presentation layer takes the help of Java time, decimal values and currency need to
Beans to display and transport the data to be formatted correctly for the users’
the Controller language and geographic location
• Nonstandard charactersets need to be
With the help of the Controller, which is part of supported
the Struts Action Class, the task of delegation is • The application should be able to adapt to
streamlined. new languages and/or regions
Conclusion
In today’s every-changing business
environment, where technology is the key to
competitiveness and success, it is absolutely
essential for organizations to have a clearly
thought-out reuse strategy that will effectively
reuse design and development best practices
and components.
References
http://java.sun.com/blueprints/corej2eepatterns/Patterns
Author Profile