IDEMPIERE-5837 Collect all System Properties of iDempiere in one class (#1980)

This commit is contained in:
Carlos Ruiz 2023-08-26 03:39:53 +02:00 committed by GitHub
parent e902ce13bc
commit c1d8a50b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 286 additions and 59 deletions

View File

@ -31,6 +31,7 @@ import java.util.logging.Level;
import org.compiere.Adempiere;
import org.compiere.model.MPInstance;
import org.compiere.model.SystemIDs;
import org.compiere.model.SystemProperties;
import org.compiere.process.ProcessCall;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoUtil;
@ -51,7 +52,7 @@ public class PackInFolderApplication implements IApplication {
@Override
public Object start(IApplicationContext context) throws Exception {
Adempiere.startup(false);
String logLevel = System.getProperty("LogLevel");
String logLevel = SystemProperties.getLogLevel();
if (logLevel == null)
logLevel = "INFO";
switch (logLevel) {

View File

@ -37,6 +37,7 @@ import org.compiere.model.MSystem;
import org.compiere.model.ModelValidationEngine;
import org.compiere.model.ServerStateChangeEvent;
import org.compiere.model.ServerStateChangeListener;
import org.compiere.model.SystemProperties;
import org.compiere.util.CLogFile;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
@ -641,7 +642,7 @@ public final class Adempiere
String className = system.getEncryptionKey();
if (className == null || className.length() == 0)
{
className = System.getProperty(SecureInterface.ADEMPIERE_SECURE);
className = SystemProperties.getAdempiereSecure();
if (className != null && className.length() > 0
&& !className.equals(SecureInterface.ADEMPIERE_SECURE_DEFAULT))
{

View File

@ -530,10 +530,7 @@ public class MSystem extends X_AD_System
public static boolean isSecureProps() {
if (Env.isWindows() || Ini.isClient())
return false;
String secureProps = System.getProperty("IDEMPIERE_SECURE_PROPERTIES");
if (secureProps != null && secureProps.equals("false"))
return false;
return true;
return SystemProperties.isSecureProperties();
}
/**

View File

@ -121,10 +121,6 @@ public abstract class PO
public static final String LOCAL_TRX_PREFIX = "POSave";
private static final String USE_TIMEOUT_FOR_UPDATE = "org.adempiere.po.useTimeoutForUpdate";
private static final String USE_OPTIMISTIC_LOCKING = "org.idempiere.po.useOptimisticLocking";
/** default timeout, 300 seconds **/
private static final int QUERY_TIME_OUT = 300;
@ -3248,7 +3244,7 @@ public abstract class PO
if (m_useOptimisticLocking != null)
return m_useOptimisticLocking;
else
return "true".equalsIgnoreCase(System.getProperty(USE_OPTIMISTIC_LOCKING, "false"));
return SystemProperties.isOptimisticLocking();
}
/**
@ -3277,7 +3273,7 @@ public abstract class PO
}
private boolean isUseTimeoutForUpdate() {
return "true".equalsIgnoreCase(System.getProperty(USE_TIMEOUT_FOR_UPDATE, "false"))
return SystemProperties.isUseTimeoutForUpdate()
&& DB.getDatabase().isQueryTimeoutSupported();
}

View File

@ -25,15 +25,230 @@
package org.compiere.model;
import org.compiere.util.Ini;
import org.compiere.util.SecureInterface;
/**
* Collection of System properties used in iDempiere
*
* @author Carlos Ruiz - globalqss - bxservice
*/
public class SystemProperties {
public static final String ZkUnitTest = "ZkUnitTest";
private static final String ADEMPIERE_DB_SYSTEM_USER = "ADEMPIERE_DB_SYSTEM_USER";
private static final String ADEMPIERE_SECURE = SecureInterface.ADEMPIERE_SECURE;
private static final String Cache_ExpireMinute = "Cache.ExpireMinute";
private static final String Cache_MaxSize = "Cache.MaxSize";
private static final String Cache_MaxSize_Per_Table_Prefix = "Cache.MaxSize.";
private static final String env_IDEMPIERE_HOME = Ini.ENV_PREFIX + Ini.IDEMPIERE_HOME;
private static final String IDEMPIERE_HOME = Ini.IDEMPIERE_HOME;
private static final String IDEMPIERE_SECURE_PROPERTIES = "IDEMPIERE_SECURE_PROPERTIES";
private static final String LogLevel = "LogLevel";
private static final String org_adempiere_po_useTimeoutForUpdate = "org.adempiere.po.useTimeoutForUpdate";
private static final String org_compiere_report_path = "org.compiere.report.path";
private static final String org_idempiere_db_debug = "org.idempiere.db.debug";
private static final String org_idempiere_db_debug_filter = "org.idempiere.db.debug.filter";
private static final String org_idempiere_FileLogPrefix = "org.idempiere.FileLogPrefix";
private static final String org_idempiere_postgresql_URLParameters = "org.idempiere.postgresql.URLParameters";
private static final String org_idempiere_po_useOptimisticLocking = "org.idempiere.po.useOptimisticLocking";
private static final String PostgreSQLNative = "PostgreSQLNative";
private static final String PropertyFile = "PropertyFile";
private static final String PropertyHomeFile = "PropertyHomeFile";
private static final String TestOCI = "TestOCI";
private static final String ZK_THEME = MSysConfig.ZK_THEME;
private static final String ZkUnitTest = "ZkUnitTest";
/**
* ADEMPIERE_DB_SYSTEM_USER allows to override the default name of the system user for the database
* @return
*/
public static String getAdempiereDBSystemUser() {
return System.getProperty(ADEMPIERE_DB_SYSTEM_USER);
}
/**
* ADEMPIERE_SECURE allows to override the default security class
* @return
*/
public static String getAdempiereSecure() {
return System.getProperty(ADEMPIERE_SECURE);
}
/**
* Cache.ExpireMinute allows to override the default expire minutes for cache
* @return
*/
public static String getCacheExpireMinute() {
return System.getProperty(Cache_ExpireMinute);
}
/**
* Cache.MaxSize allows to override the default max size for cache
* @return
*/
public static String getCacheMaxSize() {
return System.getProperty(Cache_MaxSize);
}
/**
* Cache.MaxSize.[Table] allows to define a max size for cache specific for one table
* for example -DCache.MaxSize.AD_Column=15000 will set the max size for AD_Column
* @return
*/
public static String getCacheMaxSizeTable(String tableName) {
return System.getProperty(Cache_MaxSize_Per_Table_Prefix + tableName);
}
/**
* env.IDEMPIERE_HOME to define the home of iDempiere
* @return
*/
public static String getEnvIdempiereHome() {
return System.getProperty(env_IDEMPIERE_HOME);
}
/**
* IDEMPIERE_HOME to define the home of iDempiere
* @return
*/
public static String getIdempiereHome() {
return System.getProperty(IDEMPIERE_HOME);
}
/**
* IDEMPIERE_HOME to define the home of iDempiere
* @return
*/
public static String setIdempiereHome(String idempiereHome) {
return System.setProperty(IDEMPIERE_HOME, idempiereHome);
}
/**
* Verify if the system manages properties in a more secure way
* for Windows and swing client the properties are managed as always
* for other systems (like Linux) the default is to manage it with more security
* this can be overridden passing the parameter -DIDEMPIERE_SECURE_PROPERTIES=false to the JVM
* @return
*/
public static boolean isSecureProperties() {
String secureProps = System.getProperty(IDEMPIERE_SECURE_PROPERTIES);
return ! (secureProps != null && secureProps.equals("false"));
}
/**
* LogLevel=SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST Set the log level for the Pack In Folder application
* for example: LogLevel=INFO
* @return
*/
public static String getLogLevel() {
return System.getProperty(LogLevel);
}
/**
* Define if it uses a timeout when executing an UPDATE or DELETE in PO class, default false
* @return
*/
public static boolean isUseTimeoutForUpdate() {
return "true".equalsIgnoreCase(System.getProperty(org_adempiere_po_useTimeoutForUpdate, "false"));
}
/**
* org.compiere.report.path used to override the default of the report path where jasper reports are found
* @return
*/
public static String getReportPath() {
return System.getProperty(org_compiere_report_path);
}
/**
* org.idempiere.db.debug=true to print SQL Statements as log.warning
* @return
*/
public static boolean isDBDebug() {
return "true".equals(System.getProperty(org_idempiere_db_debug));
}
/**
* org.idempiere.db.debug.filter as a regular expression to filter the statements written in log
* for example: org.idempiere.db.debug.filter='(?i)(?s:.)*\bc_order\b(?s:.)*' will show all SQL related to c_order table
* @return
*/
public static String getDBDebugFilter() {
return System.getProperty(org_idempiere_db_debug_filter);
}
/**
* org.idempiere.FileLogPrefix defines the template prefix to write logs
* @return
*/
public static String getFileLogPrefix() {
return System.getProperty(org_idempiere_FileLogPrefix);
}
/**
* org.idempiere.FileLogPrefix defines the template prefix to write logs
* @return
*/
public static String setFileLogPrefix(String fileLogPrefix) {
return System.setProperty(org_idempiere_FileLogPrefix, fileLogPrefix);
}
/**
* org.idempiere.postgresql.URLParameters allows to define additional URL parameters to be passed to
* the JDBC connection in PostgreSQL
* @return
*/
public static String getPostgresqlURLParameters() {
return System.getProperty(org_idempiere_postgresql_URLParameters);
}
/**
* Define if optimistic locking must be used for UPDATE and DELETE in PO class, default false
* @return
*/
public static boolean isOptimisticLocking() {
return "true".equalsIgnoreCase(System.getProperty(org_idempiere_po_useOptimisticLocking, "false"));
}
/**
* PostgreSQLNative allows to override the default to use the postgresql native dialect
* @return
*/
public static String getPostgreSQLNative() {
return System.getProperty(PostgreSQLNative);
}
/**
* PropertyFile allows to define a PropertyFile to use instead of the default $HOME/idempiere.properties
* @return
*/
public static String getPropertyFile() {
return System.getProperty(PropertyFile);
}
/**
* PropertyHomeFile allows to override the folder where the properties file is found
* @return
*/
public static String getPropertyHomeFile() {
return System.getProperty(PropertyHomeFile);
}
/**
* TestOCI=Y defines if oracle config must test OCI, default to not test
* @return
*/
public static boolean isTestOCI() {
return System.getProperty(TestOCI, "N").equals("Y");
}
/**
* ZK_THEME allows to define the theme to use, it overrides the SysConfig ZK_THEME so it can be used for testing purposes
* @return
*/
public static String getZkTheme() {
return System.getProperty(ZK_THEME);
}
/**
* ZkUnitTest=true to define if the component ids must be generated using AdempiereIdGenerator.escapeId

View File

@ -28,6 +28,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import org.adempiere.base.Core;
import org.compiere.model.SystemProperties;
import org.idempiere.distributed.ICacheService;
/**
@ -62,7 +63,7 @@ public class CCache<K,V> implements CacheInterface, Map<K, V>, Serializable
{
try
{
String property = System.getProperty("Cache.ExpireMinute");
String property = SystemProperties.getCacheExpireMinute();
if (property != null && property.trim().length() > 0)
{
int expireMinute = 0;
@ -87,7 +88,7 @@ public class CCache<K,V> implements CacheInterface, Map<K, V>, Serializable
{
try
{
String property = System.getProperty("Cache.MaxSize." + name);
String property = SystemProperties.getCacheMaxSizeTable(name);
if (property != null && property.trim().length() > 0)
{
int cacheMaxSize = 0;

View File

@ -25,6 +25,8 @@ import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import org.compiere.model.SystemProperties;
/**
* idempiere Log Formatter
@ -329,14 +331,14 @@ public class CLogFormatter extends Formatter
String prefix = null;
try
{
prefix = System.getProperty("org.idempiere.FileLogPrefix");
prefix = SystemProperties.getFileLogPrefix();
if (!Util.isEmpty(prefix))
return Env.parseContext(Env.getCtx(), 0, prefix, false);
}
catch (Exception ex)
{
System.out.println("Parsing error in org.idempiere.FileLogPrefix - setting back to empty from " + prefix);
System.setProperty("org.idempiere.FileLogPrefix", "");
SystemProperties.setFileLogPrefix("");
}
return "";
}

View File

@ -29,6 +29,7 @@ import java.util.logging.Level;
import org.adempiere.base.Core;
import org.compiere.Adempiere;
import org.compiere.model.SystemProperties;
import org.idempiere.distributed.ICacheService;
import org.idempiere.distributed.IClusterMember;
import org.idempiere.distributed.IClusterService;
@ -81,7 +82,7 @@ public class CacheMgt
{
try
{
String maxSize = System.getProperty("Cache.MaxSize");
String maxSize = SystemProperties.getCacheMaxSize();
if (maxSize != null && maxSize.trim().length() > 0)
{
int max = 0;

View File

@ -35,6 +35,7 @@ import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.ModelValidationEngine;
import org.compiere.model.SystemProperties;
/**
* Load and Save INI Settings from property file
@ -403,8 +404,8 @@ public final class Ini implements Serializable
*/
public static String getFileName (boolean tryUserHome)
{
if (System.getProperty("PropertyFile") != null)
return System.getProperty("PropertyFile");
if (SystemProperties.getPropertyFile() != null)
return SystemProperties.getPropertyFile();
//
String base = null;
if (tryUserHome && s_client)
@ -607,9 +608,9 @@ public final class Ini implements Serializable
*/
public static String getAdempiereHome()
{
String env = System.getProperty (ENV_PREFIX + IDEMPIERE_HOME);
String env = SystemProperties.getEnvIdempiereHome();
if (env == null || env.trim().length() == 0)
env = System.getProperty (IDEMPIERE_HOME);
env = SystemProperties.getIdempiereHome();
if (env == null || env.trim().length() == 0)
{
//client - user home, server - current working directory

View File

@ -52,6 +52,7 @@ import org.compiere.Adempiere;
import org.compiere.db.CConnection;
import org.compiere.db.Database;
import org.compiere.model.MSystem;
import org.compiere.model.SystemProperties;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@ -108,7 +109,7 @@ public class ConfigurationData
public static final String IDEMPIERE_ENV_FILE = "idempiereEnv.properties";
/** Adempiere Home */
public static final String IDEMPIERE_HOME = "IDEMPIERE_HOME";
public static final String IDEMPIERE_HOME = Ini.IDEMPIERE_HOME;
/** */
public static final String JAVA_HOME = "JAVA_HOME";
/** */
@ -224,7 +225,7 @@ public class ConfigurationData
public boolean load()
{
// Load idempiereEnv.properties
String adempiereHome = System.getProperty(IDEMPIERE_HOME);
String adempiereHome = SystemProperties.getIdempiereHome();
if (adempiereHome == null || adempiereHome.length() == 0)
adempiereHome = System.getProperty("user.dir");

View File

@ -27,6 +27,7 @@ import java.util.logging.Level;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.compiere.model.SystemProperties;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.Ini;
@ -37,7 +38,7 @@ public class SilentSetup {
public SilentSetup()
{
//Load C:\idempiere\idempiereEnv.properties
String adempiereHome = System.getProperty(ConfigurationData.IDEMPIERE_HOME);
String adempiereHome = SystemProperties.getIdempiereHome();
if (adempiereHome == null || adempiereHome.length() == 0)
adempiereHome = System.getProperty("user.dir");

View File

@ -99,9 +99,9 @@ public class ModelExporter extends SvrProcess {
{
// Load XML file and parse it
String fileNameOr = org.compiere.util.Ini.findAdempiereHome()
+ System.getProperty("file.separator")
+ File.separator
+ "data"
+ System.getProperty("file.separator")
+ File.separator
+ "ExportFile.xml";
p_FileName = fileNameOr;
}
@ -146,4 +146,4 @@ public class ModelExporter extends SvrProcess {
}
return "Exported";
}
}
}

View File

@ -28,6 +28,7 @@
**********************************************************************/
package org.adempiere.process.rpl.imp;
import java.io.File;
import java.util.logging.Level;
import org.adempiere.process.rpl.XMLHelper;
@ -98,9 +99,9 @@ public class ModelImporter extends SvrProcess {
{
// Load XML file and parse it
String fileNameOr = org.compiere.util.Ini.findAdempiereHome()
+ System.getProperty("file.separator")
+ File.separator
+ "data"
+ System.getProperty("file.separator")
+ File.separator
+ "ExportFile.xml";
p_FileName = fileNameOr;
}
@ -119,9 +120,9 @@ public class ModelImporter extends SvrProcess {
// Load XML file and parse it
/*String fileNameOr = org.compiere.util.Ini.findAdempiereHome()
+ System.getProperty("file.separator")
+ File.separator
+ "data"
+ System.getProperty("file.separator");
+ File.separator;
String pathToXmlFile = fileNameOr+"XmlExport-test.xml";
Document documentToBeImported = XMLHelper.createDocumentFromFile(pathToXmlFile);*/
@ -133,4 +134,4 @@ public class ModelImporter extends SvrProcess {
addLog(0, null, null, Msg.getMsg(getCtx(), "ImportModelProcessResult") + "\n" + result.toString());
return result.toString();
}
}
}

View File

@ -90,7 +90,7 @@ public class BundleResourceLoader {
if (inputStream != null) {
String localResourceName = toLocalName(resourceName);
String localAbsoluteFileName = destinationFolder + localResourceName;
String localAbsolutePathName = localAbsoluteFileName.substring(0, localAbsoluteFileName.lastIndexOf(System.getProperty("file.separator"))+1);
String localAbsolutePathName = localAbsoluteFileName.substring(0, localAbsoluteFileName.lastIndexOf(File.separator)+1);
Path localPath = Path.of(localAbsolutePathName);
try {
if (!Files.exists(localPath))
@ -98,7 +98,7 @@ public class BundleResourceLoader {
} catch (IOException e) {
throw new RuntimeException(e);
}
String localFileName = localAbsoluteFileName.substring(localAbsoluteFileName.lastIndexOf(System.getProperty("file.separator"))+1);
String localFileName = localAbsoluteFileName.substring(localAbsoluteFileName.lastIndexOf(File.separator)+1);
String extension = localFileName.substring(localFileName.lastIndexOf("."));
reportFile = new File(localAbsoluteFileName);
if (!reportFile.exists()) {
@ -162,7 +162,7 @@ public class BundleResourceLoader {
String path = localName.substring(0, localName.lastIndexOf("/"));
localName = localName.substring(localName.lastIndexOf("/")+1);
path = path.replace('/', '_');
localName = path + System.getProperty("file.separator") + localName;
localName = path + File.separator + localName;
}
return localName;
}

View File

@ -77,7 +77,7 @@ public class ClassResourceLoader {
String localResourceName = toLocalName(resourceName);
String localAbsolutePathName = destinationFolder + localResourceName;
reportFile = new File(localAbsolutePathName);
String localPathName = localAbsolutePathName.substring(0, localAbsolutePathName.lastIndexOf(System.getProperty("file.separator"))+1);
String localPathName = localAbsolutePathName.substring(0, localAbsolutePathName.lastIndexOf(File.separator)+1);
Path localAbsolutePath = Path.of(localPathName);
try {
if (!Files.exists(localAbsolutePath))
@ -85,7 +85,7 @@ public class ClassResourceLoader {
} catch (IOException e) {
throw new RuntimeException(e);
}
String localFileName = localAbsolutePathName.substring(localAbsolutePathName.lastIndexOf(System.getProperty("file.separator"))+1);
String localFileName = localAbsolutePathName.substring(localAbsolutePathName.lastIndexOf(File.separator)+1);
String extension = localFileName.substring(localFileName.lastIndexOf("."));
File tmpOutputFile = null;
@ -155,7 +155,7 @@ public class ClassResourceLoader {
String path = localName.substring(0, localName.lastIndexOf("/"));
localName = localName.substring(localName.lastIndexOf("/")+1);
path = path.replace('/', '_');
localName = path + System.getProperty("file.separator") + localName;
localName = path + File.separator + localName;
}
return localName;
}

View File

@ -56,6 +56,7 @@ import org.compiere.model.MQuery;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable;
import org.compiere.model.PrintInfo;
import org.compiere.model.SystemProperties;
import org.compiere.model.X_AD_PInstance_Para;
import org.compiere.print.MPrintFormat;
import org.compiere.print.PrintUtil;
@ -143,7 +144,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
private static final JasperReportsContext jasperReportContext;
static {
String reportPath = System.getProperty("org.compiere.report.path");
String reportPath = SystemProperties.getReportPath();
if (reportPath == null) {
REPORT_HOME = new File(Ini.getAdempiereHome() + File.separator + "reports");
} else {

View File

@ -14,6 +14,7 @@ import java.util.Date;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.model.SystemProperties;
import org.compiere.util.CLogger;
import org.compiere.util.Ini;
import org.compiere.util.SecureEngine;
@ -245,8 +246,8 @@ public final class Prop implements Serializable {
public static String getFileName (boolean tryUserHome)
{
if (System.getProperty("PropertyHomeFile") != null)
return System.getProperty("PropertyHomeFile");
if (SystemProperties.getPropertyHomeFile() != null)
return SystemProperties.getPropertyHomeFile();
String base = null;
if (tryUserHome && Ini.isClient())
base = System.getProperty("user.home");

View File

@ -19,6 +19,7 @@ import org.adempiere.webui.apps.AEnv;
import org.compiere.model.MClientInfo;
import org.compiere.model.MImage;
import org.compiere.model.MSysConfig;
import org.compiere.model.SystemProperties;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
@ -71,7 +72,7 @@ public final class ThemeManager {
* @return name of active theme
*/
public static String getTheme() {
String theme = System.getProperty(MSysConfig.ZK_THEME);
String theme = SystemProperties.getZkTheme();
if (Util.isEmpty(theme))
theme = MSysConfig.getValue(MSysConfig.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
if (theme.equals(m_brokenTheme)) {

View File

@ -33,6 +33,7 @@ import org.adempiere.install.IDatabaseConfig;
import org.compiere.db.AdempiereDatabase;
import org.compiere.db.Database;
import org.compiere.install.ConfigurationData;
import org.compiere.model.SystemProperties;
import org.compiere.util.CLogger;
/**
@ -453,7 +454,7 @@ public class ConfigOracle implements IDatabaseConfig
log.info("OK: Database SQL Connection");
// OCI Test
if (System.getProperty("TestOCI", "N").equals("Y"))
if (SystemProperties.isTestOCI())
{
url = "jdbc:oracle:oci8:@" + databaseName;
pass = testJDBC(url, p_db.getSystemUser(), systemPassword);

View File

@ -45,6 +45,7 @@ import org.compiere.dbPort.Convert_Oracle;
import org.compiere.model.MColumn;
import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.model.SystemProperties;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
@ -367,8 +368,8 @@ public class DB_Oracle implements AdempiereDatabase
public String convertStatement (String oraStatement)
{
Convert.logMigrationScript(oraStatement, null);
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
String filterOrDebug = System.getProperty("org.idempiere.db.debug.filter");
if (SystemProperties.isDBDebug()) {
String filterOrDebug = SystemProperties.getDBDebugFilter();
boolean print = true;
if (filterOrDebug != null)
print = oraStatement.matches(filterOrDebug);
@ -417,7 +418,7 @@ public class DB_Oracle implements AdempiereDatabase
*/
public String getSystemUser()
{
String systemUser = System.getProperty("ADEMPIERE_DB_SYSTEM_USER");
String systemUser = SystemProperties.getAdempiereDBSystemUser();
if (systemUser == null)
systemUser = "system";
return systemUser;

View File

@ -2,6 +2,7 @@ package org.compiere.dbPort;
import java.util.ArrayList;
import org.compiere.model.SystemProperties;
import org.compiere.util.CLogger;
public class Convert_Oracle extends Convert {
@ -15,8 +16,8 @@ public class Convert_Oracle extends Convert {
protected ArrayList<String> convertStatement(String sqlStatement) {
ArrayList<String> result = new ArrayList<String>();
result.add(sqlStatement);
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
String filterOrDebug = System.getProperty("org.idempiere.db.debug.filter");
if (SystemProperties.isDBDebug()) {
String filterOrDebug = SystemProperties.getDBDebugFilter();
boolean print = true;
if (filterOrDebug != null)
print = sqlStatement.matches(filterOrDebug);

View File

@ -51,6 +51,7 @@ import org.compiere.dbPort.Convert_PostgreSQL;
import org.compiere.model.MColumn;
import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.model.SystemProperties;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@ -86,7 +87,7 @@ public class DB_PostgreSQL implements AdempiereDatabase
static
{
String property = System.getProperty(P_POSTGRE_SQL_NATIVE);
String property = SystemProperties.getPostgreSQLNative();
if (!Util.isEmpty(property, true) )
{
sysNative = "Y".equalsIgnoreCase(property);
@ -205,7 +206,7 @@ public class DB_PostgreSQL implements AdempiereDatabase
.append("/").append(connection.getDbName())
.append("?encoding=UNICODE&ApplicationName=iDempiere");
String urlParameters = System.getProperty("org.idempiere.postgresql.URLParameters");
String urlParameters = SystemProperties.getPostgresqlURLParameters();
if (!Util.isEmpty(urlParameters)) {
sb.append("&").append(urlParameters);
}
@ -229,7 +230,7 @@ public class DB_PostgreSQL implements AdempiereDatabase
.append(":").append(dbPort)
.append("/").append(dbName);
String urlParameters = System.getProperty("org.idempiere.postgresql.URLParameters") ;
String urlParameters = SystemProperties.getPostgresqlURLParameters();
if (!Util.isEmpty(urlParameters)) {
sb.append("?").append(urlParameters);
}
@ -351,8 +352,8 @@ public class DB_PostgreSQL implements AdempiereDatabase
String cache = convertCache.get(oraStatement);
if (cache != null) {
Convert.logMigrationScript(oraStatement, cache);
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
String filterPgDebug = System.getProperty("org.idempiere.db.debug.filter");
if (SystemProperties.isDBDebug()) {
String filterPgDebug = SystemProperties.getDBDebugFilter();
boolean print = true;
if (filterPgDebug != null)
print = cache.matches(filterPgDebug);
@ -407,7 +408,7 @@ public class DB_PostgreSQL implements AdempiereDatabase
*/
public String getSystemUser()
{
String systemUser = System.getProperty("ADEMPIERE_DB_SYSTEM_USER");
String systemUser = SystemProperties.getAdempiereDBSystemUser();
if (systemUser == null)
systemUser = "postgres";
return systemUser;

View File

@ -24,6 +24,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.compiere.db.DB_PostgreSQL;
import org.compiere.model.SystemProperties;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Util;
@ -141,8 +142,8 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
statement = recoverQuotedStrings(statement, retVars, nonce);
result.add(statement);
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
String filterPgDebug = System.getProperty("org.idempiere.db.debug.filter");
if (SystemProperties.isDBDebug()) {
String filterPgDebug = SystemProperties.getDBDebugFilter();
boolean print = true;
if (filterPgDebug != null)
print = statement.matches(filterPgDebug);

View File

@ -24,6 +24,7 @@ import java.util.Enumeration;
import org.compiere.Adempiere;
import org.compiere.model.ServerStateChangeEvent;
import org.compiere.model.ServerStateChangeListener;
import org.compiere.model.SystemProperties;
import org.compiere.util.CLogger;
import org.eclipse.osgi.framework.console.CommandProvider;
import org.osgi.framework.BundleActivator;
@ -76,7 +77,7 @@ public class Activator implements BundleActivator {
private static synchronized void createHazelCastInstance() {
File file = null;
//try idempiere home
String dataArea = System.getProperty("IDEMPIERE_HOME");
String dataArea = SystemProperties.getIdempiereHome();
if (dataArea != null && dataArea.trim().length() > 0) {
try {
file = new File(dataArea, "hazelcast.xml");