* remove db2, sqlserver and sybase files and reference

* added silent setup support, run setup without x11
This commit is contained in:
Heng Sin Low 2007-01-14 18:40:51 +00:00
parent ef9569374d
commit f9421c0cc8
17 changed files with 715 additions and 465 deletions

View File

@ -16,7 +16,6 @@
<classpathentry kind="lib" path="/tools/lib/ant-commons-net.jar"/> <classpathentry kind="lib" path="/tools/lib/ant-commons-net.jar"/>
<classpathentry kind="lib" path="/tools/lib/ant-launcher.jar"/> <classpathentry kind="lib" path="/tools/lib/ant-launcher.jar"/>
<classpathentry kind="lib" path="/tools/lib/commons-net-1.4.0.jar"/> <classpathentry kind="lib" path="/tools/lib/commons-net-1.4.0.jar"/>
<classpathentry kind="lib" path="/lib/db2.jar"/>
<classpathentry kind="lib" path="/lib/derby.jar"/> <classpathentry kind="lib" path="/lib/derby.jar"/>
<classpathentry kind="output" path="build"/> <classpathentry kind="output" path="build"/>
</classpath> </classpath>

View File

@ -0,0 +1,67 @@
#AdempiereEnv.properties Template
#Adempiere home
ADEMPIERE_HOME=C\:\\Adempiere
#Java home
JAVA_HOME=C\:\\Program Files\\Java\\jdk1.5.0_09
#Type of jvm, sun|mac|<ibm>
ADEMPIERE_JAVA_TYPE=sun
#Java runtime options
ADEMPIERE_JAVA_OPTIONS=-Xms64M -Xmx512M
#Type of database, postgresql|oracle|oracleXE|fyracle
ADEMPIERE_DB_TYPE=postgresql
#Database server host name
ADEMPIERE_DB_SERVER=localhost
#Database port, oracle[1512], postgresql[5432], fyracle[3500]
ADEMPIERE_DB_PORT=5432
#Database name
ADEMPIERE_DB_NAME=adempiere
#Database system user password
ADEMPIERE_DB_SYSTEM=postgres
#Database user name
ADEMPIERE_DB_USER=adempiere
#Database user password
ADEMPIERE_DB_PASSWORD=adempiere
#Type of application server
ADEMPIERE_APPS_TYPE=jboss
#Application server host name
ADEMPIERE_APPS_SERVER=localhost
#Application server port
ADEMPIERE_JNP_PORT=1099
ADEMPIERE_WEB_PORT=80
ADEMPIERE_SSL_PORT=443
#Keystore setting
ADEMPIERE_KEYSTORE=C\:\\Adempiere\\keystore\\myKeystore
ADEMPIERE_KEYSTOREWEBALIAS=adempiere
ADEMPIERE_KEYSTORECODEALIAS=adempiere
ADEMPIERE_KEYSTOREPASS=myPassword
#Certificate details
#Common name, default to host name
ADEMPIERE_CERT_CN=
#Organization, default to the user name
ADEMPIERE_CERT_ORG=ADempiere Bazaar
#Organization Unit, default to 'AdempiereUser'
ADEMPIERE_CERT_ORG_UNIT=AdempiereUser
#town
ADEMPIERE_CERT_LOCATION=myTown
#state
ADEMPIERE_CERT_STATE=
#2 character country code
ADEMPIERE_CERT_COUNTRY=
#Mail server setting
ADEMPIERE_MAIL_SERVER=localhost
ADEMPIERE_ADMIN_EMAIL=admin@host.com
ADEMPIERE_MAIL_USER=
ADEMPIERE_MAIL_PASSWORD=
#ftp server setting
ADEMPIERE_FTP_SERVER=localhost
ADEMPIERE_FTP_PREFIX=my
ADEMPIERE_FTP_USER=anonymous
ADEMPIERE_FTP_PASSWORD=user@host.com

View File

@ -0,0 +1,53 @@
@Title Install Adempiere Server
@Rem $Header: /cvsroot/adempiere/install/Adempiere/RUN_setup.bat,v 1.19 2005/09/08 21:54:12 jjanke Exp $
@Echo off
@if not "%JAVA_HOME%" == "" goto JAVA_HOME_OK
@Set JAVA=java
@Echo JAVA_HOME is not set.
@Echo You may not be able to start the required Setup window !!
@Echo Set JAVA_HOME to the directory of your local 1.5 JDK.
@Echo If you experience problems, run utils/WinEnv.js
@Echo Example: cscript utils\WinEnv.js C:\Adempiere "C:\Program Files\Java\jdk1.5.0_04"
goto START
:JAVA_HOME_OK
@Set JAVA=%JAVA_HOME%\bin\java
:START
@Echo =======================================
@Echo Starting Setup ...
@Echo =======================================
@SET CP=lib\CInstall.jar;lib\Adempiere.jar;lib\CCTools.jar;lib\oracle.jar;lib\fyracle.jar;lib\derby.jar;lib\jboss.jar;lib\postgresql.jar;
@Rem Trace Level Parameter, e.g. SET ARGS=ALL
@SET ARGS=CONFIG
@Rem To test the OCI driver, add -DTestOCI=Y to the command - example:
@Rem %JAVA% -classpath %CP% -DADEMPIERE_HOME=%ADEMPIERE_HOME% -DTestOCI=Y org.compiere.install.Setup %ARGS%
@"%JAVA%" -classpath %CP% -DADEMPIERE_HOME=%ADEMPIERE_HOME% org.compiere.install.SilentSetup %ARGS%
@Echo ErrorLevel = %ERRORLEVEL%
@IF NOT ERRORLEVEL = 1 GOTO NEXT
@Echo ***************************************
@Echo Check the error messabe above.
@Echo ***************************************
@Echo Maske sure that the environment is set correctly!
@Echo Set environment variable JAVA_HOME manually
@Echo or use WinEnv.js in the util directory
@Echo ***************************************
@Pause
@Exit
:NEXT
@Rem ===================================
@Rem Setup Adempiere Environment
@Rem ===================================
@Call utils\RUN_WinEnv.bat
@Echo .
@Echo For problems, check log file in base directory
@pause

View File

@ -0,0 +1,38 @@
#!/bin/sh
#
echo Install Adempiere Server
# $Header: /cvsroot/adempiere/install/Adempiere/RUN_setup.sh,v 1.19 2005/09/08 21:54:12 jjanke Exp $
if [ $JAVA_HOME ]; then
JAVA=$JAVA_HOME/bin/java
KEYTOOL=$JAVA_HOME/bin/keytool
else
JAVA=java
KEYTOOL=keytool
echo JAVA_HOME is not set.
echo You may not be able to start the Setup
echo Set JAVA_HOME to the directory of your local JDK.
fi
echo ===================================
echo Starting Setup ...
echo ===================================
CP=lib/CInstall.jar:lib/Adempiere.jar:lib/CCTools.jar:lib/oracle.jar:lib/derby.jar:lib/fyracle.jar:lib/jboss.jar:lib/postgresql.jar:
# Trace Level Parameter, e.g. ARGS=ALL
ARGS=CONFIG
$JAVA -classpath $CP -DADEMPIERE_HOME=$ADEMPIERE_HOME org.compiere.install.SilentSetup $ARGS
echo ===================================
echo Make .sh executable & set Env
echo ===================================
chmod -R a+x *.sh
find . -name '*.sh' -exec chmod a+x '{}' \;
. utils/RUN_UnixEnv.sh
echo .
echo For problems, check log file in base directory

View File

@ -161,7 +161,6 @@
<!--unjar src="lib/${ADEMPIERE_DB_TYPE}.jar" dest="buildCLib" /--> <!--unjar src="lib/${ADEMPIERE_DB_TYPE}.jar" dest="buildCLib" /-->
<unjar src="lib/oracle.jar" dest="buildCLib" /> <unjar src="lib/oracle.jar" dest="buildCLib" />
<unjar src="lib/postgresql.jar" dest="buildCLib" /> <unjar src="lib/postgresql.jar" dest="buildCLib" />
<unjar src="lib/db2.jar" dest="buildCLib" />
<!--end vpj-cd e-evolution--> <!--end vpj-cd e-evolution-->
<unjar src="lib/fyracle.jar" dest="buildCLib" /> <unjar src="lib/fyracle.jar" dest="buildCLib" />
@ -207,7 +206,6 @@
<!--unjar src="lib/${ADEMPIERE_DB_TYPE}.jar" dest="buildSLib" /--> <!--unjar src="lib/${ADEMPIERE_DB_TYPE}.jar" dest="buildSLib" /-->
<unjar src="lib/oracle.jar" dest="buildSLib" /> <unjar src="lib/oracle.jar" dest="buildSLib" />
<unjar src="lib/postgresql.jar" dest="buildSLib" /> <unjar src="lib/postgresql.jar" dest="buildSLib" />
<unjar src="lib/db2.jar" dest="buildSLib" />
<!--end vpj-cd e-evolution--> <!--end vpj-cd e-evolution-->
<unjar src="lib/fyracle.jar" dest="buildSLib" /> <unjar src="lib/fyracle.jar" dest="buildSLib" />

View File

@ -34,9 +34,6 @@
<pathelement path="${lib.dir}/oracle.jar"/> <pathelement path="${lib.dir}/oracle.jar"/>
<pathelement path="${lib.dir}/postgresql.jar"/> <pathelement path="${lib.dir}/postgresql.jar"/>
<pathelement path="${lib.dir}/fyracle.jar"/> <pathelement path="${lib.dir}/fyracle.jar"/>
<pathelement path="${lib.dir}/sybase.jar"/>
<pathelement path="${lib.dir}/ibm.jar"/>
<pathelement path="${lib.dir}/db2.jar"/>
<pathelement path="../tools/lib/ant.jar"/> <pathelement path="../tools/lib/ant.jar"/>
<pathelement path="../tools/lib/ant-launcher.jar"/> <pathelement path="../tools/lib/ant-launcher.jar"/>
</path> </path>

View File

