* 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-launcher.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="output" path="build"/>
</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/oracle.jar" dest="buildCLib" />
<unjar src="lib/postgresql.jar" dest="buildCLib" />
<unjar src="lib/db2.jar" dest="buildCLib" />
<!--end vpj-cd e-evolution-->
<unjar src="lib/fyracle.jar" dest="buildCLib" />
@ -207,7 +206,6 @@
<!--unjar src="lib/${ADEMPIERE_DB_TYPE}.jar" dest="buildSLib" /-->
<unjar src="lib/oracle.jar" dest="buildSLib" />
<unjar src="lib/postgresql.jar" dest="buildSLib" />
<unjar src="lib/db2.jar" dest="buildSLib" />
<!--end vpj-cd e-evolution-->
<unjar src="lib/fyracle.jar" dest="buildSLib" />

View File

@ -34,9 +34,6 @@
<pathelement path="${lib.dir}/oracle.jar"/>
<pathelement path="${lib.dir}/postgresql.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-launcher.jar"/>
</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
*
* @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
{
/**
* ConfigSybase
* ConfigFyracle
* @param data
*/
public ConfigFyracle (ConfigurationData data)
@ -86,6 +86,7 @@ public class ConfigFyracle extends Config
error += " - " + e.getMessage();
pass = false;
}
if (getPanel() != null)
signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer",
pass, true, error);
log.info("OK: Database Server = " + databaseServer);
@ -96,6 +97,7 @@ public class ConfigFyracle extends Config
int databasePort = p_data.getDatabasePort();
pass = p_data.testPort (databaseServer, databasePort, true);
error = "DB Server Port = " + databasePort;
if (getPanel() != null)
signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort",
pass, true, error);
if (!pass)
@ -113,6 +115,7 @@ public class ConfigFyracle extends Config
pass = testJDBC(urlSystem, p_db.getSystemUser(), systemPassword);
error = "Error connecting: " + urlSystem
+ " - " + p_db.getSystemUser() + "/" + systemPassword;
if (getPanel() != null)
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC",
pass, true, error);
if (!pass)
@ -126,6 +129,7 @@ public class ConfigFyracle extends Config
String databasePassword = p_data.getDatabasePassword(); // PWD
pass = databasePassword != null && databasePassword.length() > 0;
error = "No Database User Password entered";
if (getPanel() != null)
signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, true, error);
if (!pass)
@ -136,6 +140,7 @@ public class ConfigFyracle extends Config
// Ignore result as it might not be imported
pass = testJDBC(url, databaseUser, databasePassword);
error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword;
if (getPanel() != null)
signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, false, error);
if (pass)

View File

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

View File

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

View File

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

View File

@ -101,6 +101,7 @@ public class ConfigTomcat extends Config
error += " - " + e.getMessage();
pass = false;
}
if (getPanel() != null)
signalOK(getPanel().okAppsServer, "ErrorAppsServer",
pass, true, error);
if (!pass)
@ -113,6 +114,7 @@ public class ConfigTomcat extends Config
File deploy = new File (p_data.getAppsServerDeployDir());
pass = deploy.exists();
error = "CATALINA_HOME Not found: " + deploy;
if (getPanel() != null)
signalOK(getPanel().okDeployDir, "ErrorDeployDir",
pass, true, error);
if (!pass)
@ -128,6 +130,7 @@ public class ConfigTomcat extends Config
File sharedLibDir = new File (sharedLib);
pass = sharedLibDir.exists();
error = "Not found (shared library): " + sharedLib;
if (getPanel() != null)
signalOK(getPanel().okDeployDir, "ErrorDeployDir",
pass, true, error);
if (!pass)
@ -138,6 +141,7 @@ public class ConfigTomcat extends Config
File webAppsDir = new File (webApps);
pass = webAppsDir.exists();
error = "Not found (webapps): " + sharedLib;
if (getPanel() != null)
signalOK(getPanel().okDeployDir, "ErrorDeployDir",
pass, true, error);
if (!pass)

View File

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

View File

@ -60,6 +60,7 @@ public class ConfigVMSun extends Config
File javaHome = new File (p_data.getJavaHome());
boolean pass = javaHome.exists();
String error = "Not found: Java Home";
if (getPanel() != null)
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass)
@ -69,6 +70,7 @@ public class ConfigVMSun extends Config
+ File.separator + "lib" + File.separator + "tools.jar");
pass = tools.exists();
error = "Not found: Java SDK = " + tools;
if (getPanel() != null)
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass)
@ -102,6 +104,7 @@ public class ConfigVMSun extends Config
log.info("OK: Version=" + thisJV);
}
error = "Wrong Java Version: Should be " + VERSION2;
if (getPanel() != null)
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass)

View File

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

View File

@ -55,6 +55,12 @@ public class KeyStoreMgt
private char[] m_password = null;
/** KeyStore */
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 */
@ -210,7 +216,7 @@ public class KeyStoreMgt
log.log(Level.SEVERE, "directory", e);
}
String dname = getDname(parent);
String dname = getDname(this, parent);
if (dname == null)
return;
//
@ -225,14 +231,46 @@ public class KeyStoreMgt
}
} // 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
* @param parent interactive dialog
* @return dname or null
*/
public static String getDname(JFrame parent)
public static String getDname(KeyStoreMgt mgt, JFrame parent)
{
String cn = mgt.commonName;
if (cn == null)
{
String cn = null;
try
{
InetAddress address = InetAddress.getLocalHost();
@ -241,11 +279,23 @@ public class KeyStoreMgt
catch (Exception e)
{
}
String ou = System.getProperty("user.name");
String o = "AdempiereUser";
String l = "MyTown";
String s = "";
String c = System.getProperty("user.country");
}
String ou = mgt.organization != null
? mgt.organization
: System.getProperty("user.name");
String o = mgt.organizationUnit != null
? mgt.organizationUnit
: "AdempiereUser";
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)
{
@ -260,6 +310,7 @@ public class KeyStoreMgt
s = skd.getS();
c = skd.getC();
}
//
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
}