Implemented db configuration as extension. Remove JVM type checking.

This commit is contained in:
Heng Sin Low 2010-11-29 01:59:28 +08:00
parent 92ea2ef0bb
commit af5cd44af8
25 changed files with 685 additions and 658 deletions

View File

@ -5,7 +5,8 @@ Bundle-SymbolicName: org.adempiere.install;singleton:=true
Bundle-Version: 1.0.0.qualifier Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: install.jar, Bundle-ClassPath: install.jar,
ant-contrib-1.0b3.jar ant-contrib-1.0b3.jar
Export-Package: org.compiere.install Export-Package: org.adempiere.install,
org.compiere.install
Require-Bundle: org.adempiere.base;bundle-version="1.0.0" Require-Bundle: org.adempiere.base;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: javax.mail;version="1.4.0", Import-Package: javax.mail;version="1.4.0",

View File

@ -0,0 +1,41 @@
<!-- ====================================================== -->
<!-- Setup Tomcat For Development Environment -->
<!-- ====================================================== -->
<project name="setup" default="setup" basedir=".">
<description>
This buildfile is used to setup the Adempiere Environment.
</description>
<property environment="env" />
<property name="envFile" value="../AdempiereEnv.properties" />
<!-- ==================================================== -->
<!-- Init -->
<!-- ==================================================== -->
<target name="setupTomcat"
description="setup tomcat">
<echo message="Setup Tomcat ===================" />
<echo message="ADEMPIERE_HOME = ${env.ADEMPIERE_HOME}" />
<!-- create the time stamp and environment -->
<tstamp />
<available file="${envFile}" property="envFileExists" />
<fail message="**** RUN_setup was not successful - please re-run ****" unless="envFileExists" />
<property file="${envFile}"/>
<filter filtersfile="${envFile}" />
<copy file="../org.adempiere.tomcat.config/META-INF/tomcat/serverTemplate.xml"
tofile="../org.adempiere.tomcat.config/META-INF/tomcat/server.xml" filtering="yes" overwrite="yes"/>
</target>
<!-- ==================================================== -->
<!-- Setup (Main) -->
<!-- ==================================================== -->
<target name="setup" depends="setupTomcat"
description="Setup Adempiere">
</target>
</project>

View File

@ -10,17 +10,17 @@
<booleanAttribute key="clearConfig" value="false"/> <booleanAttribute key="clearConfig" value="false"/>
<booleanAttribute key="clearws" value="false"/> <booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/> <booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/New_configuration"/> <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/install.app"/>
<booleanAttribute key="default" value="false"/> <booleanAttribute key="default" value="false"/>
<booleanAttribute key="includeOptional" value="false"/> <booleanAttribute key="includeOptional" value="false"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-install.app"/> <stringAttribute key="location" value="${workspace_loc}/../runtime-install.app"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -noExit"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -arch ${target.arch} -nl ${target.nl} -consoleLog -noExit"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
<stringAttribute key="pde.version" value="3.3"/> <stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.adempiere.server.server_product"/> <stringAttribute key="product" value="org.adempiere.server.server_product"/>
<stringAttribute key="selected_target_plugins" value="com.springsource.javax.mail@default:default,com.springsource.org.apache.activemq@default:default,org.eclipse.equinox.common@2:true,org.eclipse.core.jobs@default:default,org.eclipse.osgi@-1:true,com.springsource.org.apache.poi@default:default,com.springsource.org.junit@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.runtime@default:true,com.springsource.javax.jms@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.javax.ejb@default:default,org.restlet@default:default,org.apache.ant@default:default,com.springsource.org.apache.commons.collections@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.commons.net@default:default,org.eclipse.equinox.registry@default:default,com.springsource.javax.servlet@default:default,com.springsource.javax.activation@default:default,org.eclipse.equinox.app@default:default,com.springsource.org.apache.kahadb@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.javax.management.j2ee@default:default"/> <stringAttribute key="selected_target_plugins" value="org.restlet@default:default,org.eclipse.core.contenttype@default:default,com.springsource.javax.servlet@default:default,com.springsource.javax.mail@default:default,com.springsource.org.junit@default:default,com.springsource.org.apache.poi@default:default,com.springsource.javax.activation@default:default,com.springsource.javax.xml.rpc@default:default,org.eclipse.equinox.registry@default:default,com.springsource.org.apache.activemq@default:default,org.eclipse.core.runtime@default:true,com.springsource.org.apache.commons.logging@default:default,org.eclipse.core.jobs@default:default,com.springsource.org.apache.kahadb@default:default,com.springsource.javax.ejb@default:default,org.eclipse.osgi@-1:true,org.eclipse.equinox.preferences@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.apache.commons.net@default:default,org.eclipse.equinox.app@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.org.apache.commons.collections@default:default,com.springsource.javax.jms@default:default,org.eclipse.equinox.common@2:true,com.springsource.javax.xml.soap@default:default,org.apache.ant@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:true,org.apache.ecs@default:default"/> <stringAttribute key="selected_workspace_plugins" value="org.apache.ecs@default:default,org.compiere.db.postgresql.provider@default:default,org.compiere.db.oracle.provider@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:true,org.adempiere.base@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/> <booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/> <stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="false"/> <booleanAttribute key="tracing" value="false"/>

View File

@ -14,13 +14,13 @@
<booleanAttribute key="default" value="false"/> <booleanAttribute key="default" value="false"/>
<booleanAttribute key="includeOptional" value="false"/> <booleanAttribute key="includeOptional" value="false"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-install.console.app"/> <stringAttribute key="location" value="${workspace_loc}/../runtime-install.console.app"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
<stringAttribute key="pde.version" value="3.3"/> <stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.adempiere.server.server_product"/> <stringAttribute key="product" value="org.adempiere.server.server_product"/>
<stringAttribute key="selected_target_plugins" value="com.springsource.org.apache.commons.collections@default:default,com.springsource.org.apache.poi@default:default,com.springsource.org.apache.commons.logging@default:default,org.eclipse.equinox.app@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.javax.activation@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.mail@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.osgi@-1:true,com.springsource.javax.management.j2ee@default:default,org.restlet@default:default,org.eclipse.equinox.common@2:true,com.springsource.org.apache.activemq@default:default,org.apache.ant@default:default,com.springsource.org.apache.kahadb@default:default,org.eclipse.equinox.registry@default:default,com.springsource.javax.ejb@default:default,org.eclipse.core.runtime@default:true,com.springsource.javax.servlet@default:default,com.springsource.org.junit@default:default,com.springsource.javax.jms@default:default,com.springsource.net.sf.cglib@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.contenttype@default:default,com.springsource.org.apache.commons.net@default:default"/> <stringAttribute key="selected_target_plugins" value="org.restlet@default:default,com.springsource.javax.servlet@default:default,org.eclipse.equinox.common@2:true,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.jms@default:default,com.springsource.org.junit@default:default,com.springsource.org.apache.commons.collections@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.ejb@default:default,com.springsource.org.apache.commons.net@default:default,org.eclipse.equinox.registry@default:default,com.springsource.javax.mail@default:default,org.apache.ant@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.javax.activation@default:default,org.eclipse.osgi@-1:true,org.eclipse.equinox.preferences@default:default,org.eclipse.core.contenttype@default:default,com.springsource.org.apache.activemq@default:default,org.eclipse.equinox.app@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.jobs@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.org.apache.kahadb@default:default,com.springsource.org.apache.poi@default:default,com.springsource.org.apache.commons.logging@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base@default:default,org.compiere.db.postgresql.provider@default:default,org.adempiere.extend@default:false,org.compiere.db.oracle.provider@default:default,org.apache.ecs@default:default,org.adempiere.install@default:true"/> <stringAttribute key="selected_workspace_plugins" value="org.apache.ecs@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:true,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default,org.adempiere.base@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/> <booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/> <stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="false"/> <booleanAttribute key="tracing" value="false"/>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?> <?eclipse version="3.4"?>
<plugin> <plugin>
<extension-point id="org.adempiere.install.IDatabaseConfig" name="Database configuration extension" schema="schema/org.adempiere.install.IDatabaseConfig.exsd"/>
<extension <extension
id="org.adempiere.install.application" id="org.adempiere.install.application"
point="org.eclipse.core.runtime.applications"> point="org.eclipse.core.runtime.applications">

View File

