Chapter 1: Overview
Presentation
OpenXava is a framework to develop JavaEE/J2EE applications quickly and easily.
The underlaying philosophy is to define with Java annotations or XML and to program with Java, the more definition and less programming the better.
The main goal is to make the more typical things in a business application easily, while you still have the necessary flexibility to develop the most advances features as you like.
Below you can see some basic concepts of OpenXava.
Business component
The fundamental pieces to create applications in OpenXava are the business components. In OpenXava context a business component is a Java class (althought also exists a XML version) that contains all needed information about a business concept that allows you to create applications on it. For example, all needed information that the system has to know about the concept of invoice is defined in the file
Invoice.java. In a business component you can define:
- The data structure.
- Validations, calculations and in general all logic associated with the business concept.
- The possibles views, i. e. the configuration of all possible user interfaces for this component.
- The possibilities for the tabular data presentation. This is used in list mode (data navigation), reports, export to excel, etc.
- Object-relational mapping, this includes information about database tables and how to convert it to the objects of your Java application
This splitting way is good for work groups, and allows to develop generic business component for using in different projects.
Controllers
The business component does not define the things that user can do in the application; this is defined in controllers. The controllers are specified in the file
xava/controllers.xml of your project; in addition OpenXava has a set of predefined controllers in
OpenXava/xava/default-controllers.xml.
A controller is a set of actions. An action is a button or link that a user can click.
The controllers are separated from the business components because one controller can be assigned to several business components. For example, a controller to make CRUD operations, to print in PDF format or to export to plain files, etc. can be used and reused for components like invoices, customers, suppliers, etc.
Application
An OpenXava application is a set of modules. A module joins a business component with one or more controllers.
Each module of the application is what the end user uses, and generally it is configured as a portlet within a portal.
Project structure
A typical OpenXava project usually contains the these folders:
- [root]: In the root you can find build.xml (with the Ant task).
- src[source folder]: Contains your Java source code.
- xava: XML files to configure your OpenXava application. The main ones are application.xml and controllers.xml.
- i18n: Resource files with labels and messages in several languages.
- properties[source folder]: Property files to configure your application.
- data: Useful to hold the scripts to create the tables of your application, if needed.
- web: Web content. Usually JSP files, lib and classes. Most of the content is generated automatically, but you can put here your own JSPs or other custom web resources.