ERP 2.50:Developers Guide/Openbravo Main Development Concepts/it
Principi di Design
Openbravo ERP is a software application which is being developed with the following design principles in mind:
- Open Source
- ERP application framework
- Model Driven Development
- Pure web application - Rich client
- Java - Lightweight J2EE
- Support for multiple databases
The aim of Openbravo is, while following these principles, to deliver an application which is state-of-the-art from both a technological as well as a functional point of view.
Openbravo is an open source project built on open source technologies. We aim to leverage on the excellent infrastructure components developed by the open source community to ensure our platform benefits from the advantages and stability of components supported by a large community. Whenever necessary we contribute our developments back to the community.
Framework di applicazione ERP
Openbravo ERP is an application developed through an integrated development framework included in Openbravo ERP distribution. This integrated development framework takes care of a wide range of concerns in all the areas involved during the development process. Most relevant from low level to high level:
- Integration with Eclipse IDE
- Integration with SCM (Mercurial)
- Automated build process
- Automated update process
- Automated deploy process
- Built-in infrastructure for several common development needs:
- MVC framework (xmlEngine, httpBaseServlet, sqlc)
- Data access layer (based on Hibernate)
- Web server and servlet-container (integration with Apache-Tomcat and support to other J2EE implementations)
- Reporting (integration with Jasper-reports engine)
- Web services (integration with Apache-Axis)
- Emailing (integration with Sun mail)
- Process scheduling (integration with Quartz)
- MDD development framework (Openbravo Application Dictionary)
- Multi-language user interface support
- Built-in security model
- Built-in enterprise model
- Multi-currency support
- Multi-accounting schema support
Sviluppo Guidato dal Modello (MDD=Model Driven Development)
Openbravo ERP follows a Model Driven Development (MDD) approach. This means that Openbravo uses a technology agnostic model to define application components, such as windows and processes. Based on this application model, java code and other software artifacts are generated.
Openbravo model information -so called metadata- is stored in the Openbravo Application Dictionary. The process to generate the code from metadata is called Wizard for Application Development (WAD).
Model Driven Development aims to increase productivity and re-use through separation of concerns and abstraction. The model is an abstract definition of system components which contains enough information to drive the generation of one (or more) implementations of the system in a concrete technology.
This separation of concerns -abstract functional description in the model and implementatation of model components in a concrete technology- hides technology complexities to ERP domain experts in their process to define and implement new ERP functionality and simplifies the evolution of the implementation technology
In some cases it is needed to code a solution externally from the model. This is fully supported by Openbravo. Developers can freely develop their own solutions on top of the Openbravo ERP technology stack.
Modularity is a new capability introduced in the Openbravo ERP 2.50 release which allows to define and package additional functionality and configurations as extension modules, independently from the core product.
Modularity changes the way in which Openbravo ERP can be adapted to user needs. Instead of customizing the code to match user requirements, it is possible to externally -from an independent module- extend Openbravo ERP functionality and to configure it.
This new approach has several advantages. Most important:
- Enables pure distributed development: new functionalities can be developed through modules in a pure distributed manner. The team developing the module can work isolated from other teams -they only need a stable API from the other modules they use- and the life cycle of this module -including releases- is independent from other modules.
- Highly improves maintenance of code: developing through modules means packaging independently. With a proper definition of module dependencies and keeping API's stable the process of updating an instance is straightforward and can be performed in one user click
- Encourages sharing and re-use of new functionalities: developing through modules make it quite simple to share this new functionality with other people. If developers want to share their modules all they need is to package and publish them in Openbravo Forge (Central Repository). After that these modules will be publicly available and other users can search for them and install them through a simple process.
Applicazione in Pure web - Rich client
Openbravo ERP is, by its very nature, a pure web application. Ubiquity of web browsers provides an universal point of access. Openbravo understands the network as a platform, delivering and allowing users to use applications entirely through a browser.
The requirements are minimum: a web browser is available on virtually all computer systems. Moreover, being web-based means the product can be delivered over the Internet, allowing to update the application without distributing and installing software on potentially hundreds of client computers.
Traditionally web applications had big limitations in regards of user interface. This has changed with the introduction of new web technologies such as AJAX. With AJAX and similar frameworks it is possible to develop a rich, interactive and user-friendly interface
Java - Lightweight J2EE
Openbravo uses Java as its backend programming language. There are many reasons for choosing Java as the server-side language:
- Open Source nature
- Wide support for enterprise-level development
- Mature architecture for web applications
Openbravo follows Java 2 Enterprise Edition architecture (J2EE) without making use of the EJB container. Instead of that Openbravo uses lightweight infrastructure to implement access to data and business logic. In Openbravo 2.50 Openbravo has delivered a new Data Access Layer (DAL) based on Hibernate that provides a powerful but still lightweight persisting mechanism.
Supporto per databases multipli
Openbravo is committed to avoid vendor locking in any technology it uses including database. In Openbravo 2.50 Openbravo runs on PostgreSQL (8.3) and Oracle SE (10g-11g).
In future releases Openbravo aims to be database independent. The new Data Access Layer (DAL) based on Hibernate is a first step in that transition
Concetti principali in Openbravo
Requisiti di Sistema
Openbravo runs on top of a group of well-known third party applications:
- Apache-Tomcat. We use Apache Tomcat as the servlet container but others can be used instead
- Apache-Ant is used to automate a number of tasks such as build the system from source code
- PostgreSQL (8.3) or Oracle SE (10g-11g) database
All of these applications can be installed both on Linux or Windows.
Ambiente di Sviluppo
Openbravo developers have three different ways to develop their code. Following the MDD approach, most common is to edit Openbravo Application dictionary through a web browser connected to Openbravo ERP. Based on the new model definition the software artifacts can be generated automatically. A developer can also connect directly to the Openbravo database through a sql client (eg. pgAdmin, sqlDeveloper) to manage database schema objects (tables, procedures, etc.). Finally developers can develop their own code through an integrated development environment such as Eclipse.
All openbravo software artifacts are stored in text files in the development project. This includes the database definition and content. The large advantage of using text files for storing all software artifacts is that it is much easier to share and compare changes made by developers in a distributed environment.
Openbravo uses a tool called DBSourceManager to manage database source code. DBSourceManager is able to read from the database schema objects and application dictionary data and export them to xml files. It can also create or update an Openbravo database from those xml files
The process to build the system from openbravo source code includes a number of steps to generate the code at different levels (DAL, WAD and others) and put together that code with other code directly written by developers. Openbravo has automated this process through an ant task.
The automation of code generation is achieved by using the Application Dictionary and the WAD (Wizard for Application Development). WAD automatically generates all the files of the application with an MVC architecture using Openbravo MVC framework
MVC Foundation Framework (MVC-FF)
The Openbrave web user interface follows a model-view-controller approach. Openbravo uses an advanced runtime generation and templating technology (MVC-FF) to generate the user interface (the html page) on request.
MVC-FF is composed of a set of utilities developed by Openbravo: XmlEngine, SQLC and HttpBaseSecureServlet. MVC-FF is needed to allow the development of decoupled files for the Model, View and Control components of the MVC architecture.
This set of utilities has been used in the development of many other MVC applications, and it has proven to be very efficient for the Openbravo development team
XmlEngine is a utility used to create XML/HTML documents from a template in XML/HTML format and an XML configuration file with the dynamic data to be inserted in the template.
XmlEngine is easy to use because the design of the template is the identical to that of the final document desired. The input of data is made identifying the places where data will be displayed by using standard XML/HTML attributes like “id” or tags such as “DIV”. The configuration file maps the data source fields with the places identified in the template. To improve performance, the templates are read and stored in memory.
When a page is required, the template creates a document and fills it with data. The XmlEngine tool is responsible for generating the forms for editing a record, list a selection of records, create reports with grouping levels or print specific forms of the application.
The XmlEngine is described in more detail on this page.
SQLC (SQL Compiler) is a utility used to avoid the repetitive task of writing Java classes to interact with the database. The input is an XML file that contains standard SQL statements and the parameters used in the statements. SQLC reads this file and generates a Java class that has all the code necessary to connect to the database, execute the statement, read the record and create standard Java types as return for the methods.
HttpBaseServlet and HttpBaseSecureServlet are the servlets from which all of the servlets of the system that implement the Control component of MVC are derived. These servlets implement common functionalities such as authentication, authorization, database connectivity and error handling. The servlets deriving from HttpBaseSecureServlet make the standard control of reading data, interacting with the database with classes generated by SQLC and providing the output with XmlEngine. For more information on the Openbravo base servlet structure visit this page.
Data Access Layer (2.50)
In the 2.50 release a new component has been added to the Openbravo Architecture: the Data Access Layer (DAL). The DAL uses hibernate to make Openbravo entities and business objects available to the Java developer.
The DAL provides the application developer with the following functionality:
- type safe querying and retrieval of business objects from the database.
- a convenient API to update or create new data in the database.
- a type safe interface to update information of a business object, increased productivity by making the properties of a business object directly visible through getters and setters (in the IDE).
- transaction and context handling.
- security and validation checking.
- automatically maps new entries in the Application Dictionary to database tables and columns.
- generates Java class business objects (and their associations) on the basis of the Application Dictionary model.
The DAL consists of a development-time and runtime part. The development-time part takes care of generating Java business object classes. The runtime part takes care of mapping Java classes to the database and supporting functionality such as querying, security and validation.
For more information about the Data Access Layer please visit this page.