@ -0,0 +1,109 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.adempiere.install" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.adempiere.install" id="org.adempiere.install.IDatabaseConfig" name="Database configuration extension"/>
</appinfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="database"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="database">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
PostgreSQL or Oracle
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.adempiere.install.IDatabaseConfig"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,122 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2010 Heng Sin Low *
* 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. *
*****************************************************************************/
package org.adempiere.install;
/**
*
* @author hengsin
*
*/
public class DBConfigStatus {
public final static String DATABASE_SERVER = "DATABASE_SERVER";
public final static String DATABASE_SYSTEM_PASSWORD = "DATABASE_SYSTEM_PASSWORD";
public final static String DATABASE_USER = "DATABASE_USER";
public final static String DATABASE_SQL_TEST = "DATABASE_SQL_TEST";
private String statusType;
private String resourseString;
private boolean pass;
private boolean critical;
private String errorMessage;
/**
* @param statusType
* @param resourseString
* @param pass
* @param critical
* @param errorMessage
*/
public DBConfigStatus(String statusType, String resourseString, boolean pass,
boolean critical, String errorMessage) {
super();
this.statusType = statusType;
this.resourseString = resourseString;
this.pass = pass;
this.critical = critical;
this.errorMessage = errorMessage;
}
/**
* @return the statusType
*/
public String getStatusType() {
return statusType;
}
/**
* @param statusType the statusType to set
*/
public void setStatusType(String statusType) {
this.statusType = statusType;
}
/**
* @return the resourseString
*/
public String getResourseString() {
return resourseString;
}
/**
* @param resourseString the resourseString to set
*/
public void setResourseString(String resourseString) {
this.resourseString = resourseString;
}
/**
* @return the pass
*/
public boolean isPass() {
return pass;
}
/**
* @param pass the pass to set
*/
public void setPass(boolean pass) {
this.pass = pass;
}
/**
* @return the critical
*/
public boolean isCritical() {
return critical;
}
/**
* @param critical the critical to set
*/
public void setCritical(boolean critical) {
this.critical = critical;
}
/**
* @return the errorMessage
*/
public String getErrorMessage() {
return errorMessage;
}
/**
* @param errorMessage the errorMessage to set
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
}

View File

@ -0,0 +1,28 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2010 Heng Sin Low *
* 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. *
*****************************************************************************/
package org.adempiere.install;
/**
*
* @author hengsin
*
*/
public interface IDBConfigMonitor {
/**
*
* @param status
*/
public void update(DBConfigStatus status);
}

View File

@ -0,0 +1,54 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2010 Heng Sin Low *
* 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. *
*****************************************************************************/
package org.adempiere.install;
import org.compiere.install.ConfigurationData;
/**
*
* @author hengsin
*
*/
public interface IDatabaseConfig {
/**
* Get real database name from native connection profile name
* return from discoverDatabases
* @param nativeConnectioName
* @return Database name
*/
public String getDatabaseName(String nativeConnectioName);
/**
* Init Configuration Data
* @param configurationData
*/
public void init(ConfigurationData configurationData);
/**
* Discover Databases.
* To be overwritten by database configs
* @param selected selected database
* @return array of databases
*/
public String[] discoverDatabases(String selected);
/**************************************************************************
* Test
* @param monitor
* @param data
* @return error message or null if OK
*/
public String test(IDBConfigMonitor monitor, ConfigurationData data);
}

View File

@ -16,19 +16,13 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.install; package org.compiere.install;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB;
/** /**
* Configuration Setup and Test * Configuration Setup and Test
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: Config.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $ * @version $Id: Config.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $
*/ */
@ -48,13 +42,13 @@ public abstract class Config
protected ConfigurationData p_data = null; protected ConfigurationData p_data = null;
/** Logger */ /** Logger */
static CLogger log = CLogger.getCLogger (Config.class); static CLogger log = CLogger.getCLogger (Config.class);
/** /**
* Initialize * Initialize
*/ */
abstract void init(); abstract void init();
/** /**
* Test * Test
* @return error message or null of OK * @return error message or null of OK
@ -71,18 +65,7 @@ public abstract class Config
{ {
return new String[]{}; return new String[]{};
} // discoverDatabases } // discoverDatabases
/**
* Get real database name from native connection profile name
* return from discoverDatabases
* @param nativeConnectioName
* @return Database name
*/
public String getDatabaseName(String nativeConnectioName)
{
return nativeConnectioName;
}
/** /**
* Get Panel * Get Panel
* @return panel * @return panel
@ -91,7 +74,7 @@ public abstract class Config
{ {
return p_data.p_panel; return p_data.p_panel;
} // getPanel } // getPanel
/** /**
* Set Configuration Property * Set Configuration Property
* @param key key * @param key key
@ -99,7 +82,7 @@ public abstract class Config
*/ */
protected void setProperty(String key, String value) protected void setProperty(String key, String value)
{ {
p_data.p_properties.setProperty(key, value); p_data.setProperty(key, value);
} // setProperty } // setProperty
/** /**
@ -111,7 +94,7 @@ public abstract class Config
{ {
return p_data.p_properties.getProperty(key, ""); return p_data.p_properties.getProperty(key, "");
} // getProperty } // getProperty
/** /**
* UI Signal OK * UI Signal OK
* @param cb ckeck box * @param cb ckeck box
@ -120,45 +103,10 @@ public abstract class Config
* @param critical true if critical * @param critical true if critical
* @param errorMsg error Message * @param errorMsg error Message
*/ */
void signalOK (JCheckBox cb, String resString, protected void signalOK (JCheckBox cb, String resString,
boolean pass, boolean critical, String errorMsg) boolean pass, boolean critical, String errorMsg)
{ {
p_data.p_panel.signalOK(cb, resString, pass, critical, errorMsg); p_data.p_panel.signalOK(cb, resString, pass, critical, errorMsg);
} // signalOK } // signalOK
/**
* Get Web Store Context Names separated by ,
* @param con connection
* @return String of Web Store Names - e.g. /wstore
*/
protected String getWebStores(Connection con)
{
String sql = "SELECT WebContext FROM W_Store WHERE IsActive='Y'";
Statement stmt = null;
ResultSet rs = null;
StringBuffer result = new StringBuffer();
try
{
stmt = con.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next ())
{
if (result.length() > 0)
result.append(",");
result.append(rs.getString(1));
}
}
catch (Exception e)
{
log.severe(e.toString());
}
finally
{
DB.close(rs, stmt);
rs = null;
stmt = null;
}
return result.toString();
} // getWebStores
} // Config } // Config

View File

@ -22,21 +22,21 @@ import org.compiere.util.CLogMgt;
/** /**
* Open JDK JVM Configuration * Java VM Configuration
* *
* @author Jorg Janke * @author Jorg Janke
* @author Trifon Trifonov
*/ */
public class ConfigVMOpenJDK extends Config public class ConfigVM extends Config
{ {
/** /**
* ConfigVM
* @param data configuration * @param data configuration
*/ */
public ConfigVMOpenJDK (ConfigurationData data) public ConfigVM (ConfigurationData data)
{ {
super (data); super (data);
} } // ConfigVMSun
/** /**
* Init * Init
*/ */
@ -48,8 +48,8 @@ public class ConfigVMOpenJDK extends Config
if (javaHome.endsWith("jre")) if (javaHome.endsWith("jre"))
javaHome = javaHome.substring(0, javaHome.length()-4); javaHome = javaHome.substring(0, javaHome.length()-4);
p_data.setJavaHome(javaHome); p_data.setJavaHome(javaHome);
} } // init
/** /**
* Test * Test
* @return error message or null of OK * @return error message or null of OK
@ -65,52 +65,33 @@ public class ConfigVMOpenJDK extends Config
pass, true, error); pass, true, error);
if (!pass) if (!pass)
return error; return error;
/** Different VM structure //
File tools = new File (p_data.getJavaHome()
+ File.separator + "lib" + File.separator + "tools.jar");
pass = tools.exists();
error = "Not found: Java SDK = " + tools;
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass)
return error;
**/
if (CLogMgt.isLevelFinest()) if (CLogMgt.isLevelFinest())
CLogMgt.printProperties(System.getProperties(), "System", true); CLogMgt.printProperties(System.getProperties(), "System", true);
// //
log.info("OK: JavaHome=" + javaHome.getAbsolutePath()); log.info("OK: JavaHome=" + javaHome.getAbsolutePath());
setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath()); setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());
System.setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath()); System.setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());
// Java Version // Java Version
final String VERSION = "1.5.0"; final String VERSION = "1.6.0";
final String VERSION2 = "1.6.0"; final String VERSION2 = "1.7.0"; // The real one
pass = false; pass = false;
String jh = javaHome.getAbsolutePath(); String thisJV = System.getProperty("java.version");
if (jh.indexOf(VERSION) != -1) // file name has version = assuming OK pass = thisJV.indexOf(VERSION) != -1;
if (!pass && thisJV.indexOf(VERSION2) != -1)
pass = true; pass = true;
if (!pass && jh.indexOf(VERSION2) != -1) // if (pass)
pass = true; log.info("OK: Version=" + thisJV);
String thisJH = System.getProperty("java.home");
if (thisJH.indexOf(jh) != -1) // we are running the version currently error = "Wrong Java Version: Should be " + VERSION + " and above.";
{
String thisJV = System.getProperty("java.version");
pass = thisJV.indexOf(VERSION) != -1;
if (!pass && thisJV.indexOf(VERSION2) != -1)
pass = true;
if (pass)
log.info("OK: Version=" + thisJV);
}
error = "Wrong Java Version: Should be " + VERSION2;
if (getPanel() != null) if (getPanel() != null)
signalOK(getPanel().okJavaHome, "ErrorJavaHome", signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error); pass, true, error);
if (!pass) if (!pass)
return error; return error;
//
setProperty(ConfigurationData.JAVA_TYPE, p_data.getJavaType());
return null; return null;
} } // test
} }

View File

