In the following tutorial we will examine a small jZeno demo application. It is a basic example but it will show a lot of aspects of a jZeno application. The application that we are going to use is a simple order system. Customers can order products and these products are managed by an administrator. All source code is included in the jzeno download.
We would like to thank Glen Vermeylen and Joeri Van Geystelen for creating this jZeno tutorial. This online version of the tutorial is an adaptation of their original PDF version. Thanks guys !
We will now give a quick overview of the jZeno platform. The architecture of jZeno is based on the classic 3-tier architecture. The application is divided in 3 different tiers where each tier has his specific responsibility :
- Presentation Layer : This layer has the responsibility to provide the view of the application and provide the user interface towards the user.
- Business Layer : This layer contains the business logic of the application.
- Domain Layer : This layer has the responsibility to persist the business data in a database.
These layers clearly seperate difference concerns of the application. A graphical representation of the implementation of those different technical layers in jZeno :
Parts that are implemented as part of the framework are shown in light grey. Parts that are implemented by the application developers is shown in dark grey. A short description of functionality in the different layers is described below.
This is where the developer implements the user interface in pure Java code, using a rich set components as described below, and interacting with domain level concepts that are managed by the Business Layer.
- Dynamic Components. jZeno comes bundled with a number of components to create a rich user experience, and to ease development. These components take care of synchronizing state between the browser and your server, validating user input, dispatching events to event handlers, updating domain model objects, etc...
This is where the developer implements the specific business rules for the application and ultimately manipulates the Domain Layer. Queries to the database are written in a database independent way using the open source hibernate persistence framework. In essence developers are working with objects of the domain layer, using and manipulating them, and never need to worry about synchronizing these objects to the database. jZeno transparently manages your Hibernate session and will automatically synchronize the domain model objects with the persistent storage.
- Business Services. jZeno comes with a stack of services that facilitate things like security checking to authorize access to the Business Layer, dealing with dead-lock situations, setting up database transactions, managing ORM sessions, performance measuring, etc...
This is where you implement business logic Domain model objects are automatically synchronized to the database.
- Hibernate ORM Layer. Hibernate is used to persist and query the domain layer. jZeno eases the use of hibernate by managing hibernate sessions transparently. This simplifies the learning curve for hibernate significantly.
- Relational Database. Because ORM is used jZeno applications are independent of which specific database you are using for storage, easing migration in the future, and allowing you to choose the optimal database without having to worry about vendor lock-in.
- It's cross-browser display technology is AJAX based, and uses very compact interactions with the server. Web requests are compressed dramatically, greatly reducing the network bandwidth usage. jZeno has been succesfully tested on IE, Firefox and Opera.
- The client for the application is a “thin” client with a rich user interface. Most of the processing occurs on the server and the client only has the responsibility to display the application. No extra software needs to be installed, only an AJAX – compliant web browser is needed.
- Is 100% written in Java and therefore it runs on any J2EE compliant (servlet) container like Tomcat, Weblogic, Websphere, etc..
- Comes with built-in LIVE performance measuring and heap inspection.
- It has a short learning period, because of the reduced set of API's developers need to learn.
- Increases productivity. Among other things it eliminates most server restarts during development through dynamic class reloading.
- Supports reporting in PDF, Excel, RTF, HTML, ... through Jasper Reports.
The Tutorial Appliciation
This tutorial will be creating a simple application that integrates many different parts of jZeno. To give you an idea of what the application will look like, we'll give you a short tour :
First of all users need to log on to the system. After all not all users are allowed to view all data and/or perform all actions.
After this users can order items :
And they can view their orders. (Administrators can view all orders)
And finally only administrators can configure new or existing products :