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