@ -1,117 +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.File;
import org.compiere.util.CLogMgt;
/**
* Apple Mac Java VM Configuration
*
* @author Jorg Janke
* @version $Id: ConfigVMMac.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $
*/
public class ConfigVMMac extends Config
{
/**
* ConfigVMMac
* @param data configuration
*/
public ConfigVMMac (ConfigurationData data)
{
super (data);
} // ConfigVMMac
/**
* Init
*/
public void init()
{
// Java Home, e.g. D:\j2sdk1.4.1\jre
String javaHome = System.getProperty("java.home");
log.fine(javaHome);
if (javaHome.endsWith("jre"))
javaHome = javaHome.substring(0, javaHome.length()-4);
p_data.setJavaHome(javaHome);
} // init
/**
* Test
* @return error message or null of OK
*/
public String test()
{
// Java Home
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)
return error;
/** Different VM structure
File tools = new File (p_data.getJavaHome()
+ File.separator + "lib" + File.separator + "tools.jar");
pass = tools.exists();
error = "Not found: Java SDK = " + tools;
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass)
return error;
**/
if (CLogMgt.isLevelFinest())
CLogMgt.printProperties(System.getProperties(), "System", true);
//
log.info("OK: JavaHome=" + javaHome.getAbsolutePath());
setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());
System.setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());
// Java Version
final String VERSION = "1.5.0";
final String VERSION2 = "1.6.0";
pass = false;
String jh = javaHome.getAbsolutePath();
if (jh.indexOf(VERSION) != -1) // file name has version = assuming OK
pass = true;
if (!pass && jh.indexOf(VERSION2) != -1) //
pass = true;
String thisJH = System.getProperty("java.home");
if (thisJH.indexOf(jh) != -1) // we are running the version currently
{
String thisJV = System.getProperty("java.version");
pass = thisJV.indexOf(VERSION) != -1;
if (!pass && thisJV.indexOf(VERSION2) != -1)
pass = true;
if (pass)
log.info("OK: Version=" + thisJV);
}
error = "Wrong Java Version: Should be " + VERSION2;
if (getPanel() != null)
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass)
return error;
//
setProperty(ConfigurationData.JAVA_TYPE, p_data.getJavaType());
return null;
} // test
}

View File

@ -1,118 +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.File;
import org.compiere.util.CLogMgt;
/**
* Sun Java VM Configuration
*
* @author Jorg Janke
* @version $Id: ConfigVMSun.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $
*/
public class ConfigVMSun extends Config
{
/**
* ConfigVMSun
* @param data configuration
*/
public ConfigVMSun (ConfigurationData data)
{
super (data);
} // ConfigVMSun
/**
* Init
*/
public void init()
{
// Java Home, e.g. D:\j2sdk1.4.1\jre
String javaHome = System.getProperty("java.home");
log.fine(javaHome);
if (javaHome.endsWith("jre"))
javaHome = javaHome.substring(0, javaHome.length()-4);
p_data.setJavaHome(javaHome);
} // init
/**
* Test
* @return error message or null of OK
*/
public String test()
{
// Java Home
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)
return error;
// Look for tools.jar to make sure that it is not the JRE
File tools = new File (p_data.getJavaHome()
+ 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)
return error;
//
if (CLogMgt.isLevelFinest())
CLogMgt.printProperties(System.getProperties(), "System", true);
//
log.info("OK: JavaHome=" + javaHome.getAbsolutePath());
setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());
System.setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());
// Java Version
final String VERSION = "1.5.0";
final String VERSION2 = "1.6.0"; // The real one
pass = false;
String jh = javaHome.getAbsolutePath();
if (jh.indexOf(VERSION) != -1) // file name has version = assuming OK
pass = true;
if (!pass && jh.indexOf(VERSION2) != -1) //
pass = true;
String thisJH = System.getProperty("java.home");
if (thisJH.indexOf(jh) != -1) // we are running the version currently
{
String thisJV = System.getProperty("java.version");
pass = thisJV.indexOf(VERSION) != -1;
if (!pass && thisJV.indexOf(VERSION2) != -1)
pass = true;
if (pass)
log.info("OK: Version=" + thisJV);
}
error = "Wrong Java Version: Should be " + VERSION2;
if (getPanel() != null)
signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error);
if (!pass)
return error;
//
setProperty(ConfigurationData.JAVA_TYPE, p_data.getJavaType());
return null;
} // test
}

View File

@ -26,6 +26,10 @@ import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
@ -40,11 +44,15 @@ import javax.swing.JFrame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import org.adempiere.base.Service;
import org.adempiere.install.IDBConfigMonitor;
import org.adempiere.install.IDatabaseConfig;
import org.compiere.Adempiere; import org.compiere.Adempiere;
import org.compiere.db.CConnection; import org.compiere.db.CConnection;
import org.compiere.db.Database; import org.compiere.db.Database;
import org.compiere.util.CLogMgt; import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.EMail; import org.compiere.util.EMail;
import org.compiere.util.EMailAuthenticator; import org.compiere.util.EMailAuthenticator;
import org.compiere.util.Ini; import org.compiere.util.Ini;
@ -66,8 +74,19 @@ public class ConfigurationData
{ {
super (); super ();
p_panel = panel; p_panel = panel;
initDatabaseConfig();
} // ConfigurationData } // ConfigurationData
private void initDatabaseConfig()
{
List<IDatabaseConfig> configList = Service.list(IDatabaseConfig.class);
m_databaseConfig = new IDatabaseConfig[configList.size()];
for(int i = 0; i < configList.size(); i++)
{
m_databaseConfig[i] = configList.get(i);
}
}
/** UI Panel */ /** UI Panel */
protected ConfigurationPanel p_panel = null; protected ConfigurationPanel p_panel = null;
/** Environment Properties */ /** Environment Properties */
@ -88,8 +107,6 @@ public class ConfigurationData
/** */ /** */
public static final String JAVA_HOME = "JAVA_HOME"; public static final String JAVA_HOME = "JAVA_HOME";
/** */ /** */
public static final String JAVA_TYPE = "ADEMPIERE_JAVA_TYPE";
/** */
public static final String ADEMPIERE_JAVA_OPTIONS = "ADEMPIERE_JAVA_OPTIONS"; public static final String ADEMPIERE_JAVA_OPTIONS = "ADEMPIERE_JAVA_OPTIONS";
/** Default Keysore Password */ /** Default Keysore Password */
public static final String KEYSTORE_PASSWORD = "myPassword"; public static final String KEYSTORE_PASSWORD = "myPassword";
@ -183,7 +200,7 @@ public class ConfigurationData
else if (!currentValue.equals(value)) else if (!currentValue.equals(value))
p_properties.put(property, value); p_properties.put(property, value);
} }
public String getProperty(String property) public String getProperty(String property)
{ {
return p_properties.getProperty(property); return p_properties.getProperty(property);
@ -222,8 +239,7 @@ public class ConfigurationData
Properties loaded = new Properties(); Properties loaded = new Properties();
loaded.putAll(p_properties); loaded.putAll(p_properties);
// //
int javaIndex = setJavaType((String)p_properties.get(JAVA_TYPE)); initJava();
initJava(javaIndex);
if (loaded.containsKey(JAVA_HOME)) if (loaded.containsKey(JAVA_HOME))
setJavaHome((String)loaded.get(JAVA_HOME)); setJavaHome((String)loaded.get(JAVA_HOME));
// //
@ -356,7 +372,7 @@ public class ConfigurationData
* test * test
* @return true if test ok * @return true if test ok
*/ */
public boolean test() public boolean test(IDBConfigMonitor monitor)
{ {
String error = testJava(); String error = testJava();
if (error != null) if (error != null)
@ -383,7 +399,7 @@ public class ConfigurationData
if (p_panel != null) if (p_panel != null)
p_panel.setStatusBar(p_panel.lDatabaseServer.getText()); p_panel.setStatusBar(p_panel.lDatabaseServer.getText());
error = testDatabase(); error = testDatabase(monitor);
if (error != null) if (error != null)
{ {
log.warning(error); log.warning(error);
@ -680,7 +696,7 @@ public class ConfigurationData
* @param file file name * @param file file name
* @return true if able to connect * @return true if able to connect
*/ */
protected boolean testPort (String protocol, String server, int port, String file) public boolean testPort (String protocol, String server, int port, String file)
{ {
System.out.println("testPort[" + protocol + "," + server + ", " + port + ", " + file +"]"); System.out.println("testPort[" + protocol + "," + server + ", " + port + ", " + file +"]");
URL url = null; URL url = null;
@ -742,7 +758,7 @@ public class ConfigurationData
* @param shouldBeUsed true if it should be used * @param shouldBeUsed true if it should be used
* @return true if some server answered on port * @return true if some server answered on port
*/ */
protected boolean testPort (InetAddress host, int port, boolean shouldBeUsed) public boolean testPort (InetAddress host, int port, boolean shouldBeUsed)
{ {
System.out.println("testPort[" + host.getHostAddress() + ", " + port + "]"); System.out.println("testPort[" + host.getHostAddress() + ", " + port + "]");
Socket pingSocket = null; Socket pingSocket = null;
@ -944,8 +960,7 @@ public class ConfigurationData
{JAVATYPE_SUN, JAVATYPE_OPENJDK, JAVATYPE_MAC}; {JAVATYPE_SUN, JAVATYPE_OPENJDK, JAVATYPE_MAC};
/** Virtual machine Configurations */ /** Virtual machine Configurations */
private Config[] m_javaConfig = new Config[] private Config m_javaConfig = new ConfigVM(this);
{new ConfigVMSun(this), new ConfigVMOpenJDK(this), new ConfigVMMac(this)};
private ConfigAppServer m_appsConfig = new ConfigAppServer(this); private ConfigAppServer m_appsConfig = new ConfigAppServer(this);
/** /**
@ -953,79 +968,18 @@ public class ConfigurationData
*/ */
public void initJava() public void initJava()
{ {
int index = (p_panel != null ? p_panel.fJavaType.getSelectedIndex() : 0); m_javaConfig.init();
initJava(index);
} // initDatabase } // initDatabase
public 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();
}
/** /**
* Test Java * Test Java
* @return error message or null of OK * @return error message or null of OK
*/ */
public String testJava() public String testJava()
{ {
int index = p_panel != null return m_javaConfig.test();
? 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)
return "JavaType Config class missing: " + index;
return m_javaConfig[index].test();
} // testJava } // testJava
/**
* Set Java Type
* @param javaType The javaType to set.
*/
public int setJavaType (String javaType)
{
int index = -1;
for (int i = 0; i < JAVATYPE.length; i++)
{
if (JAVATYPE[i].equals(javaType))
{
index = i;
break;
}
}
if (index == -1)
{
index = 0;
log.warning("Invalid JavaType=" + javaType);
}
if (p_panel != null)
p_panel.fJavaType.setSelectedIndex(index);
else
updateProperty(JAVA_TYPE, javaType);
return index;
} // setJavaType
/**
* @return Returns the javaType.
*/
public String getJavaType ()
{
if( p_panel != null )
return (String)p_panel.fJavaType.getSelectedItem();
else
return (String)p_properties.get(JAVA_TYPE);
}
/** /**
* @return Returns the javaHome. * @return Returns the javaHome.
*/ */
@ -1177,13 +1131,7 @@ public class ConfigurationData
//end e-evolution vpj-cd 02/07/2005 PostgreSQL //end e-evolution vpj-cd 02/07/2005 PostgreSQL
/** Database Configs */ /** Database Configs */
private Config[] m_databaseConfig = new Config[] private IDatabaseConfig[] m_databaseConfig = null;
{
new ConfigOracle(this,true),
//begin e-evolution vpj-cd 02/07/2005 PostgreSQL
new ConfigPostgreSQL(this)
// end e-evolution vpj-cd 02/07/2005 PostgreSQL
};
/** /**
* Init Database * Init Database
@ -1220,7 +1168,7 @@ public class ConfigurationData
} }
else else
{ {
m_databaseConfig[index].init(); m_databaseConfig[index].init(this);
if (p_panel != null) if (p_panel != null)
{ {
@ -1236,9 +1184,10 @@ public class ConfigurationData
/** /**
* Test Database * Test Database
* @param monitor
* @return error message or null of OK * @return error message or null of OK
*/ */
public String testDatabase() public String testDatabase(IDBConfigMonitor monitor)
{ {
int index = p_panel != null int index = p_panel != null
? p_panel.fDatabaseType.getSelectedIndex() ? p_panel.fDatabaseType.getSelectedIndex()
@ -1247,7 +1196,7 @@ public class ConfigurationData
return "DatabaseType Index invalid: " + index; return "DatabaseType Index invalid: " + index;
else if (m_databaseConfig[index] == null) else if (m_databaseConfig[index] == null)
return "DatabaseType Config class missing: " + index; return "DatabaseType Config class missing: " + index;
return m_databaseConfig[index].test(); return m_databaseConfig[index].test(monitor, this);
} // testDatabase } // testDatabase
@ -1354,7 +1303,7 @@ public class ConfigurationData
else else
updateProperty(ADEMPIERE_DB_PASSWORD, databasePassword); updateProperty(ADEMPIERE_DB_PASSWORD, databasePassword);
} }
/** /**
* @return Returns the databasePort. * @return Returns the databasePort.
*/ */
@ -1457,7 +1406,7 @@ public class ConfigurationData
else else
updateProperty(ADEMPIERE_DB_USER, databaseUser); updateProperty(ADEMPIERE_DB_USER, databaseUser);
} }
/** /**
* @return Returns the mail Server. * @return Returns the mail Server.
*/ */
@ -1467,7 +1416,7 @@ public class ConfigurationData
? p_panel.fMailServer.getText() ? p_panel.fMailServer.getText()
: (String)p_properties.get(ADEMPIERE_MAIL_SERVER); : (String)p_properties.get(ADEMPIERE_MAIL_SERVER);
} }
public void setMailServer(String mailServer) public void setMailServer(String mailServer)
{ {
if (p_panel != null) if (p_panel != null)
@ -1475,7 +1424,7 @@ public class ConfigurationData
else else
updateProperty(ADEMPIERE_MAIL_SERVER, mailServer); updateProperty(ADEMPIERE_MAIL_SERVER, mailServer);
} }
/** /**
* @return Returns the mailUser. * @return Returns the mailUser.
*/ */
@ -1495,7 +1444,7 @@ public class ConfigurationData
else else
updateProperty(ADEMPIERE_MAIL_USER, mailUser); updateProperty(ADEMPIERE_MAIL_USER, mailUser);
} }
/** /**
* @return Returns the mail User Password. * @return Returns the mail User Password.
*/ */
@ -1524,7 +1473,7 @@ public class ConfigurationData
else else
updateProperty(ADEMPIERE_MAIL_PASSWORD, mailPassword); updateProperty(ADEMPIERE_MAIL_PASSWORD, mailPassword);
} }
/** /**
* @return Returns the admin email * @return Returns the admin email
*/ */
@ -1544,4 +1493,49 @@ public class ConfigurationData
else else
updateProperty(ADEMPIERE_ADMIN_EMAIL, adminEMail); updateProperty(ADEMPIERE_ADMIN_EMAIL, adminEMail);
} }
/**
* Get Web Store Context Names separated by ,
* @param con connection
* @return String of Web Store Names - e.g. /wstore
*/
public String getWebStores(Connection con)
{
String sql = "SELECT WebContext FROM W_Store WHERE IsActive='Y'";
Statement stmt = null;
ResultSet rs = null;
StringBuffer result = new StringBuffer();
try
{
stmt = con.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next ())
{
if (result.length() > 0)
result.append(",");
result.append(rs.getString(1));
}
}
catch (Exception e)
{
log.severe(e.toString());
}
finally
{
DB.close(rs, stmt);
rs = null;
stmt = null;
}
return result.toString();
} // getWebStores
/**
* Set Configuration Property
* @param key key
* @param value value
*/
public void setProperty(String key, String value)
{
p_properties.setProperty(key, value);
} // setProperty
} // ConfigurationData } // ConfigurationData

