|
Trader Pattern for Invoking Services
by: Samudra Gupta
Introduction
The world of Java now suffers from the problem of plenty. There
are so many ways that an application can be developed and
deployed. For example, you may decide to develop and deploy a
piece of software as a web application or you may decide to
deploy it as a traditional client-server application. As mature
and experienced developers, we all know the decision-making
factors, the pros and cons of any particular chosen method of
deployment. However, the scalability aspect of an application
can also be measured by how easily it can change the mode of
deployment. In this article, we will see how a Trader pattern
can help achieve flexible deployment options.
Motivation
In the recent days of enterprise application development, one of
the strong features is the layered architecture. In this, we
strive to achieve clear separation between the presentation and
the business. The goal is that each must be able to work and
change independent of the other. In this way, we tend to present
business logics as Services. These business Services can be used
by many clients at the same time. So long as, the required data is
supplied to the business Service, the logic is performed and the
result is returned to the client.
In this model, one of the other conclusions is that these
business Service components are server based, distributed by
nature and capable of serving many clients at the same point of
time. However, a good application architecture will suggest that
the client of these business Services also need not know how
these Services are deployed and how they are implemented
internally. In other words, client programs should not have to
change if, for example, we need to make any changes to the
internal implementation in these Service components or if we
decide to deploy the Service components in a completely new
deployment environment.
Just to make things easier, let us say we have a business
Service component for the bank accounts. The task of this
component is merely to retrieve the bank account details. Now we
may decide this component to deploy in the web container as a
simple JDBC based component or we may also decide to deploy this
as an Entity bean in any EJB container. The question is should
this decision affect the client to this program? The answer is
simple,no.
This is where the Trader pattern comes into the picture. In
summary, the Trader pattern helps us achieve the following
points:
- Provides a complete decoupling between the client and the
way Service components are implemented and deployed.
- Configurable selection of the type of services to be
deployed and also configurable deployment information.
- Highly scalable application architecture.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|