* wan profile enhancement

This commit is contained in:
Heng Sin Low 2007-01-12 09:12:23 +00:00
parent 026f99e87a
commit ce53ae3338
2 changed files with 34 additions and 3 deletions

View File

@ -150,13 +150,16 @@ public class CConnection implements Serializable
}
} // CConnection
/** Default jboss port **/
private final static int DEFAULT_APP_SERVER_PORT = 1099;
/** Name of Connection */
private String m_name = "Standard";
/** Application Host */
private String m_apps_host = "MyAppsServer";
/** Application Port */
private int m_apps_port = 1099;
private int m_apps_port = DEFAULT_APP_SERVER_PORT;
/** Database Type */
private String m_type = "";
@ -548,10 +551,17 @@ public class CConnection implements Serializable
{
log.config(m_connectionProfile + " -> " + connectionProfile);
m_connectionProfile = connectionProfile;
if (PROFILE_WAN.equals(m_connectionProfile))
setAppsPort(80);
else
setAppsPort(DEFAULT_APP_SERVER_PORT);
Ini.setProperty(Ini.P_CONNECTION, toStringLong());
}
else
m_connectionProfile = connectionProfile;
//reset initial context to null
m_iContext = null;
}
else
log.warning("Invalid: " + connectionProfile);
@ -1542,7 +1552,7 @@ public class CConnection implements Serializable
}
catch (CommunicationException ce) // not a "real" error
{
// m_appsException = ce;
m_appsException = ce;
String connect = (String)m_env.get(Context.PROVIDER_URL);
log.warning (connect
+ "\n - " + ce.toString ()

View File

@ -20,6 +20,8 @@ import java.sql.*;
import java.util.*;
import java.util.logging.*;
import javax.swing.JOptionPane;
import org.compiere.model.*;
/**
@ -188,7 +190,7 @@ public class CLogErrorBuffer extends Handler
String loggerName = record.getLoggerName(); // class name
String className = record.getSourceClassName(); // physical class
String methodName = record.getSourceMethodName(); //
if (DB.isConnected()
if (DB.isConnected(false)
&& !methodName.equals("saveError")
&& !methodName.equals("get_Value")
&& !methodName.equals("dataSave")
@ -200,6 +202,25 @@ public class CLogErrorBuffer extends Handler
MIssue.create(record);
m_issueError = true;
}
else
{
//display to user if database connection not available
if (!methodName.equals("saveError")
&& !methodName.equals("get_Value")
&& !methodName.equals("dataSave")
&& loggerName.indexOf("Issue") == -1
&& loggerName.indexOf("CConnection") == -1)
{
if(Ini.isClient())
{
JOptionPane.showMessageDialog(null, getFormatter().format(record), "Error", JOptionPane.ERROR_MESSAGE);
}
else
{
System.err.println(getFormatter().format(record));
}
}
}
}
}
} // publish