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,15 +16,9 @@
*****************************************************************************/ *****************************************************************************/
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
@ -72,17 +66,6 @@ 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
@ -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
/** /**
@ -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,20 +22,20 @@ 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,7 +48,7 @@ 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
@ -65,16 +65,7 @@ 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);
// //
@ -83,34 +74,24 @@ public class ConfigVMOpenJDK extends Config
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";
@ -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
@ -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

@ -31,7 +31,7 @@ public class SilentSetup {
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.");

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,7 +26,12 @@ 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
@ -34,17 +39,15 @@ import org.compiere.db.Database;
* @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 */
@ -59,11 +62,11 @@ public class ConfigOracle extends Config
/** /**
* 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
/** /**
@ -279,12 +282,14 @@ public class ConfigOracle extends Config
/************************************************************************** /**************************************************************************
* 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");
@ -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;
// //
@ -339,44 +344,44 @@ public class ConfigOracle extends Config
pass = testJDBC(url, "system", systemPassword); pass = testJDBC(url, "system", systemPassword);
error = "Error connecting: " + url error = "Error connecting: " + url
+ " - as system/" + systemPassword; + " - as system/" + systemPassword;
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 + "@"
@ -387,9 +392,9 @@ public class ConfigOracle extends Config
log.config(sqlplus); log.config(sqlplus);
pass = testSQL(sqlplus); pass = testSQL(sqlplus);
error = "Error connecting via: " + sqlplus; error = "Error connecting via: " + sqlplus;
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");

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,13 +12,18 @@
* 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
@ -26,16 +31,16 @@ import org.compiere.db.Database;
* @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 */
@ -44,11 +49,12 @@ public class ConfigPostgreSQL extends Config
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
/** /**
@ -68,12 +74,14 @@ public class ConfigPostgreSQL extends Config
/************************************************************************** /**************************************************************************
* 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");
@ -90,30 +98,30 @@ 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,
@ -121,23 +129,23 @@ public class ConfigPostgreSQL extends Config
pass = testJDBC(urlSystem, p_db.getSystemUser(), systemPassword); pass = testJDBC(urlSystem, p_db.getSystemUser(), systemPassword);
error = "Error connecting: " + urlSystem error = "Error connecting: " + urlSystem
+ " - " + p_db.getSystemUser() + "/" + systemPassword; + " - " + p_db.getSystemUser() + "/" + systemPassword;
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;
// //
@ -146,17 +154,17 @@ public class ConfigPostgreSQL extends Config
// Ignore result as it might not be imported // Ignore result as it might not be imported
pass = testJDBC(url, databaseUser, databasePassword); pass = testJDBC(url, databaseUser, databasePassword);
error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword; error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword;
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
@ -183,4 +191,9 @@ public class ConfigPostgreSQL extends Config
return true; return true;
} // testJDBC } // testJDBC
@Override
public String getDatabaseName(String nativeConnectioName) {
return nativeConnectioName;
}
} // ConfigPostgreSQL } // ConfigPostgreSQL