View File

@ -42,7 +42,8 @@ import javax.swing.JTextField;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import org.adempiere.base.Core; import org.adempiere.install.DBConfigStatus;
import org.adempiere.install.IDBConfigMonitor;
import org.apache.tools.ant.Main; import org.apache.tools.ant.Main;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
@ -52,7 +53,7 @@ import org.compiere.util.CLogger;
* @author Jorg Janke * @author Jorg Janke
* @version $Id: ConfigurationPanel.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $ * @version $Id: ConfigurationPanel.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $
*/ */
public class ConfigurationPanel extends JPanel implements ActionListener public class ConfigurationPanel extends JPanel implements ActionListener, IDBConfigMonitor
{ {
/** /**
* *
@ -106,8 +107,6 @@ public class ConfigurationPanel extends JPanel implements ActionListener
JTextField fJavaHome = new JTextField(FIELDLENGTH); JTextField fJavaHome = new JTextField(FIELDLENGTH);
JCheckBox okJavaHome = new JCheckBox(); JCheckBox okJavaHome = new JCheckBox();
private JButton bJavaHome = new JButton(iOpen); private JButton bJavaHome = new JButton(iOpen);
private JLabel lJavaType = new JLabel();
JComboBox fJavaType = new JComboBox(ConfigurationData.JAVATYPE);
// Adempiere - KeyStore // Adempiere - KeyStore
private JLabel lAdempiereHome = new JLabel(); private JLabel lAdempiereHome = new JLabel();
JTextField fAdempiereHome = new JTextField(FIELDLENGTH); JTextField fAdempiereHome = new JTextField(FIELDLENGTH);
@ -145,10 +144,10 @@ public class ConfigurationPanel extends JPanel implements ActionListener
JTextField fDatabaseUser = new JTextField(FIELDLENGTH); JTextField fDatabaseUser = new JTextField(FIELDLENGTH);
private JLabel lDatabasePassword = new JLabel(); private JLabel lDatabasePassword = new JLabel();
JPasswordField fDatabasePassword = new JPasswordField(); JPasswordField fDatabasePassword = new JPasswordField();
JCheckBox okDatabaseServer = new JCheckBox(); public JCheckBox okDatabaseServer = new JCheckBox();
JCheckBox okDatabaseUser = new JCheckBox(); public JCheckBox okDatabaseUser = new JCheckBox();
JCheckBox okDatabaseSystem = new JCheckBox(); public JCheckBox okDatabaseSystem = new JCheckBox();
JCheckBox okDatabaseSQL = new JCheckBox(); public JCheckBox okDatabaseSQL = new JCheckBox();
// //
JLabel lMailServer = new JLabel(); JLabel lMailServer = new JLabel();
JTextField fMailServer = new JTextField(FIELDLENGTH); JTextField fMailServer = new JTextField(FIELDLENGTH);
@ -183,9 +182,6 @@ public class ConfigurationPanel extends JPanel implements ActionListener
okJavaHome.setEnabled(false); okJavaHome.setEnabled(false);
bJavaHome.setMargin(bInsets); bJavaHome.setMargin(bInsets);
bJavaHome.setToolTipText(res.getString("JavaHomeInfo")); bJavaHome.setToolTipText(res.getString("JavaHomeInfo"));
lJavaType.setToolTipText(res.getString("JavaTypeInfo"));
lJavaType.setText(res.getString("JavaType"));
fJavaType.setPreferredSize(fJavaHome.getPreferredSize());
JLabel sectionLabel = new JLabel("Java"); JLabel sectionLabel = new JLabel("Java");
sectionLabel.setForeground(titledBorder.getTitleColor()); sectionLabel.setForeground(titledBorder.getTitleColor());
@ -203,10 +199,6 @@ public class ConfigurationPanel extends JPanel implements ActionListener
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
this.add(bJavaHome, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0 this.add(bJavaHome, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
this.add(lJavaType, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
this.add(fJavaType, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 0), 0, 0));
// AdempiereHome - KeyStore // AdempiereHome - KeyStore
lAdempiereHome.setToolTipText(res.getString("AdempiereHomeInfo")); lAdempiereHome.setToolTipText(res.getString("AdempiereHomeInfo"));
lAdempiereHome.setText(res.getString("AdempiereHome")); lAdempiereHome.setText(res.getString("AdempiereHome"));
@ -431,7 +423,6 @@ public class ConfigurationPanel extends JPanel implements ActionListener
// //
bAdempiereHome.addActionListener(this); bAdempiereHome.addActionListener(this);
bJavaHome.addActionListener(this); bJavaHome.addActionListener(this);
fJavaType.addActionListener(this);
fDatabaseType.addActionListener(this); fDatabaseType.addActionListener(this);
fDatabaseDiscovered.addActionListener(this); fDatabaseDiscovered.addActionListener(this);
bHelp.addActionListener(this); bHelp.addActionListener(this);
@ -475,8 +466,6 @@ public class ConfigurationPanel extends JPanel implements ActionListener
fDatabaseName.setText(m_data.resolveDatabaseName(dbName)); fDatabaseName.setText(m_data.resolveDatabaseName(dbName));
} }
// //
else if (e.getSource() == fJavaType)
m_data.initJava();
else if (e.getSource() == fDatabaseType) else if (e.getSource() == fDatabaseType)
m_data.initDatabase(""); m_data.initDatabase("");
// //
@ -570,7 +559,7 @@ public class ConfigurationPanel extends JPanel implements ActionListener
private void test() throws Exception private void test() throws Exception
{ {
bSave.setEnabled(false); bSave.setEnabled(false);
if (!m_data.test()) if (!m_data.test(this))
return; return;
// //
m_statusBar.setText(res.getString("Ok")); m_statusBar.setText(res.getString("Ok"));
@ -621,30 +610,37 @@ public class ConfigurationPanel extends JPanel implements ActionListener
if (!m_data.save()) if (!m_data.save())
return; return;
// Final Info
JOptionPane.showConfirmDialog(this, res.getString("EnvironmentSaved"),
res.getString("AdempiereServerSetup"),
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
/** 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);
}
// To be sure // To be sure
((Frame)SwingUtilities.getWindowAncestor(this)).dispose(); ((Frame)SwingUtilities.getWindowAncestor(this)).dispose();
System.exit(0); // remains active when License Dialog called System.exit(0); // remains active when License Dialog called
/** **/ /** **/
} // save } // save
/* (non-Javadoc)
* @see org.adempiere.install.IDBConfigMonitor#update(org.adempiere.install.DBConfigStatus)
*/
@Override
public void update(DBConfigStatus status) {
if (status.getStatusType().equals(DBConfigStatus.DATABASE_SERVER))
{
signalOK(okDatabaseServer, status.getResourseString(),
status.isPass(), status.isCritical(), status.getErrorMessage());
}
else if (status.getStatusType().equals(DBConfigStatus.DATABASE_SYSTEM_PASSWORD))
{
signalOK(okDatabaseSystem, status.getResourseString(), status.isPass(),
status.isCritical(), status.getErrorMessage());
}
else if (status.getStatusType().equals(DBConfigStatus.DATABASE_USER))
{
signalOK(okDatabaseUser, status.getResourseString(), status.isPass(),
status.isCritical(), status.getErrorMessage());
}
else if (status.getStatusType().equals(DBConfigStatus.DATABASE_SQL_TEST))
{
signalOK(okDatabaseSQL, status.getResourseString(), status.isPass(),
status.isCritical(), status.getErrorMessage());
}
}
} // ConfigurationPanel } // ConfigurationPanel

