DBSourceManager

From InfiniteERP Wiki
Jump to: navigation, search
Back button.png   Back to Main Page


DBSourceManager

DBSourceManager is a Java library that helps with database tasks related to development. Its most important feature is database independence — you can focus on the development of database features and let DBSourceManager deal with the database implementation details.

DBSourceManager is based on DDLUtils and the database model used by DBSourceManager is an extension of the model used by DDLUtils. DDLUtils supports a large list of database engines, but all the extensions created in DBSourceManager only work for Oracle and PostgreSQL.

The main goal of DBSourceManager is to aid the developer in the creation and maintenance of database physical objects and data. The way this works is via an array of XML files which represent database physical objects or table records. DBSourceManager contains utilities which allow the developer to export its objects into these XML files, and which allow modifications in these XML files to be moved into the database by updating it.

Therefore, the developer can focus on creating and changing its components (either in the database or in the XML files), and DBSourceManager can automatically move the changes in either place to the other.

Architecture

As previously stated, DBSourceManager is based on the DDLUtils Apache project. Internally, its structure can be described as:

  • A series of classes to handle the Database model
  • A series of classes which are related to how the objects and their changes are transformed into RDBMS-specific commands

Common Tasks

The main tasks which DBSourceManager allows the developer to do are the following:

export.database

This task generates XML files corresponding with the database physical objects and the Application Dictionary table contents. It exports everything from the database so that the XML files reflect the current state of the database.

See export.database in Development Build Tasks for usage details.

update.database

This task updates the database, applying the changes which are necessary to transform it so that it follows the model described in the XML files. It reads the XML files and applies any differences to the database.

See update.database in Development Build Tasks for usage details.

export.config.script

This task generates a configuration script of the current system.

Model Filters

DBSourceManager uses a mechanism which is called Model filters to purposely remove some unwanted objects from the physical database model. These filters can be extended by modules.

To know how to exclude database physical objects from the model, see How to exclude Database Physical Objects From Model.

Relationship with Build Tasks

DBSourceManager tasks are integrated into the InfiniteERP build system. The main tasks are executed as Ant tasks:

  • ant export.database — exports the current database state to XML files
  • ant update.database — updates the database from XML files
  • ant export.config.script — exports the configuration script

These tasks are related to modularity concepts in InfiniteERP. When developing modules, only modules "in development" are exported by DBSourceManager.

Relationship with InfiniteERP Architecture

DBSourceManager plays a key role in the InfiniteERP development workflow:

  • It enables database independence — the same XML files can be used for both Oracle and PostgreSQL
  • It supports the Model Driven Development approach by keeping database schema in sync with the Application Dictionary
  • It enables modular development by allowing modules to export their own database changes independently
  • It works together with Data Access Layer to keep the runtime model and the database in sync

See Also

References


This work is a derivative of DBSourceManager by Openbravo Wiki, used under CC BY-SA 2.5 ES. This work is licensed under CC BY-SA 2.5.