@ -1,252 +0,0 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.install;
import java.io.*;
import java.net.*;
import java.sql.*;
import org.compiere.db.*;
import org.compiere.util.*;
import com.ibm.db2.jcc.*;
/**
* DB/2 Configuration Test
*
* @author Jorg Janke
* @version $Id: ConfigDB2.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $
*/
public class ConfigDB2 extends Config
{
/**
* ConfigOracle
* @param data configuration
*/
public ConfigDB2 (ConfigurationData data)
{
super (data);
} // ConfigOracle
/** DB/2 Driver */
private static DB2Driver s_db2Driver = null;
/** Last Connection */
private Connection m_con = null;
/**
* Init
*/
public void init()
{
p_data.setDatabasePort(String.valueOf(DB_DB2.DEFAULT_PORT_0));
p_data.setDatabaseName("adempiere");
p_data.setDatabaseSystemPassword(true);
} // init
/**************************************************************************
* Test
* @return error message or null if OK
*/
public String test()
{
// Database Server
String server = p_data.getDatabaseServer();
boolean pass = server != null && server.length() > 0
&& server.toLowerCase().indexOf("localhost") == -1
&& !server.equals("127.0.0.1");
String error = "Not correct: DB Server = " + server;
InetAddress databaseServer = null;
try
{
if (pass)
databaseServer = InetAddress.getByName(server);
}
catch (Exception e)
{
error += " - " + e.getMessage();
pass = false;
}
signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer",
pass, true, error);
log.info("OK: Database Server = " + databaseServer);
setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName());
setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType());
// Database Port
int databasePort = p_data.getDatabasePort();
pass = p_data.testPort (databaseServer, databasePort, true);
error = "DB Server Port = " + databasePort;
signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort",
pass, true, error);
if (!pass)
return error;
log.info("OK: Database Port = " + databasePort);
setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort));
// JDBC Database Info
String databaseName = p_data.getDatabaseName(); // Service Name
String systemPassword = p_data.getDatabaseSystemPassword();
pass = systemPassword != null && systemPassword.length() > 0;
error = "No Database System Password entered";
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC",
pass, true, error);
if (!pass)
return error;
//
// URL (derived) jdbc:oracle:thin:@//prod1:1521/prod1
String url = "jdbc:db2://" + databaseServer.getHostName()
+ ":" + databasePort
+ "/" + databaseName;
pass = testJDBC(url, "db2admin", systemPassword);
error = "Error connecting: " + url
+ " - as db2admin/" + systemPassword;
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC",
pass, true, error);
if (!pass)
return error;
log.info("OK: Connection = " + url);
setProperty(ConfigurationData.ADEMPIERE_DB_URL, url);
log.info("OK: Database System User " + databaseName);
setProperty(ConfigurationData.ADEMPIERE_DB_NAME, databaseName);
setProperty(ConfigurationData.ADEMPIERE_DB_SYSTEM, systemPassword);
// Database User Info
String databaseUser = p_data.getDatabaseUser(); // UID
String databasePassword = p_data.getDatabasePassword(); // PWD
pass = databasePassword != null && databasePassword.length() > 0;
error = "Invalid Database User Password";
signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, true, error);
if (!pass)
return error;
// Ignore result as it might not be imported
pass = testJDBC(url, databaseUser, databasePassword);
error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword;
signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, false, error);
if (pass)
{
log.info("OK: Database User = " + databaseUser);
if (m_con != null)
setProperty(ConfigurationData.ADEMPIERE_WEBSTORES, getWebStores(m_con));
}
else
log.warning(error);
setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser);
setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword);
if (!p_data.getAppsServerType().equals(ConfigurationData.APPSTYPE_TOMCAT))
{
String cmd = "db2 ";
if (Env.isWindows())
cmd = "db2cmd -c -w -i db2 ";
String sqlcmd1 = cmd + "connect to xx";
String sqlcmd2 = cmd + "-f utils/db2/Test.sql";
log.config(sqlcmd2);
pass = testSQL(sqlcmd2);
error = "Error connecting via: " + sqlcmd2;
signalOK(getPanel().okDatabaseSQL, "ErrorTNS",
pass, true, error);
if (pass)
log.info("OK: Database SQL Connection");
}
m_con = null;
return null;
} // test
/**
* Test JDBC Connection to Server
* @param url connection string
* @param uid user id
* @param pwd password
* @return true if OK
*/
private boolean testJDBC (String url, String uid, String pwd)
{
log.fine("Url=" + url + ", UID=" + uid);
try
{
if (s_db2Driver == null)
{
s_db2Driver = new DB2Driver();
DriverManager.registerDriver(s_db2Driver);
}
m_con = DriverManager.getConnection(url, uid, pwd);
}
catch (Exception e)
{
log.warning(e.toString());
return false;
}
return true;
} // testJDBC
/**
* Test Command Line Connection
* @param sqlcmd sql command line
* @return true if OK
*/
private boolean testSQL (String sqlcmd)
{
if (true)
return true;
//
StringBuffer sbOut = new StringBuffer();
StringBuffer sbErr = new StringBuffer();
int result = -1;
try
{
Process p = Runtime.getRuntime().exec (sqlcmd);
InputStream in = p.getInputStream();
int c;
while ((c = in.read()) != -1)
{
sbOut.append((char)c);
System.out.print((char)c);
}
in.close();
in = p.getErrorStream();
while ((c = in.read()) != -1)
sbErr.append((char)c);
in.close();
// Get result
try
{
Thread.yield();
result = p.exitValue();
}
catch (Exception e) // Timing issue on Solaris.
{
Thread.sleep(200); // .2 sec
result = p.exitValue();
}
}
catch (Exception ex)
{
log.warning(ex.toString());
}
log.finer(sbOut.toString());
if (sbErr.length() > 0)
log.warning(sbErr.toString());
return result == 0;
} // testSQL
} // ConfigDB2

View File

@ -21,13 +21,13 @@ import org.compiere.db.*;
* Firebird Fyracle Configuration * Firebird Fyracle Configuration
* *
* @author Marek Mosiewicz * @author Marek Mosiewicz
* @version $Id: ConfigSybase.java,v 1.4 2005/03/11 20:30:23 jjanke Exp $ * @version $Id: ConfigFyracle.java,v 1.4 2005/03/11 20:30:23 jjanke Exp $
*/ */
public class ConfigFyracle extends Config public class ConfigFyracle extends Config
{ {
/** /**
* ConfigSybase * ConfigFyracle
* @param data * @param data
*/ */
public ConfigFyracle (ConfigurationData data) public ConfigFyracle (ConfigurationData data)
@ -86,8 +86,9 @@ public class ConfigFyracle extends Config
error += " - " + e.getMessage(); error += " - " + e.getMessage();
pass = false; pass = false;
} }
signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer",
pass, true, error);
log.info("OK: Database Server = " + databaseServer); log.info("OK: Database Server = " + databaseServer);
setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName()); setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName());
setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType()); setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType());
@ -95,9 +96,10 @@ public class ConfigFyracle extends Config
// Database Port // Database Port
int databasePort = p_data.getDatabasePort(); int databasePort = p_data.getDatabasePort();
pass = p_data.testPort (databaseServer, databasePort, true); pass = p_data.testPort (databaseServer, databasePort, true);
error = "DB Server Port = " + databasePort; error = "DB Server Port = " + databasePort;
signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: Database Port = " + databasePort); log.info("OK: Database Port = " + databasePort);
@ -113,8 +115,9 @@ public class ConfigFyracle extends Config
pass = testJDBC(urlSystem, p_db.getSystemUser(), systemPassword); pass = testJDBC(urlSystem, p_db.getSystemUser(), systemPassword);
error = "Error connecting: " + urlSystem error = "Error connecting: " + urlSystem
+ " - " + p_db.getSystemUser() + "/" + systemPassword; + " - " + p_db.getSystemUser() + "/" + systemPassword;
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseSystem, "ErrorJDBC",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: System Connection = " + urlSystem); log.info("OK: System Connection = " + urlSystem);
@ -126,8 +129,9 @@ public class ConfigFyracle extends Config
String databasePassword = p_data.getDatabasePassword(); // PWD String databasePassword = p_data.getDatabasePassword(); // PWD
pass = databasePassword != null && databasePassword.length() > 0; pass = databasePassword != null && databasePassword.length() > 0;
error = "No Database User Password entered"; error = "No Database User Password entered";
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
// //
@ -136,8 +140,9 @@ public class ConfigFyracle extends Config
// Ignore result as it might not be imported // Ignore result as it might not be imported
pass = testJDBC(url, databaseUser, databasePassword); pass = testJDBC(url, databaseUser, databasePassword);
error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword; error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword;
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", if (getPanel() != null)
pass, false, error); signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, false, error);
if (pass) if (pass)
log.info("OK: Database User = " + databaseUser); log.info("OK: Database User = " + databaseUser);
else else

View File