View File

@ -18,7 +18,7 @@ public class SilentSetup {
String adempiereHome = System.getProperty(ConfigurationData.ADEMPIERE_HOME); String adempiereHome = System.getProperty(ConfigurationData.ADEMPIERE_HOME);
if (adempiereHome == null || adempiereHome.length() == 0) if (adempiereHome == null || adempiereHome.length() == 0)
adempiereHome = System.getProperty("user.dir"); adempiereHome = System.getProperty("user.dir");
// boolean envLoaded = false; // boolean envLoaded = false;
String fileName = adempiereHome + File.separator + ConfigurationData.ADEMPIERE_ENV_FILE; String fileName = adempiereHome + File.separator + ConfigurationData.ADEMPIERE_ENV_FILE;
File env = new File(fileName); File env = new File(fileName);
@ -27,18 +27,18 @@ public class SilentSetup {
System.err.println("Usage: Please edit AdempiereEnvTemplate.properties and save as AdempiereEnv.properties"); System.err.println("Usage: Please edit AdempiereEnvTemplate.properties and save as AdempiereEnv.properties");
return; return;
} }
Ini.setShowLicenseDialog(false); Ini.setShowLicenseDialog(false);
ConfigurationData data = new ConfigurationData(null); ConfigurationData data = new ConfigurationData(null);
if (!data.load()) return; if (!data.load()) return;
if (!data.test()) if (!data.test(null))
{ {
System.err.println(""); System.err.println("");
System.err.println("Warning: One or more of the configuration test failed."); System.err.println("Warning: One or more of the configuration test failed.");
System.err.println(""); System.err.println("");
} }
if (!data.save()) return; if (!data.save()) return;
/** Run Ant **/ /** Run Ant **/
try try
{ {
@ -54,7 +54,7 @@ public class SilentSetup {
CLogger.get().log(Level.SEVERE, "ant", e); CLogger.get().log(Level.SEVERE, "ant", e);
} }
} }
/** /**
* Start * Start
* @param args Log Level e.g. ALL, FINE * @param args Log Level e.g. ALL, FINE
@ -72,7 +72,7 @@ public class SilentSetup {
// File Logger at least FINE // File Logger at least FINE
if (fileHandler.getLevel().intValue() > Level.FINE.intValue()) if (fileHandler.getLevel().intValue() > Level.FINE.intValue())
fileHandler.setLevel(Level.FINE); fileHandler.setLevel(Level.FINE);
new SilentSetup(); new SilentSetup();
} }
} }

View File

@ -41,9 +41,9 @@ public class ConfigurationConsole {
Ini.setShowLicenseDialog(false); Ini.setShowLicenseDialog(false);
data.load(); data.load();
data.initJava();
try { try {
jvmType(reader, writer);
jvmHome(reader, writer); jvmHome(reader, writer);
adempiereHome(reader, writer); adempiereHome(reader, writer);
@ -169,7 +169,7 @@ public class ConfigurationConsole {
{ {
data.setDatabaseSystemPassword(dbPassword); data.setDatabaseSystemPassword(dbPassword);
} }
String error = data.testDatabase(); String error = data.testDatabase(null);
if (error != null && error.trim().length() > 0) if (error != null && error.trim().length() > 0)
{ {
writer.println("Database test fail: " + error); writer.println("Database test fail: " + error);
@ -416,62 +416,12 @@ public class ConfigurationConsole {
if (error != null && error.trim().length() > 0) if (error != null && error.trim().length() > 0)
{ {
writer.println("JVM test fail: " + error); writer.println("JVM test fail: " + error);
jvmType(reader, writer);
continue; continue;
} }
break; break;
} }
} }
private void jvmType(BufferedReader reader, PrintWriter writer) throws IOException {
//java type
String javaType = data.getJavaType();
int javaTypeSelected = 0;
for(int i = 0; i < ConfigurationData.JAVATYPE.length; i++)
{
if (ConfigurationData.JAVATYPE[i].equals(javaType))
{
javaTypeSelected = i;
break;
}
}
// console.writer().println("JVM Type:");
for(int i = 0; i < ConfigurationData.JAVATYPE.length; i++)
{
writer.println((i+1) + ". " + ConfigurationData.JAVATYPE[i]);
}
while (true)
{
writer.println("JVM Type [" + (javaTypeSelected+1) + "]:");
String input = reader.readLine();
if (input != null && input.trim().length() > 0)
{
try
{
int inputIndex = Integer.parseInt(input);
if (inputIndex <= 0 || inputIndex > ConfigurationData.JAVATYPE.length)
{
writer.println("Invalid input, please enter numeric value of 1 to " + ConfigurationData.JAVATYPE.length);
continue;
}
data.initJava(inputIndex-1);
data.setJavaType(ConfigurationData.JAVATYPE[inputIndex-1]);
break;
}
catch (NumberFormatException e){
writer.println("Invalid input, please enter numeric value of 1 to " + ConfigurationData.JAVATYPE.length);
continue;
}
}
else
{
data.initJava(javaTypeSelected);
data.setJavaType(ConfigurationData.JAVATYPE[javaTypeSelected]);
}
break;
}
}
private void dbType(BufferedReader reader, PrintWriter writer) throws IOException { private void dbType(BufferedReader reader, PrintWriter writer) throws IOException {
String dbType = data.getDatabaseType(); String dbType = data.getDatabaseType();

View File

@ -11,7 +11,6 @@
<property environment="env" /> <property environment="env" />
<property name="envFile" value="AdempiereEnv.properties" /> <property name="envFile" value="AdempiereEnv.properties" />
<property name="server" value="nas" />
<!-- ==================================================== --> <!-- ==================================================== -->
<!-- Init --> <!-- Init -->

View File

@ -21,8 +21,8 @@
<stringAttribute key="pde.version" value="3.3"/> <stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.adempiere.server.server_product"/> <stringAttribute key="product" value="org.adempiere.server.server_product"/>
<stringAttribute key="productFile" value="/org.adempiere.server-feature/server.product"/> <stringAttribute key="productFile" value="/org.adempiere.server-feature/server.product"/>
<stringAttribute key="selected_target_plugins" value="org.eclipse.equinox.p2.touchpoint.natives@default:default,org.springframework.osgi.io@default:default,com.springsource.org.apache.commons.collections@default:default,com.springsource.javax.servlet.jsp.jstl@default:default,com.springsource.javax.servlet.jsp@default:default,com.springsource.org.apache.xerces@default:false,com.springsource.org.apache.poi@default:default,com.springsource.org.apache.xml.serializer@default:default,org.eclipse.virgo.util.parser.manifest@default:default,org.eclipse.equinox.p2.ql@default:default,com.springsource.slf4j.api@default:default,com.springsource.org.apache.commons.logging@default:default,javax.xml@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,com.springsource.org.apache.catalina.ha.springsource@default:false,org.eclipse.virgo.util.io@default:default,org.springframework.core@default:default,org.eclipse.equinox.p2.director@default:default,com.springsource.org.aopalliance@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,com.springsource.org.apache.jasper.springsource@default:false,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,com.springsource.slf4j.simple@default:false,com.springsource.javax.xml.soap@default:default,org.eclipse.gemini.web.extender@4:true,com.springsource.org.apache.juli.extras.springsource@default:default,com.springsource.javax.activation@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,com.springsource.javax.el@default:default,org.apache.commons.codec@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.console@default:default,org.springframework.aop@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.ds@4:true,org.eclipse.ecf@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.org.apache.catalina.springsource@default:default,org.eclipse.gemini.web.tomcat@4:true,org.springframework.osgi.core@default:default,org.eclipse.virgo.util.osgi@default:default,com.springsource.javax.mail@default:default,org.eclipse.virgo.util.math@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.security@default:default,com.springsource.org.apache.catalina.tribes.springsource@default:false,com.springsource.org.apache.el.springsource@default:default,org.eclipse.equinox.preferences@default:default,org.springframework.beans@default:default,org.eclipse.virgo.util.common@default:default,org.eclipse.osgi@-1:true,org.eclipse.equinox.p2.jarprocessor@default:default,com.springsource.javax.annotation@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,com.springsource.javax.xml.ws@default:default,com.springsource.javax.management.j2ee@default:default,org.restlet@3:true,org.eclipse.equinox.util@default:default,com.springsource.org.eclipse.jdt.core.compiler.batch@default:default,org.eclipse.equinox.common@2:true,org.apache.commons.httpclient@default:default,com.springsource.org.apache.activemq@default:default,org.eclipse.osgi.services@4:true,org.sat4j.pb@default:default,org.eclipse.equinox.p2.metadata@default:default,org.apache.ant@default:default,com.springsource.org.apache.kahadb@default:default,org.eclipse.equinox.registry@default:default,org.sat4j.core@default:default,com.springsource.javax.xml.stream@default:default,org.restlet.ext.servlet@default:default,com.springsource.org.apache.xmlcommons@default:default,com.springsource.javax.ejb@default:default,org.eclipse.equinox.p2.engine@default:default,org.springframework.context@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.gemini.web.core@4:true,org.eclipse.core.runtime@4:true,com.springsource.org.apache.xml.resolver@default:default,com.springsource.org.apache.taglibs.standard@default:default,com.springsource.javax.servlet@default:default,com.springsource.org.junit@default:default,com.springsource.javax.xml.bind@default:default,com.springsource.org.apache.coyote.springsource@default:false,com.springsource.javax.jms@default:default,org.apache.commons.logging@default:default,org.eclipse.equinox.launcher.gtk.linux.x86@default:false,com.springsource.net.sf.cglib@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.contenttype@default:default,com.springsource.javax.persistence@default:default,com.springsource.org.apache.commons.net@default:default"/> <stringAttribute key="selected_target_plugins" value="org.eclipse.equinox.security@default:default,org.eclipse.virgo.util.common@default:default,org.restlet@3:true,com.springsource.javax.xml.ws@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.osgi.services@4:true,com.springsource.org.apache.el.springsource@default:default,com.springsource.javax.xml.bind@default:default,org.springframework.osgi.core@default:default,org.eclipse.equinox.launcher@default:default,com.springsource.javax.servlet@default:default,org.eclipse.equinox.common@2:true,com.springsource.javax.xml.stream@default:default,com.springsource.javax.xml.rpc@default:default,org.restlet.ext.servlet@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.p2.director@default:default,com.springsource.javax.jms@default:default,org.eclipse.ecf@default:default,org.eclipse.virgo.util.io@default:default,org.eclipse.gemini.web.extender@4:true,org.eclipse.equinox.ds@4:true,org.eclipse.equinox.p2.core@default:default,org.springframework.core@default:default,com.springsource.org.junit@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,com.springsource.org.apache.commons.collections@default:default,org.springframework.beans@default:default,com.springsource.org.apache.xml.resolver@default:default,org.eclipse.equinox.launcher.gtk.linux.x86@default:false,com.springsource.javax.management.j2ee@default:default,org.eclipse.virgo.util.math@default:default,com.springsource.javax.ejb@default:default,com.springsource.javax.persistence@default:default,com.springsource.javax.annotation@default:default,com.springsource.slf4j.api@default:default,com.springsource.org.apache.taglibs.standard@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,com.springsource.org.apache.xmlcommons@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.gemini.web.tomcat@4:true,com.springsource.javax.servlet.jsp@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.springframework.aop@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.repository@default:default,com.springsource.org.apache.catalina.tribes.springsource@default:false,com.springsource.org.apache.commons.net@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.equinox.registry@default:default,com.springsource.javax.servlet.jsp.jstl@default:default,com.springsource.javax.mail@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.apache.ant@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,com.springsource.org.apache.xerces@default:false,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.gemini.web.core@4:true,com.springsource.net.sf.cglib@default:default,com.springsource.javax.activation@default:default,org.apache.commons.httpclient@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.equinox.http.registry@default:default,com.springsource.org.apache.catalina.springsource@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.osgi@-1:true,org.eclipse.virgo.util.parser.manifest@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.virgo.util.osgi@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.p2.ql@default:default,com.springsource.org.apache.juli.extras.springsource@default:default,com.springsource.org.apache.coyote.springsource@default:false,com.springsource.org.apache.activemq@default:default,org.sat4j.core@default:default,org.sat4j.pb@default:default,org.apache.commons.logging@default:default,com.springsource.org.apache.catalina.ha.springsource@default:false,org.springframework.osgi.io@default:default,org.eclipse.equinox.app@default:default,org.springframework.context@default:default,org.eclipse.equinox.util@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.core.runtime@4:true,com.springsource.org.aopalliance@default:default,org.eclipse.core.jobs@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.javax.el@default:default,com.springsource.org.apache.jasper.springsource@default:false,com.springsource.org.apache.kahadb@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,com.springsource.org.apache.xml.serializer@default:default,com.springsource.slf4j.simple@default:false,com.springsource.org.eclipse.jdt.core.compiler.batch@default:default,com.springsource.org.apache.poi@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,com.springsource.org.apache.commons.logging@default:default,javax.xml@default:default,org.apache.commons.codec@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.tomcat.config@default:false,org.adempiere.base@default:default,org.adempiere.payment.processor@default:default,org.compiere.db.postgresql.provider@default:default,org.adempiere.pipo.handlers@default:default,org.adempiere.extend@default:false,org.adempiere.plugin.utils@default:default,org.adempiere.replication@default:default,org.compiere.db.oracle.provider@default:default,org.apache.ecs@default:default,org.adempiere.base.process@default:default,org.adempiere.report.jasper.library@default:default,org.adempiere.report.jasper@default:default,org.adempiere.ui@default:default,org.adempiere.install@3:true,org.adempiere.report.jasper.webapp@4:true,org.adempiere.replication.server@4:true,org.adempiere.base.callout@default:default,org.adempiere.pipo@default:default,org.adempiere.ui.zk@4:true,org.adempiere.server@4:true,org.adempiere.webstore@4:true"/> <stringAttribute key="selected_workspace_plugins" value="org.apache.ecs@default:default,org.adempiere.report.jasper@default:default,org.adempiere.report.jasper.webapp@4:true,org.adempiere.report.jasper.library@default:default,org.adempiere.replication@default:default,org.adempiere.extend@default:false,org.adempiere.install@3:true,org.adempiere.replication.server@4:true,org.compiere.db.oracle.provider@default:default,org.adempiere.pipo@default:default,org.adempiere.tomcat.config@default:false,org.adempiere.plugin.utils@default:default,org.adempiere.server@4:true,org.adempiere.pipo.handlers@default:default,org.compiere.db.postgresql.provider@default:default,org.adempiere.payment.processor@default:default,org.adempiere.ui.zk@4:true,org.adempiere.base.process@default:default,org.adempiere.base.callout@default:default,org.adempiere.webstore@4:true,org.adempiere.base@default:default,org.adempiere.ui@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/> <booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/> <booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/> <booleanAttribute key="useCustomFeatures" value="false"/>

View File

@ -4,7 +4,8 @@ Bundle-Name: OracleProvider
Bundle-SymbolicName: org.compiere.db.oracle.provider;singleton:=true Bundle-SymbolicName: org.compiere.db.oracle.provider;singleton:=true
Bundle-Version: 1.0.0.qualifier Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.adempiere.base;bundle-version="1.0.0" Require-Bundle: org.adempiere.base;bundle-version="1.0.0",
org.adempiere.install;bundle-version="1.0.0"
Bundle-ClassPath: ., Bundle-ClassPath: .,
ojdbc6.jar, ojdbc6.jar,
c3p0-0.9.1.2.jar, c3p0-0.9.1.2.jar,

View File

@ -8,5 +8,14 @@
id="Oracle"> id="Oracle">
</database> </database>
</extension> </extension>
<extension
id="org.adempiere.db.config.ConfigOracle"
name="Oracle Database Configuration"
point="org.adempiere.install.IDatabaseConfig">
<database
class="org.adempiere.db.oracle.config.ConfigOracle"
id="Oracle">
</database>
</extension>
</plugin> </plugin>

View File

@ -14,7 +14,7 @@
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html * * or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/ *****************************************************************************/
package org.compiere.install; package org.adempiere.db.oracle.config;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
@ -26,27 +26,30 @@ import java.sql.DriverManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.adempiere.install.DBConfigStatus;
import org.adempiere.install.IDBConfigMonitor;
import org.adempiere.install.IDatabaseConfig;
import org.compiere.db.Database; import org.compiere.db.Database;
import org.compiere.install.ConfigurationData;
import org.compiere.util.CLogger;
/** /**
* Oracle Configuration * Oracle Configuration
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: ConfigOracle.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $ * @version $Id: ConfigOracle.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $
*/ */
public class ConfigOracle extends Config public class ConfigOracle implements IDatabaseConfig
{ {
private final static CLogger log = CLogger.getCLogger(ConfigOracle.class);
/** /**
* ConfigOracle * ConfigOracle
* @param data configuration
* @param XE express edition
*/ */
public ConfigOracle (ConfigurationData data, boolean XE) public ConfigOracle ()
{ {
super (data);
m_XE = XE;
} // ConfigOracle } // ConfigOracle
/** Discoverd TNS */ /** Discoverd TNS */
private String[] p_discovered = null; private String[] p_discovered = null;
/** Discovered Database Name */ /** Discovered Database Name */
@ -55,17 +58,17 @@ public class ConfigOracle extends Config
private Connection m_con = null; private Connection m_con = null;
/** Express Edition */ /** Express Edition */
private boolean m_XE = false; private boolean m_XE = false;
/** /**
* Init * Init
*/ */
public void init() public void init(ConfigurationData configurationData)
{ {
p_data.setDatabasePort(String.valueOf(Database.DB_ORACLE_DEFAULT_PORT)); configurationData.setDatabasePort(String.valueOf(Database.DB_ORACLE_DEFAULT_PORT));
// //
p_data.setDatabaseSystemPassword(true); configurationData.setDatabaseSystemPassword(true);
} // init } // init
/** /**
* Discover Databases. * Discover Databases.
* To be overwritten by database configs * To be overwritten by database configs
@ -87,7 +90,7 @@ public class ConfigOracle extends Config
list.add(def.toLowerCase()); list.add(def.toLowerCase());
dblist.add(def.toLowerCase()); dblist.add(def.toLowerCase());
} }
if (m_XE) if (m_XE)
{ {
String serviceName = "xe"; String serviceName = "xe";
@ -97,9 +100,9 @@ public class ConfigOracle extends Config
dblist.add(serviceName); dblist.add(serviceName);
} }
} }
String path = System.getenv("ORACLE_HOME"); String path = System.getenv("ORACLE_HOME");
if (path == null) if (path == null)
{ {
// Search for Oracle Info // Search for Oracle Info
path = System.getProperty("java.library.path"); path = System.getProperty("java.library.path");
@ -165,9 +168,9 @@ public class ConfigOracle extends Config
dblist.toArray(p_dbname); dblist.toArray(p_dbname);
return p_discovered; return p_discovered;
} // discoverDatabases } // discoverDatabases
@Override @Override
public String getDatabaseName(String nativeConnectioName) public String getDatabaseName(String nativeConnectioName)
{ {
int idx = -1; int idx = -1;
if (p_discovered == null) return nativeConnectioName; if (p_discovered == null) return nativeConnectioName;
@ -179,8 +182,8 @@ public class ConfigOracle extends Config
break; break;
} }
} }
if (idx >= 0 if (idx >= 0
&& p_dbname != null && p_dbname != null
&& idx < p_dbname.length) && idx < p_dbname.length)
return p_dbname[idx]; return p_dbname[idx];
else else
@ -265,7 +268,7 @@ public class ConfigOracle extends Config
log.fine(entry); log.fine(entry);
list.add(entry); list.add(entry);
} }
} }
} }
// Convert to Array // Convert to Array
@ -275,18 +278,20 @@ public class ConfigOracle extends Config
list.toArray(retValue); list.toArray(retValue);
return retValue; return retValue;
} // getTNS_Names } // getTNS_Names
/************************************************************************** /**************************************************************************
* Test * Test
* @param monitor
* @param data
* @return error message or null if OK * @return error message or null if OK
*/ */
public String test() public String test(IDBConfigMonitor monitor, ConfigurationData data)
{ {
// Database Server // Database Server
String server = p_data.getDatabaseServer(); String server = data.getDatabaseServer();
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");
String error = "Not correct: DB Server = " + server; String error = "Not correct: DB Server = " + server;
InetAddress databaseServer = null; InetAddress databaseServer = null;
@ -300,35 +305,35 @@ public class ConfigOracle extends Config
error += " - " + e.getMessage(); error += " - " + e.getMessage();
pass = false; pass = false;
} }
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SERVER, "ErrorDatabaseServer",
pass, true, error); pass, true, error));
log.info("OK: Database Server = " + databaseServer); log.info("OK: Database Server = " + databaseServer);
setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName()); data.setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName());
setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType()); data.setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, data.getDatabaseType());
setProperty(ConfigurationData.ADEMPIERE_DB_PATH, p_data.getDatabaseType()); data.setProperty(ConfigurationData.ADEMPIERE_DB_PATH, data.getDatabaseType());
// Database Port // Database Port
int databasePort = p_data.getDatabasePort(); int databasePort = data.getDatabasePort();
pass = p_data.testPort (databaseServer, databasePort, true); pass = data.testPort (databaseServer, databasePort, true);
error = "DB Server Port = " + databasePort; error = "DB Server Port = " + databasePort;
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SERVER, "ErrorDatabasePort",
pass, true, error); pass, true, error));
if (!pass) if (!pass)
return error; return error;
log.info("OK: Database Port = " + databasePort); log.info("OK: Database Port = " + databasePort);
setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort)); data.setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort));
// JDBC Database Info // JDBC Database Info
String databaseName = p_data.getDatabaseName(); // Service Name String databaseName = data.getDatabaseName(); // Service Name
String systemPassword = p_data.getDatabaseSystemPassword(); String systemPassword = 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";
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC",
pass, true, error); pass, true, error));
if (!pass) if (!pass)
return error; return error;
// //
@ -337,48 +342,48 @@ public class ConfigOracle extends Config
+ ":" + databasePort + ":" + databasePort
+ "/" + databaseName; + "/" + databaseName;
pass = testJDBC(url, "system", systemPassword); pass = testJDBC(url, "system", systemPassword);
error = "Error connecting: " + url error = "Error connecting: " + url
+ " - as system/" + systemPassword; + " - as system/" + systemPassword;
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC",
pass, true, error); pass, true, error));
if (!pass) if (!pass)
return error; return error;
log.info("OK: Connection = " + url); log.info("OK: Connection = " + url);
setProperty(ConfigurationData.ADEMPIERE_DB_URL, url); data.setProperty(ConfigurationData.ADEMPIERE_DB_URL, url);
log.info("OK: Database System User " + databaseName); log.info("OK: Database System User " + databaseName);
setProperty(ConfigurationData.ADEMPIERE_DB_NAME, databaseName); data.setProperty(ConfigurationData.ADEMPIERE_DB_NAME, databaseName);
setProperty(ConfigurationData.ADEMPIERE_DB_SYSTEM, systemPassword); data.setProperty(ConfigurationData.ADEMPIERE_DB_SYSTEM, systemPassword);
// Database User Info // Database User Info
String databaseUser = p_data.getDatabaseUser(); // UID String databaseUser = data.getDatabaseUser(); // UID
String databasePassword = p_data.getDatabasePassword(); // PWD String databasePassword = 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";
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_USER, "ErrorJDBC",
pass, true, error); 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).";
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_USER, "ErrorJDBC",
pass, false, error); pass, false, error));
if (pass) if (pass)
{ {
log.info("OK: Database User = " + databaseUser); log.info("OK: Database User = " + databaseUser);
if (m_con != null) if (m_con != null)
setProperty(ConfigurationData.ADEMPIERE_WEBSTORES, getWebStores(m_con)); data.setProperty(ConfigurationData.ADEMPIERE_WEBSTORES, data.getWebStores(m_con));
} }
else else
log.warning(error); log.warning(error);
setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser); data.setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser);
setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword); data.setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword);
// TNS Name Info via sqlplus // TNS Name Info via sqlplus
String sqlplus = "sqlplus system/" + systemPassword + "@" String sqlplus = "sqlplus system/" + systemPassword + "@"
+ "//" + databaseServer.getHostName() + "//" + databaseServer.getHostName()
+ ":" + databasePort + ":" + databasePort
@ -387,12 +392,12 @@ 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;
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseSQL, "ErrorTNS", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SQL_TEST, "ErrorTNS",
pass, true, error); pass, true, error));
if (pass) if (pass)
log.info("OK: Database SQL Connection"); log.info("OK: Database SQL Connection");
// OCI Test // OCI Test
if (System.getProperty("TestOCI", "N").equals("Y")) if (System.getProperty("TestOCI", "N").equals("Y"))
{ {
@ -404,7 +409,7 @@ public class ConfigOracle extends Config
log.warning("Cannot connect via Net8: " + url); log.warning("Cannot connect via Net8: " + url);
} }
log.info("OCI Test Skipped"); log.info("OCI Test Skipped");
// //
m_con = null; m_con = null;
return null; return null;
@ -485,5 +490,5 @@ public class ConfigOracle extends Config
log.warning(sbErr.toString()); log.warning(sbErr.toString());
return result == 0; return result == 0;
} // testSQL } // testSQL
} // ConfigOracle } // ConfigOracle

