* Improve startup time

* Make validation of application server and database connection
on startup optional
* Separate the database interface file by database. This will ease
concurrent development of multiple database support.
This commit is contained in:
Heng Sin Low 2006-11-23 03:24:25 +00:00
parent 8ede88a395
commit a12fa4bcab
1 changed files with 19 additions and 5 deletions

View File

@ -302,7 +302,10 @@ public final class ALogin extends CDialog
{ {
m_cc = CConnection.get(Adempiere.getCodeBaseHost()); m_cc = CConnection.get(Adempiere.getCodeBaseHost());
hostField.setValue(m_cc); hostField.setValue(m_cc);
validateConnection ();
if ( Ini.isPropertyBool(Ini.P_VALIDATE_CONNECTION_ON_STARTUP)) {
validateConnection();
}
// Application/PWD // Application/PWD
userTextField.setText(Ini.getProperty(Ini.P_UID)); userTextField.setText(Ini.getProperty(Ini.P_UID));
@ -339,15 +342,25 @@ public final class ALogin extends CDialog
} }
} // processWindowEvent } // processWindowEvent
private void validateAppServer() {
m_cc.testAppsServer();
}
private void connectToDatabase() {
//Check connection
DB.setDBTarget(m_cc);
DB.connect();
}
/** /**
* Validate Connection * Validate Connection
*/ */
private void validateConnection() private void validateConnection()
{ {
m_connectionOK = false; m_connectionOK = false;
// validateAppServer();
m_cc.testAppsServer();
m_cc.testDatabase(false); connectToDatabase();
// //
hostField.setDisplay(); hostField.setDisplay();
} // validateConnection } // validateConnection
@ -393,6 +406,7 @@ public final class ALogin extends CDialog
connectionOK(); // first ok connectionOK(); // first ok
else else
{ {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
m_okPressed = true; m_okPressed = true;
defaultsOK(); // disposes defaultsOK(); // disposes
} }
@ -532,7 +546,7 @@ public final class ALogin extends CDialog
m_pwd = new String (passwordField.getPassword()); m_pwd = new String (passwordField.getPassword());
// Establish connection // Establish connection
DB.setDBTarget(CConnection.get()); connectToDatabase();
if (!DB.isConnected()) if (!DB.isConnected())
{ {
statusBar.setStatusLine(txt_NoDatabase, true); statusBar.setStatusLine(txt_NoDatabase, true);