@ -90,8 +90,9 @@ public class ConfigJBoss extends Config
error += " - " + e.getMessage(); error += " - " + e.getMessage();
pass = false; pass = false;
} }
signalOK(getPanel().okAppsServer, "ErrorAppsServer", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okAppsServer, "ErrorAppsServer",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: AppsServer = " + appsServer); log.info("OK: AppsServer = " + appsServer);
@ -103,8 +104,9 @@ public class ConfigJBoss extends Config
File deploy = new File (p_data.getAppsServerDeployDir()); File deploy = new File (p_data.getAppsServerDeployDir());
pass = deploy.exists(); pass = deploy.exists();
error = "Not found: " + deploy; error = "Not found: " + deploy;
signalOK(getPanel().okDeployDir, "ErrorDeployDir", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDeployDir, "ErrorDeployDir",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
setProperty(ConfigurationData.ADEMPIERE_APPS_DEPLOY, p_data.getAppsServerDeployDir()); setProperty(ConfigurationData.ADEMPIERE_APPS_DEPLOY, p_data.getAppsServerDeployDir());
@ -115,8 +117,9 @@ public class ConfigJBoss extends Config
pass = !p_data.testPort (appsServer, JNPPort, false) pass = !p_data.testPort (appsServer, JNPPort, false)
&& p_data.testServerPort(JNPPort); && p_data.testServerPort(JNPPort);
error = "Not correct: JNP Port = " + JNPPort; error = "Not correct: JNP Port = " + JNPPort;
signalOK(getPanel().okJNPPort, "ErrorJNPPort", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okJNPPort, "ErrorJNPPort",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: JNPPort = " + JNPPort); log.info("OK: JNPPort = " + JNPPort);
@ -127,8 +130,9 @@ public class ConfigJBoss extends Config
pass = !p_data.testPort ("http", appsServer.getHostName(), WebPort, "/") pass = !p_data.testPort ("http", appsServer.getHostName(), WebPort, "/")
&& p_data.testServerPort(WebPort); && p_data.testServerPort(WebPort);
error = "Not correct: Web Port = " + WebPort; error = "Not correct: Web Port = " + WebPort;
signalOK(getPanel().okWebPort, "ErrorWebPort", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okWebPort, "ErrorWebPort",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: Web Port = " + WebPort); log.info("OK: Web Port = " + WebPort);
@ -139,8 +143,9 @@ public class ConfigJBoss extends Config
pass = !p_data.testPort ("https", appsServer.getHostName(), sslPort, "/") pass = !p_data.testPort ("https", appsServer.getHostName(), sslPort, "/")
&& p_data.testServerPort(sslPort); && p_data.testServerPort(sslPort);
error = "Not correct: SSL Port = " + sslPort; error = "Not correct: SSL Port = " + sslPort;
signalOK(getPanel().okSSLPort, "ErrorWebPort", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okSSLPort, "ErrorWebPort",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: SSL Port = " + sslPort); log.info("OK: SSL Port = " + sslPort);

View File

@ -299,8 +299,9 @@ public class ConfigOracle extends Config
error += " - " + e.getMessage(); error += " - " + e.getMessage();
pass = false; pass = false;
} }
signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer",
pass, true, error);
log.info("OK: Database Server = " + databaseServer); log.info("OK: Database Server = " + databaseServer);
setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName()); setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName());
setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType()); setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType());
@ -309,9 +310,10 @@ public class ConfigOracle extends Config
// Database Port // Database Port
int databasePort = p_data.getDatabasePort(); int databasePort = p_data.getDatabasePort();
pass = p_data.testPort (databaseServer, databasePort, true); pass = p_data.testPort (databaseServer, databasePort, true);
error = "DB Server Port = " + databasePort; error = "DB Server Port = " + databasePort;
signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: Database Port = " + databasePort); log.info("OK: Database Port = " + databasePort);
@ -323,8 +325,9 @@ public class ConfigOracle extends Config
String systemPassword = p_data.getDatabaseSystemPassword(); String systemPassword = p_data.getDatabaseSystemPassword();
pass = systemPassword != null && systemPassword.length() > 0; pass = systemPassword != null && systemPassword.length() > 0;
error = "No Database System Password entered"; error = "No Database System Password entered";
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseSystem, "ErrorJDBC",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
// //
@ -335,8 +338,9 @@ public class ConfigOracle extends Config
pass = testJDBC(url, "system", systemPassword); pass = testJDBC(url, "system", systemPassword);
error = "Error connecting: " + url error = "Error connecting: " + url
+ " - as system/" + systemPassword; + " - as system/" + systemPassword;
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseSystem, "ErrorJDBC",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: Connection = " + url); log.info("OK: Connection = " + url);
@ -351,15 +355,17 @@ public class ConfigOracle extends Config
String databasePassword = p_data.getDatabasePassword(); // PWD String databasePassword = p_data.getDatabasePassword(); // PWD
pass = databasePassword != null && databasePassword.length() > 0; pass = databasePassword != null && databasePassword.length() > 0;
error = "Invalid Database User Password"; error = "Invalid Database User Password";
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
// Ignore result as it might not be imported // Ignore result as it might not be imported
pass = testJDBC(url, databaseUser, databasePassword); pass = testJDBC(url, databaseUser, databasePassword);
error = "Cannot connect to User: " + databaseUser + "/" + databasePassword + " - Database may not be imported yet (OK on initial run)."; error = "Cannot connect to User: " + databaseUser + "/" + databasePassword + " - Database may not be imported yet (OK on initial run).";
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", if (getPanel() != null)
pass, false, error); signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, false, error);
if (pass) if (pass)
{ {
log.info("OK: Database User = " + databaseUser); log.info("OK: Database User = " + databaseUser);
@ -380,8 +386,9 @@ public class ConfigOracle extends Config
log.config(sqlplus); log.config(sqlplus);
pass = testSQL(sqlplus); pass = testSQL(sqlplus);
error = "Error connecting via: " + sqlplus; error = "Error connecting via: " + sqlplus;
signalOK(getPanel().okDatabaseSQL, "ErrorTNS", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseSQL, "ErrorTNS",
pass, true, error);
if (pass) if (pass)
log.info("OK: Database SQL Connection"); log.info("OK: Database SQL Connection");
} }

View File