View File

@ -7,6 +7,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: ., Bundle-ClassPath: .,
postgresql.jar, postgresql.jar,
c3p0-0.9.1.2.jar c3p0-0.9.1.2.jar
Require-Bundle: org.adempiere.base;bundle-version="1.0.0" Require-Bundle: org.adempiere.base;bundle-version="1.0.0",
org.adempiere.install;bundle-version="1.0.0"
Import-Package: junit.framework;version="3.8.2", Import-Package: junit.framework;version="3.8.2",
org.junit;version="4.8.1" org.junit;version="4.8.1"

View File

@ -8,5 +8,14 @@
id="PostgreSQL"> id="PostgreSQL">
</database> </database>
</extension> </extension>
<extension
id="org.adempiere.db.postgresql.config.ConfigPostgreSQL"
name="PostgreSQL Database Configuration"
point="org.adempiere.install.IDatabaseConfig">
<database
class="org.adempiere.db.postgresql.config.ConfigPostgreSQL"
id="PostgreSQL">
</database>
</extension>
</plugin> </plugin>

View File

@ -12,43 +12,49 @@
* Portions created by Victor Perez are Copyright (C) 1999-2005 e-Evolution,S.C * Portions created by Victor Perez are Copyright (C) 1999-2005 e-Evolution,S.C
* Contributor(s): Victor Perez * Contributor(s): Victor Perez
*****************************************************************************/ *****************************************************************************/
package org.compiere.install; package org.adempiere.db.postgresql.config;
import java.net.InetAddress; import java.net.InetAddress;
import java.sql.Connection; import java.sql.Connection;
import org.adempiere.install.DBConfigStatus;
import org.adempiere.install.IDBConfigMonitor;
import org.adempiere.install.IDatabaseConfig;
import org.compiere.db.AdempiereDatabase; import org.compiere.db.AdempiereDatabase;
import org.compiere.db.Database; import org.compiere.db.Database;
import org.compiere.install.ConfigurationData;
import org.compiere.util.CLogger;
/** /**
* PostgreSQL Configuration * PostgreSQL Configuration
* *
* @author Victor Perez e-Evolution * @author Victor Perez e-Evolution
* @version $Id: ConfigPostgreSQL.java,v 1.0 2005/01/31 06:08:15 vpj-cd Exp $ * @version $Id: ConfigPostgreSQL.java,v 1.0 2005/01/31 06:08:15 vpj-cd Exp $
*/ */
public class ConfigPostgreSQL extends Config public class ConfigPostgreSQL implements IDatabaseConfig
{ {
private final static CLogger log = CLogger.getCLogger(ConfigPostgreSQL.class);
/** /**
* ConfigPostgreSQL * ConfigPostgreSQL
* @param data
*/ */
public ConfigPostgreSQL (ConfigurationData data) public ConfigPostgreSQL ()
{ {
super (data);
} // ConfigPostgreSQL } // ConfigPostgreSQL
/** Discovered TNS */ /** Discovered TNS */
private String[] p_discovered = null; private String[] p_discovered = null;
private AdempiereDatabase p_db = Database.getDatabase(Database.DB_POSTGRESQL); private AdempiereDatabase p_db = Database.getDatabase(Database.DB_POSTGRESQL);
/** /**
* Init * Init
* @param configurationData
*/ */
public void init() public void init(ConfigurationData configurationData)
{ {
p_data.setDatabasePort(String.valueOf(Database.DB_POSTGRESQL_DEFAULT_PORT)); configurationData.setDatabasePort(String.valueOf(Database.DB_POSTGRESQL_DEFAULT_PORT));
} // init } // init
/** /**
@ -64,20 +70,22 @@ public class ConfigPostgreSQL extends Config
p_discovered = new String[]{}; p_discovered = new String[]{};
return p_discovered; return p_discovered;
} // discoveredDatabases } // discoveredDatabases
/************************************************************************** /**************************************************************************
* Test * Test
* @param monitor
* @param data
* @return error message or null if OK * @return error message or null if OK
*/ */
public String test() public String test(IDBConfigMonitor monitor, ConfigurationData data)
{ {
// Database Server // Database Server
String server = p_data.getDatabaseServer(); String server = data.getDatabaseServer();
boolean pass = server != null && server.length() > 0; boolean pass = server != null && server.length() > 0;
// vpj-cd e-evolution && server.toLowerCase().indexOf("localhost") == -1 // vpj-cd e-evolution && server.toLowerCase().indexOf("localhost") == -1
// vpj-cd e-evolution && !server.equals("127.0.0.1"); // vpj-cd e-evolution && !server.equals("127.0.0.1");
String error = "Not correct: DB Server = " + server; String error = "Not correct: DB Server = " + server;
InetAddress databaseServer = null; InetAddress databaseServer = null;
try try
@ -90,77 +98,77 @@ public class ConfigPostgreSQL extends Config
error += " - " + e.getMessage(); error += " - " + e.getMessage();
pass = false; pass = false;
} }
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SERVER, "ErrorDatabaseServer",
pass, true, error); pass, true, error));
log.info("OK: Database Server = " + databaseServer); log.info("OK: Database Server = " + databaseServer);
setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName()); data.setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName());
setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType()); data.setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, data.getDatabaseType());
setProperty(ConfigurationData.ADEMPIERE_DB_PATH, p_data.getDatabaseType()); data.setProperty(ConfigurationData.ADEMPIERE_DB_PATH, data.getDatabaseType());
// Database Port // Database Port
int databasePort = p_data.getDatabasePort(); int databasePort = data.getDatabasePort();
pass = p_data.testPort (databaseServer, databasePort, true); pass = data.testPort (databaseServer, databasePort, true);
error = "DB Server Port = " + databasePort; error = "DB Server Port = " + databasePort;
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SERVER, "ErrorDatabasePort",
pass, true, error); pass, true, error));
if (!pass) if (!pass)
return error; return error;
log.info("OK: Database Port = " + databasePort); log.info("OK: Database Port = " + databasePort);
setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort)); data.setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort));
// JDBC Database Info // JDBC Database Info
String databaseName = p_data.getDatabaseName(); // Service Name String databaseName = data.getDatabaseName(); // Service Name
String systemPassword = p_data.getDatabaseSystemPassword(); String systemPassword = data.getDatabaseSystemPassword();
// URL (derived) // 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;
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC",
pass, true, error); pass, true, error));
if (!pass) if (!pass)
return error; return error;
log.info("OK: System Connection = " + urlSystem); log.info("OK: System Connection = " + urlSystem);
setProperty(ConfigurationData.ADEMPIERE_DB_SYSTEM, systemPassword); data.setProperty(ConfigurationData.ADEMPIERE_DB_SYSTEM, systemPassword);
// Database User Info // Database User Info
String databaseUser = p_data.getDatabaseUser(); // UID String databaseUser = data.getDatabaseUser(); // UID
String databasePassword = p_data.getDatabasePassword(); // PWD String databasePassword = 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";
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_USER, "ErrorJDBC",
pass, true, error); pass, true, error));
if (!pass) if (!pass)
return error; return error;
// //
String url= p_db.getConnectionURL(databaseServer.getHostName(), databasePort, String url= p_db.getConnectionURL(databaseServer.getHostName(), databasePort,
databaseName, databaseUser); databaseName, databaseUser);
// 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;
if (getPanel() != null) if (monitor != null)
signalOK(getPanel().okDatabaseUser, "ErrorJDBC", monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_USER, "ErrorJDBC",
pass, false, error); pass, false, error));
if (pass) if (pass)
log.info("OK: Database User = " + databaseUser); log.info("OK: Database User = " + databaseUser);
else else
log.warning(error); log.warning(error);
setProperty(ConfigurationData.ADEMPIERE_DB_URL, url); data.setProperty(ConfigurationData.ADEMPIERE_DB_URL, url);
setProperty(ConfigurationData.ADEMPIERE_DB_NAME, databaseName); data.setProperty(ConfigurationData.ADEMPIERE_DB_NAME, databaseName);
setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser); data.setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser);
setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword); data.setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword);
return null; return null;
} // test } // test
/** /**
* Test JDBC Connection to Server * Test JDBC Connection to Server
* @param url connection string * @param url connection string
@ -182,5 +190,10 @@ public class ConfigPostgreSQL extends Config
} }
return true; return true;
} // testJDBC } // testJDBC
@Override
public String getDatabaseName(String nativeConnectioName) {
return nativeConnectioName;
}
} // ConfigPostgreSQL } // ConfigPostgreSQL