Difference between revisions of "User:Trigger"

From iDempiere
Line 75: Line 75:
  
 
===Creation of the default database===
 
===Creation of the default database===
−
Now, we know how the script load the [http://wiki.idempiere.org/wiki/User:Trigger#Default_Database_Configuration_Properties database configuration properties]. In this section, we will see how the script automatised his creation. This involves to know how the script get a session and create the database scheme. Let us go through the source code!
+
Now, we know how the script load the [[User:Trigger#Default_Database_Configuration_Properties|database configuration properties]]. In this section, we will see how the script automatised his creation. This involves to know how the script get a session and create the database scheme. Let us go through the source code!
 
<p>The class which is responsible to get a session and create the default database is ''com.openbravo.pos.forms.JRootApp''.
 
<p>The class which is responsible to get a session and create the default database is ''com.openbravo.pos.forms.JRootApp''.

Revision as of 20:27, 13 August 2014

About Me

I am Ralph WAFO, a software engineer and developer. I am more interested by object oriented programming paradigm and mostly use java programming language.

I want to impact the world and I will become the most powerful system analyst of this century... Yes, The Most POWERFULL!!!

Understand source code, debug, test and document my work is a really pleasure for me. I am really glad when I perform a task properly, document and share my work. I really like team work, It is very important for me to be social and helpful. I also like to share my passion with the others.

I'm living my dream through The Steve Jobs Project supported by Redhuan and IT-Kamer company Ltd which is lead by Stanley Mungwe.
Redhuan's trainings are more interesting and he teachs us more about the 21st Century skills and how to get them. At the end of a particular training, i got a source code of an free and open source software from him...

POS source code is quite wonderful. I have gone through briefly and seen how the initialisation and configuration of apps are performed into the code... You surely understand it !!! I cannot resist to produce a good documentation to ease the use of this source code. Do you want to follow me in this amazing adventure? Read the next section!

What I am doing now

I am working on the most exciting project in the world: Steve Jobs Project !!!
Do you know anything about Point Of Sale?
This is an essay about technical documentation of the source code of OpenBravo Point Of Sale.

Technical Documentation

Default Database Configuration Properties

Pos project tree.png

Let's start by describing the data model and show, into the code,
how the script define the DataBase and configuration properties...

I suppose you have imported the project source code successfully.

In NetbeansIDE your project should be like that on the picture below.
When you run the project the first time, the application notifies you because it does not find a database and informs you that it will create a default database. Just click on Yes!
Notification.png

Now take a look at the IDE console. We can see that the class responsible to application configurations is com.openbravo.pos.forms.AppConfig.

Output-run-screen.png

The following is an UML Class diagram for com.openbravo.pos.forms.AppConfig

AppConfig-UML-Model.png

Try to open the file into your IDE and focus on the part of code in which database parameters are configured. Into this class, the method in charge to initialise the default value of configuration parameters is loadDefault.

private void loadDefault() {

       m_propsconfig = new Properties();

       String dirname = System.getProperty("dirname.path");
       dirname = dirname == null ? "./" : dirname;

       m_propsconfig.setProperty("db.driverlib", 
             new File(new File(dirname), "lib/derby.jar").getAbsolutePath());
       m_propsconfig.setProperty("db.driver", "org.apache.derby.jdbc.EmbeddedDriver");
       m_propsconfig.setProperty("db.URL", "jdbc:derby:" + 
             new File(new File(System.getProperty("user.home")), 
                 AppLocal.APP_ID + "-database").getAbsolutePath() + ";create=true");
       m_propsconfig.setProperty("db.user", "");
       m_propsconfig.setProperty("db.password", "");
       ...
       ...
}
At this level we can see the default parameter by using the debugger. Just create a breakpoint, run debugger and check variable state. I let you try it. The following pictures show the default value of the variable on my own computer. The other configuration properties are into the same methods loadDefault. Browse it to have an idea. Defautl-variable-values.png

We can proceed now to understand how the script automatised the creation of the default database. This involve how the script get a session and execute SQL queries. But those who are curius, take a look at this class: com.openbrave.pos.forms.DataLogicSystem.

Creation of the default database

Now, we know how the script load the database configuration properties. In this section, we will see how the script automatised his creation. This involves to know how the script get a session and create the database scheme. Let us go through the source code!

The class which is responsible to get a session and create the default database is com.openbravo.pos.forms.JRootApp.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.