@ -34,11 +34,11 @@ public class ConfigPostgreSQL extends Config
public ConfigPostgreSQL (ConfigurationData data) public ConfigPostgreSQL (ConfigurationData data)
{ {
super (data); super (data);
} // ConfigSybase } // ConfigPostgreSQL
/** Discoverd TNS */ /** Discoverd TNS */
private String[] p_discovered = null; private String[] p_discovered = null;
/** Sybase DB Info */ /** PostgreSQL DB Info */
private DB_PostgreSQL p_db = new DB_PostgreSQL(); private DB_PostgreSQL p_db = new DB_PostgreSQL();
/** /**
@ -88,8 +88,9 @@ public class ConfigPostgreSQL extends Config
error += " - " + e.getMessage(); error += " - " + e.getMessage();
pass = false; pass = false;
} }
signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer",
pass, true, error);
log.info("OK: Database Server = " + databaseServer); log.info("OK: Database Server = " + databaseServer);
setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName()); setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName());
setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType()); setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType());
@ -98,9 +99,10 @@ public class ConfigPostgreSQL extends Config
// Database Port // Database Port
int databasePort = p_data.getDatabasePort(); int databasePort = p_data.getDatabasePort();
pass = p_data.testPort (databaseServer, databasePort, true); pass = p_data.testPort (databaseServer, databasePort, true);
error = "DB Server Port = " + databasePort; error = "DB Server Port = " + databasePort;
signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: Database Port = " + databasePort); log.info("OK: Database Port = " + databasePort);
@ -111,14 +113,15 @@ public class ConfigPostgreSQL extends Config
String databaseName = p_data.getDatabaseName(); // Service Name String databaseName = p_data.getDatabaseName(); // Service Name
String systemPassword = p_data.getDatabaseSystemPassword(); String systemPassword = p_data.getDatabaseSystemPassword();
// URL (derived) jdbc:sybase:Tds:prod1:5000/prod1 // URL (derived)
String urlSystem = p_db.getConnectionURL(databaseServer.getHostName(), databasePort, String urlSystem = p_db.getConnectionURL(databaseServer.getHostName(), databasePort,
p_db.getSystemDatabase(databaseName), p_db.getSystemUser()); p_db.getSystemDatabase(databaseName), p_db.getSystemUser());
pass = testJDBC(urlSystem, p_db.getSystemUser(), systemPassword); pass = testJDBC(urlSystem, p_db.getSystemUser(), systemPassword);
error = "Error connecting: " + urlSystem error = "Error connecting: " + urlSystem
+ " - " + p_db.getSystemUser() + "/" + systemPassword; + " - " + p_db.getSystemUser() + "/" + systemPassword;
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseSystem, "ErrorJDBC",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: System Connection = " + urlSystem); log.info("OK: System Connection = " + urlSystem);
@ -130,8 +133,9 @@ public class ConfigPostgreSQL extends Config
String databasePassword = p_data.getDatabasePassword(); // PWD String databasePassword = p_data.getDatabasePassword(); // PWD
pass = databasePassword != null && databasePassword.length() > 0; pass = databasePassword != null && databasePassword.length() > 0;
error = "Invalid Database User Password"; error = "Invalid Database User Password";
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
// //
@ -140,8 +144,9 @@ public class ConfigPostgreSQL extends Config
// Ignore result as it might not be imported // Ignore result as it might not be imported
pass = testJDBC(url, databaseUser, databasePassword); pass = testJDBC(url, databaseUser, databasePassword);
error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword; error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword;
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", if (getPanel() != null)
pass, false, error); signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, false, error);
if (pass) if (pass)
log.info("OK: Database User = " + databaseUser); log.info("OK: Database User = " + databaseUser);
else else

View File

@ -101,8 +101,9 @@ public class ConfigTomcat extends Config
error += " - " + e.getMessage(); error += " - " + e.getMessage();
pass = false; pass = false;
} }
signalOK(getPanel().okAppsServer, "ErrorAppsServer", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okAppsServer, "ErrorAppsServer",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: AppsServer = " + appsServer); log.info("OK: AppsServer = " + appsServer);
@ -113,8 +114,9 @@ public class ConfigTomcat extends Config
File deploy = new File (p_data.getAppsServerDeployDir()); File deploy = new File (p_data.getAppsServerDeployDir());
pass = deploy.exists(); pass = deploy.exists();
error = "CATALINA_HOME Not found: " + deploy; error = "CATALINA_HOME Not found: " + deploy;
signalOK(getPanel().okDeployDir, "ErrorDeployDir", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDeployDir, "ErrorDeployDir",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
setProperty(ConfigurationData.ADEMPIERE_APPS_DEPLOY, p_data.getAppsServerDeployDir()); setProperty(ConfigurationData.ADEMPIERE_APPS_DEPLOY, p_data.getAppsServerDeployDir());
@ -128,8 +130,9 @@ public class ConfigTomcat extends Config
File sharedLibDir = new File (sharedLib); File sharedLibDir = new File (sharedLib);
pass = sharedLibDir.exists(); pass = sharedLibDir.exists();
error = "Not found (shared library): " + sharedLib; error = "Not found (shared library): " + sharedLib;
signalOK(getPanel().okDeployDir, "ErrorDeployDir", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDeployDir, "ErrorDeployDir",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
@ -138,8 +141,9 @@ public class ConfigTomcat extends Config
File webAppsDir = new File (webApps); File webAppsDir = new File (webApps);
pass = webAppsDir.exists(); pass = webAppsDir.exists();
error = "Not found (webapps): " + sharedLib; error = "Not found (webapps): " + sharedLib;
signalOK(getPanel().okDeployDir, "ErrorDeployDir", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okDeployDir, "ErrorDeployDir",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
// //

View File

@ -60,8 +60,9 @@ public class ConfigVMMac extends Config
File javaHome = new File (p_data.getJavaHome()); File javaHome = new File (p_data.getJavaHome());
boolean pass = javaHome.exists(); boolean pass = javaHome.exists();
String error = "Not found: Java Home"; String error = "Not found: Java Home";
signalOK(getPanel().okJavaHome, "ErrorJavaHome", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
/** Different VM structure /** Different VM structure
@ -101,8 +102,9 @@ public class ConfigVMMac extends Config
log.info("OK: Version=" + thisJV); log.info("OK: Version=" + thisJV);
} }
error = "Wrong Java Version: Should be " + VERSION2; error = "Wrong Java Version: Should be " + VERSION2;
signalOK(getPanel().okJavaHome, "ErrorJavaHome", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
// //

View File

@ -60,8 +60,9 @@ public class ConfigVMSun extends Config
File javaHome = new File (p_data.getJavaHome()); File javaHome = new File (p_data.getJavaHome());
boolean pass = javaHome.exists(); boolean pass = javaHome.exists();
String error = "Not found: Java Home"; String error = "Not found: Java Home";
signalOK(getPanel().okJavaHome, "ErrorJavaHome", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
// Look for tools.jar to make sure that it is not the JRE // Look for tools.jar to make sure that it is not the JRE
@ -69,8 +70,9 @@ public class ConfigVMSun extends Config
+ File.separator + "lib" + File.separator + "tools.jar"); + File.separator + "lib" + File.separator + "tools.jar");
pass = tools.exists(); pass = tools.exists();
error = "Not found: Java SDK = " + tools; error = "Not found: Java SDK = " + tools;
signalOK(getPanel().okJavaHome, "ErrorJavaHome", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
// //
@ -102,8 +104,9 @@ public class ConfigVMSun extends Config
log.info("OK: Version=" + thisJV); log.info("OK: Version=" + thisJV);
} }
error = "Wrong Java Version: Should be " + VERSION2; error = "Wrong Java Version: Should be " + VERSION2;
signalOK(getPanel().okJavaHome, "ErrorJavaHome", if (getPanel() != null)
pass, true, error); signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
// //

View File

@ -96,6 +96,18 @@ public class ConfigurationData
public static final String ADEMPIERE_KEYSTORECODEALIAS = "ADEMPIERE_KEYSTORECODEALIAS"; public static final String ADEMPIERE_KEYSTORECODEALIAS = "ADEMPIERE_KEYSTORECODEALIAS";
/** */ /** */
public static final String ADEMPIERE_KEYSTOREWEBALIAS = "ADEMPIERE_KEYSTOREWEBALIAS"; public static final String ADEMPIERE_KEYSTOREWEBALIAS = "ADEMPIERE_KEYSTOREWEBALIAS";
public static final String ADEMPIERE_CERT_CN = "ADEMPIERE_CERT_CN";
public static final String ADEMPIERE_CERT_ORG = "ADEMPIERE_CERT_ORG";
public static final String ADEMPIERE_CERT_ORG_UNIT = "ADEMPIERE_CERT_ORG_UNIT";
public static final String ADEMPIERE_CERT_LOCATION = "ADEMPIERE_CERT_LOCATION";
public static final String ADEMPIERE_CERT_STATE = "ADEMPIERE_CERT_STATE";
public static final String ADEMPIERE_CERT_COUNTRY = "ADEMPIERE_CERT_COUNTRY";
/** DB Type */ /** DB Type */
public static final String ADEMPIERE_DB_TYPE = "ADEMPIERE_DB_TYPE"; public static final String ADEMPIERE_DB_TYPE = "ADEMPIERE_DB_TYPE";
@ -142,6 +154,14 @@ public class ConfigurationData
public static final String ADEMPIERE_WEBSTORES = "ADEMPIERE_WEBSTORES"; public static final String ADEMPIERE_WEBSTORES = "ADEMPIERE_WEBSTORES";
private void updateProperty(String property, String value) {
if (value == null) value = "";
String currentValue = (String)p_properties.get(property);
if (currentValue == null)
p_properties.put(property, value);
else if (!currentValue.equals(value))
p_properties.put(property, value);
}
/** /**
* Load Configuration Data * Load Configuration Data
@ -173,26 +193,29 @@ public class ConfigurationData
if (p_properties.size() > 5) if (p_properties.size() > 5)
envLoaded = true; envLoaded = true;
// //
setJavaType((String)p_properties.get(JAVA_TYPE)); int javaIndex = setJavaType((String)p_properties.get(JAVA_TYPE));
initJava(); initJava(javaIndex);
setJavaHome((String)p_properties.get(JAVA_HOME)); setJavaHome((String)p_properties.get(JAVA_HOME));
// //
setAdempiereHome((String)p_properties.get(ADEMPIERE_HOME)); setAdempiereHome((String)p_properties.get(ADEMPIERE_HOME));
String s = (String)p_properties.get(ADEMPIERE_KEYSTOREPASS); String s = (String)p_properties.get(ADEMPIERE_KEYSTOREPASS);
if (s == null || s.length() == 0) if (s == null || s.length() == 0)
{
s = KEYSTORE_PASSWORD; s = KEYSTORE_PASSWORD;
p_properties.put(ADEMPIERE_KEYSTOREPASS, s);
}
setKeyStore(s); setKeyStore(s);
// //
setAppsServerType((String)p_properties.get(ADEMPIERE_APPS_TYPE)); int appServerIndex = setAppsServerType((String)p_properties.get(ADEMPIERE_APPS_TYPE));
initAppsServer(); initAppsServer(appServerIndex);
setAppsServer((String)p_properties.get(ADEMPIERE_APPS_SERVER)); setAppsServer((String)p_properties.get(ADEMPIERE_APPS_SERVER));
setAppsServerDeployDir((String)p_properties.get(ADEMPIERE_APPS_DEPLOY)); setAppsServerDeployDir((String)p_properties.get(ADEMPIERE_APPS_DEPLOY));
setAppsServerJNPPort((String)p_properties.get(ADEMPIERE_JNP_PORT)); setAppsServerJNPPort((String)p_properties.get(ADEMPIERE_JNP_PORT));
setAppsServerWebPort((String)p_properties.get(ADEMPIERE_WEB_PORT)); setAppsServerWebPort((String)p_properties.get(ADEMPIERE_WEB_PORT));
setAppsServerSSLPort((String)p_properties.get(ADEMPIERE_SSL_PORT)); setAppsServerSSLPort((String)p_properties.get(ADEMPIERE_SSL_PORT));
// //
setDatabaseType((String)p_properties.get(ADEMPIERE_DB_TYPE)); int dbTypeIndex = setDatabaseType((String)p_properties.get(ADEMPIERE_DB_TYPE));
initDatabase((String)p_properties.get(ADEMPIERE_DB_NAME)); // fills Database Options initDatabase((String)p_properties.get(ADEMPIERE_DB_NAME), dbTypeIndex); // fills Database Options
setDatabaseDiscovered((String)p_properties.get(ADEMPIERE_DB_NAME)); setDatabaseDiscovered((String)p_properties.get(ADEMPIERE_DB_NAME));
setDatabaseServer((String)p_properties.get(ADEMPIERE_DB_SERVER)); setDatabaseServer((String)p_properties.get(ADEMPIERE_DB_SERVER));
setDatabasePort((String)p_properties.get(ADEMPIERE_DB_PORT)); setDatabasePort((String)p_properties.get(ADEMPIERE_DB_PORT));
@ -202,10 +225,13 @@ public class ConfigurationData
setDatabasePassword((String)p_properties.get(ADEMPIERE_DB_PASSWORD)); setDatabasePassword((String)p_properties.get(ADEMPIERE_DB_PASSWORD));
setDatabaseSystemPassword((String)p_properties.get(ADEMPIERE_DB_SYSTEM)); setDatabaseSystemPassword((String)p_properties.get(ADEMPIERE_DB_SYSTEM));
p_panel.fMailServer.setText((String)p_properties.get(ADEMPIERE_MAIL_SERVER)); if (p_panel != null)
p_panel.fMailUser.setText((String)p_properties.get(ADEMPIERE_MAIL_USER)); {
p_panel.fMailPassword.setText((String)p_properties.get(ADEMPIERE_MAIL_PASSWORD)); p_panel.fMailServer.setText((String)p_properties.get(ADEMPIERE_MAIL_SERVER));
p_panel.fAdminEMail.setText((String)p_properties.get(ADEMPIERE_ADMIN_EMAIL)); p_panel.fMailUser.setText((String)p_properties.get(ADEMPIERE_MAIL_USER));
p_panel.fMailPassword.setText((String)p_properties.get(ADEMPIERE_MAIL_PASSWORD));
p_panel.fAdminEMail.setText((String)p_properties.get(ADEMPIERE_ADMIN_EMAIL));
}
} }
InetAddress localhost = null; InetAddress localhost = null;
@ -243,10 +269,13 @@ public class ConfigurationData
setDatabaseUser("adempiere"); setDatabaseUser("adempiere");
setDatabasePassword("adempiere"); setDatabasePassword("adempiere");
// Mail Server // Mail Server
p_panel.fMailServer.setText(hostName); if (p_panel != null)
p_panel.fMailUser.setText("info"); {
p_panel.fMailPassword.setText(""); p_panel.fMailServer.setText(hostName);
p_panel.fAdminEMail.setText("info@" + hostName); p_panel.fMailUser.setText("info");
p_panel.fMailPassword.setText("");
p_panel.fAdminEMail.setText("info@" + hostName);
}
// //
} // !envLoaded } // !envLoaded
@ -308,7 +337,8 @@ public class ConfigurationData
return false; return false;
} }
p_panel.setStatusBar(p_panel.lAppsServer.getText()); if (p_panel != null)
p_panel.setStatusBar(p_panel.lAppsServer.getText());
error = testAppsServer(); error = testAppsServer();
if (error != null) if (error != null)
{ {
@ -316,7 +346,8 @@ public class ConfigurationData
return false; return false;
} }
p_panel.setStatusBar(p_panel.lDatabaseServer.getText()); if (p_panel != null)
p_panel.setStatusBar(p_panel.lDatabaseServer.getText());
error = testDatabase(); error = testDatabase();
if (error != null) if (error != null)
{ {
@ -324,7 +355,8 @@ public class ConfigurationData
return false; return false;
} }
p_panel.setStatusBar(p_panel.lMailServer.getText()); if (p_panel != null)
p_panel.setStatusBar(p_panel.lMailServer.getText());
error = testMail(); error = testMail();
if (error != null) if (error != null)
{ {
@ -346,8 +378,9 @@ public class ConfigurationData
m_adempiereHome = new File (getAdempiereHome()); m_adempiereHome = new File (getAdempiereHome());
boolean pass =m_adempiereHome.exists(); boolean pass =m_adempiereHome.exists();
String error = "Not found: AdempiereHome = " + m_adempiereHome; String error = "Not found: AdempiereHome = " + m_adempiereHome;
p_panel.signalOK(p_panel.okAdempiereHome, "ErrorAdempiereHome", if (p_panel != null)
pass, true, error); p_panel.signalOK(p_panel.okAdempiereHome, "ErrorAdempiereHome",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: AdempiereHome = " + m_adempiereHome); log.info("OK: AdempiereHome = " + m_adempiereHome);
@ -359,19 +392,33 @@ public class ConfigurationData
p_properties.setProperty(ADEMPIERE_KEYSTORE, fileName); p_properties.setProperty(ADEMPIERE_KEYSTORE, fileName);
// KeyStore Password // KeyStore Password
String pw = new String(p_panel.fKeyStore.getPassword()); String pw = p_panel != null
? new String(p_panel.fKeyStore.getPassword())
: (String)p_properties.get(ADEMPIERE_KEYSTOREPASS);
pass = pw != null && pw.length() > 0; pass = pw != null && pw.length() > 0;
error = "Invalid Key Store Password = " + pw; error = "Invalid Key Store Password = " + pw;
p_panel.signalOK(p_panel.okKeyStore, "KeyStorePassword", if (p_panel != null)
pass, true, error); p_panel.signalOK(p_panel.okKeyStore, "KeyStorePassword",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
p_properties.setProperty(ADEMPIERE_KEYSTOREPASS, pw); p_properties.setProperty(ADEMPIERE_KEYSTOREPASS, pw);
KeyStoreMgt ks = new KeyStoreMgt (fileName, p_panel.fKeyStore.getPassword()); KeyStoreMgt ks = p_panel != null
error = ks.verify((JFrame)SwingUtilities.getWindowAncestor(p_panel)); ? new KeyStoreMgt (fileName, p_panel.fKeyStore.getPassword())
: new KeyStoreMgt (fileName, pw.toCharArray());
ks.setCommonName((String)p_properties.getProperty(ADEMPIERE_CERT_CN));
ks.setOrganization((String)p_properties.getProperty(ADEMPIERE_CERT_ORG));
ks.setOrganizationUnit((String)p_properties.getProperty(ADEMPIERE_CERT_ORG_UNIT));
ks.setLocation((String)p_properties.getProperty(ADEMPIERE_CERT_LOCATION));
ks.setState((String)p_properties.getProperty(ADEMPIERE_CERT_STATE));
ks.setCountry((String)p_properties.getProperty(ADEMPIERE_CERT_COUNTRY));
error = p_panel != null
? ks.verify((JFrame)SwingUtilities.getWindowAncestor(p_panel))
: ks.verify(null);
pass = error == null; pass = error == null;
p_panel.signalOK(p_panel.okKeyStore, "KeyStorePassword", if (p_panel != null)
pass, true, error); p_panel.signalOK(p_panel.okKeyStore, "KeyStorePassword",
pass, true, error);
if (!pass) if (!pass)
return error; return error;
log.info("OK: KeyStore = " + fileName); log.info("OK: KeyStore = " + fileName);
@ -386,7 +433,9 @@ public class ConfigurationData
private String testMail() private String testMail()
{ {
// Mail Server // Mail Server
String server = p_panel.fMailServer.getText(); String server = p_panel != null
? p_panel.fMailServer.getText()
: (String)p_properties.get(ADEMPIERE_MAIL_SERVER);
boolean pass = server != null && server.length() > 0 boolean pass = server != null && server.length() > 0
&& server.toLowerCase().indexOf("localhost") == -1 && server.toLowerCase().indexOf("localhost") == -1
&& !server.equals("127.0.0.1"); && !server.equals("127.0.0.1");
@ -402,8 +451,9 @@ public class ConfigurationData
error += " - " + e.getMessage(); error += " - " + e.getMessage();
pass = false; pass = false;
} }
p_panel.signalOK(p_panel.okMailServer, "ErrorMailServer", if (p_panel != null)
pass, true, error); p_panel.signalOK(p_panel.okMailServer, "ErrorMailServer",
pass, true, error);
if (!pass) if (!pass)
{ {
p_properties.setProperty(ADEMPIERE_MAIL_SERVER, ""); p_properties.setProperty(ADEMPIERE_MAIL_SERVER, "");
@ -412,13 +462,19 @@ public class ConfigurationData
p_properties.setProperty(ADEMPIERE_MAIL_SERVER, mailServer.getHostName()); p_properties.setProperty(ADEMPIERE_MAIL_SERVER, mailServer.getHostName());
// Mail User // Mail User
String mailUser = p_panel.fMailUser.getText(); String mailUser = p_panel != null
String mailPassword = new String(p_panel.fMailPassword.getPassword()); ? p_panel.fMailUser.getText()
: (String)p_properties.get(ADEMPIERE_MAIL_USER);
String mailPassword = p_panel != null
? new String(p_panel.fMailPassword.getPassword())
: (String)p_properties.get(ADEMPIERE_MAIL_PASSWORD);
// m_errorString = "ErrorMailUser"; // m_errorString = "ErrorMailUser";
// log.config("Mail User = " + mailUser + "/" + mailPassword); // log.config("Mail User = " + mailUser + "/" + mailPassword);
// Mail Address // Mail Address
String adminEMailString = p_panel.fAdminEMail.getText(); String adminEMailString = p_panel != null
? p_panel.fAdminEMail.getText()
: (String)p_properties.get(ADEMPIERE_ADMIN_EMAIL);
InternetAddress adminEMail = null; InternetAddress adminEMail = null;
try try
{ {
@ -435,8 +491,9 @@ public class ConfigurationData
error = "Not verified EMail = " + adminEMail; error = "Not verified EMail = " + adminEMail;
pass = testMailServer(mailServer, adminEMail, mailUser, mailPassword); pass = testMailServer(mailServer, adminEMail, mailUser, mailPassword);
} }
p_panel.signalOK(p_panel.okMailUser, "ErrorMail", if (p_panel != null)
pass, false, error); p_panel.signalOK(p_panel.okMailUser, "ErrorMail",
pass, false, error);
if (pass) if (pass)
{ {
log.info("OK: EMail = " + adminEMail); log.info("OK: EMail = " + adminEMail);
@ -492,8 +549,9 @@ public class ConfigurationData
if (!smtpOK) if (!smtpOK)
{ {
String error = "No active Mail Server"; String error = "No active Mail Server";
p_panel.signalOK (p_panel.okMailServer, "ErrorMailServer", if (p_panel != null)
false, false, error); p_panel.signalOK (p_panel.okMailServer, "ErrorMailServer",
false, false, error);
log.warning(error); log.warning(error);
return false; return false;
} }
@ -707,19 +765,25 @@ public class ConfigurationData
catch (Exception e) catch (Exception e)
{ {
log.severe("Cannot save Properties to " + fileName + " - " + e.toString()); log.severe("Cannot save Properties to " + fileName + " - " + e.toString());
JOptionPane.showConfirmDialog(p_panel, if (p_panel != null)
ConfigurationPanel.res.getString("ErrorSave"), JOptionPane.showConfirmDialog(p_panel,
ConfigurationPanel.res.getString("AdempiereServerSetup"), ConfigurationPanel.res.getString("ErrorSave"),
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); ConfigurationPanel.res.getString("AdempiereServerSetup"),
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
else
System.err.println(ConfigurationPanel.res.getString("ErrorSave"));
return false; return false;
} }
catch (Throwable t) catch (Throwable t)
{ {
log.severe("Cannot save Properties to " + fileName + " - " + t.toString()); log.severe("Cannot save Properties to " + fileName + " - " + t.toString());
JOptionPane.showConfirmDialog(p_panel, if (p_panel != null)
ConfigurationPanel.res.getString("ErrorSave"), JOptionPane.showConfirmDialog(p_panel,
ConfigurationPanel.res.getString("AdempiereServerSetup"), ConfigurationPanel.res.getString("ErrorSave"),
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); ConfigurationPanel.res.getString("AdempiereServerSetup"),
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
else
System.err.println(ConfigurationPanel.res.getString("ErrorSave"));
return false; return false;
} }
log.info(fileName); log.info(fileName);
@ -736,11 +800,7 @@ public class ConfigurationData
// Create Connection // Create Connection
String ccType = Database.DB_ORACLE; String ccType = Database.DB_ORACLE;
if (getDatabaseType().equals(DBTYPE_MS)) if (getDatabaseType().equals(DBTYPE_DERBY))
ccType = Database.DB_MSSQLServer;
else if (getDatabaseType().equals(DBTYPE_DB2))
ccType = Database.DB_DB2;
else if (getDatabaseType().equals(DBTYPE_DERBY))
ccType = Database.DB_DERBY; ccType = Database.DB_DERBY;
//begin vpj-cd e-evolution 03/17/2005 PostgreSQL //begin vpj-cd e-evolution 03/17/2005 PostgreSQL
else if (getDatabaseType().equals(DBTYPE_POSTGRESQL)) else if (getDatabaseType().equals(DBTYPE_POSTGRESQL))
@ -755,7 +815,7 @@ public class ConfigurationData
cc = CConnection.get (ccType, cc = CConnection.get (ccType,
getDatabaseServer(), getDatabasePort(), getDatabaseName(), getDatabaseServer(), getDatabasePort(), getDatabaseName(),
getDatabaseUser(), getDatabasePassword()); getDatabaseUser(), getDatabasePassword());
cc.setAppsHost(p_panel.fAppsServer.getText()); cc.setAppsHost(getAppsServer());
cc.setConnectionProfile(CConnection.PROFILE_LAN); cc.setConnectionProfile(CConnection.PROFILE_LAN);
} }
catch(Exception e) catch(Exception e)
@ -789,7 +849,9 @@ public class ConfigurationData
*/ */
public String getAdempiereHome() public String getAdempiereHome()
{ {
return p_panel.fAdempiereHome.getText(); return p_panel != null
? p_panel.fAdempiereHome.getText()
: (String)p_properties.get(ADEMPIERE_HOME);
} // getAdempiereHome } // getAdempiereHome
/** /**
@ -798,7 +860,10 @@ public class ConfigurationData
*/ */
public void setAdempiereHome (String adempiereHome) public void setAdempiereHome (String adempiereHome)
{ {
p_panel.fAdempiereHome.setText(adempiereHome); if (p_panel != null)
p_panel.fAdempiereHome.setText(adempiereHome);
else
updateProperty(ADEMPIERE_HOME, adempiereHome);
} // setAdempiereHome } // setAdempiereHome
/** /**
@ -819,7 +884,10 @@ public class ConfigurationData
*/ */
public void setKeyStore (String password) public void setKeyStore (String password)
{ {
p_panel.fKeyStore.setText(password); if (p_panel != null)
p_panel.fKeyStore.setText(password);
else
updateProperty(ADEMPIERE_KEYSTOREPASS, password);
} // setKeyStore } // setKeyStore
@ -845,17 +913,23 @@ public class ConfigurationData
*/ */
public void initJava() public void initJava()
{ {
int index = p_panel.fJavaType.getSelectedIndex(); int index = (p_panel != null ? p_panel.fJavaType.getSelectedIndex() : 0);
initJava(index);
} // initDatabase
private void initJava(int index)
{
if (index < 0 || index >= JAVATYPE.length) if (index < 0 || index >= JAVATYPE.length)
log.warning("JavaType Index invalid: " + index); log.warning("JavaType Index invalid: " + index);
else if (m_javaConfig[index] == null) else if (m_javaConfig[index] == null)
{ {
log.warning("JavaType Config missing: " + JAVATYPE[index]); log.warning("JavaType Config missing: " + JAVATYPE[index]);
p_panel.fJavaType.setSelectedIndex(0); if (p_panel != null)
p_panel.fJavaType.setSelectedIndex(0);
} }
else else
m_javaConfig[index].init(); m_javaConfig[index].init();
} // initDatabase }
/** /**
* Test Java * Test Java
@ -863,7 +937,9 @@ public class ConfigurationData
*/ */
public String testJava() public String testJava()
{ {
int index = p_panel.fJavaType.getSelectedIndex(); int index = p_panel != null
? p_panel.fJavaType.getSelectedIndex()
: setJavaType((String)p_properties.get(JAVA_TYPE));
if (index < 0 || index >= JAVATYPE.length) if (index < 0 || index >= JAVATYPE.length)
return "JavaType Index invalid: " + index; return "JavaType Index invalid: " + index;
else if (m_javaConfig[index] == null) else if (m_javaConfig[index] == null)
@ -875,7 +951,7 @@ public class ConfigurationData
* Set Java Type * Set Java Type
* @param javaType The javaType to set. * @param javaType The javaType to set.
*/ */
public void setJavaType (String javaType) public int setJavaType (String javaType)
{ {
int index = -1; int index = -1;
for (int i = 0; i < JAVATYPE.length; i++) for (int i = 0; i < JAVATYPE.length; i++)
@ -891,7 +967,12 @@ public class ConfigurationData
index = 0; index = 0;
log.warning("Invalid JavaType=" + javaType); log.warning("Invalid JavaType=" + javaType);
} }
p_panel.fJavaType.setSelectedIndex(index); if (p_panel != null)
p_panel.fJavaType.setSelectedIndex(index);
else
updateProperty(JAVA_TYPE, javaType);
return index;
} // setJavaType } // setJavaType
/** /**
@ -899,7 +980,10 @@ public class ConfigurationData
*/ */
public String getJavaType () public String getJavaType ()
{ {
return (String)p_panel.fJavaType.getSelectedItem(); if( p_panel != null )
return (String)p_panel.fJavaType.getSelectedItem();
else
return (String)p_properties.get(JAVA_TYPE);
} }
/** /**
@ -907,14 +991,20 @@ public class ConfigurationData
*/ */
public String getJavaHome () public String getJavaHome ()
{ {
return p_panel.fJavaHome.getText(); if (p_panel != null)
return p_panel.fJavaHome.getText();
else
return (String)p_properties.get(JAVA_HOME);
} }
/** /**
* @param javaHome The javaHome to set. * @param javaHome The javaHome to set.
*/ */
public void setJavaHome (String javaHome) public void setJavaHome (String javaHome)
{ {
p_panel.fJavaHome.setText(javaHome); if (p_panel != null)
p_panel.fJavaHome.setText(javaHome);
else
updateProperty(JAVA_HOME, javaHome);
} }
/************************************************************************** /**************************************************************************
@ -943,7 +1033,12 @@ public class ConfigurationData
*/ */
public void initAppsServer() public void initAppsServer()
{ {
int index = p_panel.fAppsType.getSelectedIndex(); int index = (p_panel != null ? p_panel.fAppsType.getSelectedIndex() : 0);
initAppsServer(index);
} // initAppsServer
private void initAppsServer(int index)
{
if (index < 0 || index >= APPSTYPE.length) if (index < 0 || index >= APPSTYPE.length)
log.warning("AppsServerType Index invalid: " + index); log.warning("AppsServerType Index invalid: " + index);
else if (m_appsConfig[index] == null) else if (m_appsConfig[index] == null)
@ -953,7 +1048,7 @@ public class ConfigurationData
} }
else else
m_appsConfig[index].init(); m_appsConfig[index].init();
} // initAppsServer }
/** /**
* Test Apps Server * Test Apps Server
@ -961,7 +1056,9 @@ public class ConfigurationData
*/ */
public String testAppsServer() public String testAppsServer()
{ {
int index = p_panel.fAppsType.getSelectedIndex(); int index = p_panel != null
? p_panel.fAppsType.getSelectedIndex()
: setAppsServerType((String)p_properties.get(ADEMPIERE_APPS_TYPE));
if (index < 0 || index >= APPSTYPE.length) if (index < 0 || index >= APPSTYPE.length)
return "AppsServerType Index invalid: " + index; return "AppsServerType Index invalid: " + index;
else if (m_appsConfig[index] == null) else if (m_appsConfig[index] == null)
@ -974,7 +1071,7 @@ public class ConfigurationData
* Set Apps Server Type * Set Apps Server Type
* @param appsType The appsType to set. * @param appsType The appsType to set.
*/ */
public void setAppsServerType (String appsType) public int setAppsServerType (String appsType)
{ {
int index = -1; int index = -1;
for (int i = 0; i < APPSTYPE.length; i++) for (int i = 0; i < APPSTYPE.length; i++)
@ -990,7 +1087,12 @@ public class ConfigurationData
index = 0; index = 0;
log.warning("Invalid AppsType=" + appsType); log.warning("Invalid AppsType=" + appsType);
} }
p_panel.fAppsType.setSelectedIndex(index); if (p_panel != null)
p_panel.fAppsType.setSelectedIndex(index);
else
updateProperty(ADEMPIERE_APPS_TYPE, appsType);
return index;
} // setAppsServerType } // setAppsServerType
/** /**
@ -999,7 +1101,9 @@ public class ConfigurationData
*/ */
public String getAppsServerType () public String getAppsServerType ()
{ {
return (String)p_panel.fAppsType.getSelectedItem(); return p_panel != null
? (String)p_panel.fAppsType.getSelectedItem()
: (String)p_properties.get(ADEMPIERE_APPS_TYPE);
} // setDatabaseType } // setDatabaseType
/** /**
@ -1007,14 +1111,19 @@ public class ConfigurationData
*/ */
public String getAppsServer () public String getAppsServer ()
{ {
return p_panel.fAppsServer.getText(); return p_panel != null
? p_panel.fAppsServer.getText()
: (String)p_properties.get(ADEMPIERE_APPS_SERVER);
} }
/** /**
* @param appsServer The appsServer to set. * @param appsServer The appsServer to set.
*/ */
public void setAppsServer (String appsServer) public void setAppsServer (String appsServer)
{ {
p_panel.fAppsServer.setText(appsServer); if (p_panel != null)
p_panel.fAppsServer.setText(appsServer);
else
updateProperty(ADEMPIERE_APPS_SERVER, appsServer);
} }
/** /**
@ -1022,31 +1131,42 @@ public class ConfigurationData
*/ */
public String getAppsServerDeployDir () public String getAppsServerDeployDir ()
{ {
return p_panel.fDeployDir.getText(); return p_panel != null
? p_panel.fDeployDir.getText()
: (String)p_properties.get(ADEMPIERE_APPS_DEPLOY);
} }
/** /**
* @param appsServerDeployDir The appsServerDeployDir to set. * @param appsServerDeployDir The appsServerDeployDir to set.
*/ */
public void setAppsServerDeployDir (String appsServerDeployDir) public void setAppsServerDeployDir (String appsServerDeployDir)
{ {
p_panel.fDeployDir.setText(appsServerDeployDir); if (p_panel != null)
p_panel.fDeployDir.setText(appsServerDeployDir);
else
updateProperty(ADEMPIERE_APPS_DEPLOY, appsServerDeployDir);
} }
/** /**
* @param enable if true enable entry * @param enable if true enable entry
*/ */
public void setAppsServerDeployDir (boolean enable) public void setAppsServerDeployDir (boolean enable)
{ {
p_panel.fDeployDir.setEnabled(enable); if (p_panel != null)
p_panel.bDeployDir.setEnabled(enable); {
p_panel.fDeployDir.setEnabled(enable);
p_panel.bDeployDir.setEnabled(enable);
}
} }
/** /**
* @return Returns the appsServerJNPPort. * @return Returns the appsServerJNPPort.
*/ */
public int getAppsServerJNPPort () public int getAppsServerJNPPort ()
{ {
String port = p_panel != null
? p_panel.fJNPPort.getText()
: (String)p_properties.get(ADEMPIERE_JNP_PORT);
try try
{ {
return Integer.parseInt(p_panel.fJNPPort.getText()); return Integer.parseInt(port);
} }
catch (Exception e) catch (Exception e)
{ {
@ -1059,23 +1179,31 @@ public class ConfigurationData
*/ */
public void setAppsServerJNPPort (String appsServerJNPPort) public void setAppsServerJNPPort (String appsServerJNPPort)
{ {
p_panel.fJNPPort.setText(appsServerJNPPort); if (p_panel != null)
p_panel.fJNPPort.setText(appsServerJNPPort);
else
updateProperty(ADEMPIERE_JNP_PORT, appsServerJNPPort);
} }
/** /**
* @param enable if enable JNP entry * @param enable if enable JNP entry
*/ */
public void setAppsServerJNPPort (boolean enable) public void setAppsServerJNPPort (boolean enable)
{ {
p_panel.fJNPPort.setEnabled(enable); if (p_panel != null)
p_panel.fJNPPort.setEnabled(enable);
} }
/** /**
* @return Returns the appsServerSSLPort. * @return Returns the appsServerSSLPort.
*/ */
public int getAppsServerSSLPort () public int getAppsServerSSLPort ()
{ {
String port = p_panel != null
? p_panel.fSSLPort.getText()
: (String)p_properties.get(ADEMPIERE_SSL_PORT);
try try
{ {
return Integer.parseInt(p_panel.fSSLPort.getText()); return Integer.parseInt(port);
} }
catch (Exception e) catch (Exception e)
{ {
@ -1088,23 +1216,30 @@ public class ConfigurationData
*/ */
public void setAppsServerSSLPort (String appsServerSSLPort) public void setAppsServerSSLPort (String appsServerSSLPort)
{ {
p_panel.fSSLPort.setText(appsServerSSLPort); if (p_panel != null)
p_panel.fSSLPort.setText(appsServerSSLPort);
else
updateProperty(ADEMPIERE_SSL_PORT, appsServerSSLPort);
} }
/** /**
* @param enable if tre enable SSL entry * @param enable if tre enable SSL entry
*/ */
public void setAppsServerSSLPort (boolean enable) public void setAppsServerSSLPort (boolean enable)
{ {
p_panel.fSSLPort.setEnabled(enable); if (p_panel != null)
p_panel.fSSLPort.setEnabled(enable);
} }
/** /**
* @return Returns the appsServerWebPort. * @return Returns the appsServerWebPort.
*/ */
public int getAppsServerWebPort () public int getAppsServerWebPort ()
{ {
String port = p_panel != null
? p_panel.fWebPort.getText()
: (String)p_properties.get(ADEMPIERE_WEB_PORT);
try try
{ {
return Integer.parseInt(p_panel.fWebPort.getText()); return Integer.parseInt(port);
} }
catch (Exception e) catch (Exception e)
{ {
@ -1117,14 +1252,18 @@ public class ConfigurationData
*/ */
public void setAppsServerWebPort (String appsServerWebPort) public void setAppsServerWebPort (String appsServerWebPort)
{ {
p_panel.fWebPort.setText(appsServerWebPort); if (p_panel != null)
p_panel.fWebPort.setText(appsServerWebPort);
else
updateProperty(ADEMPIERE_WEB_PORT, appsServerWebPort);
} }
/** /**
* @param enable if tre enable Web entry * @param enable if tre enable Web entry
*/ */
public void setAppsServerWebPort (boolean enable) public void setAppsServerWebPort (boolean enable)
{ {
p_panel.fWebPort.setEnabled(enable); if (p_panel != null)
p_panel.fWebPort.setEnabled(enable);
} }
@ -1138,10 +1277,6 @@ public class ConfigurationData
private static String DBTYPE_ORACLE = "oracle"; private static String DBTYPE_ORACLE = "oracle";
/** Oracle XP */ /** Oracle XP */
private static String DBTYPE_ORACLEXE = "oracleXE"; private static String DBTYPE_ORACLEXE = "oracleXE";
/** DB/2 */
private static String DBTYPE_DB2 = "<db2>";
/** MS SQL Server */
private static String DBTYPE_MS = "<sqlServer>";
// begin e-evolution vpj-cd 02/07/2005 PostgreSQL // begin e-evolution vpj-cd 02/07/2005 PostgreSQL
/** PostgreSQL */ /** PostgreSQL */
@ -1155,8 +1290,6 @@ public class ConfigurationData
static String[] DBTYPE = new String[] static String[] DBTYPE = new String[]
{DBTYPE_ORACLEXE, {DBTYPE_ORACLEXE,
DBTYPE_ORACLE, DBTYPE_ORACLE,
//DBTYPE_DB2,
//DBTYPE_MS,
DBTYPE_FYRACLE, DBTYPE_FYRACLE,
//begin e-evolution vpj-cd 02/07/2005 PostgreSQL //begin e-evolution vpj-cd 02/07/2005 PostgreSQL
DBTYPE_POSTGRESQL DBTYPE_POSTGRESQL
@ -1169,7 +1302,6 @@ public class ConfigurationData
{ {
new ConfigOracle(this,true), new ConfigOracle(this,true),
new ConfigOracle(this,false), new ConfigOracle(this,false),
//new ConfigDB2(this),
//begin e-evolution vpj-cd 02/07/2005 PostgreSQL //begin e-evolution vpj-cd 02/07/2005 PostgreSQL
//null //null
//null, //null,
@ -1185,25 +1317,34 @@ public class ConfigurationData
*/ */
public void initDatabase(String selected) public void initDatabase(String selected)
{ {
int index = p_panel.fDatabaseType.getSelectedIndex(); int index = (p_panel != null ? p_panel.fDatabaseType.getSelectedIndex() : 0);
initDatabase(selected, index);
} // initDatabase
private void initDatabase(String selected, int index)
{
if (index < 0 || index >= DBTYPE.length) if (index < 0 || index >= DBTYPE.length)
log.warning("DatabaseType Index invalid: " + index); log.warning("DatabaseType Index invalid: " + index);
else if (m_databaseConfig[index] == null) else if (m_databaseConfig[index] == null)
{ {
log.warning("DatabaseType Config missing: " + DBTYPE[index]); log.warning("DatabaseType Config missing: " + DBTYPE[index]);
p_panel.fDatabaseType.setSelectedIndex(0); if (p_panel != null)
p_panel.fDatabaseType.setSelectedIndex(0);
} }
else else
{ {
m_databaseConfig[index].init(); m_databaseConfig[index].init();
String[] databases = m_databaseConfig[index].discoverDatabases(selected); if (p_panel != null)
DefaultComboBoxModel model = new DefaultComboBoxModel(databases); {
p_panel.fDatabaseDiscovered.setModel(model); String[] databases = m_databaseConfig[index].discoverDatabases(selected);
p_panel.fDatabaseDiscovered.setEnabled(databases.length != 0); DefaultComboBoxModel model = new DefaultComboBoxModel(databases);
if (databases.length > 0) p_panel.fDatabaseDiscovered.setModel(model);
p_panel.fDatabaseName.setText(databases[0]); p_panel.fDatabaseDiscovered.setEnabled(databases.length != 0);
if (databases.length > 0)
p_panel.fDatabaseName.setText(databases[0]);
}
} }
} // initDatabase }
/** /**
* Test Database * Test Database
@ -1211,7 +1352,9 @@ public class ConfigurationData
*/ */
public String testDatabase() public String testDatabase()
{ {
int index = p_panel.fDatabaseType.getSelectedIndex(); int index = p_panel != null
? p_panel.fDatabaseType.getSelectedIndex()
: setDatabaseType((String)p_properties.get(ADEMPIERE_DB_TYPE));
if (index < 0 || index >= DBTYPE.length) if (index < 0 || index >= DBTYPE.length)
return "DatabaseType Index invalid: " + index; return "DatabaseType Index invalid: " + index;
else if (m_databaseConfig[index] == null) else if (m_databaseConfig[index] == null)
@ -1224,7 +1367,7 @@ public class ConfigurationData
* Set Database Type * Set Database Type
* @param databaseType The databaseType to set. * @param databaseType The databaseType to set.
*/ */
public void setDatabaseType (String databaseType) public int setDatabaseType (String databaseType)
{ {
int index = -1; int index = -1;
for (int i = 0; i < DBTYPE.length; i++) for (int i = 0; i < DBTYPE.length; i++)
@ -1240,7 +1383,12 @@ public class ConfigurationData
index = 0; index = 0;
log.warning("Invalid DatabaseType=" + databaseType); log.warning("Invalid DatabaseType=" + databaseType);
} }
p_panel.fDatabaseType.setSelectedIndex(index); if (p_panel != null)
p_panel.fDatabaseType.setSelectedIndex(index);
else
updateProperty(ADEMPIERE_DB_TYPE, databaseType);
return index;
} // setDatabaseType } // setDatabaseType
/** /**
@ -1248,7 +1396,9 @@ public class ConfigurationData
*/ */
public String getDatabaseType () public String getDatabaseType ()
{ {
return (String)p_panel.fDatabaseType.getSelectedItem(); return p_panel != null
? (String)p_panel.fDatabaseType.getSelectedItem()
: (String)p_properties.get(ADEMPIERE_DB_TYPE);
} }
/** /**
* @return Returns the database Discovered. * @return Returns the database Discovered.
@ -1262,7 +1412,8 @@ public class ConfigurationData
*/ */
public void setDatabaseDiscovered (String databaseDiscovered) public void setDatabaseDiscovered (String databaseDiscovered)
{ {
p_panel.fDatabaseDiscovered.setSelectedItem(databaseDiscovered); if (p_panel != null)
p_panel.fDatabaseDiscovered.setSelectedItem(databaseDiscovered);
} }
/** /**
@ -1270,14 +1421,19 @@ public class ConfigurationData
*/ */
public String getDatabaseName () public String getDatabaseName ()
{ {
return p_panel.fDatabaseName.getText(); return p_panel != null
? p_panel.fDatabaseName.getText()
: (String)p_properties.get(ADEMPIERE_DB_NAME);
} }
/** /**
* @param databaseName The databaseName to set. * @param databaseName The databaseName to set.
*/ */
public void setDatabaseName (String databaseName) public void setDatabaseName (String databaseName)
{ {
p_panel.fDatabaseName.setText(databaseName); if (p_panel != null)
p_panel.fDatabaseName.setText(databaseName);
else
updateProperty(ADEMPIERE_DB_NAME, databaseName);
} }
/** /**
@ -1285,26 +1441,40 @@ public class ConfigurationData
*/ */
public String getDatabasePassword () public String getDatabasePassword ()
{ {
char[] pw = p_panel.fDatabasePassword.getPassword(); if (p_panel != null)
if (pw != null) {
return new String(pw); char[] pw = p_panel.fDatabasePassword.getPassword();
return ""; if (pw != null)
return new String(pw);
return "";
}
else
{
String pw = (String)p_properties.get(ADEMPIERE_DB_PASSWORD);
return (pw != null ? pw : "");
}
} }
/** /**
* @param databasePassword The databasePassword to set. * @param databasePassword The databasePassword to set.
*/ */
public void setDatabasePassword (String databasePassword) public void setDatabasePassword (String databasePassword)
{ {
p_panel.fDatabasePassword.setText(databasePassword); if (p_panel != null)
p_panel.fDatabasePassword.setText(databasePassword);
else
updateProperty(ADEMPIERE_DB_PASSWORD, databasePassword);
} }
/** /**
* @return Returns the databasePort. * @return Returns the databasePort.
*/ */
public int getDatabasePort () public int getDatabasePort ()
{ {
String port = p_panel != null
? p_panel.fDatabasePort.getText()
: (String)p_properties.get(ADEMPIERE_DB_PORT);
try try
{ {
return Integer.parseInt(p_panel.fDatabasePort.getText()); return Integer.parseInt(port);
} }
catch (Exception e) catch (Exception e)
{ {
@ -1317,59 +1487,84 @@ public class ConfigurationData
*/ */
public void setDatabasePort (String databasePort) public void setDatabasePort (String databasePort)
{ {
p_panel.fDatabasePort.setText(databasePort); if (p_panel != null)
p_panel.fDatabasePort.setText(databasePort);
else
updateProperty(ADEMPIERE_DB_PORT, databasePort);
} }
/** /**
* @return Returns the databaseServer. * @return Returns the databaseServer.
*/ */
public String getDatabaseServer () public String getDatabaseServer ()
{ {
return p_panel.fDatabaseServer.getText(); return p_panel != null
? p_panel.fDatabaseServer.getText()
: (String)p_properties.get(ADEMPIERE_DB_SERVER);
} }
/** /**
* @param databaseServer The databaseServer to set. * @param databaseServer The databaseServer to set.
*/ */
public void setDatabaseServer (String databaseServer) public void setDatabaseServer (String databaseServer)
{ {
p_panel.fDatabaseServer.setText(databaseServer); if (p_panel != null)
p_panel.fDatabaseServer.setText(databaseServer);
else
updateProperty(ADEMPIERE_DB_SERVER, databaseServer);
} }
/** /**
* @return Returns the databaseSystemPassword. * @return Returns the databaseSystemPassword.
*/ */
public String getDatabaseSystemPassword () public String getDatabaseSystemPassword ()
{ {
char[] pw = p_panel.fSystemPassword.getPassword(); if (p_panel != null)
if (pw != null) {
return new String(pw); char[] pw = p_panel.fSystemPassword.getPassword();
return ""; if (pw != null)
return new String(pw);
return "";
}
else
{
String pw = (String)p_properties.get(ADEMPIERE_DB_SYSTEM);
return (pw != null ? pw : "");
}
} }
/** /**
* @param databaseSystemPassword The databaseSystemPassword to set. * @param databaseSystemPassword The databaseSystemPassword to set.
*/ */
public void setDatabaseSystemPassword (String databaseSystemPassword) public void setDatabaseSystemPassword (String databaseSystemPassword)
{ {
p_panel.fSystemPassword.setText(databaseSystemPassword); if (p_panel != null)
p_panel.fSystemPassword.setText(databaseSystemPassword);
else
updateProperty(ADEMPIERE_DB_SYSTEM, databaseSystemPassword);
} }
/** /**
* @param enable enable Database System Password * @param enable enable Database System Password
*/ */
public void setDatabaseSystemPassword (boolean enable) public void setDatabaseSystemPassword (boolean enable)
{ {
p_panel.fSystemPassword.setEnabled(enable); if (p_panel != null)
p_panel.fSystemPassword.setEnabled(enable);
} }
/** /**
* @return Returns the databaseUser. * @return Returns the databaseUser.
*/ */
public String getDatabaseUser () public String getDatabaseUser ()
{ {
return p_panel.fDatabaseUser.getText(); return p_panel != null
? p_panel.fDatabaseUser.getText()
: (String)p_properties.get(ADEMPIERE_DB_USER);
} }
/** /**
* @param databaseUser The databaseUser to set. * @param databaseUser The databaseUser to set.
*/ */
public void setDatabaseUser (String databaseUser) public void setDatabaseUser (String databaseUser)
{ {
p_panel.fDatabaseUser.setText(databaseUser); if (p_panel != null)
p_panel.fDatabaseUser.setText(databaseUser);
else
updateProperty(ADEMPIERE_DB_USER, databaseUser);
} }
} // ConfigurationData } // ConfigurationData

View File

@ -55,6 +55,12 @@ public class KeyStoreMgt
private char[] m_password = null; private char[] m_password = null;
/** KeyStore */ /** KeyStore */
private KeyStore m_keyStore = null; private KeyStore m_keyStore = null;
private String organizationUnit;
private String location;
private String state;
private String country;
private String commonName;
private String organization;
/** Directory below ADEMPIERE_HOME */ /** Directory below ADEMPIERE_HOME */
@ -210,7 +216,7 @@ public class KeyStoreMgt
log.log(Level.SEVERE, "directory", e); log.log(Level.SEVERE, "directory", e);
} }
String dname = getDname(parent); String dname = getDname(this, parent);
if (dname == null) if (dname == null)
return; return;
// //
@ -225,27 +231,71 @@ public class KeyStoreMgt
} }
} // createCertificate } // createCertificate
public void setCommonName(String cn)
{
commonName = cn;
}
public void setOrganization(String o)
{
organization = o;
}
public void setOrganizationUnit(String o)
{
organizationUnit = o;
}
public void setLocation(String l)
{
location = l;
}
public void setState(String s)
{
state = s;
}
public void setCountry(String c)
{
country = c;
}
/** /**
* Get Distinguised Name * Get Distinguised Name
* @param parent interactive dialog * @param parent interactive dialog
* @return dname or null * @return dname or null
*/ */
public static String getDname(JFrame parent) public static String getDname(KeyStoreMgt mgt, JFrame parent)
{ {
String cn = null; String cn = mgt.commonName;
try if (cn == null)
{ {
InetAddress address = InetAddress.getLocalHost(); try
cn = address.getCanonicalHostName(); {
InetAddress address = InetAddress.getLocalHost();
cn = address.getCanonicalHostName();
}
catch (Exception e)
{
}
} }
catch (Exception e)
{ String ou = mgt.organization != null
} ? mgt.organization
String ou = System.getProperty("user.name"); : System.getProperty("user.name");
String o = "AdempiereUser"; String o = mgt.organizationUnit != null
String l = "MyTown"; ? mgt.organizationUnit
String s = ""; : "AdempiereUser";
String c = System.getProperty("user.country"); String l = mgt.location != null
? mgt.location
: "MyTown";
String s = mgt.state != null
? mgt.state
: "";
String c = mgt.country != null
? mgt.country
: System.getProperty("user.country");
// //
if (parent != null) if (parent != null)
{ {
@ -260,6 +310,7 @@ public class KeyStoreMgt
s = skd.getS(); s = skd.getS();
c = skd.getC(); c = skd.getC();
} }
// //
if (cn == null || cn.length() == 0) if (cn == null || cn.length() == 0)
{ {

View File

@ -0,0 +1,73 @@
package org.compiere.install;
import java.io.File;
import java.util.logging.Handler;
import java.util.logging.Level;
import org.apache.tools.ant.Main;
import org.compiere.util.CLogFile;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.Ini;
public class SilentSetup {
public SilentSetup()
{
//Load C:\Adempiere\AdempiereEnv.properties
String adempiereHome = System.getProperty(ConfigurationData.ADEMPIERE_HOME);
if (adempiereHome == null || adempiereHome.length() == 0)
adempiereHome = System.getProperty("user.dir");
boolean envLoaded = false;
String fileName = adempiereHome + File.separator + ConfigurationData.ADEMPIERE_ENV_FILE;
File env = new File(fileName);
if (!env.exists())
{
System.err.println("Usage: Please edit AdempiereEnvTemplate.properties and save as AdempiereEnv.properties");
return;
}
Ini.setShowLicenseDialog(false);
ConfigurationData data = new ConfigurationData(null);
if (!data.load()) return;
if (!data.test()) return;
if (!data.save()) return;
/** Run Ant **/
try
{
CLogger.get().info("Starting Ant ... ");
System.setProperty("ant.home", ".");
String[] args = new String[] {"setup"};
// Launcher.main (args); // calls System.exit
Main antMain = new Main();
antMain.startAnt(args, null, null);
}
catch (Exception e)
{
CLogger.get().log(Level.SEVERE, "ant", e);
}
}
/**
* Start
* @param args Log Level e.g. ALL, FINE
*/
public static void main(String[] args)
{
CLogMgt.initialize(true);
Handler fileHandler = new CLogFile(System.getProperty("user.dir"), false, false);
CLogMgt.addHandler(fileHandler);
// Log Level
if (args.length > 0)
CLogMgt.setLevel(args[0]);
else
CLogMgt.setLevel(Level.INFO);
// File Loger at least FINE
if (fileHandler.getLevel().intValue() > Level.FINE.intValue())
fileHandler.setLevel(Level.FINE);
new SilentSetup();
} // main
}