Development Project Structure

From InfiniteERP Wiki
Jump to: navigation, search

Introduction

This document describes the structure of an Openbravo ERP development project. Openbravo ERP has a tree directory structure that logically divides different core components (XmlEngine, SQLC, HttpBaseServlet) and WAD (Wizard for Application Dictionary) from the ERP itself (forms, reports, call-outs, combos, processes and so on).

Project Structure

The following image provides a snapshot of the Openbravo ERP development project structure.

 openbravo  
   |-build
   |-config
   |-docs
   |-legal
   |-lib
   |-modules
   |-referencedata
   |-src
   |-src-core
   |-src-db
   |-src-gen
   |-src-test
   |-src-trl
   |-src-util
   |-src-wad
   |-srcAD
   |-temp
   |-web
   |-WebContent

build

The build directory contains the classes sub-folder where all of the compiled Java classes are copied to after executing the ant compilation build tasks . Also, the Java source code that is generated from the applications *.xsql files during the sqlc phase of the project build is written to the javasqlc sub-folder.

  |-build
     |-classes
        |-org
           ...
     |-javasqlc
        |-src
        |-srcAD

config

The config directory contains the Openbravo ERP configuration files. The config directory is where the setup script is downloaded to and executed from. Other configuration files in the config directory include the application properties file, Openbravo.properties, which is generated after running the setup process, and logging and scheduling properties files (log4j.lcf and quartz.properties). In this folder there are several .template files (Openbravo.properties.template, Format.xml.template, log4j.lcf.template, ...), which need to have their corresponding files (Openbravo.properties, Format.xml, ...) for Openbravo to work correctly.

  |-config
     |-log4j.lcf
     |-Openbravo.properties
     |-quartz.properties
     |-...
Bulbgraph.png   Starting from PR19Q1 log4j.lcf files have been replaced for log4j2's config files log4j2.xml, log4j2-web.xml and src-test/src/log4j2-test.xml

docs

The docs directory contains Openbravo's API documentation, which can be generated using the Javadoc tool. This documentation can be generated by executing the command ant generate.java.doc

legal

The legal directory contains a collection of licenses for the various libraries that Openbravo ERP utilizes.

lib

The lib directory contains all of the Java jar libraries used throughout the application. It is split into build and runtime, build containing the libraries used during compilation of Openbravo ERP, and runtime containing the jar files that are used during the application's execution.

 |-lib
    |-build
    |-runtime

modules

The modules directory is where any modules that you may have installed or developed are located. Each module has a top level directory named according to the Java package specified in its module description, and then below, a similar layout to the core development structure, which is in itself a module. When developing a module in the application dictionary, when the module is exported, it will be exported here to the modules directory.

 |-modules
    |-org.openbravo.examples.helloworld
       |-src
          ...
       |-src-db
          |-database
             |-model
             |-sourcedata
       |-web
           ...
       |-lib
         |-runtime
         |-build

Above is the structure of a sample module.

In Openbravo 3, there are several modules inside the modules/ folder which are now part of the standard distribution.

referencedata

The referencedata directory contains implementation specific reference data such as accounting structures, reports, product lists or price lists etc. Reference data modules are a convenient way to load reference data into Openbravo ERP. More information about this can be found here

  referencedata
     |-sampledata
     |-standard

src

The src directory is the top level directory of the main source code base for the Openbravo ERP project. It contains the source code for all of the components that make up the core Openbravo classic web application windows, and also services, including forms, reports, call-outs, combos, Data Access Layer (DAL), processes, manual windows, xsql and HTML files, reports etc.

  |-src
     |-org
        |-openbravo
           |-authentication
           |-base
           |-dal
           |-erpCommon
              |-ad_actionButton
              |-ad_callouts
              ...
              |-ad_reports
           |-erpReports
           |-scheduling
           |-services

The ad_ prefix (in erpCommon folders/packages) denotes Application Dictionary. The directory name endings are pretty much self-explanatory. The difference between ad_reports and erpReports lays in the way we access a report within the application. If it's accessible directly through the menu, then it should be in ad_reports. On the other hand some windows (Invoices, orders, etc.) have a Print icon in the toolbar, which generates a report. These reports should be stored in erpReports.

src-core

The src-core directory contains the source code of the core components: XmlEngine (View), SQLC (Model), HttpBaseServlet (Controller) and ConnectionPool.

  |-src-core
     |-src
        |-org
           |-openbravo
              |-base
                 ...
                 |-HttpBaseServlet.java
                 |-HttpBaseUtils.java
                 ...
              |-data
                 |-Sqlc.java
              |-database
              |-exception
              |-utils
              |-xmlEngine

src-db

The src-db directory contains the dbsourcemanager library. It also contains the database directory which is where all of the model data (structure: tables, constraints, procedures and triggers), sample data (Openbravo ERP data such as products, business partners and so on) and source data (windows and tabs metadata) in plain *.xml files are located.

  |-src-db
     |-build
     |-database
        |-lib
            |-dbsourcemanager.jar
        |-model
        |-sourcedata

src-util

The src-util folder contains the diagnostics tool, the buildvalidations, and the modulescripts. The diagnostic directory contains the code/tool to execute a diagnostic test on your configuration and report any problems or items you have not configured correctly. The diagnostic tool is executed using the ant diagnostic task from the root openbravo directory. You can find more information about what build validations and modulescripts are, and how to create one, here.

 src-util
   |-buildvalidation
   |-diagnostics
     |-build
     |-config
     |-src
     |-WebContent
   |-modulescript

src-gen

The src-gen directory contains the DAL model objects generated from the Openbravo model (tables, columns, references etc.) the during the ant generate.entities task.

  src-gen
     |-org
        |-openbravo
           |-model

src-test

The src-test directory contains the test source code, such as JUnit test and suites.

  src-test
     |-src
       |-org
         |-openbravo
           |-test
              |-ant
              |-base
              |-dal
              |-expression
              ...

src-trl

The src-trl directory contains the source code of the code which generates entries in the database for every translatable string in html, jrxml, fo and srpt files.

  |-src-trl
     |-src
        |-org
           |-openbravo
              |-translate

src-wad

The src-wad directory contains the source code of WAD (Wizard for Application Dictionary), which is used to generate classic window files from Application Dictionary window definition information.

  |-src-wad
     |-src
        |-org
           |-openbravo
              |-wad

srcAD

The srcAD directory contains all of the automatically generated code from the Application Dictionary.

temp

Temporary folder containing files which are not committed to Mercurial. It is created only when needed, for example, when obx files are downloaded from the Central Repository.

web

The web directory contains all of the web resources such as cascading style sheets (CSS), Javascript code, images and pop-up windows.

 web
  |-images
  |-js
  |-popups
  |-skins

WebContent

Is the web output folder for Eclipse, the output folder defines the webapp used by the Eclipse Tomcat integration. Contains WEB-INF (with web.xml and other important files) and META-INF.