IDEMPIERE-1093 Database: added connection pool properties file support / avoid requirement for org.jfree.io

This commit is contained in:
Carlos Ruiz 2019-12-25 19:18:27 +01:00
parent 83134677ee
commit 0caa446721
4 changed files with 9 additions and 15 deletions

View File

@ -12,8 +12,7 @@ Bundle-ClassPath: .,
lib/c3p0.jar,
lib/mchange-commons-java.jar,
lib/ojdbc7.jar
Import-Package: org.jfree.io;version="1.0.23",
org.osgi.framework,
Import-Package: org.osgi.framework,
org.slf4j;version="1.7.2"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.adempiere.db.oracle.OracleBundleActivator

View File

@ -19,12 +19,13 @@ package org.compiere.db;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Driver;
@ -40,8 +41,6 @@ import java.util.logging.Level;
import javax.sql.DataSource;
import oracle.jdbc.OracleDriver;
import org.adempiere.db.oracle.OracleBundleActivator;
import org.adempiere.exceptions.DBException;
import org.compiere.Adempiere;
@ -55,10 +54,11 @@ import org.compiere.util.Ini;
import org.compiere.util.Language;
import org.compiere.util.Trx;
import org.compiere.util.Util;
import org.jfree.io.IOUtils;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import oracle.jdbc.OracleDriver;
/**
* Oracle Database Port
*
@ -640,10 +640,8 @@ public class DB_Oracle implements AdempiereDatabase
dir.mkdir();
propertyFile = new File(propertyFilename);
try {
FileOutputStream fos = new FileOutputStream(propertyFile);
inputStream = url.openStream();
IOUtils.getInstance().copyStreams(inputStream, fos);
fos.close();
Files.copy(inputStream, propertyFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
inputStream.close();
inputStream = null;
} catch (FileNotFoundException e) {

View File

@ -12,7 +12,6 @@ Bundle-ClassPath: .,
Require-Bundle: org.adempiere.base;bundle-version="0.0.0",
org.adempiere.install;bundle-version="0.0.0"
Import-Package: junit.framework;version="3.8.2",
org.jfree.io;version="1.0.23",
org.junit;version="4.8.1",
org.osgi.framework,
org.slf4j;version="1.7.2"

View File

@ -21,12 +21,13 @@ package org.compiere.db;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
@ -55,7 +56,6 @@ import org.compiere.util.Ini;
import org.compiere.util.Language;
import org.compiere.util.Trx;
import org.compiere.util.Util;
import org.jfree.io.IOUtils;
import com.mchange.v2.c3p0.ComboPooledDataSource;
@ -729,10 +729,8 @@ public class DB_PostgreSQL implements AdempiereDatabase
dir.mkdir();
propertyFile = new File(propertyFilename);
try {
FileOutputStream fos = new FileOutputStream(propertyFile);
inputStream = url.openStream();
IOUtils.getInstance().copyStreams(inputStream, fos);
fos.close();
Files.copy(inputStream, propertyFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
inputStream.close();
inputStream = null;
} catch (FileNotFoundException e) {