Real-Time Auction Service Application Based On Frameworks Available For J2EE Platform
Real-Time Auction Service Application Based On Frameworks Available For J2EE Platform
Real-Time Auction Service Application Based On Frameworks Available For J2EE Platform
discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/224130569
CITATIONS
READS
239
3 authors, including:
Bartosz Sakowicz
Lodz University of Technology
88 PUBLICATIONS 227 CITATIONS
SEE PROFILE
166
INTRODUCTION
Java Enterprise Edition platform offers much
flexibility as far as implementation of certain application is
concerned. This results in large number of frameworks that
can help developers in their work. Frameworks discussed in
the paper mainly worked in different areas however, their
integration capabilities were very important as well. In order
to create considered auction service, Hibernate, Spring, Java
Server Faces and Rich Faces solutions have been used.
AUCTION SERVICE DESCRIPTION
Auction service considered in the article differs from
the casual idea of auction (user paying the highest price wins).
It provides two main types of auctions.
First one follows the rule, that user who gave smallest
unique price wins and pays offered amount of money.
Moreover this type of auction has a defined offer cost, i.e.
price that a user has to pay for each placed offer. Finally,
auction has a prescribed duration time, in which bidders can
submit their offers.
Second auction type shares some of the ideas each
placed offer costs defined amount of money and duration time
is defined at the beginning of the auction. However, the rule
which determines auction winner is completely different.
Every offer increases the price of a product by defined amount
of money. Person which placed the last bid wins and pays the
final price. What is more duration time also increases with
every offer.
Second type of auction is much more challenging as
development of the service is concerned. This is because of
the fact, that duration time is measured in seconds and has to
be updated in real-time as users would often like to place their
offers very close to the end of auction. It forced usage of
AJAX technology (allowing partial update of site content
without the necessity to refresh the whole page), which was
implemented with Rich Faces framework.
Maciej Pilichowski, Bartosz Sakowicz and Jakub Chapiski are
members of Department of Microelectronics and Computer Science,
Technical University of Lodz, Poland
e-mail: maciej.pilichowski@googlemail.com
sakowicz@dmcs.pl
jchlapi@dmcs.pl
APPLICATION BASE
Spring is a starting point of development [5,8]. All
other technologies are added to the project by integration with
this framework. It is also a central point of application
operation, as all the objects (beans) used, are created and
maintained within Spring framework. Configuration used in
this particular application differs from the standard one
because some tasks which commonly are performed with
Spring are passed to other specific frameworks. This happened
in case of dispatcher servlet, which was replaced with its
167
counterpart provided by Java Server Faces this resulted in
following lines added to the WEB.XML file:
<servlet>
<servlet-name>
Faces Servlet
</servlet-name>
<servlet-class>
javax.faces.webapp.FacesServlet
</servlet-class>
<load-on-startup>
1
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
Faces Servlet
</servlet-name>
<url-pattern>
*.htm
</url-pattern>
</servlet-mapping>
SERVICE LAYER
Methods belonging to objects from this layer perform
business logic operations. These commonly involved data
manipulation which is allowed by DAO layer. Usually, each
service object has a member which is a corresponding data
access object (for example BidderService class has a
BidderDAO member). Dependency injection has been used for
the purpose of object management, i.e. Spring framework
initializes proper DAO component and injects it into a service
object.
Moreover, explicit definition indicating object, which
is to be injected is not necessary with Spring, instead autowiring feature have been applied. Each field that is to be
initialized with this tool is preceded with @Autowired
annotation, that makes Spring look for the component with
name fitting the field type in the base package, defined earlier
with the component-scan property. Spring provides also
suitable annotations to indicate that a class belongs to service
tier - @Service. Additionally @Transactional annotation has
been used to assure transactions support. Service objects are
the only ones visible for presentation tier. Because of this, any
method that either returns or receives data from the user
interface has to be implemented as a service method.
In simpler applications DAO and service layers can
be merged into one. However, in case of this project such a
division was fully justified and resulted in clear distinction
between database access and any other actions performed with
business objects. Complexity of service methods varies,
though some of them simply encapsulate one DAO method
168
while others can use many of them in a chain, and introduce
business logic tasks in between.
PRESENTATION LAYER
Presentation layer for the application being a subject
of this article have been based on the Java Server Faces and
Rich Faces solutions [6].
JSP pages were used as a container for user interface
components provided by other frameworks. In general they
consist of HTML tags and scriplets which hold Java code
allowing dynamic content. However, in the considered
application, HTML language was used only for the purpose of
proper arrangement of the objects on the page and scriplets
were not present at all.
Java Server Faces technology provides a set of
common user interface components. Due to the fact, that
application's look was designed in a highly customized way,
only the basic UI components like outputText or
graphicImage were placed on JSP pages. Still, functional tags
from the JSF library like, form, loadBundle etc. where used
extensively in the whole application. Generally, Java Server
Faces technology provided a solid base for the presentation
tier of a target application. Due to the fact, that it offers much
more than only user interface components, appeared to be
irreplaceable even in cases, in which they are coming from
other tool. This is because of features like input field
validators, navigation rules or multiple language support, that
was be easily implemented in the considered auction service.
Although, for this project UI components from Rich Faces
framework have been used, the ones offered by JSF shall be
enough for most of developers' needs.
The user interface itself has been mainly implemented
with Rich Faces framework because of its large set of rich user
interface components, that surpasses the one that comes with
JSF. It offers WYSIWYG editor, file upload component,
tables with appendable data sources and many others.
Moreover, those components are much more responsive as
they take advantage of AJAX technology, with no need for the
developer to write JavaScript code. What is also very
important, those components are highly customizable as far as
their look and feel is considered. Fig. 2 and Fig. 3 present data
table component with default [2] and auction service specific
look.
169
this technology. Dependency injection and support of different
life-cycles for components have been extremely useful during
development.
Hibernate fully deserves its leading position among
solutions for database access. This has been proved during the
development of the auction service application. With
Hibernate one can easily access data without SQL knowledge.
Object oriented criteria API allows complicated queries to be
implemented in a clear and easy way. Moreover, no noticeable
lags did occur even in case of complex operations. Though
Hibernate can be recommended as a very good ORM tool.
JSF is a technology that needs no introduction,
because it is present on the market for a very long time. Its
usage in this project proves that it still is a framework, that
cannot be overestimated. Tag library and custom tag creation
capability facilitate creation of the user interface. Navigation
rules allow clear definition of flow of control in a web
application, and the auction service application benefits from
it.
Rich Faces is a quite new framework, but it is gaining
more and more users thank to a large set of attractive and fully
customizable user interface components. They also make
application much more responsive due to AJAX support.
However, this particular feature did not perform good enough
to be implemented in a final auction service. User interface
components were displayed and refreshed properly, but
amount of data transferred form the server was not acceptable.
As a further development a research have to be done in order
to find alternate solution (eg. JQuery library).
ACKNOWLEDGEMENTS
One of the authors is a scholarship holder of project
entitled "Innovative education ..." supported by European
Social Fund.
REFERENCES
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
Spring
Framework
API
2.5,
http://static.springsource.org/spring/docs/2.5.x/api/
Rich Faces developer's guide, http://www.jboss.org/fileaccess/default/members/jbossrichfaces/freezone/docs/dev
guide/en/html_single/index.html
A.P.Rajshekhar, Hibernate: Criteria queries in depth,
Devarticles, 2006
J. Wojciechowski, J. Murlewski, B. Sakowicz, A. Napieralski, "Object-relational mapping application in web-based
tutor-supporting system", CADSM, Lviv-Polyana, Ukraine,
Feb. 23-26, 2005,pp. 307-310, ISBN 966-553-431-9
T. Bk, B. Sakowicz , A. Napieralski, Development of
Advanced J2EE Solutions Based on Lightweight
Containers on the Example of e-department
Application, 13th International Conference Mixed
Design of Integrated Circuits and Systems MIXDES
2006, ISBN 83-922632-9-1.
A. Frymarkiewicz, B. Sakowicz, M. Wjtowski, Easily
Extendible Framework for Computational Purposes
Based on JavaServer Faces, 13th International
Conference Mixed Design of Integrated Circuits and
Systems MIXDES 2006, ISBN 83-922632-9-1
P. Ziemniak, B. Sakowicz, A. Napieralski, "Object
oriented application cooperation methods with relational
database (ORM) based on J2EE Technology";
CADSM'2007; 9th International Conference The
Experience Of Designing And Application Of Cad
Systems In Microelectronics, Polyana, Ukraina, 20 - 24
February 2007, ISBN 978-966-553-587-4
M. Mela, B. Sakowicz, J. Chlapinski: "Advertising Service
Based on Spring Framework", 9th
International
Conference Modern Problems of Radio Engineering,
Telecommunications and Computer Science, TCSET2008,
19-23 February 2008, Lviv-Slavsko, Ukraine