reorganize the management of the product preferences
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/org.eclipse.osbp.preferences.feature/feature.xml b/org.eclipse.osbp.preferences.feature/feature.xml
index 157845e..9e82256 100644
--- a/org.eclipse.osbp.preferences.feature/feature.xml
+++ b/org.eclipse.osbp.preferences.feature/feature.xml
@@ -17,7 +17,7 @@
label="%featureName"
version="0.9.0.qualifier"
provider-name="%providerName"
- plugin="org.eclipse.osbp.preferences">
+ plugin="org.eclipse.osbp.license">
<description>
%description
diff --git a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/APreferencePage.java b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/APreferencePage.java
index ea266fc..90ccf98 100644
--- a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/APreferencePage.java
+++ b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/APreferencePage.java
@@ -322,20 +322,22 @@
store.selectOsbpProductProject(((IJavaProject)element).getProject());
}
}
-
- @Override
- public boolean performOk() {
- checkAndUpdateMissingVendorDrivers();
- return super.performOk();
- }
-
- /**
- * Checks and updates if necessary the missing vendor driver configurations (features and plug-ins)
- * in the product configuration file.
- */
- public void checkAndUpdateMissingVendorDrivers(){
- store.updateMissingVendorDrivers();
- }
+
+ //TODO temporary disabling of automatic product file enrichment to be replaced
+ // with option button in the preferences pages
+// @Override
+// public boolean performOk() {
+// checkAndUpdateMissingVendorDrivers();
+// return super.performOk();
+// }
+//
+// /**
+// * Checks and updates if necessary the missing vendor driver configurations (features and plug-ins)
+// * in the product configuration file.
+// */
+// public void checkAndUpdateMissingVendorDrivers(){
+// store.updateMissingVendorDrivers();
+// }
}
\ No newline at end of file
diff --git a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/ATreeFieldEditor.java b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/ATreeFieldEditor.java
index 2f7846c..991e3cc 100644
--- a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/ATreeFieldEditor.java
+++ b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/ATreeFieldEditor.java
@@ -21,11 +21,12 @@
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.osbp.preferences.DataSourceConfiguration;
-import org.eclipse.osbp.preferences.EnumDatabaseVendor;
import org.eclipse.osbp.preferences.ItemDescription;
import org.eclipse.osbp.preferences.PersistenceUnitConfiguration;
import org.eclipse.osbp.preferences.Preference;
import org.eclipse.osbp.preferences.ProductConfigurationPrefs.DDL_GENERATION;
+import org.eclipse.osbp.preferences.databases.vendors.DatabaseVendor;
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor;
import org.eclipse.osbp.preferences.ui.constants.LicenseConstants;
import org.eclipse.osbp.preferences.ui.data.ProductConfigurationStore;
import org.eclipse.swt.SWT;
@@ -138,8 +139,8 @@
newEditor = comboEditor;
String selection = item.getText(EDITABLECOLUMN);
int index = 0;
- for (EnumDatabaseVendor vendor : EnumDatabaseVendor.values()) {
- String text = vendor.toString();
+ for (DatabaseVendor vendor : MasterDatabaseVendor.getSupportedDatabaseVendors()) {
+ String text = vendor.name();
comboEditor.add(text);
if (text.equals(selection)) {
comboEditor.select(index);
@@ -153,7 +154,7 @@
for(TreeItem temp : editor.getItem().getParentItem().getItems()){
// update the driver class
if(temp.getText().equals(DataSourceConfiguration.DataSourceItemDescription.DRIVER_CLASS)){
- EnumDatabaseVendor vendor = EnumDatabaseVendor.byName(comboEditor.getText());
+ DatabaseVendor vendor = MasterDatabaseVendor.byName(comboEditor.getText());
temp.setText(EDITABLECOLUMN, vendor.getDriverClass());
break;
}
@@ -193,7 +194,7 @@
}
editor.getItem().setText(EDITABLECOLUMN, comboEditor.getText());
// get the vendor from the list of defined jndi sources
- EnumDatabaseVendor vendor = ((ProductConfigurationStore)getPreferenceStore()).getExistingDataSourceVendor(comboEditor.getText());
+ DatabaseVendor vendor = ((ProductConfigurationStore)getPreferenceStore()).getExistingDataSourceVendor(comboEditor.getText());
for(TreeItem temp : editor.getItem().getParentItem().getItems()){
// update the batch writing
diff --git a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/DataSourcesFieldEditor.java b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/DataSourcesFieldEditor.java
index 9737a72..97a3ac8 100644
--- a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/DataSourcesFieldEditor.java
+++ b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/component/DataSourcesFieldEditor.java
@@ -19,9 +19,9 @@
import org.eclipse.osbp.preferences.DataSourceConfiguration;
import org.eclipse.osbp.preferences.DataSourceConfiguration.DataSourceItemDescription;
-import org.eclipse.osbp.preferences.EnumDatabaseVendor;
import org.eclipse.osbp.preferences.IItemDescribed;
import org.eclipse.osbp.preferences.ItemDescription;
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TreeDescribedItem;
import org.eclipse.swt.widgets.TreeItem;
@@ -52,7 +52,7 @@
IItemDescribed describedItem = (IItemDescribed) treeItem;
DataSourceConfiguration dataItem = new DataSourceConfiguration(
describedItem.getName(),
- EnumDatabaseVendor.byName(describedItem.getValue(DataSourceItemDescription.DATABASE_TYPE), "", ""),
+ MasterDatabaseVendor.byName(describedItem.getValue(DataSourceItemDescription.DATABASE_TYPE), "", ""),
describedItem.getValue(DataSourceItemDescription.SERVER_NAME),
ItemDescription.parseInt(describedItem.getValue(DataSourceItemDescription.SERVER_PORT), -1),
describedItem.getValue(DataSourceItemDescription.DATABASE_NAME),
diff --git a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/constants/LicenseConstants.java b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/constants/LicenseConstants.java
index 0752441..c164ffd 100644
--- a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/constants/LicenseConstants.java
+++ b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/constants/LicenseConstants.java
@@ -16,15 +16,15 @@
import java.util.List;
-import org.eclipse.osbp.preferences.EnumDatabaseVendor;
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor;
import com.google.common.collect.ImmutableList;
public interface LicenseConstants {
- final List<String> LICENSED_DATABASE_VENDORS = ImmutableList.of( EnumDatabaseVendor.ORACLE.getDriverVendor(),
- EnumDatabaseVendor.MYSQL.getDriverVendor(),
- EnumDatabaseVendor.MYSQL8.getDriverVendor(),
- EnumDatabaseVendor.MSSQL.getDriverVendor());
+ final List<String> LICENSED_DATABASE_VENDORS =
+ ImmutableList.of(MasterDatabaseVendor.ORACLE.getDriverVendor(),
+ MasterDatabaseVendor.MYSQL.getDriverVendor(), MasterDatabaseVendor.MYSQL8.getDriverVendor(),
+ MasterDatabaseVendor.MSSQL.getDriverVendor());
final String DATABASE_VENDOR = "{$DATABASE_VENDOR}";
final String LICENSE_TITLE_TEXT = "LICENSE";
final String LICENSE_MESSAGE_TEXT = "Please respect the " + DATABASE_VENDOR + " LICENSE!";
diff --git a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductConfigurationStore.java b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductConfigurationStore.java
index 1725c72..9ba7789 100644
--- a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductConfigurationStore.java
+++ b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductConfigurationStore.java
@@ -45,7 +45,6 @@
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.osbp.preferences.DataSourceConfiguration;
import org.eclipse.osbp.preferences.EntityMockConfiguration;
-import org.eclipse.osbp.preferences.EnumDatabaseVendor;
import org.eclipse.osbp.preferences.IProductConfigurationPrefs;
import org.eclipse.osbp.preferences.LocaleUtils;
import org.eclipse.osbp.preferences.PersistenceUnitConfiguration;
@@ -53,6 +52,8 @@
import org.eclipse.osbp.preferences.ProductConfiguration;
import org.eclipse.osbp.preferences.ProductConfigurationDefaultPrefs;
import org.eclipse.osbp.preferences.ProductConfigurationPrefs;
+import org.eclipse.osbp.preferences.databases.vendors.DatabaseVendor;
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor;
import org.eclipse.osbp.preferences.ui.component.APreferencePage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -199,7 +200,7 @@
return namesValues;
}
- public EnumDatabaseVendor getExistingDataSourceVendor(String jndiname) {
+ public DatabaseVendor getExistingDataSourceVendor(String jndiname) {
if(jndiname != null && !jndiname.isEmpty()){
Iterator<DataSourceConfiguration> it = prefs.getDataSources().iterator();
while(it.hasNext()){
@@ -209,7 +210,7 @@
}
}
}
- return EnumDatabaseVendor.ORACLE;
+ return MasterDatabaseVendor.ORACLE;
}
public String[][] getMockDataSelectItems() {
@@ -241,9 +242,11 @@
case PROJECT_WIZARD_ABSOLUTE_LOCATION: return prefsUsed.projectWizardUsesAbsoluteLocation();
case BPM_ENGINE_HIBERNATE_SHOW_SQL: return prefsUsed.isBpmEngineHibernateShowSql();
case BPM_ENGINE_HIBERNATE_FORMAT_SQL: return prefsUsed.isBpmEngineHibernateFormatSql();
+ case BPM_ENGINE_LOGGING: return prefsUsed.isBpmEngineLogging();
case HIDE_USERMENU: return prefsUsed.hideUserMenu();
+ case JAVA_POS_UPLOADED_BITMAPS: return prefsUsed.hasJavaPosUploadedBitmaps();
default:
- LOGGER.error(CASE_NOT_IMPLEMENTED);
+ LOGGER.debug(CASE_NOT_IMPLEMENTED);
}
LOGGER.error("no Product Configuration boolean attribute {} found", name);
return false;
@@ -264,9 +267,11 @@
case PROJECT_WIZARD_ABSOLUTE_LOCATION: prefs.setProjectWizardUsingAbsoluteLocation(value); return;
case BPM_ENGINE_HIBERNATE_SHOW_SQL: prefs.setBpmEngineHibernateShowSql(value); return;
case BPM_ENGINE_HIBERNATE_FORMAT_SQL: prefs.setBpmEngineHibernateFormatSql(value); return;
+ case BPM_ENGINE_LOGGING: prefs.setBpmEngineLogging(value);
case HIDE_USERMENU: prefs.setHideUserMenu(value); return;
+ case JAVA_POS_UPLOADED_BITMAPS: prefs.setJavaPosUploadedBitmaps(value);
default:
- LOGGER.error(CASE_NOT_IMPLEMENTED);
+ LOGGER.debug(CASE_NOT_IMPLEMENTED);
}
LOGGER.error("no Product Configuration boolean attribute {} found, could not set {}", name, value);
}
@@ -290,7 +295,7 @@
case HYBRID_REFRESH_PERSPECTIVE_INACTIVE: return prefsUsed.getHybridRefresherMilliSecsInactive();
case BPM_ENGINE_HIBERNATE_MAX_FETCH_DEPTH: return prefsUsed.getBpmEngineHibernateMaxFetchDepth();
default:
- LOGGER.error(CASE_NOT_IMPLEMENTED);
+ LOGGER.debug(CASE_NOT_IMPLEMENTED);
}
LOGGER.error("no Product Configuration integer attribute {} found", name);
return 0;
@@ -311,7 +316,7 @@
case HYBRID_REFRESH_PERSPECTIVE_INACTIVE: prefs.setHybridRefresherMilliSecsInactive(value); return;
case BPM_ENGINE_HIBERNATE_MAX_FETCH_DEPTH: prefs.setBpmEngineHibernateMaxFetchDepth(value); return;
default:
- LOGGER.error(CASE_NOT_IMPLEMENTED);
+ LOGGER.debug(CASE_NOT_IMPLEMENTED);
}
LOGGER.error("no Product Configuration integer attribute {} found, could not set {}", name, value);
}
@@ -394,6 +399,7 @@
case SELECT_PRODUCT_CONFIGURATION: return prefs.getName();
case ACTIVEMQ_BROKER_SERVER: return prefsUsed.getActiveMqBrokerServerName();
case BPM_ENGINE_SERVER: return prefsUsed.getBpmServerIp();
+ case BPM_ENGINE_INITIAL_PROCESS: return prefsUsed.getBpmInitialProcess();
case EMAIL_SERVER: return prefsUsed.getEmailServerIp();
case AUTHENTICATION_ADMIN_EMAIL: return prefsUsed.getAdminEmail();
case AUTHENTICATION_ADMIN_USERNAME: return prefsUsed.getAdminEmailUsername();
@@ -412,7 +418,7 @@
case JAVA_POS_PORT_CONFIGURATION: return prefsUsed.getJavaPosPortConfiguration();
case ENTITY_MOCK_DATA: return EntityMockConfiguration.serialize(prefsUsed.getEntityMockData());
default:
- LOGGER.error(CASE_NOT_IMPLEMENTED);
+ LOGGER.debug(CASE_NOT_IMPLEMENTED);
}
LOGGER.error("no Product Configuration string attribute {} found", name);
return "";
@@ -472,6 +478,7 @@
case SELECT_PRODUCT_CONFIGURATION: selectOsbpProductProject(value); return;
case ACTIVEMQ_BROKER_SERVER: prefs.setActiveMqBrokerServerName(value); return;
case BPM_ENGINE_SERVER: prefs.setBpmServerIp(value); return;
+ case BPM_ENGINE_INITIAL_PROCESS: prefs.setBpmInitialProcess(value); return;
case EMAIL_SERVER: prefs.setEmailServerIp(value); return;
case AUTHENTICATION_ADMIN_EMAIL: prefs.setAdminEmail(value); return;
case AUTHENTICATION_ADMIN_USERNAME: prefs.setAdminEmailUsername(value); return;
@@ -494,7 +501,7 @@
case JAVA_POS_PORT_CONFIGURATION: prefs.setJavaPosPortConfiguration(value); return;
case ENTITY_MOCK_DATA: prefs.setEntityMockData(value); return;
default:
- LOGGER.error(CASE_NOT_IMPLEMENTED);
+ LOGGER.debug(CASE_NOT_IMPLEMENTED);
}
LOGGER.error("no Product Configuration string attribute {} found, could not set {}", name, value);
}
@@ -542,7 +549,7 @@
InputStream fisSourceFile = new FileInputStream(file);
content = IOUtils.toString(fisSourceFile, "UTF-8");
if (content != null) {
- for(EnumDatabaseVendor vendor : prefs.getDataBaseVendors()){
+ for(DatabaseVendor vendor : prefs.getDataBaseVendors()){
if(!content.contains(vendor.getProductFeatures())) {
content = content.replace(" <features>", " <features>\n"+ vendor.getProductFeatures());
}
diff --git a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/page/PreferencePageBpmEngine.java b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/page/PreferencePageBpmEngine.java
index d971c82..cb11e0d 100644
--- a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/page/PreferencePageBpmEngine.java
+++ b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/page/PreferencePageBpmEngine.java
@@ -38,10 +38,12 @@
new Item(Type.SERVER, Preference.BPM_ENGINE_SERVER, "Server Name or IP"),
new Item(Type.INTEGER, Preference.BPM_ENGINE_PORT, "Port (default="+IProductConfigurationPrefs.DEFAULT_PORT_BPM_ENGINE+")"),
new Item(Type.INTEGER, Preference.BPM_ENGINE_TIMEOUT, "Timeout in msec"),
- new Item("Hibernate Settings"),
+ new Item(Type.TEXT, Preference.BPM_ENGINE_INITIAL_PROCESS, "Initial Process"),
+ new Item("Debug Settings"),
new Item(Type.BOOLEAN, Preference.BPM_ENGINE_HIBERNATE_SHOW_SQL, "Show SQL"),
new Item(Type.BOOLEAN, Preference.BPM_ENGINE_HIBERNATE_FORMAT_SQL, "Format SQL"),
new Item(Type.INTEGER, Preference.BPM_ENGINE_HIBERNATE_MAX_FETCH_DEPTH, "Max fetch depth"),
+ new Item(Type.BOOLEAN, Preference.BPM_ENGINE_LOGGING, "Process logging"),
};
}
}
diff --git a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/page/PreferencePagePeripheralDevices.java b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/page/PreferencePagePeripheralDevices.java
index 6584e77..406ca4f 100644
--- a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/page/PreferencePagePeripheralDevices.java
+++ b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/page/PreferencePagePeripheralDevices.java
@@ -35,7 +35,8 @@
new Item(""),
new Item("JavaPOS Settings"),
new Item(Type.TEXT, Preference.JAVA_POS_CONFIGURATION, "Configuration file"),
- new Item(Type.TEXT, Preference.JAVA_POS_PORT_CONFIGURATION, "Port")
+ new Item(Type.BOOLEAN, Preference.JAVA_POS_UPLOADED_BITMAPS, "Uploaded bitmaps"),
+ new Item(Type.TEXT, Preference.JAVA_POS_PORT_CONFIGURATION, "Remote service port")
};
}
diff --git a/org.eclipse.osbp.preferences/META-INF/MANIFEST.MF b/org.eclipse.osbp.preferences/META-INF/MANIFEST.MF
index f9bffb7..8993add 100644
--- a/org.eclipse.osbp.preferences/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.preferences/META-INF/MANIFEST.MF
@@ -4,7 +4,9 @@
Bundle-SymbolicName: org.eclipse.osbp.preferences
Bundle-Version: 0.9.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.eclipse.osbp.preferences;version="0.9.0"
+Export-Package: org.eclipse.osbp.preferences;version="0.9.0",
+ org.eclipse.osbp.preferences.databases.reservedkeywords,
+ org.eclipse.osbp.preferences.databases.vendors
Import-Package: javax.annotation,
javax.transaction,
org.apache.commons.io,
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/DataSourceConfiguration.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/DataSourceConfiguration.java
index 7ffc39f..1e7ec0e 100644
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/DataSourceConfiguration.java
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/DataSourceConfiguration.java
@@ -21,14 +21,13 @@
import java.util.Properties;
import java.util.TreeMap;
+import org.eclipse.osbp.preferences.databases.vendors.DatabaseVendor;
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor;
import org.joda.time.DateTimeZone;
import org.osgi.service.jdbc.DataSourceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-
-// TODO: Auto-generated Javadoc
/**
* Helper class containing DataSource configuration data needed for JPA and
* JDBC.
@@ -94,7 +93,7 @@
private String fName;
/** The data base vendor. */
- private EnumDatabaseVendor fDataBaseVendor;
+ private DatabaseVendor fDataBaseVendor;
/** The driver vendor. */
private String fDriverVendor;
@@ -169,7 +168,7 @@
*/
public DataSourceConfiguration(
String name,
- EnumDatabaseVendor dataBaseVendor,
+ DatabaseVendor dataBaseVendor,
String serverName, int serverPort,
String databaseName, String databaseUser, String databasePass) {
this(
@@ -212,7 +211,7 @@
*/
protected DataSourceConfiguration( // NOSONAR
String name,
- EnumDatabaseVendor dataBaseVendor,
+ DatabaseVendor dataBaseVendor,
String driverVendor, String driverType, String driverClass,
String serverName, int serverPort,
String databaseName, String databaseUser, String databasePass,
@@ -261,7 +260,7 @@
*/
protected DataSourceConfiguration( // NOSONAR
String name,
- EnumDatabaseVendor dataBaseVendor,
+ DatabaseVendor dataBaseVendor,
String driverVendor, String driverType, String driverClass,
String serverName, int serverPort,
String databaseName, String databaseUser, String databasePass,
@@ -303,7 +302,7 @@
@Override
public String getValue(String attribute) { // NOSONAR
switch (attribute) { // NOSONAR
- case DataSourceItemDescription.DATABASE_TYPE: return fDataBaseVendor.toString();
+ case DataSourceItemDescription.DATABASE_TYPE: return fDataBaseVendor.name();
case DataSourceItemDescription.DRIVER_CLASS: return fDriverClass;
case DataSourceItemDescription.SERVER_NAME: return fServerName;
case DataSourceItemDescription.SERVER_PORT: return ((Integer)fServerPort).toString();
@@ -322,7 +321,7 @@
public void setValue(String attribute, String value) {
switch (attribute) { // NOSONAR
case DataSourceItemDescription.DATABASE_TYPE: { // NOSONAR
- fDataBaseVendor = EnumDatabaseVendor.byName(value, value, value);
+ fDataBaseVendor = MasterDatabaseVendor.byName(value, value, value);
fDriverVendor = fDataBaseVendor.getDriverVendor();
fDriverType = fDataBaseVendor.getDriverType();
fDriverClass = fDataBaseVendor.getDriverClass();
@@ -455,7 +454,7 @@
*
* @return the database vendor
*/
- public EnumDatabaseVendor getDatabaseVendor() {
+ public DatabaseVendor getDatabaseVendor() {
return fDataBaseVendor;
}
@@ -477,26 +476,26 @@
* @return the default schema name
*/
public String getDefaultSchemaName() {
- switch (fDataBaseVendor) { // NOSONAR
- case H2_IN_MEMORY:
+ switch (fDataBaseVendor.name()) { // NOSONAR
+ case "H2_IN_MEMORY":
return getDatabaseName();
- case H2_LOCAL_FILE:
+ case "H2_LOCAL_FILE":
return getDatabaseName();
- case MSSQL:
+ case "MSSQL":
return "dbo";
- case MYSQL:
+ case "MYSQL":
return getDatabaseName();
- case MYSQL8:
+ case "MYSQL8":
return getDatabaseName();
- case ORACLE:
+ case "ORACLE":
return getDatabaseUser();
- case DERBY_IN_MEMORY:
+ case "DERBY_IN_MEMORY":
return "APP";
- case DERBY_LOCAL_FILE:
+ case "DERBY_LOCAL_FILE":
return "APP";
- case DERBY_CLIENT:
+ case "DERBY_CLIENT":
return getDatabaseUser();
- case POSTGRESQL:
+ case "POSTGRESQL":
return "public";
default:
break;
@@ -575,7 +574,7 @@
@Override
protected String _serialize() {
return fName
- +VALUE_SEPARATOR+fDataBaseVendor.toString()
+ +VALUE_SEPARATOR+fDataBaseVendor.name()
+VALUE_SEPARATOR+fDriverVendor
+VALUE_SEPARATOR+fDriverType
+VALUE_SEPARATOR+fDriverClass
@@ -599,7 +598,7 @@
String dataBaseName = (tokens.length < 8) ? "" : tokens[7];
return new DataSourceConfiguration( // NOSONAR
tokens[0],
- EnumDatabaseVendor.byName(vendorName, driverVendor, dataBaseName),
+ MasterDatabaseVendor.byName(vendorName, driverVendor, dataBaseName),
tokens[2],
tokens[3],
tokens[4],
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/EnumDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/EnumDatabaseVendor.java
deleted file mode 100644
index 025249c..0000000
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/EnumDatabaseVendor.java
+++ /dev/null
@@ -1,1032 +0,0 @@
-/******************************************************************************
- * *
- * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
- * *
- * All rights reserved. This program and the accompanying materials *
- * are made available under the terms of the Eclipse Public License v1.0 *
- * which accompanies this distribution, and is available at *
- * http://www.eclipse.org/legal/epl-v10.html *
- * *
- *============================================================================*
- * Initial contribution: *
- * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
- ******************************************************************************/
-package org.eclipse.osbp.preferences;
-
-import java.sql.Date;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-// TODO: Auto-generated Javadoc
-class VARIABLE { // NOSONAR
- protected static final String VENDOR = "%%VENDOR%%";
- protected static final String TYPE = "%%TYPE%%";
- protected static final String SERVER = "%%SERVER%%";
- protected static final String SERVERINSTANCE = "%%INSTANCE%%";
- protected static final String PORT = "%%PORT%%";
- protected static final String DATABASE = "%%DATABASE%%";
- protected static final String DATABASESCHEMA = "%%DATABASESCHEMA%%";
- protected static final String USERHOME = "%%USERHOME%%";
- protected static final String TIMEZONE = "%%TIMEZONE%%";
- protected static final String USERNAME = "%%USERNAME%%";
- protected static final String PASSWORD = "%%PASSWORD%%";
-}
-
-/**
- * The Enum EnumDatabaseVendor.
- */
-public enum EnumDatabaseVendor {
-
- /** The derby in memory. */
- /*
- * ... // http://hsqldb.org/doc/src/org/hsqldb/jdbc/JDBCDriver.html //
- * http://hsqldb.org/doc/guide/dbproperties-chapt.html HSQLDB_IN_MEMORY
- * ("hsqldb", "", "org.hsqldb.jdbc.JDBCDriver",
- * "jdbc:hsqldb:mem:"+VARIABLE.DATABASE //
- * http://h2database.com/html/features.html#execute_sql_on_connection
- * +";INIT=" // create schema on initial startup //
- * http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#
- * dbc_schemas_schema_objects //
- * http://www.hsqldb.org/doc/guide/ch09.html#N11DB1
- * //+"ALTER SCHEMA PUBLIC RENAME TO "+VARIABLE.DATABASE
- * //+"CREATE SCHEMA IF NOT EXISTS "+VARIABLE.DATABASE // SEPARATOR between
- * multipe SQL commandos //+"\\;" // use this schema as default
- * +"SET SCHEMA "+VARIABLE.DATABASE // SEPARATOR between multipe SQL
- * commandos +"", "JDBC",
- * "driverType, URL, description, logWriter, loginTimeout, password, passwordChars, url, user"
- * ), // http://www.h2database.com/html/features.html#database_url
- * HSQLDB_LOCAL_FILE ("hsqldb", "", "org.hsqldb.jdbc.JDBCDriver",
- * "jdbc:hsqldb:file:"+VARIABLE.USERHOME+"/"+VARIABLE.DATABASE //
- * http://h2database.com/html/features.html#execute_sql_on_connection
- * +";INIT=" // create schema on initial startup //
- * http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#
- * dbc_schemas_schema_objects //
- * http://www.hsqldb.org/doc/guide/ch09.html#N11DB1
- * //+"ALTER SCHEMA PUBLIC RENAME TO "+VARIABLE.DATABASE
- * //+"CREATE SCHEMA IF NOT EXISTS "+VARIABLE.DATABASE // SEPARATOR between
- * multipe SQL commandos //+"\\;" // use this schema as default
- * +"SET SCHEMA "+VARIABLE.DATABASE // SEPARATOR between multipe SQL
- * commandos +"", "JDBC",
- * "driverType, URL, description, logWriter, loginTimeout, password, passwordChars, url, user"
- * ),
- */
- DERBY_IN_MEMORY(true, "derby", "", "org.apache.derby.jdbc.EmbeddedDriver", "jdbc:derby:memory:" + VARIABLE.DATABASE
- // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlp17453.html
- // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlpinmemdb.html
- // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlp40653.html
- + ";create=true" + "",
- "JDBC",
- "attributesAsPassword, connectionAttributes, createDatabase, dataSourceName, databaseName, description, logWriter, loginTimeout, password, shutdownDatabase, user",
- "org.hibernate.dialect.DerbyTenSevenDialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.derby\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"org.eclipse.osbp.dependencies.feature.derby\"/>",
- "id int", "uuid String",
- // according to https://db.apache.org/derby/docs/10.8/ref/rrefidlengthlimits.html
- 128, 128, 128) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_DERBY);
- }
- /**
- * Init database vendor specific properties
- * @return
- */
- @Override
- public Properties initSpecificProperties() {
- Properties properties = new Properties();
- properties.put("createDatabase", "create");
- return properties;
- }
- },
- // https://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
- /** The derby local file. */
- // https://db.apache.org/derby/integrate/plugin_help/derby_app.html
- DERBY_LOCAL_FILE(false, "derby", "", "org.apache.derby.jdbc.EmbeddedDriver",
- "jdbc:derby:directory:" + VARIABLE.DATABASE
- // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlp17453.html
- // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlpinmemdb.html
- // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlp40653.html
- + ";create=true" + "",
- "JDBC",
- // "URL, " +
- "attributesAsPassword, connectionAttributes, createDatabase, dataSourceName, databaseName, description, logWriter, loginTimeout, password, shutdownDatabase, user",
- "org.hibernate.dialect.DerbyTenSevenDialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.derby\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"org.eclipse.osbp.dependencies.feature.derby\"/>",
- "id int", "uuid String",
- // according to https://db.apache.org/derby/docs/10.8/ref/rrefidlengthlimits.html
- 128, 128, 128) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_DERBY);
- }
- @Override
- public String applySchemaNameSpecifications(String databaseName, String userName) {
- // remove '/' oder '\'
- return databaseName.replaceAll("[/\\\\\\.:]", "");
- }
- /**
- * Init database vendor specific properties
- * @return
- */
- @Override
- public Properties initSpecificProperties() {
- Properties properties = new Properties();
- properties.put("createDatabase", "create");
- return properties;
- }
- },
- // https://karussell.wordpress.com/2009/06/09/hibernate-cfg-xml-settings-for-derby-oracle-and-h2/
- /** The derby client. */
- // https://db.apache.org/derby/integrate/plugin_help/derby_app.html
- DERBY_CLIENT(false, "derby", "", "org.apache.derby.jdbc.ClientDriver",
- "jdbc:derby://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + "/" + VARIABLE.DATABASE + ";create=true",
- "JDBC",
- // "URL, " +
- "connectionAttributes, createDatabase, dataSourceName, databaseName, description, logWriter, loginTimeout, maxStatements, password, portNumber,"
- +" retrieveMessageText, securityMechanism, serverName, shutdownDatabase, ssl, traceDirectory, traceFile, traceFileAppend, traceLevel, user",
- "org.hibernate.dialect.DerbyDialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.derby\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"org.eclipse.osbp.dependencies.feature.derby\"/>",
- "id int", "uuid String",
- // according to https://db.apache.org/derby/docs/10.8/ref/rrefidlengthlimits.html
- 128, 128, 128) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_DERBY);
- }
- /**
- * Init database vendor specific properties
- * @return
- */
- @Override
- public Properties initSpecificProperties() {
- Properties properties = new Properties();
- properties.put("createDatabase", "create");
- return properties;
- }
- },
-
- /** The h2 in memory. */
- // http://www.h2database.com/html/features.html#in_memory_databases
- H2_IN_MEMORY(true, "h2", "", "org.h2.Driver", "jdbc:h2:mem:" + VARIABLE.DATABASE
- // http://h2database.com/html/features.html#execute_sql_on_connection
- + ";DB_CLOSE_DELAY=-1"
- + ";INIT="
- // create schema on initial startup
- + "CREATE SCHEMA IF NOT EXISTS " + VARIABLE.DATABASESCHEMA
- // SEPARATOR between multipe SQL commandos
- + "\\;"
- // use this schema as default
- + "SET SCHEMA " + VARIABLE.DATABASESCHEMA
- // SEPARATOR between multipe SQL commandos
- + "\\;"
- + "SET AUTOCOMMIT=TRUE"
- // http://h2database.com/html/features.html#auto_mixed_mode
- // H2 can't mix memory AND AUTO-SERVER - +";AUTO_SERVER=TRUE"
- // http://h2database.com/html/features.html#in_memory_databases
- + "",
- "JDBC",
- "driverType, URL, description, logWriter, loginTimeout, password, passwordChars, user",
- "org.hibernate.dialect.H2Dialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.h2\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"org.eclipse.osbp.dependencies.feature.h2\"/>",
- /** do NOT use <code>int</code> for id in H2, because table SEQUENCE doesn't exist also discussed at http://stackoverflow.com/questions/9909893/jpa-how-to-annotate-id-so-its-autoincrements-without-sequence-table*/
- "/** do NOT use <code>int</code> for id in H2, because table SEQUENCE doesn't exist */ uuid String",
- "uuid String",
- // only for convenience, normally no limit according to
- // http://www.h2database.com/html/advanced.html#limits_limitations
- 128, 128, 128) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_H2);
- }
-
- /**
- * in H2 there are no schema names!
- */
- @Override
- public String applySchemaNameSpecifications(String databaseName, String userName) {
- return "DEFAULT";
- }
-
- @Override
- public String convertToDateSQL(Date date) {
- return "'"+date.toString().replace(".0","")+"'";
- }
-
- @Override
- public String convertToTimestampSQL(Timestamp date) {
- return "'"+date.toString().replace(".0","")+"'";
- }
-
- },
-
- /** The h2 local file. */
- // http://www.h2database.com/html/features.html#database_url
- H2_LOCAL_FILE(false, "h2", "", "org.h2.Driver", "jdbc:h2:file:" + VARIABLE.DATABASE
- // http://h2database.com/html/features.html#execute_sql_on_connection
- + ";INIT="
- // create schema on initial startup
- + "CREATE SCHEMA IF NOT EXISTS " + VARIABLE.DATABASESCHEMA
- // SEPARATOR between multipe SQL commandos
- + "\\;"
- // use this schema as default
- + "SET SCHEMA " + VARIABLE.DATABASESCHEMA
- // SEPARATOR between multipe SQL commandos
- + "\\;"
- + "SET AUTOCOMMIT=TRUE"
- // http://h2database.com/html/features.html#auto_mixed_mode
- + "",
- "JDBC",
- "URL, description, logWriter, loginTimeout, password, passwordChars, user",
- "org.hibernate.dialect.H2Dialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.h2\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"org.eclipse.osbp.dependencies.feature.h2\"/>",
- /** do NOT use <code>int</code> for id in H2, because table SEQUENCE doesn't exist also discussed at http://stackoverflow.com/questions/9909893/jpa-how-to-annotate-id-so-its-autoincrements-without-sequence-table*/
- "/** do NOT use <code>int</code> for id in H2, because table SEQUENCE doesn't exist */ uuid String",
- "uuid String",
- // only for convenience, normally no limit according to
- // http://www.h2database.com/html/advanced.html#limits_limitations
- 128, 128, 128) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_H2);
- }
-
- /**
- * in H2 there are no schema names!
- */
- @Override
- public String applySchemaNameSpecifications(String databaseName, String userName) {
- return "DEFAULT";
- }
-
- @Override
- public String convertToDateSQL(Date date) {
- return "'"+date.toString().replace(".0","")+"'";
- }
-
- @Override
- public String convertToTimestampSQL(Timestamp date) {
- return "'"+date.toString().replace(".0","")+"'";
- }
-
- },
-
- //jdbc:sqlserver://<server>:<port>;databaseName=<databasename>
-
- /** The mssql. */
- MSSQL(false, "sqlserver", "thin", "com.microsoft.sqlserver.jdbc.SQLServerDriver",
- "jdbc:sqlserver://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + ";databaseName=" + VARIABLE.DATABASE +";instanceName=" + VARIABLE.SERVERINSTANCE + ";trustServerCertificate=true;Integrated Security=false;",
- "JDBC",
- "FIPS, FIPSProvider, GSSCredentials, JASSConfigurationName, URL, accessToken, applicationIntent, applicationName, authentication, authenticationScheme,"
- +" columnEncryptionSetting, databaseName, description, enablePrepareOnFirstPreparedStatementCall, encrypt, failoverPartner, hostNameInCertificate,"
- +" instanceName, integratedSecurity, keyStoreAuthentication, keyStoreLocation, keyStoreSecret, lastUpdateCount, lockTimeout, logWriter, loginTimeout,"
- +" multiSubnetFailover, packetSize, password, portNumber, queryTimeout, responseBuffering, selectMethod, sendStringParametersAsUnicode, sendTimeAsDatetime,"
- +" serverName, serverNameAsACE, serverPreparedStatementDiscardThreshold, serverSpn, socketTimeout, transparentNetworkIPResolution, trustServerCertificate,"
- +" trustStore, trustStorePassword, trustStoreType, user, workstationID, xopenStates",
- "org.hibernate.dialect.SQLServerDialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.mssql\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"org.osbee.technologystack.mssql.feature\"/>\n",
- "id int",
- "uuid String",
- // according to https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
- 64, 64, 64) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_MYSQL);
- }
-
-
- @Override
- public String convertToDateSQL(Date date) {
- return "cast('"+date.toString().replace(".0","")+"' as datetime)";
- }
-
- @Override
- public String convertToTimestampSQL(Timestamp date) {
- return "cast('"+date.toString().replace(".0","")+"' as datetime2)";
- }
-
- /**
- * in sqlserver use the default schema 'dbo'
- */
- @Override
- public String applySchemaNameSpecifications(String databaseName, String userName) {
- return "dbo";
- }
-
- },
- // see samples
- // -
- // http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html
- // -
- // http://www.mkyong.com/jdbc/how-to-connect-to-mysql-with-jdbc-driver-java/
- /** The mysql. */
- // - http://www.vogella.com/tutorials/MySQLJava/article.html
- MYSQL(false, "mysql", "thin", "com.mysql.jdbc.Driver",
- "jdbc:mysql://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + "/" + VARIABLE.DATABASE + "?useSSL=false&useLegacyDatetimeCode=false&serverTimezone=" + VARIABLE.TIMEZONE, "JDBC",
- "URL, allowLoadLocalInfile, allowMasterDownConnections, allowMultiQueries, allowNanAndInf, allowUrlInLocalInfile, alwaysSendSetIsolation," +
- " authenticationPlugins, autoClosePStmtStreams, autoDeserialize, autoGenerateTestcaseScript, autoReconnect, autoReconnectForConnectionPools," +
- " autoReconnectForPools, autoSlowLog, blobsAreStrings, cacheCallableStatements, cacheCallableStmts, cachePrepStmts, cachePreparedStatements," +
- " cacheResultSetMetadata, cacheServerConfiguration, callableStatementCacheSize, callableStmtCacheSize, capitalizeDBMDTypes, capitalizeTypeNames," +
- " characterEncoding, characterSetResults, clientCertificateKeyStorePassword, clientCertificateKeyStoreType, clientCertificateKeyStoreUrl," +
- " clientInfoProvider, clobCharacterEncoding, clobberStreamingResults, compensateOnDuplicateKeyUpdateCounts, connectTimeout, connectionAttributes," +
- " connectionCollation, connectionLifecycleInterceptors, continueBatchOnError, createDatabaseIfNotExist, databaseName, defaultAuthenticationPlugin," +
- " defaultFetchSize, detectCustomCollations, detectServerPreparedStmts, disabledAuthenticationPlugins, disconnectOnExpiredPasswords, dontTrackOpenResources," +
- " dumpMetadataOnColumnNotFound, dumpQueriesOnException, dynamicCalendars, elideSetAutoCommits, emptyStringsConvertToZero, emulateLocators," +
- " emulateUnsupportedPstmts, enablePacketDebug, enableQueryTimeouts, encoding, exceptionInterceptors, explainSlowQueries, failOverReadOnly," +
- " functionsNeverReturnBlobs, gatherPerfMetrics, gatherPerformanceMetrics, generateSimpleParameterMetadata, getProceduresReturnsFunctions," +
- " holdResultsOpenOverStatementClose, ignoreNonTxTables, includeInnodbStatusInDeadlockExceptions, includeThreadDumpInDeadlockExceptions," +
- " includeThreadNamesAsStatementComment, initialTimeout, interactiveClient, isInteractiveClient, jdbcCompliantTruncation, jdbcCompliantTruncationForReads," +
- " largeRowSizeThreshold, loadBalanceAutoCommitStatementRegex, loadBalanceAutoCommitStatementThreshold, loadBalanceBlacklistTimeout, " +
- " loadBalanceConnectionGroup, loadBalanceEnableJMX, loadBalanceExceptionChecker, loadBalancePingTimeout, loadBalanceSQLExceptionSubclassFailover," +
- " loadBalanceSQLStateFailover, loadBalanceStrategy, loadBalanceValidateConnectionOnSwapServer, localSocketAddress, logSlowQueries, logWriter," +
- " logXaCommands, logger, loggerClassName, loginTimeout, maintainTimeStats, maxAllowedPacket, maxQuerySizeToLog, maxReconnects, maxRows," +
- " metadataCacheSize, netTimeoutForStreamingResults, noAccessToProcedureBodies, noDatetimeStringSync, noTimezoneConversionForTimeType," +
- " nullCatalogMeansCurrent, nullNamePatternMatchesAll, overrideSupportsIntegrityEnhancementFacility, packetDebugBufferSize, padCharsWithSpace," +
- " paranoid, parseInfoCacheFactory, password, passwordCharacterEncoding, pedantic, pinGlobalTxToPhysicalConnection, populateInsertRowWithDefaultValues," +
- " port, portNumber, prepStmtCacheSize, prepStmtCacheSqlLimit, preparedStatementCacheSize, preparedStatementCacheSqlLimit, processEscapeCodesForPrepStmts," +
- " profileSQL, profileSql, profilerEventHandler, propertiesTransform, propertiesViaRef, queriesBeforeRetryMaster, queryTimeoutKillsConnection," +
- " reconnectAtTxEnd, relaxAutoCommit, replicationEnableJMX, reportMetricsIntervalMillis, requireSSL, resourceId, resultSetSizeThreshold," +
- " retainStatementAfterResultSetClose, retriesAllDown, rewriteBatchedStatements, rollbackOnPooledClose, roundRobinLoadBalance, runningCTS13," +
- " secondsBeforeRetryMaster, selfDestructOnPingMaxOperations, selfDestructOnPingSecondsLifetime, serverConfigCacheFactory, serverName," +
- " serverTimezone, sessionVariables, slowQueryThresholdMillis, slowQueryThresholdNanos, socketFactory, socketFactoryClassName, socketTimeout," +
- " statementInterceptors, strictFloatingPoint, strictUpdates, tcpKeepAlive, tcpNoDelay, tcpRcvBuf, tcpSndBuf, tcpTrafficClass, tinyInt1isBit," +
- " traceProtocol, transformedBitIsBoolean, treatUtilDateAsTimestamp, trustCertificateKeyStorePassword, trustCertificateKeyStoreType," +
- " trustCertificateKeyStoreUrl, ultraDevHack, url, useAffectedRows, useBlobToStoreUTF8OutsideBMP, useColumnNamesInFindColumn, useCompression," +
- " useConfigs, useCursorFetch, useDirectRowUnpack, useDynamicCharsetInfo, useFastDateParsing, useFastIntParsing, useGmtMillisForDatetimes," +
- " useHostsInPrivileges, useInformationSchema, useJDBCCompliantTimezoneShift, useJvmCharsetConverters, useLegacyDatetimeCode, useLocalSessionState," +
- " useLocalTransactionState, useNanosForElapsedTime, useOldAliasMetadataBehavior, useOldUTF8Behavior, useOnlyServerErrorMessages, useReadAheadInput," +
- " useSSL, useSSPSCompatibleTimezoneShift, useServerPrepStmts, useServerPreparedStmts, useSqlStateCodes, useStreamLengthsInPrepStmts, useTimezone," +
- " useUltraDevWorkAround, useUnbufferedInput, useUnicode, useUsageAdvisor, user, utf8OutsideBmpExcludedColumnNamePattern," +
- " utf8OutsideBmpIncludedColumnNamePattern, verifyServerCertificate, yearIsDateType, zeroDateTimeBehavior",
- "org.hibernate.dialect.MySQLDialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.mysql\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"org.osbee.technologystack.mysql.feature\"/>\n",
- "id int",
- "uuid String",
- // according to https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
- 64, 64, 64) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_MYSQL);
- }
-
- @Override
- public String getToDateSQLMethod() {
- return "str_to_date";
-
- }
-
- @Override
- public String getToTimestampSQLMethod() {
- return "str_to_date";
- }
-
- @Override
- public String convertToDateSQL(Date date) {
- return "str_to_date('"+date.toString().replace(".0","")+"','%Y-%m-%d')";
- }
-
- @Override
- public String convertToTimestampSQL(Timestamp date) {
- return "str_to_date('"+date.toString().replace(".0","")+"','%Y-%m-%d %H:%i:%s')";
- }
-
- },
- // see samples
- // -
- // http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html
- // -
- // http://www.mkyong.com/jdbc/how-to-connect-to-mysql-with-jdbc-driver-java/
- /** The mysql8. */
- // - http://www.vogella.com/tutorials/MySQLJava/article.html
- MYSQL8(false, "mysql8", "thin", "com.mysql.cj.jdbc.Driver",
- "jdbc:mysql://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + "/" + VARIABLE.DATABASE + "?useSSL=false&AllowPublicKeyRetrieval=true&useLegacyDatetimeCode=false&serverTimezone=" + VARIABLE.TIMEZONE, "JDBC",
- "URL, allowLoadLocalInfile, allowMasterDownConnections, allowMultiQueries, allowNanAndInf, allowPublicKeyRetrieval, allowUrlInLocalInfile, alwaysSendSetIsolation, authenticationPlugins, autoClosePStmtStreams, autoDeserialize, autoGenerateTestcaseScript, autoReconnect, autoReconnectForConnectionPools, autoReconnectForPools, autoSlowLog, blobsAreStrings, cacheCallableStatements, cacheCallableStmts, cachePrepStmts, cachePreparedStatements, cacheResultSetMetadata, cacheServerConfiguration, callableStatementCacheSize, callableStmtCacheSize, capitalizeDBMDTypes, capitalizeTypeNames, characterEncoding, characterSetResults, clientCertificateKeyStorePassword, clientCertificateKeyStoreType, clientCertificateKeyStoreUrl, clientInfoProvider, clobCharacterEncoding, clobberStreamingResults, compensateOnDuplicateKeyUpdateCounts, connectTimeout, connectionAttributes, connectionCollation, connectionLifecycleInterceptors, continueBatchOnError, createDatabaseIfNotExist, databaseName, defaultAuthenticationPlugin, defaultFetchSize, detectCustomCollations, detectServerPreparedStmts, disabledAuthenticationPlugins, disconnectOnExpiredPasswords, dontTrackOpenResources, dumpMetadataOnColumnNotFound, dumpQueriesOnException, dynamicCalendars, elideSetAutoCommits, emptyStringsConvertToZero, emulateLocators, emulateUnsupportedPstmts, enablePacketDebug, enableQueryTimeouts, encoding, exceptionInterceptors, explainSlowQueries, failOverReadOnly, functionsNeverReturnBlobs, gatherPerfMetrics, gatherPerformanceMetrics, generateSimpleParameterMetadata, getProceduresReturnsFunctions, holdResultsOpenOverStatementClose, ignoreNonTxTables, includeInnodbStatusInDeadlockExceptions, includeThreadDumpInDeadlockExceptions, includeThreadNamesAsStatementComment, initialTimeout, interactiveClient, isInteractiveClient, jdbcCompliantTruncation, jdbcCompliantTruncationForReads, largeRowSizeThreshold, loadBalanceAutoCommitStatementRegex, loadBalanceAutoCommitStatementThreshold, loadBalanceBlacklistTimeout, loadBalanceConnectionGroup, loadBalanceEnableJMX, loadBalanceExceptionChecker, loadBalancePingTimeout, loadBalanceSQLExceptionSubclassFailover, loadBalanceSQLStateFailover, loadBalanceStrategy, loadBalanceValidateConnectionOnSwapServer, localSocketAddress, logSlowQueries, logWriter, logXaCommands, logger, loggerClassName, loginTimeout, maintainTimeStats, maxAllowedPacket, maxQuerySizeToLog, maxReconnects, maxRows, metadataCacheSize, netTimeoutForStreamingResults, noAccessToProcedureBodies, noDatetimeStringSync, noTimezoneConversionForTimeType, nullCatalogMeansCurrent, nullNamePatternMatchesAll, overrideSupportsIntegrityEnhancementFacility, packetDebugBufferSize, padCharsWithSpace, paranoid, parseInfoCacheFactory, password, passwordCharacterEncoding, pedantic, pinGlobalTxToPhysicalConnection, populateInsertRowWithDefaultValues, port, portNumber, prepStmtCacheSize, prepStmtCacheSqlLimit, preparedStatementCacheSize, preparedStatementCacheSqlLimit, processEscapeCodesForPrepStmts, profileSQL, profileSql, profilerEventHandler, propertiesTransform, propertiesViaRef, queriesBeforeRetryMaster, queryTimeoutKillsConnection, reconnectAtTxEnd, relaxAutoCommit, replicationEnableJMX, reportMetricsIntervalMillis, requireSSL, resourceId, resultSetSizeThreshold, retainStatementAfterResultSetClose, retriesAllDown, rewriteBatchedStatements, rollbackOnPooledClose, roundRobinLoadBalance, runningCTS13, secondsBeforeRetryMaster, selfDestructOnPingMaxOperations, selfDestructOnPingSecondsLifetime, serverConfigCacheFactory, serverName, serverTimezone, sessionVariables, slowQueryThresholdMillis, slowQueryThresholdNanos, socketFactory, socketFactoryClassName, socketTimeout, statementInterceptors, strictFloatingPoint, strictUpdates, tcpKeepAlive, tcpNoDelay, tcpRcvBuf, tcpSndBuf, tcpTrafficClass, tinyInt1isBit, traceProtocol, transformedBitIsBoolean, treatUtilDateAsTimestamp, trustCertificateKeyStorePassword, trustCertificateKeyStoreType, trustCertificateKeyStoreUrl, ultraDevHack, url, useAffectedRows, useBlobToStoreUTF8OutsideBMP, useColumnNamesInFindColumn, useCompression, useConfigs, useCursorFetch, useDirectRowUnpack, useDynamicCharsetInfo, useFastDateParsing, useFastIntParsing, useGmtMillisForDatetimes, useHostsInPrivileges, useInformationSchema, useJDBCCompliantTimezoneShift, useJvmCharsetConverters, useLegacyDatetimeCode, useLocalSessionState, useLocalTransactionState, useNanosForElapsedTime, useOldAliasMetadataBehavior, useOldUTF8Behavior, useOnlyServerErrorMessages, useReadAheadInput, useSSL, useSSPSCompatibleTimezoneShift, useServerPrepStmts, useServerPreparedStmts, useSqlStateCodes, useStreamLengthsInPrepStmts, useTimezone, useUltraDevWorkAround, useUnbufferedInput, useUnicode, useUsageAdvisor, user, utf8OutsideBmpExcludedColumnNamePattern, utf8OutsideBmpIncludedColumnNamePattern, verifyServerCertificate, yearIsDateType, zeroDateTimeBehavior",
- "org.hibernate.dialect.MySQLDialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.mysql8\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"org.osbee.technologystack.mysql8.feature\"/>\n",
- "id int",
- "uuid String",
- // according to https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
- 64, 64, 64) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_MYSQL);
- }
-
- @Override
- public String getToDateSQLMethod() {
- return "str_to_date";
-
- }
-
- @Override
- public String getToTimestampSQLMethod() {
- return "str_to_date";
- }
-
- @Override
- public String convertToDateSQL(Date date) {
- return "str_to_date('"+date.toString().replace(".0","")+"','%Y-%m-%d')";
- }
-
- @Override
- public String convertToTimestampSQL(Timestamp date) {
- return "str_to_date('"+date.toString().replace(".0","")+"','%Y-%m-%d %H:%i:%s')";
- }
-
- },
-
- // -
- // https://jdbc.postgresql.org/documentation/80/index.html
- // -
- POSTGRESQL(false, "postgresql", "thin", "org.postgresql.Driver",
- "jdbc:postgresql://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + "/" + VARIABLE.DATABASE + "?ssl=false",
- "JDBC",
- "allowEncodingChanges, applicationName, assumeMinServerVersion, autosave, binaryTransfer, binaryTransferDisable, binaryTransferEnable,"
- + "cancelSignalTimeout, connectTimeout, currentSchema, databaseMetadataCacheFields, databaseMetadataCacheFieldsMiB, databaseName, defaultAutoCommit,"
- +"defaultRowFetchSize, disableColumnSanitiser, fromReference, gssLib, hostRecheckSeconds, jaasApplicationName, jaasLogin, kerberosServerName, "
- +"loadBalanceHosts, logUnclosedConnections, logWriter, loggerFile, loggerLevel, loginTimeout, password, portNumber, preferQueryMode, prepareThreshold,"
- +"preparedStatementCacheQueries, preparedStatementCacheSizeMiB, protocolVersion, reWriteBatchedInserts, readOnly, receiveBufferSize, replication,"
- +"sendBufferSize, serverName, socketFactory, socketFactoryArg, socketTimeout, ssl, sslCert, sslFactoryArg, sslHostnameVerifier, sslKey, sslMode,"
- +"sslPassword, sslPasswordCallback, sslRootCert, sslfactory, sspiServiceClass, stringType, targetServerType, tcpKeepAlive, unknownLength, url, useSpNego, user",
- "org.hibernate.dialect.PostgreSQLDialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.postgresql\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"org.eclipse.osbp.technologystack.postgresql.feature\"/>\n",
- "id int",
- "uuid String",
- // according to https://wiki.postgresql.org/wiki/PostgreSQL_vs_SQL_Standard#Identifier_lengths
- 18, 18, 18) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_POSTGRESQL);
- }
-
- /* see https://jdbc.postgresql.org/documentation/80/escapes-datetime.html */
- @Override
- public String convertToDateSQL(Date date) {
- return "{d '" + date.toString()+"'}";
- }
-
- @Override
- public String convertToTimestampSQL(Timestamp date) {
- return "{ts'"+date.toString()+"'}";
- }
-
- /**
- * in postgreSQL we use the default schema 'public'
- */
- @Override
- public String applySchemaNameSpecifications(String databaseName, String userName) {
- return "public";
- }
- },
-
- /** The oracle. */
- ORACLE(false, "oracle", "thin", "oracle.jdbc.OracleDriver",
- "jdbc:" + VARIABLE.VENDOR + ":" + VARIABLE.TYPE + ":@" + VARIABLE.SERVER + ":" + VARIABLE.PORT + ":"
- + VARIABLE.DATABASE,
- "Oracle-JDBC",
- "ONSConfiguration, TNSEntryName, URL, connectionCacheName, connectionCacheProperties, connectionCachingEnabled, connectionProperties,"
- +"dataSourceName, databaseName, description, driverType, explicitCachingEnabled, fastConnectionFailoverEnabled, implicitCachingEnabled,"
- +"logWriter, loginTimeout, maxStatements, networkProtocol, password, portNumber, serverName, serviceName, user",
- "org.hibernate.dialect.Oracle10gDialect",
- " <plugin id=\"org.eclipse.gemini.dbaccess.oracle\" autoStart=\"true\" startLevel=\"2\" />",
- " <feature id=\"net.osbee.dependencies.feature.oracle\"/>\n",
- "id int",
- "uuid String",
- // according to https://oracle-base.com/articles/12c/long-identifiers-12cr2#backwards-compatibility
- 30, 30, 30) {
- @Override
- public String applySqlSpecifications(String sqlStatement) {
- return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_ORACLE);
- }
-
-
- @Override
- public String getToTimestampSQLMethod() {
- return "to_timestamp";
- }
-
- @Override
- public String convertToTimestampSQL(Timestamp date) {
- return "to_timestamp('"+date.toString().replace(".0","")+"','YYYY-MM-DD HH24:MI:SS')";
- }
-
- /**
- * in ORACLE the schema name is the user name
- */
- @Override
- public String applySchemaNameSpecifications(String databaseName, String userName) {
- return userName;
- }
- };
-
- /** The is in memory. */
- private final boolean fIsInMemory;
-
- /** The driver vendor. */
- private final String fDriverVendor;
-
- /** The driver type. */
- private final String fDriverType;
-
- /** The driver class. */
- private final String fDriverClass;
-
- /** The jdbc url format. */
- private final String fJdbcUrlFormat;
-
- /** The persistence batch writing. */
- private final String fPersistenceBatchWriting;
-
- /** The hibernate dialect. */
- private final String fHibernateDialect;
-
- /** The product features. */
- private final String fProductFeatures;
-
- /** The product configurations. */
- private final String fProductConfigurations;
-
- /** The entity property base ID. */
- private final String fEntityPropertyBaseID;
-
- /** The entity property base UUID. */
- private final String fEntityPropertyBaseUUID;
-
- /** The property keys. */
- private final List<String> fPropertyKeys;
-
- /** The table identifier length*/
- private final int fTableNameLength;
-
- /** The column identifier length*/
- private final int fColumnNameLength;
-
- /** The index identifier length*/
- private final int fIndexNameLength;
-
- public int getfTableNameLength() {
- return fTableNameLength;
- }
-
- public int getfColumnNameLength() {
- return fColumnNameLength;
- }
-
- public int getfIndexNameLength() {
- return fIndexNameLength;
- }
-
- public static int getMaxTableNameLength() {
- ArrayList<Integer> temp = new ArrayList<>();
- for(EnumDatabaseVendor v : EnumDatabaseVendor.values()){
- temp.add(v.getfTableNameLength());
- }
- Collections.sort(temp);
- return temp.get(0);
- }
-
- public static int getMaxColumnNameLength() {
- ArrayList<Integer> temp = new ArrayList<>();
- for(EnumDatabaseVendor v : EnumDatabaseVendor.values()){
- temp.add(v.getfColumnNameLength());
- }
- Collections.sort(temp);
- return temp.get(0);
- }
-
- public static int getMaxIndexNameLength() {
- ArrayList<Integer> temp = new ArrayList<>();
- for(EnumDatabaseVendor v : EnumDatabaseVendor.values()){
- temp.add(v.getfIndexNameLength());
- }
- Collections.sort(temp);
- return temp.get(0);
- }
-
-
- /**
- * Instantiates a new enum database vendor.
- *
- * @param isInMemory
- * the is in memory
- * @param driverVendor
- * the driver vendor
- * @param driverType
- * the driver type
- * @param driverClass
- * the driver class
- * @param jdbcUrlFormat
- * the jdbc url format
- * @param persistenceBatchWriting
- * the persistence batch writing
- * @param propertyKeys
- * the property keys
- * @param hibernateDialect
- * the hibernate dialect
- * @param productConfigurations
- * the product configurations
- * @param productFeatures
- * the product features
- * @param entityPropertyBaseID
- * the entity property base ID
- * @param entityPropertyBaseUUID
- * the entity property base UUID
- */
- private EnumDatabaseVendor(boolean isInMemory, String driverVendor, String driverType, String driverClass,
- String jdbcUrlFormat, String persistenceBatchWriting, String propertyKeys, String hibernateDialect,
- String productConfigurations, String productFeatures, String entityPropertyBaseID,
- String entityPropertyBaseUUID, int tablenamelength, int columnnamelength, int indexnamelength) {
- fIsInMemory = isInMemory;
- fDriverVendor = driverVendor;
- fDriverType = driverType;
- fDriverClass = driverClass;
- fJdbcUrlFormat = jdbcUrlFormat;
- fPersistenceBatchWriting = persistenceBatchWriting;
- fPropertyKeys = new ArrayList<>();
- if (propertyKeys != null) {
- for (String propertyKey : propertyKeys.split(",")) {
- fPropertyKeys.add(propertyKey.trim());
- }
- }
- fHibernateDialect = hibernateDialect;
- fProductFeatures = productFeatures;
- fProductConfigurations = productConfigurations;
- fEntityPropertyBaseID = entityPropertyBaseID;
- fEntityPropertyBaseUUID = entityPropertyBaseUUID;
- fTableNameLength = tablenamelength;
- fColumnNameLength = columnnamelength;
- fIndexNameLength = indexnamelength;
- }
-
- /**
- * Equals ignore case.
- *
- * @param s1
- * the s 1
- * @param s2
- * the s 2
- * @return true, if successful
- */
- private static boolean equalsIgnoreCase(String s1, String s2) {
- s1 = s1.replaceAll("_IN_", "").replaceAll("_", ""); // NOSONAR
- s2 = s2.replaceAll("_IN_", "").replaceAll("_", ""); // NOSONAR
- return s1.equalsIgnoreCase(s2);
- }
-
- /**
- * Gets the database features.
- *
- * @param vendors
- * the vendors
- * @return the database features
- */
- public static String getDatabaseFeatures(Set<EnumDatabaseVendor> vendors) {
- ArrayList<String> result = new ArrayList<>();
- for (EnumDatabaseVendor vendor : vendors) {
- result.add(vendor.getProductFeatures());
- }
- return String.join("\n", result);
- }
-
- /**
- * Gets the necessary configurations.
- *
- * @param vendors
- * the vendors
- * @return the necessary configurations
- */
- public static String getNecessaryConfigurations(Set<EnumDatabaseVendor> vendors) {
- ArrayList<String> result = new ArrayList<>();
- for (EnumDatabaseVendor vendor : vendors) {
- result.add(vendor.getProductConfigurations());
- }
- return String.join("\n", result);
- }
-
- /**
- * Gets the unnecessary configurations.
- *
- * @param vendors
- * the vendors
- * @return the unnecessary configurations
- */
- public static String getUnnecessaryConfigurations(Set<EnumDatabaseVendor> vendors) {
- ArrayList<String> result = new ArrayList<>();
- for (EnumDatabaseVendor vendor : values()) {
- if (!vendors.contains(vendor)) {
- result.add(vendor.getProductConfigurations());
- }
- }
- return String.join("\n", result);
- }
-
- /**
- * By name.
- *
- * @param vendorName
- * the vendor name
- * @return the enum database vendor
- */
- public static EnumDatabaseVendor byName(String vendorName) { // NOSONAR
- return byName(vendorName, vendorName, vendorName);
- }
-
- /**
- * By name.
- *
- * @param vendorName
- * the vendor name
- * @param driverVendor
- * the driver vendor
- * @param dataBaseName
- * the data base name
- * @return the enum database vendor
- */
- public static EnumDatabaseVendor byName(String vendorName, String driverVendor, String dataBaseName) { // NOSONAR
- for (EnumDatabaseVendor step : values()) {
- if (equalsIgnoreCase(step.name(), vendorName) || equalsIgnoreCase(step.fDriverVendor, vendorName)) {
- return step;
- }
- }
- for (EnumDatabaseVendor step : values()) {
- if (equalsIgnoreCase(step.name(), dataBaseName) || equalsIgnoreCase(step.fDriverVendor, dataBaseName)) {
- return step;
- }
- if (equalsIgnoreCase(step.name(), driverVendor) || equalsIgnoreCase(step.fDriverVendor, driverVendor)) {
- return step;
- }
- }
- return ORACLE;
- }
-
- /** The Constant ONE_ROW_ONE_COLUMN_TABLE. */
- public static final String ONE_ROW_ONE_COLUMN_TABLE = "{{ONE_ROW_ONE_COLUMN_TABLE}}";
-
- /** The Constant ONE_ROW_ONE_COLUMN_TABLE_DERBY. */
- public static final String ONE_ROW_ONE_COLUMN_TABLE_DERBY = "SYSIBM.SYSDUMMY1";
-
- /** The Constant ONE_ROW_ONE_COLUMN_TABLE_H2. */
- public static final String ONE_ROW_ONE_COLUMN_TABLE_H2 = "DUAL";
-
- /** The Constant ONE_ROW_ONE_COLUMN_TABLE_MYSQL. */
- public static final String ONE_ROW_ONE_COLUMN_TABLE_MYSQL = "DUAL";
-
- /** The Constant ONE_ROW_ONE_COLUMN_TABLE_MYSQL. */
- public static final String ONE_ROW_ONE_COLUMN_TABLE_POSTGRESQL = "DUAL";
-
- /** The Constant ONE_ROW_ONE_COLUMN_TABLE_ORACLE. */
- public static final String ONE_ROW_ONE_COLUMN_TABLE_ORACLE = "DUAL";
-
-
-
- /**
- * Apply sql specifications.
- *
- * @param sqlStatement
- * the sql statement
- * @return applied vendor specific SQL statement
- */
- abstract public String applySqlSpecifications(String sqlStatement);
-
- /**
- * Gets the to date SQL method.
- *
- * @return applied vendor specific 'to date' SQL statement prefix
- */
- @Deprecated
- public String getToDateSQLMethod() {
- return "to_date";
- }
-
- /**
- * Gets the to timestamp SQL method.
- *
- * @return applied vendor specific 'to timestamp' SQL statement prefix
- */
- @Deprecated
- public String getToTimestampSQLMethod() {
- return "to_timestamp";
- }
-
-
- /**
- * Convert to date SQL.
- *
- * @param date
- * the date
- * @return applied vendor specific 'to date' SQL statement part
- */
- public String convertToDateSQL(Date date) {
- return "to_date('"+date.toString().replace(".0","")+"','YYYY-MM-DD HH24:MI:SS')";
- }
-
- /**
- * Convert to timestamp SQL.
- *
- * @param date
- * the date
- * @return applied vendor specific 'to date' SQL statement part
- */
- public String convertToTimestampSQL(Timestamp date) {
- return "to_timestamp('"+date.toString().replace(".0","")+"','YYYY-MM-DD HH24:MI:SS')";
- }
-
- /**
- * Apply schema name specifications.
- *
- * @param schemaName
- * the schema name
- * @return the string
- */
- public String applySchemaNameSpecifications(String databaseName, String userName) {
- // cut off the leading path and remove all remaining / \ . :
- return databaseName.replaceAll(".*[/\\\\]", "").replaceAll("~[/\\\\]", "").replaceAll("[/\\\\\\.:]", "");
- }
-
- /**
- * Checks if is in memory.
- *
- * @return true, if is in memory
- */
- public boolean isInMemory() {
- return fIsInMemory;
- }
-
- /**
- * Gets the driver vendor.
- *
- * @return the driver vendor
- */
- public String getDriverVendor() {
- return fDriverVendor;
- }
-
- /**
- * Gets the driver type.
- *
- * @return the driver type
- */
- public String getDriverType() {
- return fDriverType;
- }
-
- /**
- * Gets the driver class.
- *
- * @return the driver class
- */
- public String getDriverClass() {
- return fDriverClass;
- }
-
- /**
- * Gets the hibernate dialect.
- *
- * @return the hibernate dialect
- */
- public String getHibernateDialect() {
- return fHibernateDialect;
- }
-
- /**
- * Gets the product features.
- *
- * @return the product features
- */
- public String getProductFeatures() {
- return fProductFeatures;
- }
-
- /**
- * Gets the product configurations.
- *
- * @return the product configurations
- */
- public String getProductConfigurations() {
- return fProductConfigurations;
- }
-
- /**
- * Gets the entity property base ID.
- *
- * @return the entity property base ID
- */
- public String getEntityPropertyBaseID() {
- return fEntityPropertyBaseID;
- }
-
- /**
- * Gets the entity property base UUID.
- *
- * @return the entity property base UUID
- */
- public String getEntityPropertyBaseUUID() {
- return fEntityPropertyBaseUUID;
- }
-
- /**
- * Gets the persistence batch writing.
- *
- * @return the persistence batch writing
- */
- public String getPersistenceBatchWriting() {
- return fPersistenceBatchWriting;
- }
-
- /**
- * Jdbc url.
- *
- * @param driverVendor
- * the driver vendor
- * @param driverType
- * the driver type
- * @param serverName
- * the server name
- * @param serverPort
- * the server port
- * @param databaseName
- * the database name
- * @param jdbUrlFormat
- * the jdb url format
- * @param timezone
- * the timezone
- * @param username
- * the username
- * @param password
- * the password
- * @return the string
- */
- public String jdbcUrl(String driverVendor, String driverType, String serverName, int serverPort,
- String databaseName, String jdbUrlFormat, String timezone, String username, String password) {
- if ((driverVendor == null) || driverVendor.trim().isEmpty()) {
- driverVendor = fDriverVendor; // NOSONAR
- }
- if ((driverType == null) || driverType.trim().isEmpty()) {
- driverType = fDriverType; // NOSONAR
- }
- if (serverName == null) {
- serverName = "???"; // NOSONAR
- }
- // for sqlserver ....
- String serverInstance = "";
- int idx=serverName.indexOf('\\');
- if ( idx >= 0 ) {
- serverInstance=serverName.substring(idx+1);
- serverName=serverName.substring(0,idx);
- }
-
- if (serverPort == 0) {
- serverPort = -1; // NOSONAR
- }
-
- String format = ((jdbUrlFormat != null) && !jdbUrlFormat.isEmpty()) ? jdbUrlFormat : fJdbcUrlFormat;
- String retcode = format // NOSONAR
- .replaceAll(VARIABLE.VENDOR, driverVendor).replaceAll(VARIABLE.TYPE, driverType)
- .replaceAll(VARIABLE.SERVER, serverName).replaceAll(VARIABLE.PORT, ((Integer) serverPort).toString())
- .replaceAll(VARIABLE.DATABASE, databaseName)
- .replaceAll(VARIABLE.DATABASESCHEMA, applySchemaNameSpecifications(databaseName,username))
- .replaceAll(VARIABLE.SERVERINSTANCE, serverInstance)
- .replaceAll(VARIABLE.USERHOME, System.getProperty("user.home").replace(java.io.File.separator, "/")+"/")
- .replaceAll(VARIABLE.TIMEZONE, timezone)
- .replaceAll(VARIABLE.USERNAME, username)
- .replaceAll(VARIABLE.PASSWORD, password);
-
- return retcode;
- }
-
- /**
- * Supports property key.
- *
- * @param key
- * the key
- * @return true, if successful
- */
- public boolean supportsPropertyKey(String key) {
- if (fPropertyKeys.isEmpty()) {
- return true;
- } else {
- return fPropertyKeys.contains(key);
- }
- }
-
- /**
- * Init database vendor specific properties
- * @return
- */
- public Properties initSpecificProperties() {
- Properties properties = new Properties();
- return properties;
- }
-
-}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/IProductConfigurationPrefs.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/IProductConfigurationPrefs.java
index 61e99ed..ecedeb4 100644
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/IProductConfigurationPrefs.java
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/IProductConfigurationPrefs.java
@@ -39,6 +39,8 @@
public abstract int getBpmServerPort();
public abstract int getBpmResponseTimeout();
+
+ public abstract String getBpmInitialProcess();
public abstract String getEuroXRefRatesURLDaily();
@@ -118,6 +120,8 @@
public abstract boolean isBpmEngineHibernateShowSql();
public abstract boolean isBpmEngineHibernateFormatSql();
+
+ public abstract boolean isBpmEngineLogging();
public abstract String getBpmEnginePersistenceUnit();
@@ -148,7 +152,11 @@
public abstract String getJavaPosPortConfiguration();
+ public abstract boolean hasJavaPosUploadedBitmaps();
+
public abstract Collection<EntityMockConfiguration> getEntityMockData();
public abstract boolean hideUserMenu();
+
+ public abstract int getCubeViewPort();
}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/Preference.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/Preference.java
index d10a3e6..2ff232a 100644
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/Preference.java
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/Preference.java
@@ -43,6 +43,8 @@
BPM_ENGINE_HIBERNATE_SHOW_SQL,
BPM_ENGINE_HIBERNATE_FORMAT_SQL,
BPM_ENGINE_HIBERNATE_MAX_FETCH_DEPTH,
+ BPM_ENGINE_INITIAL_PROCESS,
+ BPM_ENGINE_LOGGING,
DATASOURCES,
PRODUCTCONFIGURATION,
DTO_REALM_PORTAL_ID,
@@ -73,7 +75,9 @@
JAVA_POS_CONFIGURATION,
JAVA_POS_PORT_CONFIGURATION,
HIDE_USERMENU,
- ENTITY_MOCK_DATA
+ ENTITY_MOCK_DATA,
+ JAVA_POS_UPLOADED_BITMAPS,
+ CUBE_VIEW_PORT
;
public static Preference by(String name) {
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfiguration.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfiguration.java
index 54d039f..4667b02 100644
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfiguration.java
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfiguration.java
@@ -346,6 +346,10 @@
return prefs().isBpmEngineHibernateFormatSql();
}
+ public static boolean isBpmEngineLogging() {
+ return prefs().isBpmEngineLogging();
+ }
+
public static int getBpmEngineHibernateMaxFetchDepth() {
return prefs().getBpmEngineHibernateMaxFetchDepth();
}
@@ -358,6 +362,10 @@
return prefs().getBpmEngineHibernateSchemaName(persistenceUnit);
}
+ public static String getBpmInitialProcess() {
+ return prefs().getBpmInitialProcess();
+ }
+
/**
* @return show theme tool control if true
*/
@@ -402,10 +410,15 @@
public static String getJavaPosConfiguration() {
return prefs().getJavaPosConfiguration();
}
+
public static String getJavaPosPortConfiguration() {
return prefs().getJavaPosPortConfiguration();
}
+ public static boolean hasJavaPosUploadedBitmaps() {
+ return prefs().hasJavaPosUploadedBitmaps();
+ }
+
public static String getDatainterchangeConfiguration() {
return prefs().getDatainterchangeConfiguration();
}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfigurationDefaultPrefs.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfigurationDefaultPrefs.java
index efda123..93e7022 100644
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfigurationDefaultPrefs.java
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfigurationDefaultPrefs.java
@@ -21,6 +21,8 @@
import java.util.TreeMap;
import org.eclipse.core.resources.IProject;
+import org.eclipse.osbp.preferences.databases.vendors.DatabaseVendor;
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.osgi.service.prefs.Preferences;
@@ -46,6 +48,7 @@
public static final String DERBYMEMORY = "DERBYMEMORY";
public static final String IP_OR_HOST = "<ip-or-host>";
public static final String BPM_ENGINE_PERSISTENCE_UNIT = "bpm";
+ private static final String MAVEN_ACTIVATED = "mavenActivated";
@Override
public String getBusinessBundleClassNameReadOnly() {
@@ -58,47 +61,47 @@
public ProductConfigurationDefaultPrefs() {
initializeIfNotExists (ORACLE, ORACLE,
- EnumDatabaseVendor.ORACLE, IP_OR_HOST, 1521, DATABASE_HINT, USERNAME_HINT, PASSWORD_HINT);
+ MasterDatabaseVendor.ORACLE, IP_OR_HOST, 1521, DATABASE_HINT, USERNAME_HINT, PASSWORD_HINT);
/* === datasource using a MySQL database === */
initializeIfNotExists (MSSQL, null,
- EnumDatabaseVendor.MSSQL, IP_OR_HOST, 1433, DATABASE_HINT, USERNAME_HINT, "");
+ MasterDatabaseVendor.MSSQL, IP_OR_HOST, 1433, DATABASE_HINT, USERNAME_HINT, "");
/* === datasource using a MySQL database === */
initializeIfNotExists (MYSQL, null,
- EnumDatabaseVendor.MYSQL, IP_OR_HOST, 3306, DATABASE_HINT, USERNAME_HINT, "");
+ MasterDatabaseVendor.MYSQL, IP_OR_HOST, 3306, DATABASE_HINT, USERNAME_HINT, "");
/* === datasource using a MySQL database === */
initializeIfNotExists (MYSQL8, null,
- EnumDatabaseVendor.MYSQL8, IP_OR_HOST, 3306, DATABASE_HINT, USERNAME_HINT, "");
+ MasterDatabaseVendor.MYSQL8, IP_OR_HOST, 3306, DATABASE_HINT, USERNAME_HINT, "");
/* === datasource using a H2 in-Memory database === */
initializeIfNotExists (ProductConfigurationPrefs.DEFAULT_H2MEMORY_DATASOURCE, null,
- EnumDatabaseVendor.H2_IN_MEMORY, null, -1, H2MEMORY, H2MEMORY, H2MEMORY); // NOSONAR
+ MasterDatabaseVendor.H2_IN_MEMORY, null, -1, H2MEMORY, H2MEMORY, H2MEMORY); // NOSONAR
/* === datasource using a H2 local-file database === */
initializeIfNotExists (ProductConfigurationPrefs.DEFAULT_H2LOCALFILE_DATASOURCE, null,
- EnumDatabaseVendor.H2_LOCAL_FILE, null, -1, H2LOCALFILEFILE, H2LOCALFILE, H2LOCALFILE);
+ MasterDatabaseVendor.H2_LOCAL_FILE, null, -1, H2LOCALFILEFILE, H2LOCALFILE, H2LOCALFILE);
/* === datasource using a Derby in-Memory database === */
initializeIfNotExists (ProductConfigurationPrefs.DEFAULT_DERBYMEMORY_DATASOURCE, null,
- EnumDatabaseVendor.DERBY_IN_MEMORY, null, -1, DERBYMEMORY, DERBYMEMORY, DERBYMEMORY);
+ MasterDatabaseVendor.DERBY_IN_MEMORY, null, -1, DERBYMEMORY, DERBYMEMORY, DERBYMEMORY);
/* === datasource using a Derby local-file database === */
initializeIfNotExists (ProductConfigurationPrefs.DEFAULT_DERBYLOCALFILE_DATASOURCE, null,
- EnumDatabaseVendor.DERBY_LOCAL_FILE, null, -1, DERBYLOCALFILEFILE, DERBYLOCALFILE, DERBYLOCALFILE);
+ MasterDatabaseVendor.DERBY_LOCAL_FILE, null, -1, DERBYLOCALFILEFILE, DERBYLOCALFILE, DERBYLOCALFILE);
/* === datasource using a Derby database === */
initializeIfNotExists (ProductConfigurationPrefs.DEFAULT_DERBYSERVER_DATASOURCE, null,
- EnumDatabaseVendor.DERBY_CLIENT, IP_OR_HOST, 1527, DATABASE_HINT, USERNAME_HINT, PASSWORD_HINT);
+ MasterDatabaseVendor.DERBY_CLIENT, IP_OR_HOST, 1527, DATABASE_HINT, USERNAME_HINT, PASSWORD_HINT);
/* === datasource using a PostgreSQL database === */
initializeIfNotExists (ProductConfigurationPrefs.DEFAULT_POSTGRESQL_DATASOURCE, null,
- EnumDatabaseVendor.POSTGRESQL, IP_OR_HOST, 5432, DATABASE_HINT, USERNAME_HINT, PASSWORD_HINT);
+ MasterDatabaseVendor.POSTGRESQL, IP_OR_HOST, 5432, DATABASE_HINT, USERNAME_HINT, PASSWORD_HINT);
// --- generate reasonable default preferences for development product
initializeIfNotExists (ProductConfigurationPrefs.PERSISTENCE_UNIT_AUTHENTICATION,
ProductConfigurationPrefs.DEFAULT_DATASOURCE_FOR_AUTHENTICATION, true, true,
null, 1000,
true, 200,
- "off", "create-or-extend-tables", // NOSONAR
+ "off", PersistenceUnitProperties.CREATE_OR_EXTEND,
PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
initializeIfNotExists (ProductConfigurationPrefs.PERSISTENCE_UNIT_BLOB,
ProductConfigurationPrefs.DEFAULT_DATASOURCE_FOR_BLOB, true, true,
null, 1000,
true, 200,
- "off", "create-or-extend-tables",
+ "off", PersistenceUnitProperties.CREATE_OR_EXTEND,
PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
initializeIfNotExists (ProductConfigurationPrefs.PERSISTENCE_UNIT_BPM,
ProductConfigurationPrefs.DEFAULT_DATASOURCE_FOR_BPM, true, true,
@@ -110,12 +113,12 @@
ProductConfigurationPrefs.DEFAULT_DATASOURCE_FOR_BUSINESSDATA, true, true,
null, 1000,
true, 200,
- "off", "create-or-extend-tables",
+ "off", PersistenceUnitProperties.CREATE_OR_EXTEND,
PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
}
private void initializeIfNotExists( // NOSONAR
- String dataSource, String dataSourceConsumer, EnumDatabaseVendor vendor, // NOSONAR
+ String dataSource, String dataSourceConsumer, DatabaseVendor vendor, // NOSONAR
String serverName, int serverPort,
String database, String username, String password) {
String driverVendor = vendor.getDriverVendor();
@@ -177,6 +180,11 @@
return 10000;
}
+ @Override
+ public String getBpmInitialProcess() {
+ return "";
+ }
+
/* (non-Javadoc)
* @see org.eclipse.osbp.preferences.IProductConfigurationPrefs#getEuroXRefRatesURLDaily()
*/
@@ -430,6 +438,11 @@
}
@Override
+ public boolean isBpmEngineLogging() {
+ return false;
+ }
+
+ @Override
public boolean isBpmEngineHibernateFormatSql() {
return false;
}
@@ -476,7 +489,10 @@
@Override
public boolean isMavenActivated() {
- return false;
+ String p1 = System.getProperty(MAVEN_ACTIVATED,"false");
+ String p2 = System.getenv(MAVEN_ACTIVATED);
+
+ return !"false".equalsIgnoreCase(p1) || "true".equalsIgnoreCase(p2);
}
@Override
@@ -509,5 +525,14 @@
public final boolean hideUserMenu() {
return false;
}
-
+
+ @Override
+ public boolean hasJavaPosUploadedBitmaps() {
+ return false;
+ }
+
+ @Override
+ public int getCubeViewPort() {
+ return 8080;
+ }
}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfigurationPrefs.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfigurationPrefs.java
index 7040efd..5465df5 100644
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfigurationPrefs.java
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductConfigurationPrefs.java
@@ -29,6 +29,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;
@@ -56,6 +57,8 @@
import org.eclipse.core.runtime.preferences.IPreferenceNodeVisitor;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.osbp.preferences.databases.vendors.DatabaseVendor;
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.joda.time.DateTimeZone;
import org.osgi.service.prefs.BackingStoreException;
@@ -88,7 +91,6 @@
private String protocolUnit;
private boolean identifyByUsername = true;
private boolean autoLogin = false;
- private boolean encryptPasswords = true;
private boolean noRememberMe = false;
private String adminEmail = "";
private String adminEmailUsername = "";
@@ -116,25 +118,27 @@
private boolean bpmHibernateShowSql;
private boolean bpmHibernateFormatSql;
private int bpmHibernateMaxFetchDepth;
+ private String bpmInitialProcess;
+ private Boolean bpmEngineLogging;
private boolean demoToolsTheme;
private boolean demoToolsLanguage;
private boolean demoToolsPrintService;
private boolean hideUserMenu;
private boolean projectWizardAbsoluteLocation;
private boolean mavenActivated;
+ private int cubeViewPort;
/*
* ========================= internal utilities ===========================
*/
public static final String PREFERENCES_PATH = ".metadata/.plugins/org.eclipse.core.runtime/"
- + EclipsePreferences.DEFAULT_PREFERENCES_DIRNAME + "/";
+ + EclipsePreferences.DEFAULT_PREFERENCES_DIRNAME + "/"; // NOSONAR
public static final String PRODUCT_PREFERENCES = "org.eclipse.osbp.production";
public static final String PREFERENCES_FULL_PATH = PREFERENCES_PATH + PRODUCT_PREFERENCES + "."
+ EclipsePreferences.PREFS_FILE_EXTENSION;
private static final Logger LOGGER = LoggerFactory.getLogger(ProductConfigurationPrefs.class);
- private boolean forceInitialize = true;
private final IScopeContext scopeContext;
/**
* listener triggered by preference changed due to user actions inside
@@ -151,7 +155,9 @@
private Boolean emailUseSslOnConnect;
private String javaPosConfiguration;
private String javaPosPortConfiguration;
+ private boolean javaPosUploadedBitmaps;
private String datainterchangeConfiguration;
+ private boolean initializationDone = false;
public static final String BUSINESS_BUNDLE_CLASS_NAME = "BUSINESS_BUNDLE_CLASS_NAME_read_only";
@@ -165,10 +171,12 @@
private static final String LANGUAGES_AUTOTRANSLATE = "languages.autotranslate";
private static final String LANGUAGES_AUTOCREATE = "languages.autocreate";
private static final String LANGUAGES_SHOW_SELECT_IN_RESPECTIVE_LOCALE = "lanuages.selectInRespectiveLocales";
- // See:
- // http://code.google.com/apis/language/translate/v2/getting_started.html
+ /**
+ See:
+ http://code.google.com/apis/language/translate/v2/getting_started.html
private static final String LANGUAGES_GOOGLE_HTTP_REFERRER = "languages.google_http_referrer";
private static final String LANGUAGES_GOOGLE_API_KEY = "languages.google_api_key";
+ */
private static final String LANGUAGES_LANGUAGE = "language";
private static final String LANGUAGES_COUNTRY = "country";
@@ -199,6 +207,7 @@
private static final String JAVA_POS_NODE = "javaPOS";
private static final String JAVA_POS_CONFIGURATION = "javaPosConfiguration";
private static final String JAVA_POS_PORT_CONFIGURATION = "javaPosPortConfiguration";
+ private static final String JAVA_POS_UPLOADED_BITMAPS = "javaPosUploadedBitmaps";
/*
* ========================= Datainterchange initializer
@@ -315,7 +324,8 @@
private static final String BPM_HIBERNATE_SHOW_SQL = "hibernateShowSql";
private static final String BPM_HIBERNATE_FORMAT_SQL = "hibernateFormatSql";
private static final String BPM_HIBERNATE_MAX_FETCH_DEPTH = "hibernateMaxFetchDepth";
- private static final String BPM_HIBERNATE_SCHEMA_NAME = "hibernateSchemaName";
+ private static final String BPM_INITIAL_PROCESS = "bpmInitialProcess";
+ private static final String BPM_LOGGING = "bpmLogging";
/*
* ========================= persistence unit initializer
@@ -338,7 +348,6 @@
private static final String PERSISTENCE_LOGGINGLEVEL = "loggingLevel";
private static final String PERSISTENCE_DDLGENERATION = "ddlGeneration";
private static final String PERSISTENCE_PERSISTENCEXMLPATH = "persistenceXMLPath";
- private static final String PERSISTENCE_WEAVING = "weaving";
/*
* ========================= mock data generator initializer
@@ -360,7 +369,6 @@
*/
private static final String DEMO_NODE = "demo";
private static final String DEMO_TOOLS_THEME = "demoToolsTheme";
- private static final String DEMO_TOOLS_STRATEGY = "demoToolsStrategy";
private static final String DEMO_TOOLS_LANGUAGE = "demoToolsLanguage";
private static final String DEMO_TOOLS_PRINTSERVICE = "toolsPrintService";
private static final String HIDE_USERMENU = "hideUserMenu";
@@ -376,9 +384,19 @@
*/
private static final String REPORT_PRINTER_NODE = "reportPrinter";
- public static enum DDL_GENERATION {
- CREATE("create-tables", "create"), DROP_CREATE("drop-and-create-tables",
- "create"), UPDATE("create-or-extend-tables", "update"), NONE("none", "validate");
+ /*
+ * ========================= bi unit initializer
+ * ===========================
+ */
+
+ public static final String BI_NODE = "bi";
+ private static final String CUBE_VIEW_PORT = "cubeViewPort";
+
+ // ############################################################################
+
+ public enum DDL_GENERATION {
+ CREATE(PersistenceUnitProperties.CREATE_ONLY, "create"), DROP_CREATE(PersistenceUnitProperties.DROP_AND_CREATE,
+ "create"), UPDATE(PersistenceUnitProperties.CREATE_OR_EXTEND, "update"), NONE(PersistenceUnitProperties.NONE, "validate");
private final String eclipseLink;
private final String hibernate;
@@ -406,23 +424,23 @@
}
}
- public Set<EnumDatabaseVendor> getDataBaseVendors() {
- TreeSet<EnumDatabaseVendor> result = new TreeSet<>();
+ public Set<DatabaseVendor> getDataBaseVendors() {
+ TreeSet<DatabaseVendor> result = new TreeSet<>();
for (String pu : getPersistenceUnitNames()) {
addDataBaseVendor(result, getPersistenceUnitJndiName(pu));
}
return result;
}
- public Set<EnumDatabaseVendor> getDataBaseVendors(String... jndiNames) {
- TreeSet<EnumDatabaseVendor> result = new TreeSet<>();
+ public Set<DatabaseVendor> getDataBaseVendors(String... jndiNames) {
+ TreeSet<DatabaseVendor> result = new TreeSet<>();
for (String jndiName : jndiNames) {
addDataBaseVendor(result, jndiName);
}
return result;
}
- private void addDataBaseVendor(TreeSet<EnumDatabaseVendor> result, String jndiName) {
+ private void addDataBaseVendor(TreeSet<DatabaseVendor> result, String jndiName) {
DataSourceConfiguration ds = getDataSource(jndiName);
if (ds != null) {
result.add(ds.getDatabaseVendor());
@@ -435,7 +453,7 @@
this.name = name;
this.project = project;
if (watchRegister) {
- preferenceChangedListener = new IPreferenceChangeListener() {
+ preferenceChangedListener = new IEclipsePreferences.IPreferenceChangeListener() {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
forceReloadConfiguration();
@@ -444,7 +462,8 @@
} else {
preferenceChangedListener = null;
}
- LOGGER.trace(getInformation() + " # constructed");
+ String info = getInformation();
+ LOGGER.trace("{} # constructed", info);
}
public IScopeContext getScopeContext() {
@@ -481,7 +500,7 @@
serialize(ProductConfiguration.workspacePrefs().getProductPreferences(), "", serialized);
Set<String> result = new TreeSet<>();
for (String item : serialized) {
- if (!item.startsWith("persistenceUnit") && !item.startsWith("datasource.")
+ if (!item.startsWith(PERSISTENCE_NODE) && !item.startsWith("datasource.")
&& !item.startsWith("shiro/datasource") && !item.startsWith("shiro/persistenceunit")) {
result.add(item);
}
@@ -505,70 +524,60 @@
}
public static IResource getPrefsFile(IResource project) {
- if ((project instanceof IProject) && !((IProject) project).isOpen())
- return null;
try {
-
IResource[] rl = null;
-
- if (project instanceof IProject)
+ if (project instanceof IProject && ((IProject) project).isOpen()) {
rl = ((IProject) project).members();
- if (project instanceof IFolder)
+ } else if (project instanceof IFolder) {
rl = ((IFolder) project).members();
-
+ }
for (IResource resource : rl) {
- if (resource.exists()) {
- if ((resource instanceof IFolder)) {
- IResource f = getPrefsFile(resource);
- if (f != null) {
- return f;
- }
- } else if ((resource instanceof IFile) && "product".equals(resource.getFileExtension())) {
- try {
- String[] tokens = IOUtils.toString(((IFile) resource).getContents())
- .split("-DproductConfigurationFile=");
- if (tokens.length > 1) {
- String filePath = tokens[1].replace('\r', ' ').replace('\n', ' ').replace('\t', ' ')
- .split(" ")[0].replace("DEFAULTFILE", PREFERENCES_FULL_PATH);
- // The following line is required to perform a
- // string substitution.
- // In case of having a file path with
- // placeholders this will replace them with the
- // defined string in the eclipse string
- // substitution preferences:
- // Reference > Preferences > Run/Debug > String
- // Substitution
- filePath = VariablesPlugin.getDefault().getStringVariableManager()
- .performStringSubstitution(filePath);
- File handle = new File(filePath);
- if (handle.exists()) {
- String fileName = handle.getAbsolutePath();
- IWorkspace space = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = space.getRoot();
- try { // NOSONAR
- IFile[] resources = root.findFilesForLocationURI(new File(fileName).toURI());
- if (resources != null) {
- for (IFile f : resources) {
- if (f.exists()) {
- return f;
- }
- }
- }
- LOGGER.error("Preferences file not found: {}", fileName);
- } catch (Exception e) { // NOSONAR
- e.printStackTrace();
- } // NOSONAR
- }
- LOGGER.error("Preferences file not found: {}", filePath);
- }
- } catch (IOException e) {
- e.printStackTrace(); // NOSONAR
- }
- } // NOSONAR
+ if (resource.exists() && resource instanceof IFolder) {
+ IResource f = getPrefsFile(resource);
+ if (f != null) {
+ return f;
+ }
+ } else if ((resource instanceof IFile) && "product".equals(resource.getFileExtension())) {
+ return loadPrefs(resource);
}
}
- } catch (CoreException e) { // NOSONAR
- e.printStackTrace(); // NOSONAR
+ } catch (CoreException | IOException e) {
+ LOGGER.error("{}", e);
+ }
+ return null;
+ }
+
+ private static IResource loadPrefs(IResource resource) throws CoreException, IOException {
+ String[] tokens = IOUtils.toString(((IFile) resource).getContents())
+ .split("-DproductConfigurationFile=");
+ if (tokens.length > 1) {
+ String filePath = tokens[1].replace('\r', ' ').replace('\n', ' ').replace('\t', ' ')
+ .split(" ")[0].replace("DEFAULTFILE", PREFERENCES_FULL_PATH);
+ // The following line is required to perform a
+ // string substitution.
+ // In case of having a file path with
+ // placeholders this will replace them with the
+ // defined string in the eclipse string
+ // substitution preferences:
+ // Reference > Preferences > Run/Debug > String
+ // Substitution
+ filePath = VariablesPlugin.getDefault().getStringVariableManager()
+ .performStringSubstitution(filePath);
+ File handle = new File(filePath);
+ if (handle.exists()) {
+ String fileName = handle.getAbsolutePath();
+ IWorkspace space = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = space.getRoot();
+ IFile[] resources = root.findFilesForLocationURI(new File(fileName).toURI());
+ if (resources != null) {
+ for (IFile f : resources) {
+ if (f.exists()) {
+ return f;
+ }
+ }
+ }
+ }
+ LOGGER.error("Preferences file not found: {}", filePath);
}
return null;
}
@@ -654,38 +663,6 @@
return dataSources.keySet();
}
- // /**
- // * @return the name of the active DataSource
- // */
- // public String getDataSourceNameForAuthentication() {
- // initialize();
- // return dataSourceForAuthentication;
- // }
- //
- // /**
- // * @return the name of the active DataSource
- // */
- // public String getDataSourceNameForBLOB() {
- // initialize();
- // return dataSourceForBLOB;
- // }
- //
- // /**
- // * @return the name of the bpm DataSource
- // */
- // public String getDataSourceNameForBPM() {
- // initialize();
- // return dataSourceForBPM;
- // }
- //
- // /**
- // * @return the name of the bpm DataSource
- // */
- // public String getDataSourceNameForBusinessData() {
- // initialize();
- // return dataSourceForBusinessData;
- // }
-
/**
* @param jndiName
* the requested DataSource
@@ -710,7 +687,7 @@
* the requested DataSource
* @return name of the JDBC driver class
*/
- public EnumDatabaseVendor getDataSourceDatabaseVendor(String jndiName) {
+ public DatabaseVendor getDataSourceDatabaseVendor(String jndiName) {
initialize();
DataSourceConfiguration jndi = dataSources.get(jndiName);
return (jndi == null) ? null : jndi.getDatabaseVendor();
@@ -841,14 +818,11 @@
* @return the ddl generation flag
*/
public String getPersistenceUnitEffectiveEclipseLinkDdlGeneration(String persistenceUnitName) {
- EnumDatabaseVendor vendor = getDataSourceDatabaseVendor(getPersistenceUnitJndiName(persistenceUnitName));
+ DatabaseVendor vendor = getDataSourceDatabaseVendor(getPersistenceUnitJndiName(persistenceUnitName));
if (vendor.isInMemory()) {
return DDL_GENERATION.CREATE.eclipseLink;
} else {
- switch (vendor) {
- default:
- return getPersistenceUnitParameterizedEclipseLinkDdlGeneration(persistenceUnitName);
- }
+ return getPersistenceUnitParameterizedEclipseLinkDdlGeneration(persistenceUnitName);
}
}
@@ -1004,20 +978,25 @@
*/
public final String getShiroConfiguration(String staticRealmClassName) {
initialize();
- String mainSection = "[main]" + IShiroConfiguration.INI_NEWLINE;
- String realms = "";
+ StringBuilder mainSection = new StringBuilder();
+ mainSection.append("[main]");
+ mainSection.append(IShiroConfiguration.INI_NEWLINE);
+ StringBuilder realms = new StringBuilder();
if (!shiros.containsKey(ProductConfiguration.SHIRO_STATIC_REALM)) {
shiros.put(ProductConfiguration.SHIRO_STATIC_REALM, new StaticConfiguration(staticRealmClassName, 1));
}
- for (String name : shiros.keySet()) {
- mainSection += shiros.get(name).getShiroConfiguration(name);
- if (!realms.isEmpty()) {
- realms += ",";
+ for (Entry<String, IShiroConfiguration> entry : shiros.entrySet()) {
+ mainSection.append(entry.getValue().getShiroConfiguration(entry.getKey()));
+ if (realms.length()>0) {
+ realms.append(",");
}
- realms += "$" + name;
+ realms.append("$");
+ realms.append(entry.getKey());
}
- mainSection += "securityManager.realms = " + realms + IShiroConfiguration.INI_NEWLINE;
- return mainSection;
+ mainSection.append("securityManager.realms = ");
+ mainSection.append(realms);
+ mainSection.append(IShiroConfiguration.INI_NEWLINE);
+ return mainSection.toString();
}
public String getPreferencesFile() {
@@ -1031,7 +1010,7 @@
return location.toOSString();
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NullPointerException e) {
- e.printStackTrace();
+ LOGGER.error("{}", e);
}
}
return getLocation();
@@ -1115,6 +1094,46 @@
return projectWizardAbsoluteLocation;
}
+ /**
+ * @return use this url for the cube view
+ */
+ @Override
+ public final int getCubeViewPort() {
+ initialize();
+ return cubeViewPort;
+ }
+
+ @Override
+ public String getBusinessBundleClassNameReadOnly() {
+ initialize();
+ return businessBundleClassNameReadOnly;
+ }
+
+ @Override
+ public String getBpmServerIp() {
+ initialize();
+ return bpmServerIp;
+ }
+
+ @Override
+ public int getBpmServerPort() {
+ initialize();
+ return bpmServerPort;
+ }
+
+ @Override
+ public int getBpmResponseTimeout() {
+ initialize();
+ return bpmResponseTimeout;
+ }
+
+ @Override
+ public String getBpmInitialProcess() {
+ initialize();
+ return bpmInitialProcess;
+ }
+
+
/* ========================= setters =========================== */
public void setEuroForeignExchangeReferenceRatesURLDaily(String euroForeignExchangeReferenceRatesURLDaily) {
@@ -1139,10 +1158,6 @@
this.autoLogin = put(AUTHENTICATION_NODE, AUTHENTICATION_AUTOLOGIN, autoLogin);
}
- public void setEncryptPasswords(boolean encryptPasswords) {
- this.encryptPasswords = put(AUTHENTICATION_NODE, AUTHENTICATION_ENCRYPT_PASSWORDS, encryptPasswords);
- }
-
public void setNoRememberMe(boolean noRememberMe) {
this.noRememberMe = put(AUTHENTICATION_NODE, AUTHENTICATION_HIDE_REMEMBER_ME, noRememberMe);
}
@@ -1224,13 +1239,12 @@
this.shiros = configs;
Preferences realms = getNode(SHIRO_NODE);
if (realms != null) {
- for (String name : shiros.keySet()) {
- Preferences realm = realms.node(name);
- if (configs.get(name) instanceof DtoConfiguration) {
- } else if (configs.get(name) instanceof LdapConfiguration) {
- put(realm, LDAP_PORTAL_ID, ((LdapConfiguration) shiros.get(name)).getPortalId());
- put(realm, LDAP_URL, ((LdapConfiguration) shiros.get(name)).getUrl());
- put(realm, LDAP_USERDNTEMPLATE, ((LdapConfiguration) shiros.get(name)).getTemplate());
+ for (Entry<String, IShiroConfiguration> entrySet : shiros.entrySet()) {
+ Preferences realm = realms.node(entrySet.getKey());
+ if (entrySet.getValue() instanceof LdapConfiguration) {
+ put(realm, LDAP_PORTAL_ID, ((LdapConfiguration) entrySet.getValue()).getPortalId());
+ put(realm, LDAP_URL, ((LdapConfiguration) entrySet.getValue()).getUrl());
+ put(realm, LDAP_USERDNTEMPLATE, ((LdapConfiguration) entrySet.getValue()).getTemplate());
}
}
try {
@@ -1247,9 +1261,9 @@
Preferences datasourceNode = getNode(DATASOURCE_NODE);
clear(datasourceNode);
if (datasourceNode != null) {
- for (String dataSourceName : dataSources.keySet()) {
- Preferences dataSource = datasourceNode.node(dataSourceName);
- DataSourceConfiguration dsc = dataSources.get(dataSourceName);
+ for (Entry<String, DataSourceConfiguration> entrySet : dataSources.entrySet()) {
+ Preferences dataSource = datasourceNode.node(entrySet.getKey());
+ DataSourceConfiguration dsc = entrySet.getValue();
put(dataSource, DATASOURCE_ENUM_ITEM, dsc.getDatabaseVendor().name());
put(dataSource, DATASOURCE_DRIVER_VENDOR, dsc.getDriverVendor());
put(dataSource, DATASOURCE_DRIVER_TYPE, dsc.getDriverType());
@@ -1337,28 +1351,8 @@
showLanguageSelectInRespectiveLocale);
}
- @Override
- public String getBusinessBundleClassNameReadOnly() {
- initialize();
- return businessBundleClassNameReadOnly;
- }
-
- @Override
- public String getBpmServerIp() {
- initialize();
- return bpmServerIp;
- }
-
- @Override
- public int getBpmServerPort() {
- initialize();
- return bpmServerPort;
- }
-
- @Override
- public int getBpmResponseTimeout() {
- initialize();
- return bpmResponseTimeout;
+ public void setCubeViewUrl(int cubeViewPort) {
+ this.cubeViewPort = put((String) null, CUBE_VIEW_PORT, cubeViewPort);
}
public void setBpmServerIp(String bpmServerIp) {
@@ -1376,6 +1370,14 @@
this.bpmResponseTimeout = put(BPM_NODE, BPM_RESPONSE_TIMEOUT, bpmResponseTimeout);
}
+ public void setBpmInitialProcess(String value) {
+ this.bpmInitialProcess = put(BPM_NODE, BPM_INITIAL_PROCESS, value);
+ }
+
+ public void setBpmEngineLogging(boolean value) {
+ this.bpmEngineLogging = put(BPM_NODE, BPM_LOGGING, value);
+ }
+
public void setDemoToolsTheme(boolean demoToolsTheme) {
this.demoToolsTheme = put(DEMO_NODE, DEMO_TOOLS_THEME, demoToolsTheme);
}
@@ -1392,68 +1394,15 @@
this.projectWizardAbsoluteLocation = put(PROJECT_WIZARD_NODE, PROJECT_WIZARD_ABSOLUTE_LOCATION,
projectWizardAbsoluteLocation);
}
+
+ // ----------------------------------------------------------------------------------------------------
private IEclipsePreferences applyCustomizedPreferenceDirectory(IEclipsePreferences preference) {
- // if (project != null) {
- // if (preference instanceof ProjectPreferences) {
- // IResource prefsFile = getPrefsFile(project);
- // if (prefsFile instanceof IFile) {
- // try {
- // Class<?> preferenceClass = preference.getClass();
- // Method getLoadLevel =
- // preferenceClass.getDeclaredMethod("getLoadLevel");
- // getLoadLevel.setAccessible(true);
- // ProjectPreferences loadLevelInstance = (ProjectPreferences)
- // getLoadLevel.invoke(preference);
- // Class<?>loadLevelClass = loadLevelInstance.getClass();
- // Field fileField = loadLevelClass.getDeclaredField("file");
- // fileField.setAccessible(true);
- // IFile activeFile = (IFile) fileField.get(loadLevelInstance);
- // if ((activeFile == null) ||
- // !activeFile.getFullPath().toOSString().equals(prefsFile.getFullPath().toOSString()))
- // {
- // fileField.set(loadLevelInstance, prefsFile);
- // preference.sync();
- // forceReloadConfiguration();
- // }
- // }
- // catch (NoSuchFieldException x) {
- // x.printStackTrace();
- // }
- // catch (IllegalArgumentException x) {
- // x.printStackTrace();
- // }
- // catch (IllegalAccessException x) {
- // x.printStackTrace();
- // }
- // catch (BackingStoreException e) {
- // e.printStackTrace();
- // }
- // catch (NoSuchMethodException e) {
- // e.printStackTrace();
- // }
- // catch (SecurityException e) {
- // e.printStackTrace();
- // }
- // catch (InvocationTargetException e) {
- // e.printStackTrace();
- // }
- // }
- // }
- // }
return preference;
}
protected IEclipsePreferences getProductPreferences() {
if (project != null) {
- // IPreferencesService service = Platform.getPreferencesService();
- // Preferences root = service.getRootNode();
- // Preferences myInstanceNode =
- // root.node(project.getName()).node(InstanceScope.SCOPE).node(PRODUCT_PREFERENCES);
- // return (IEclipsePreferences) myInstanceNode;
- // ??? return
- // applyCustomizedPreferenceDirectory((IEclipsePreferences)
- // scopeContext.getNode(InstanceScope.SCOPE).node(PRODUCT_PREFERENCES));
return applyCustomizedPreferenceDirectory(scopeContext.getNode(PRODUCT_PREFERENCES));
} else {
return scopeContext.getNode(PRODUCT_PREFERENCES);
@@ -1496,13 +1445,12 @@
node.flush();
registerWatch();
} catch (Exception e) { // NOSONAR
- LOGGER.error("node " + node.name() + " and key " + key // NOSONAR
- + " could not be set or flushed because " + e.getLocalizedMessage());
+ LOGGER.error("node {} and key {} could not be set because {}", node.name(), key, e);
}
}
} else {
- LOGGER.error(
- "node " + (node != null ? node.name() : "null") + " and key " + key + " are no valid arguments");
+ String nd = (node != null ? node.name() : "null");
+ LOGGER.error("node {} and key {} are no valid arguments", nd, key);
}
return value;
}
@@ -1535,18 +1483,13 @@
return value;
}
- // private Double put(String nodeName, String key, Double value) {
- // put(nodeName, key, value.toString());
- // return value;
- // }
-
/**
* sets the flag, that the configuration has to be reloaded. Deregisters all
* watchers/listeners on preference changes due to preference dialog and
* file modification
*/
public void forceReloadConfiguration() {
- forceInitialize = true;
+ initializationDone = true;
deregisterWatch();
}
@@ -1628,8 +1571,9 @@
Set<Exception> exceptions = new HashSet<>();
// --- (re)load the configuration if something has changed or it has not
// been loaded by now ---
- if (forceInitialize || (authRESTfulApiPort < 1)) {
- LOGGER.trace(getInformation() + " # initialize");
+ if (initializationDone || (authRESTfulApiPort < 1)) {
+ String info = getInformation();
+ LOGGER.trace("{} # initialize", info);
deregisterWatch();
try {
initializeReadOnly();
@@ -1721,12 +1665,17 @@
} catch (Exception e) {
exceptions.add(e);
}
+ try {
+ initializeBI();
+ } catch (Exception e) {
+ exceptions.add(e);
+ }
if (!exceptions.isEmpty()) {
Exception e = new ConfigurationException(exceptions);
LOGGER.error("exceptions caught while reading configuration", e);
System.exit(0); // NOSONAR
}
- forceInitialize = false;
+ initializationDone = false;
registerWatch();
}
}
@@ -1739,7 +1688,7 @@
mavenActivated = root.getBoolean(MAVEN_ACTIVATED, defaultPrefs.isMavenActivated());
}
- private void initializeLanguages() throws Exception {
+ private void initializeLanguages() {
Preferences root = getProductPreferences();
int languagesSupported = root.getInt(LANGUAGES_SUPPORTED, 0);
if (languagesSupported < 1) {
@@ -1775,13 +1724,13 @@
languages.put("default", null);
}
- private void initializeUomoUnits() throws Exception {
+ private void initializeUomoUnits() {
Preferences uomounitsNode = getProductPreferencesNode(UOMOUNIT_NODE);
// --- read all preferences ---
uomoMetricUnit = uomounitsNode.getBoolean(UOMOUNIT_METRIC, defaultPrefs.isUomoMetricUnit());
}
- private void initializeEuroXRefRates() throws Exception {
+ private void initializeEuroXRefRates() {
Preferences euroXRefURL = getProductPreferencesNode(EURO_X_REF_URL_NODE);
// --- read all preferences ---
euroForeignExchangeReferenceRatesURLDaily = euroXRefURL.get(EURO_X_REF_URL_DAILY,
@@ -1790,19 +1739,19 @@
defaultPrefs.getEuroXRefRatesURLPrevious());
}
- private void initializeDatainterchange() throws Exception {
+ private void initializeDatainterchange() {
Preferences datainterchange = getProductPreferencesNode(DATAINTERCHANGE_NODE);
// --- read all preferences ---
datainterchangeConfiguration = datainterchange.get(DATAINTERCHANGE_CONFIGURATION,
defaultPrefs.getDatainterchangeConfiguration());
}
- private void initializeReadOnly() throws Exception {
+ private void initializeReadOnly() {
Preferences readOnly = getProductPreferences();
businessBundleClassNameReadOnly = readOnly.get(BUSINESS_BUNDLE_CLASS_NAME, "");
}
- private void initializeAuthentication() throws Exception {
+ private void initializeAuthentication() {
Preferences authentication = getProductPreferencesNode(AUTHENTICATION_NODE);
authenticationOrganizationId = authentication.get(AUTHENTICATION_ORGANIZATION_ID,
defaultPrefs.getAuthenticationOrganizationId());
@@ -1812,7 +1761,7 @@
authRESTfulApiPort = authentication.getInt(AUTH_RESTFUL_PORT, defaultPrefs.getAuthRESTfulPort());
}
- private void initializeActiveMqBroker() throws Exception {
+ private void initializeActiveMqBroker() {
Preferences activeMqBroker = getProductPreferencesNode(ACTIVEMQBROKER_NODE);
// --- read all preferences ---
activeMqBrokerServerName = activeMqBroker.get(ACTIVEMQBROKER_SERVER,
@@ -1823,7 +1772,7 @@
}
}
- private void initializeHybridConnection() throws Exception {
+ private void initializeHybridConnection() {
Preferences hybridConnection = getProductPreferencesNode(HYBRID_NODE);
// --- read all preferences ---
hybridRefresherMilliSecsActive = hybridConnection.getInt(HYBRID_REFRESHER_MILLISECS_ACTIVE,
@@ -1832,7 +1781,7 @@
defaultPrefs.getHybridRefresherMilliSecsInactive());
}
- private void initializeRealms() throws Exception {
+ private void initializeRealms() {
Preferences realms = getProductPreferencesNode(SHIRO_NODE);
maxLoginAttempts = realms.getInt(SHIRO_MAX_LOGIN_ATTEMPTS, defaultPrefs.getMaxLoginAttempts());
protocolDatasource = realms.get(SHIRO_PROTOCOL_DATASOURCE, defaultPrefs.getProtocolDatasource());
@@ -1840,35 +1789,39 @@
identifyByUsername = realms.getBoolean(SHIRO_IDENTIFY_BY_USERNAME, defaultPrefs.getIdentifyByUsername());
// --- generate reasonable default preferences for development product
- if (realms.childrenNames().length == 0) {
- Preferences dtoRealm = realms.node(SHIRO_DTO_REALM_CLASS);
- dtoRealm.putInt(DTO_PORTAL_ID, defaultPrefs.getDtoRealmPortalId());
+ try {
+ if (realms.childrenNames().length == 0) {
+ Preferences dtoRealm = realms.node(SHIRO_DTO_REALM_CLASS);
+ dtoRealm.putInt(DTO_PORTAL_ID, defaultPrefs.getDtoRealmPortalId());
- Preferences ldapRealm = realms.node(SHIRO_LDAP_REALM_CLASS);
- ldapRealm.putInt(LDAP_PORTAL_ID, defaultPrefs.getLdapRealmPortalId());
- ldapRealm.put(LDAP_URL, defaultPrefs.getLdapContextFactoryUrl());
- ldapRealm.put(LDAP_USERDNTEMPLATE, defaultPrefs.getLdapUserDnTemplate());
- realms.flush();
- }
- // --- read all preferences ---
- for (String iname : realms.childrenNames()) {
- Preferences realm = realms.node(iname);
- if (iname.contains("DTO")) {
- int portalId = realm.getInt(DTO_PORTAL_ID, defaultPrefs.getDtoRealmPortalId());
- DtoConfiguration configuration = new DtoConfiguration(iname, portalId);
- shiros.put(SHIRO_DTO_REALM, configuration);
- } else if (iname.contains("LDAP")) {
- int portalId = realm.getInt(LDAP_PORTAL_ID, defaultPrefs.getLdapRealmPortalId());
- String userDnTemplate = realm.get(LDAP_USERDNTEMPLATE, defaultPrefs.getLdapUserDnTemplate());
- String contextFactoryUrl = realm.get(LDAP_URL, defaultPrefs.getLdapContextFactoryUrl());
- if ((portalId > 0) && (portalId < 1000) // NOSONAR
- && !userDnTemplate.isEmpty() && !contextFactoryUrl.isEmpty() && !contextFactoryUrl.contains("<")
- && !contextFactoryUrl.contains(">")) {
- LdapConfiguration configuration = new LdapConfiguration(iname, portalId, contextFactoryUrl,
- userDnTemplate);
- shiros.put(SHIRO_LDAP_REALM, configuration);
+ Preferences ldapRealm = realms.node(SHIRO_LDAP_REALM_CLASS);
+ ldapRealm.putInt(LDAP_PORTAL_ID, defaultPrefs.getLdapRealmPortalId());
+ ldapRealm.put(LDAP_URL, defaultPrefs.getLdapContextFactoryUrl());
+ ldapRealm.put(LDAP_USERDNTEMPLATE, defaultPrefs.getLdapUserDnTemplate());
+ realms.flush();
+ }
+ // --- read all preferences ---
+ for (String iname : realms.childrenNames()) {
+ Preferences realm = realms.node(iname);
+ if (iname.contains("DTO")) {
+ int portalId = realm.getInt(DTO_PORTAL_ID, defaultPrefs.getDtoRealmPortalId());
+ DtoConfiguration configuration = new DtoConfiguration(iname, portalId);
+ shiros.put(SHIRO_DTO_REALM, configuration);
+ } else if (iname.contains("LDAP")) {
+ int portalId = realm.getInt(LDAP_PORTAL_ID, defaultPrefs.getLdapRealmPortalId());
+ String userDnTemplate = realm.get(LDAP_USERDNTEMPLATE, defaultPrefs.getLdapUserDnTemplate());
+ String contextFactoryUrl = realm.get(LDAP_URL, defaultPrefs.getLdapContextFactoryUrl());
+ if ((portalId > 0) && (portalId < 1000) // NOSONAR
+ && !userDnTemplate.isEmpty() && !contextFactoryUrl.isEmpty() && !contextFactoryUrl.contains("<")
+ && !contextFactoryUrl.contains(">")) {
+ LdapConfiguration configuration = new LdapConfiguration(iname, portalId, contextFactoryUrl,
+ userDnTemplate);
+ shiros.put(SHIRO_LDAP_REALM, configuration);
+ }
}
}
+ } catch (BackingStoreException e) {
+ LOGGER.error("{}", e);
}
}
@@ -1877,107 +1830,115 @@
}
private void initializeIfNotExists(Preferences root, Preferences dataSourcesPrefs, // NOSONAR
- String dataSource, String dataSourceConsumer, EnumDatabaseVendor vendor, String serverName, int serverPort,
- String database, String username, String password) throws Exception {
- if (!dataSourcesPrefs.nodeExists(dataSource)) {
- Preferences dataSourcePref = dataSourcesPrefs.node(dataSource);
- if ((dataSourceConsumer != null) && !dataSourceConsumer.isEmpty()) {
- root.put(dataSourceConsumer, dataSource);
- }
- put(dataSourcePref, DATASOURCE_ENUM_ITEM, vendor.name());
- put(dataSourcePref, DATASOURCE_DRIVER_VENDOR, vendor.getDriverVendor());
- put(dataSourcePref, DATASOURCE_DRIVER_TYPE, vendor.getDriverType());
- put(dataSourcePref, DATASOURCE_DRIVER_CLASS, vendor.getDriverClass());
- if ((serverName != null) && !serverName.isEmpty()) {
- put(dataSourcePref, DATASOURCE_SERVER_NAME, serverName);
- }
- if (serverPort >= 0) {
- put(dataSourcePref, DATASOURCE_SERVER_PORT, serverPort);
- }
+ String dataSource, String dataSourceConsumer, DatabaseVendor vendor, String serverName, int serverPort,
+ String database, String username, String password) {
+ try {
+ if (!dataSourcesPrefs.nodeExists(dataSource)) {
+ Preferences dataSourcePref = dataSourcesPrefs.node(dataSource);
+ if ((dataSourceConsumer != null) && !dataSourceConsumer.isEmpty()) {
+ root.put(dataSourceConsumer, dataSource);
+ }
+ put(dataSourcePref, DATASOURCE_ENUM_ITEM, vendor.name());
+ put(dataSourcePref, DATASOURCE_DRIVER_VENDOR, vendor.getDriverVendor());
+ put(dataSourcePref, DATASOURCE_DRIVER_TYPE, vendor.getDriverType());
+ put(dataSourcePref, DATASOURCE_DRIVER_CLASS, vendor.getDriverClass());
+ if ((serverName != null) && !serverName.isEmpty()) {
+ put(dataSourcePref, DATASOURCE_SERVER_NAME, serverName);
+ }
+ if (serverPort >= 0) {
+ put(dataSourcePref, DATASOURCE_SERVER_PORT, serverPort);
+ }
- put(dataSourcePref, DATASOURCE_SERVER_TIMEZONE,
- DateTimeZone.forID(ZoneId.systemDefault().normalized().toString()).getNameKey(0));
- put(dataSourcePref, DATASOURCE_DATABASE_NAME, database);
- put(dataSourcePref, DATASOURCE_DATABASE_USER, username);
- put(dataSourcePref, DATASOURCE_DATABASE_PASS, password);
- dataSourcesPrefs.flush();
- root.flush();
+ put(dataSourcePref, DATASOURCE_SERVER_TIMEZONE,
+ DateTimeZone.forID(ZoneId.systemDefault().normalized().toString()).getNameKey(0));
+ put(dataSourcePref, DATASOURCE_DATABASE_NAME, database);
+ put(dataSourcePref, DATASOURCE_DATABASE_USER, username);
+ put(dataSourcePref, DATASOURCE_DATABASE_PASS, password);
+ dataSourcesPrefs.flush();
+ root.flush();
+ }
+ } catch (BackingStoreException e) {
+ LOGGER.error("{}", e);
}
}
- private void initializeDataSources() throws Exception {
+ private void initializeDataSources() {
Preferences root = getProductPreferences();
Preferences dataSourcesPrefs = getProductPreferencesNode(DATASOURCE_NODE);
/* === datasource using a Oracle database === */
initializeIfNotExists(root, dataSourcesPrefs, ProductConfigurationDefaultPrefs.ORACLE,
- ProductConfigurationDefaultPrefs.ORACLE, EnumDatabaseVendor.ORACLE,
+ ProductConfigurationDefaultPrefs.ORACLE, MasterDatabaseVendor.ORACLE,
ProductConfigurationDefaultPrefs.IP_OR_HOST, 1521, ProductConfigurationDefaultPrefs.DATABASE_HINT,
ProductConfigurationDefaultPrefs.USERNAME_HINT, ProductConfigurationDefaultPrefs.PASSWORD_HINT);
/* === datasource using a Microsoft SQLserver database === */
initializeIfNotExists(root, dataSourcesPrefs, ProductConfigurationDefaultPrefs.MSSQL, null,
- EnumDatabaseVendor.MSSQL, ProductConfigurationDefaultPrefs.IP_OR_HOST, 1433, ProductConfigurationDefaultPrefs.DATABASE_HINT,
+ MasterDatabaseVendor.MSSQL, ProductConfigurationDefaultPrefs.IP_OR_HOST, 1433, ProductConfigurationDefaultPrefs.DATABASE_HINT,
ProductConfigurationDefaultPrefs.USERNAME_HINT, "");
/* === datasource using a MySQL database === */
initializeIfNotExists(root, dataSourcesPrefs, ProductConfigurationDefaultPrefs.MYSQL, null,
- EnumDatabaseVendor.MYSQL, ProductConfigurationDefaultPrefs.IP_OR_HOST, 3306, ProductConfigurationDefaultPrefs.DATABASE_HINT,
+ MasterDatabaseVendor.MYSQL, ProductConfigurationDefaultPrefs.IP_OR_HOST, 3306, ProductConfigurationDefaultPrefs.DATABASE_HINT,
ProductConfigurationDefaultPrefs.USERNAME_HINT, "");
/* === datasource using a MySQL8 database === */
initializeIfNotExists(root, dataSourcesPrefs, ProductConfigurationDefaultPrefs.MYSQL8, null,
- EnumDatabaseVendor.MYSQL8, ProductConfigurationDefaultPrefs.IP_OR_HOST, 3306, ProductConfigurationDefaultPrefs.DATABASE_HINT,
+ MasterDatabaseVendor.MYSQL8, ProductConfigurationDefaultPrefs.IP_OR_HOST, 3306, ProductConfigurationDefaultPrefs.DATABASE_HINT,
ProductConfigurationDefaultPrefs.USERNAME_HINT, "");
/* === datasource using a H2 in-Memory database === */
initializeIfNotExists(root, dataSourcesPrefs, DEFAULT_H2MEMORY_DATASOURCE, null,
- EnumDatabaseVendor.H2_IN_MEMORY, null, -1, ProductConfigurationDefaultPrefs.H2MEMORY,
+ MasterDatabaseVendor.H2_IN_MEMORY, null, -1, ProductConfigurationDefaultPrefs.H2MEMORY,
ProductConfigurationDefaultPrefs.H2MEMORY, ProductConfigurationDefaultPrefs.H2MEMORY); // NOSONAR
/* === datasource using a H2 local-file database === */
initializeIfNotExists(root, dataSourcesPrefs, DEFAULT_H2LOCALFILE_DATASOURCE, null,
- EnumDatabaseVendor.H2_LOCAL_FILE, null, -1, ProductConfigurationDefaultPrefs.H2LOCALFILE,
+ MasterDatabaseVendor.H2_LOCAL_FILE, null, -1, ProductConfigurationDefaultPrefs.H2LOCALFILE,
ProductConfigurationDefaultPrefs.H2LOCALFILE, ProductConfigurationDefaultPrefs.H2LOCALFILE);
/* === datasource using a Derby in-Memory database === */
initializeIfNotExists(root, dataSourcesPrefs, DEFAULT_DERBYMEMORY_DATASOURCE, null,
- EnumDatabaseVendor.DERBY_IN_MEMORY, null, -1, ProductConfigurationDefaultPrefs.DERBYMEMORY,
+ MasterDatabaseVendor.DERBY_IN_MEMORY, null, -1, ProductConfigurationDefaultPrefs.DERBYMEMORY,
ProductConfigurationDefaultPrefs.DERBYMEMORY, ProductConfigurationDefaultPrefs.DERBYMEMORY);
/* === datasource using a Derby local-file database === */
initializeIfNotExists(root, dataSourcesPrefs, DEFAULT_DERBYLOCALFILE_DATASOURCE, null,
- EnumDatabaseVendor.DERBY_LOCAL_FILE, null, -1, ProductConfigurationDefaultPrefs.DERBYLOCALFILE,
+ MasterDatabaseVendor.DERBY_LOCAL_FILE, null, -1, ProductConfigurationDefaultPrefs.DERBYLOCALFILE,
ProductConfigurationDefaultPrefs.DERBYLOCALFILE, ProductConfigurationDefaultPrefs.DERBYLOCALFILE);
/* === datasource using a Derby database === */
initializeIfNotExists(root, dataSourcesPrefs, DEFAULT_DERBYSERVER_DATASOURCE, null,
- EnumDatabaseVendor.DERBY_CLIENT, ProductConfigurationDefaultPrefs.IP_OR_HOST, 1527,
+ MasterDatabaseVendor.DERBY_CLIENT, ProductConfigurationDefaultPrefs.IP_OR_HOST, 1527,
ProductConfigurationDefaultPrefs.DATABASE_HINT, ProductConfigurationDefaultPrefs.USERNAME_HINT,
ProductConfigurationDefaultPrefs.PASSWORD_HINT);
/* === datasource using a PostgreSQL database === */
initializeIfNotExists(root, dataSourcesPrefs, DEFAULT_POSTGRESQL_DATASOURCE, null,
- EnumDatabaseVendor.POSTGRESQL, ProductConfigurationDefaultPrefs.IP_OR_HOST, 5432,
+ MasterDatabaseVendor.POSTGRESQL, ProductConfigurationDefaultPrefs.IP_OR_HOST, 5432,
ProductConfigurationDefaultPrefs.DATABASE_HINT, ProductConfigurationDefaultPrefs.USERNAME_HINT,
ProductConfigurationDefaultPrefs.PASSWORD_HINT);
- for (String dataSourceName : dataSourcesPrefs.childrenNames()) {
- Preferences dataSource = dataSourcesPrefs.node(dataSourceName);
- String vendorName = dataSource.get(DATASOURCE_ENUM_ITEM, "");
- String driverVendor = dataSource.get(DATASOURCE_DRIVER_VENDOR, "");
- String databaseName = dataSource.get(DATASOURCE_DATABASE_NAME, "");
- EnumDatabaseVendor vendor = EnumDatabaseVendor.byName(vendorName, driverVendor, databaseName);
- String driverType = dataSource.get(DATASOURCE_DRIVER_TYPE, "");
- String driverClass = dataSource.get(DATASOURCE_DRIVER_CLASS, "");
- String serverName = dataSource.get(DATASOURCE_SERVER_NAME, "");
- int serverPort = dataSource.getInt(DATASOURCE_SERVER_PORT, 0);
- String serverTimezone = dataSource.get(DATASOURCE_SERVER_TIMEZONE,
- DateTimeZone.forID(ZoneId.systemDefault().normalized().toString()).getNameKey(0));
- String databaseUser = dataSource.get(DATASOURCE_DATABASE_USER, "");
- String databasePass = dataSource.get(DATASOURCE_DATABASE_PASS, "");
- String jdbcUrlFormat = dataSource.get(DATASOURCE_JDBC_URL_FORMAT, null);
- if (!driverClass.isEmpty() && !databaseName.isEmpty() && !databaseUser.isEmpty()) {
- DataSourceConfiguration configuration = new DataSourceConfiguration(dataSourceName, vendor,
- driverVendor, driverType, driverClass, serverName, serverPort, databaseName, databaseUser,
- databasePass, jdbcUrlFormat, serverTimezone);
- dataSources.put(dataSourceName, configuration);
+ try {
+ for (String dataSourceName : dataSourcesPrefs.childrenNames()) {
+ Preferences dataSource = dataSourcesPrefs.node(dataSourceName);
+ String vendorName = dataSource.get(DATASOURCE_ENUM_ITEM, "");
+ String driverVendor = dataSource.get(DATASOURCE_DRIVER_VENDOR, "");
+ String databaseName = dataSource.get(DATASOURCE_DATABASE_NAME, "");
+ DatabaseVendor vendor = MasterDatabaseVendor.byName(vendorName, driverVendor, databaseName);
+ String driverType = dataSource.get(DATASOURCE_DRIVER_TYPE, "");
+ String driverClass = dataSource.get(DATASOURCE_DRIVER_CLASS, "");
+ String serverName = dataSource.get(DATASOURCE_SERVER_NAME, "");
+ int serverPort = dataSource.getInt(DATASOURCE_SERVER_PORT, 0);
+ String serverTimezone = dataSource.get(DATASOURCE_SERVER_TIMEZONE,
+ DateTimeZone.forID(ZoneId.systemDefault().normalized().toString()).getNameKey(0));
+ String databaseUser = dataSource.get(DATASOURCE_DATABASE_USER, "");
+ String databasePass = dataSource.get(DATASOURCE_DATABASE_PASS, "");
+ String jdbcUrlFormat = dataSource.get(DATASOURCE_JDBC_URL_FORMAT, null);
+ if (!driverClass.isEmpty() && !databaseName.isEmpty() && !databaseUser.isEmpty()) {
+ DataSourceConfiguration configuration = new DataSourceConfiguration(dataSourceName, vendor,
+ driverVendor, driverType, driverClass, serverName, serverPort, databaseName, databaseUser,
+ databasePass, jdbcUrlFormat, serverTimezone);
+ dataSources.put(dataSourceName, configuration);
+ }
}
+ } catch (BackingStoreException e) {
+ LOGGER.error("{}", e);
}
}
- private void initializeEmail() throws Exception {
+ private void initializeEmail() {
Preferences authentication = getProductPreferencesNode(AUTHENTICATION_NODE);
adminEmail = authentication.get(AUTHENTICATION_ADMIN_EMAIL_ACCOUNT, defaultPrefs.getAdminEmail());
adminEmailUsername = authentication.get(AUTHENTICATION_ADMIN_EMAIL_USERNAME,
@@ -1993,7 +1954,7 @@
emailUseSslOnConnect = email.getBoolean(EMAIL_USE_SSL_ON_CONNECT, defaultPrefs.isEmailUseSslOnConnect());
}
- private void initializeBPM() throws Exception {
+ private void initializeBPM() {
Preferences bpm = getProductPreferencesNode(BPM_NODE);
bpmServerIp = bpm.get(BPM_SERVER_IP, defaultPrefs.getBpmServerIp());
bpmServerPort = bpm.getInt(BPM_SERVER_PORT, 0);
@@ -2003,84 +1964,92 @@
bpmResponseTimeout = bpm.getInt(BPM_RESPONSE_TIMEOUT, defaultPrefs.getBpmResponseTimeout());
bpmHibernateShowSql = bpm.getBoolean(BPM_HIBERNATE_SHOW_SQL, defaultPrefs.isBpmEngineHibernateShowSql());
bpmHibernateFormatSql = bpm.getBoolean(BPM_HIBERNATE_FORMAT_SQL, defaultPrefs.isBpmEngineHibernateFormatSql());
- bpmHibernateMaxFetchDepth = bpm.getInt(BPM_HIBERNATE_MAX_FETCH_DEPTH,
- defaultPrefs.getBpmEngineHibernateMaxFetchDepth());
+ bpmHibernateMaxFetchDepth = bpm.getInt(BPM_HIBERNATE_MAX_FETCH_DEPTH, defaultPrefs.getBpmEngineHibernateMaxFetchDepth());
+ bpmInitialProcess = bpm.get(BPM_INITIAL_PROCESS, defaultPrefs.getBpmInitialProcess());
+ bpmEngineLogging = bpm.getBoolean(BPM_LOGGING, defaultPrefs.isBpmEngineLogging());
}
- private void initializeIfNotExists(boolean force, Preferences root, Preferences pus, String persistenceUnit,
+ private void initializeIfNotExists(boolean force, Preferences root, Preferences pus, String persistenceUnit, // NOSONAR
String dataSource, boolean deployOnStartup, boolean queryCache, String batchWriting, int batchWritingSize,
- boolean cacheStatements, int cacheStatementsSize, String loggingLevel, String dllGeneration, String xmlPath)
- throws Exception { // NOSONAR
- if (force || !pus.nodeExists(persistenceUnit)) {
- DataSourceConfiguration dataSourceConfiguration = getDataSource(dataSource);
- Preferences pu = pus.node(persistenceUnit);
- pu.put(PERSISTENCE_DATASOURCE, dataSource);
- pu.putBoolean(PERSISTENCE_DEPLOYONSTARTUP, deployOnStartup);
- pu.putBoolean(PERSISTENCE_QUERYCACHE, queryCache);
- if (batchWriting == null) {
- batchWriting = dataSourceConfiguration.getDefaultBatchWriting();
+ boolean cacheStatements, int cacheStatementsSize, String loggingLevel, String dllGeneration, String xmlPath) {
+ try {
+ if (force || !pus.nodeExists(persistenceUnit)) {
+ DataSourceConfiguration dataSourceConfiguration = getDataSource(dataSource);
+ Preferences pu = pus.node(persistenceUnit);
+ pu.put(PERSISTENCE_DATASOURCE, dataSource);
+ pu.putBoolean(PERSISTENCE_DEPLOYONSTARTUP, deployOnStartup);
+ pu.putBoolean(PERSISTENCE_QUERYCACHE, queryCache);
+ if (batchWriting == null) {
+ batchWriting = dataSourceConfiguration.getDefaultBatchWriting();
+ }
+ pu.put(PERSISTENCE_BATCHWRITING, batchWriting);
+ pu.putInt(PERSISTENCE_BATCHWRITINGSIZE, batchWritingSize);
+ pu.putBoolean(PERSISTENCE_CACHESTATEMENTS, cacheStatements);
+ pu.putInt(PERSISTENCE_CACHESTATEMENTSSIZE, cacheStatementsSize);
+ pu.put(PERSISTENCE_LOGGINGLEVEL, loggingLevel);
+ pu.put(PERSISTENCE_DDLGENERATION, dllGeneration);
+ pu.put(PERSISTENCE_PERSISTENCEXMLPATH, xmlPath);
+ pus.flush();
+ root.flush();
}
- pu.put(PERSISTENCE_BATCHWRITING, batchWriting);
- pu.putInt(PERSISTENCE_BATCHWRITINGSIZE, batchWritingSize);
- pu.putBoolean(PERSISTENCE_CACHESTATEMENTS, cacheStatements);
- pu.putInt(PERSISTENCE_CACHESTATEMENTSSIZE, cacheStatementsSize);
- pu.put(PERSISTENCE_LOGGINGLEVEL, loggingLevel);
- pu.put(PERSISTENCE_DDLGENERATION, dllGeneration);
- pu.put(PERSISTENCE_PERSISTENCEXMLPATH, xmlPath);
- pus.flush();
- root.flush();
+ } catch (BackingStoreException e) {
+ LOGGER.error("{}", e);
}
}
- private void initializePersistenceUnits() throws Exception {
+ private void initializePersistenceUnits() {
Preferences root = getProductPreferences();
Preferences pus = getProductPreferencesNode(PERSISTENCE_NODE);
// --- generate reasonable default preferences for development product
initializeIfNotExists(false, root, pus, PERSISTENCE_UNIT_AUTHENTICATION, dataSourceForAuthentication, true,
- true, null, 1000, true, 200, "off", "create-or-extend-tables", // NOSONAR
+ true, null, 1000, true, 200, "off", PersistenceUnitProperties.CREATE_OR_EXTEND, // NOSONAR
PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
initializeIfNotExists(false, root, pus, PERSISTENCE_UNIT_BLOB, dataSourceForBLOB, true, true, null, 1000, true,
- 200, "off", "create-or-extend-tables", PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
+ 200, "off", PersistenceUnitProperties.CREATE_OR_EXTEND, PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
initializeIfNotExists(false, root, pus, PERSISTENCE_UNIT_BPM, dataSourceForBPM, true, true, null, 1000, true,
200, "off", "none", PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
initializeIfNotExists(false, root, pus, PERSISTENCE_UNIT_BUSINESSDATA, dataSourceForBusinessData, true, true,
- null, 1000, true, 200, "off", "create-or-extend-tables",
+ null, 1000, true, 200, "off", PersistenceUnitProperties.CREATE_OR_EXTEND,
PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
// --- read all preferences ---
- for (String persistenceUnitName : pus.childrenNames()) {
- Preferences pu = pus.node(persistenceUnitName);
- String jndiName = pu.get(PERSISTENCE_DATASOURCE, "");
- boolean deployOnStartup = pu.getBoolean(PERSISTENCE_DEPLOYONSTARTUP,
- PersistenceUnitConfiguration.DEPLOY_ON_STARTUP);
- boolean queryCache = pu.getBoolean(PERSISTENCE_QUERYCACHE, PersistenceUnitConfiguration.QUERY_CACHE);
- String batchWriting = pu.get(PERSISTENCE_BATCHWRITING, "JDBC");
- int batchWritingSize = pu.getInt(PERSISTENCE_BATCHWRITINGSIZE,
- PersistenceUnitConfiguration.BATCH_WRITING_SIZE);
- boolean cacheStatements = pu.getBoolean(PERSISTENCE_CACHESTATEMENTS,
- PersistenceUnitConfiguration.CACHE_STATEMENTS);
- int cacheStatementSize = pu.getInt(PERSISTENCE_CACHESTATEMENTSSIZE,
- PersistenceUnitConfiguration.CACHE_STATEMENTS_SIZE);
- String loggingLevel = pu.get(PERSISTENCE_LOGGINGLEVEL, PersistenceUnitConfiguration.LOGGING_LEVEL);
- String ddlGeneration = pu.get(PERSISTENCE_DDLGENERATION, DDL_GENERATION.UPDATE.eclipseLink());
- String persistenceXMLPath = pu.get(PERSISTENCE_PERSISTENCEXMLPATH,
- PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
- PersistenceUnitConfiguration configuration = new PersistenceUnitConfiguration(persistenceUnitName, jndiName,
- deployOnStartup, queryCache, batchWriting, batchWritingSize, cacheStatements, cacheStatementSize,
- loggingLevel, ddlGeneration, persistenceXMLPath);
- persistenceUnits.put(persistenceUnitName, configuration);
+ try {
+ for (String persistenceUnitName : pus.childrenNames()) {
+ Preferences pu = pus.node(persistenceUnitName);
+ String jndiName = pu.get(PERSISTENCE_DATASOURCE, "");
+ boolean deployOnStartup = pu.getBoolean(PERSISTENCE_DEPLOYONSTARTUP,
+ PersistenceUnitConfiguration.DEPLOY_ON_STARTUP);
+ boolean queryCache = pu.getBoolean(PERSISTENCE_QUERYCACHE, PersistenceUnitConfiguration.QUERY_CACHE);
+ String batchWriting = pu.get(PERSISTENCE_BATCHWRITING, "JDBC");
+ int batchWritingSize = pu.getInt(PERSISTENCE_BATCHWRITINGSIZE,
+ PersistenceUnitConfiguration.BATCH_WRITING_SIZE);
+ boolean cacheStatements = pu.getBoolean(PERSISTENCE_CACHESTATEMENTS,
+ PersistenceUnitConfiguration.CACHE_STATEMENTS);
+ int cacheStatementSize = pu.getInt(PERSISTENCE_CACHESTATEMENTSSIZE,
+ PersistenceUnitConfiguration.CACHE_STATEMENTS_SIZE);
+ String loggingLevel = pu.get(PERSISTENCE_LOGGINGLEVEL, PersistenceUnitConfiguration.LOGGING_LEVEL);
+ String ddlGeneration = pu.get(PERSISTENCE_DDLGENERATION, DDL_GENERATION.UPDATE.eclipseLink());
+ String persistenceXMLPath = pu.get(PERSISTENCE_PERSISTENCEXMLPATH,
+ PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML_DEFAULT);
+ PersistenceUnitConfiguration configuration = new PersistenceUnitConfiguration(persistenceUnitName, jndiName,
+ deployOnStartup, queryCache, batchWriting, batchWritingSize, cacheStatements, cacheStatementSize,
+ loggingLevel, ddlGeneration, persistenceXMLPath);
+ persistenceUnits.put(persistenceUnitName, configuration);
+ }
+ } catch (BackingStoreException e) {
+ LOGGER.error("{}", e);
}
}
- private void initializeProjectWizard() throws Exception {
+ private void initializeProjectWizard() {
Preferences projectWizard = getProductPreferencesNode(PROJECT_WIZARD_NODE);
// --- read all preferences ---
projectWizardAbsoluteLocation = projectWizard.getBoolean(PROJECT_WIZARD_ABSOLUTE_LOCATION,
defaultPrefs.projectWizardUsesAbsoluteLocation());
}
- private void initializeDemo() throws Exception {
+ private void initializeDemo() {
Preferences demo = getProductPreferencesNode(DEMO_NODE);
demoToolsTheme = demo.getBoolean(DEMO_TOOLS_THEME, defaultPrefs.hasDemoToolsTheme());
demoToolsLanguage = demo.getBoolean(DEMO_TOOLS_LANGUAGE, defaultPrefs.hasDemoToolsLanguage());
@@ -2089,33 +2058,35 @@
}
- private void initializeJavaPOS() throws Exception {
+ private void initializeJavaPOS() {
Preferences javaPos = getProductPreferencesNode(JAVA_POS_NODE);
// --- read all preferences ---
javaPosConfiguration = javaPos.get(JAVA_POS_CONFIGURATION, defaultPrefs.getJavaPosConfiguration());
javaPosPortConfiguration = javaPos.get(JAVA_POS_PORT_CONFIGURATION, defaultPrefs.getJavaPosPortConfiguration());
+ javaPosUploadedBitmaps = javaPos.getBoolean(JAVA_POS_UPLOADED_BITMAPS, defaultPrefs.hasJavaPosUploadedBitmaps());
}
- //TODO remove
- private void initializeIfNotExists(Preferences root, Preferences dataSourcesPrefs, String mockname) throws Exception {
- put(dataSourcesPrefs, mockname, mockname);
- dataSourcesPrefs.flush();
- root.flush();
- }
-
- private void initializeEntityMocksData() throws Exception {
+ private void initializeEntityMocksData() {
Preferences dataSourcesPrefs = getProductPreferencesNode(MOCK_DATA_NODE);
- for (String dataSourceName : dataSourcesPrefs.keys()) {
- Preferences dataSource = dataSourcesPrefs.node(dataSourceName);
- String name = dataSource.name();
-
- if (!name.isEmpty()) {
- EntityMockConfiguration configuration = new EntityMockConfiguration(name);
- mockData.put(dataSourceName, configuration);
+ try {
+ for (String dataSourceName : dataSourcesPrefs.keys()) {
+ Preferences dataSource = dataSourcesPrefs.node(dataSourceName);
+ if (!dataSource.name().isEmpty()) {
+ EntityMockConfiguration configuration = new EntityMockConfiguration(dataSource.name());
+ mockData.put(dataSourceName, configuration);
+ }
}
+ } catch (BackingStoreException e) {
+ LOGGER.error("{}", e);
}
}
+ private void initializeBI() {
+ Preferences bi = getProductPreferencesNode(BI_NODE);
+ cubeViewPort = bi.getInt(CUBE_VIEW_PORT, defaultPrefs.getCubeViewPort());
+ }
+
+
public void setBpmEngineHibernateShowSql(boolean value) {
bpmHibernateShowSql = put(BPM_NODE, BPM_HIBERNATE_SHOW_SQL, value);
}
@@ -2147,6 +2118,12 @@
}
@Override
+ public boolean isBpmEngineLogging() {
+ initialize();
+ return bpmEngineLogging;
+ }
+
+ @Override
public String getBpmEnginePersistenceUnit() {
return ProductConfigurationDefaultPrefs.BPM_ENGINE_PERSISTENCE_UNIT;
}
@@ -2156,7 +2133,7 @@
initialize();
String databaseName = getDataSourceDatabaseName(getPersistenceUnitJndiName(persistenceUnit));
String userName = getDataSourceUserName(getPersistenceUnitJndiName(persistenceUnit));
- EnumDatabaseVendor vendor = getDataSourceDatabaseVendor(getPersistenceUnitJndiName(persistenceUnit));
+ DatabaseVendor vendor = getDataSourceDatabaseVendor(getPersistenceUnitJndiName(persistenceUnit));
if (vendor != null) {
return vendor.applySchemaNameSpecifications(databaseName, userName);
}
@@ -2213,7 +2190,7 @@
@Override
public String getReportPrinter(String reportName) {
- return getNode(REPORT_PRINTER_NODE).get(reportName, "NaN");
+ return getNode(REPORT_PRINTER_NODE).get(reportName, "");
}
@Override
@@ -2238,12 +2215,11 @@
node.flush();
registerWatch();
} catch (Exception e) { // NOSONAR
- LOGGER.error("node " + node.name() + " and key " + key // NOSONAR
- + " could not be set or flushed because " + e.getLocalizedMessage());
+ LOGGER.error("node {} and key {} could not be set or flushed because {}", node.name(), key, e);
}
} else {
- LOGGER.error(
- "node " + (node != null ? node.name() : "null") + " and key " + key + " are no valid arguments");
+ String nd = (node != null ? node.name() : "null");
+ LOGGER.error("node {} and key {} are no valid arguments", nd, key);
}
}
@@ -2257,7 +2233,7 @@
}
public void setJavaPosPortConfiguration(String value) {
- this.javaPosPortConfiguration = put(JAVA_POS_NODE, JAVA_POS_PORT_CONFIGURATION, value);
+ javaPosPortConfiguration = put(JAVA_POS_NODE, JAVA_POS_PORT_CONFIGURATION, value);
}
@Override
@@ -2265,6 +2241,15 @@
return javaPosPortConfiguration;
}
+ public void setJavaPosUploadedBitmaps(boolean value) {
+ javaPosUploadedBitmaps = put(JAVA_POS_NODE, JAVA_POS_UPLOADED_BITMAPS, value);
+ }
+
+ @Override
+ public boolean hasJavaPosUploadedBitmaps() {
+ return javaPosUploadedBitmaps;
+ }
+
public EntityMockConfiguration getEntityMockData(String mockName) {
try {
initializeEntityMocksData();
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileBase.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileBase.java
index 0d8751c..ff636df 100644
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileBase.java
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileBase.java
@@ -25,6 +25,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.eclipse.osbp.preferences.databases.vendors.DatabaseVendor;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -80,7 +81,7 @@
}
/** set of necessary data base vendors defined by the product preferences */
- protected final Set<EnumDatabaseVendor> dataBaseVendors;
+ protected final Set<DatabaseVendor> dataBaseVendors;
public ProductFileBase(ProductConfigurationPrefs prefs) {
dataBaseVendors = prefs.getDataBaseVendors();
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileConfigurations.xtend b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileConfigurations.xtend
index ee4776c..2bca72b 100644
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileConfigurations.xtend
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileConfigurations.xtend
@@ -14,6 +14,8 @@
*/
package org.eclipse.osbp.preferences
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor
+
/**
* <configurations> dependencies for the OSBP product bundle <code>*.product</code> file.
*/
@@ -77,7 +79,7 @@
removeDuplicates(asString
.replace(
"${{NECESSARY_DATA_BASE_VENDOR_CONFIGURATIONS}}",
- EnumDatabaseVendor.getNecessaryConfigurations(dataBaseVendors)
+ MasterDatabaseVendor.getNecessaryConfigurations(dataBaseVendors)
)
)
}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileFeatures.xtend b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileFeatures.xtend
index 65a8ae8..3d6ef99 100644
--- a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileFeatures.xtend
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/ProductFileFeatures.xtend
@@ -16,6 +16,7 @@
import org.eclipse.core.runtime.IBundleGroupProvider
import org.eclipse.core.runtime.Platform
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor
/**
* <plugins> dependencies for the OSBP product bundle <code>*.product</code> file.
@@ -51,7 +52,7 @@
removeDuplicates(asString
.replace(
"${{DATA_BASE_VENDOR_FEATURES}}",
- EnumDatabaseVendor.getDatabaseFeatures(dataBaseVendors)
+ MasterDatabaseVendor.getDatabaseFeatures(dataBaseVendors)
)
)
}
@@ -73,7 +74,7 @@
}
}
if (netOsbee){
- return "\t<feature id=\"net.osbee.softwarefactory.runtime.feature\"/>"
+ return "\t<feature id=\"net.osbee.softwarefactory.runtime.feature\"/>\n\t<feature id=\"net.osbee.softwarefactory.runtime.pos.feature\"/>"
} else if (orgOsbee){
return "\t<feature id=\"org.osbee.softwarefactory.runtime.feature\"/>"
}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordDerby.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordDerby.java
new file mode 100644
index 0000000..d6b99ca
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordDerby.java
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2019 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.reservedkeywords;
+
+/**
+ * This enum lists all derby reserved keywords.
+ */
+public enum ReservedKeywordDerby {
+
+ /** Derby keywords*/
+ ADD("ADD"), ALL("ALL"), ALLOCATE("ALLOCATE"), ALTER("ALTER"), AND("AND"), ANY("ANY"), ARE("ARE"), AS("AS"), ASC("ASC"), ASSERTION("ASSERTION"), AT("AT"), AUTHORIZATION("AUTHORIZATION"), AVG("AVG"),
+
+ BEGIN("BEGIN"),BETWEEN("BETWEEN"), BIGINT("BIGINT"), BIT("BIT"), BOOLEAN("BOOLEAN"), BOTH("BOTH"), BY("BY"),
+
+ CALL("CALL"), CASCADE("CASCADE"), CASCADED("CASCADED"), CASE("CASE"), CAST("CAST"), CHAR("CHAR"), CHARACTER("CHARACTER"), CHECK("CHECK"), CLOSE("CLOSE"), COALESCE("COALESCE"),
+ COLLATE("COLLATE"), COLLATION("COLLATION"), COLUMN("COLUMN"), COMMIT("COMMIT"), CONNECT("CONNECT"), CONNECTION("CONNECTION"), CONSTRAINT("CONSTRAINT"), CONSTRAINTS("CONSTRAINTS"),
+ CONTINUE("CONTINUE"), CONVERT("CONVERT"), CORRESPONDING("CORRESPONDING"), CREATE("CREATE"), CURRENT("CURRENT"), CURRENT_DATE("CURRENT_DATE"), CURRENT_TIME("CURRENT_TIME"),
+ CURRENT_TIMESTAMP("CURRENT_TIMESTAMP"), CURRENT_USER("CURRENT_USER"), CURSOR("CURSOR"),
+
+ DEALLOCATE("DEALLOCATE"), DEC("DEC"), DECIMAL("DECIMAL"), DECLARE("DECLARE"), DEFAULT("DEFAULT"), DEFERRABLE("DEFERRABLE"), DEFERRED("DEFERRED"),
+ DELETE("DELETE"), DESC("DESC"), DESCRIBE("DESCRIBE"), DIAGNOSTICS("DIAGNOSTICS"), DISCONNECT("DISCONNECT"), DISTINCT("DISTINCT"), DOUBLE("DOUBLE"),
+ DROP("DROP"),
+
+ ELSE("ELSE"), END("END"), END_EXEC("END-EXEC"), ESCAPE("ESCAPE"), EXCEPT("EXCEPT"), EXCEPTION("EXCEPTION"), EXEC("EXEC"), EXECUTE("EXECUTE"),
+ EXISTS("EXISTS"), EXPLAIN("EXPLAIN"), EXTERNAL("EXTERNAL"),
+
+ FALSE("FALSE"), FETCH("FETCH"), FIRST("FIRST"), FLOAT("FLOAT"), FOR("FOR"), FOREIGN("FOREIGN"), FOUND("FOUND"), FROM("FROM"), FULL("FULL"), FUNCTION("FUNCTION"),
+
+ GET("GET"), GETCURRENTCONNECTION("GETCURRENTCONNECTION"), GLOBAL("GLOBAL"), GO("GO"), GOTO("GOTO"), GRANT("GRANT"), GROUP("GROUP"),
+
+ HAVING("HAVING"), HOUR("HOUR"),
+
+ IDENTITY("IDENTITY"), IMMEDIATE("IMMEDIATE"), IN("IN"), INDICATOR("INDICATOR"), INITIALLY("INITIALLY"), INNER("INNER"), INOUT("INOUT"), INPUT("INPUT"), INSENSITIVE("INSENSITIVE"),
+ INSERT("INSERT"), INT("INT"), INTEGER("INTEGER"), INTERSECT("INTERSECT"), INTO("INTO"), IS("IS"), ISOLATION("ISOLATION"),
+
+ JOIN("JOIN"),
+
+ KEY("KEY"),
+
+ LAST("LAST"), LEFT("LEFT"), LIKE("LIKE"), LOWER("LOWER"), LTRIM("LTRIM"),
+
+ MATCH("MATCH"), MAX("MAX"), MIN("MIN"), MINUTE("MINUTE"),
+
+ NATIONAL("NATIONAL"), NATURAL("NATURAL"), NCHAR("NCHAR"), NVARCHAR("NVARCHAR"), NEXT("NEXT"), NO("NO"), NOT("NOT"), NULL("NULL"), NULLIF("NULLIF"), NUMERIC("NUMERIC"),
+
+ OF("OF"), ON("ON"), ONLY("ONLY"), OPEN("OPEN"), OPTION("OPTION"), OR("OR"), ORDER("ORDER"), OUTER("OUTER"), OUTPUT("OUTPUT"), OVERLAPS("OVERLAPS"),
+
+ PAD("PAD"), PARTIAL("PARTIAL"), PREPARE("PREPARE"), PRESERVE("PRESERVE"), PRIMARY("PRIMARY"), PRIOR("PRIOR"), PRIVILEGES("PRIVILEGES"), PROCEDURE("PROCEDURE"), PUBLIC("PUBLIC"),
+
+ READ("READ"), REAL("REAL"), REFERENCES("REFERENCES"), RELATIVE("RELATIVE"), RESTRICT("RESTRICT"), REVOKE("REVOKE"), RIGHT("RIGHT"), ROLLBACK("ROLLBACK"), ROWS("ROWS"), RTRIM("RTRIM"),
+
+ SCHEMA("SCHEMA"), SCROLL("SCROLL"), SECOND("SECOND"), SELECT("SELECT"), SESSION_USER("SESSION_USER"), SET("SET"), SMALLINT("SMALLINT"), SOME("SOME"), SPACE("SPACE"), SQL("SQL"),
+ SQLCODE("SQLCODE"), SQLERROR("SQLERROR"), SQLSTATE("SQLSTATE"), SUBSTR("SUBSTR"), SUBSTRING("SUBSTRING"), SUM("SUM"), SYSTEM_USER("SYSTEM_USER"),
+
+ TABLE("TABLE"), TEMPORARY("TEMPORARY"), TIMEZONE_HOUR("TIMEZONE_HOUR"), TIMEZONE_MINUTE("TIMEZONE_MINUTE"), TO("TO"), TRANSACTION("TRANSACTION"), TRANSLATE("TRANSLATE"), TRANSLATION("TRANSLATION"),TRUE("TRUE"),
+
+ UNION("UNION"), UNIQUE("UNIQUE"), UNKNOWN("UNKNOWN"), UPDATE("UPDATE"), UPPER("UPPER"), USER("USER"), USING("USING"),
+
+ VALUES("VALUES"), VARCHAR("VARCHAR"), VARYING("VARYING"), VIEW("VIEW"),
+
+ WHENEVER("WHENEVER"), WHERE("WHERE"), WITH("WITH"), WORK("WORK"), WRITE("WRITE"),
+
+ XML("XML"), XMLEXISTS("XMLEXISTS"), XMLPARSE("XMLPARSE"), XMLQUERY("XMLQUERY"), XMLSERIALIZE("XMLSERIALIZE"),
+
+ YEAR("YEAR");
+
+ /** The keyword name. */
+ private final String name;
+
+ /**
+ * Instantiates a new enum of reserved keyword.
+ * @param name the keyword
+ */
+ private ReservedKeywordDerby(String name) {
+ this.name = name;
+ }
+
+ public static boolean isReserved(String name) {
+ String temp = name.toUpperCase();
+ for (ReservedKeywordDerby keyword : values()) {
+ if (temp.equals(keyword.name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordH2.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordH2.java
new file mode 100644
index 0000000..910ffda
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordH2.java
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2019 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.reservedkeywords;
+
+/**
+ * This enum lists all h2 reserved keywords.
+ */
+public enum ReservedKeywordH2 {
+
+ /** H2 keywords*/
+ ALL("ALL"),
+
+ CHECK("CHECK"), CONSTRAINT("CONSTRAINT"), CROSS("CROSS"), CURRENT_DATE("CURRENT_DATE"), CURRENT_TIME("CURRENT_TIME"), CURRENT_TIMESTAMP("CURRENT_TIMESTAMP"),
+
+ DISTINCT("DISTINCT"),
+
+ EXCEPT("EXCEPT"), EXISTS("EXISTS"),
+
+ FALSE("FALSE"), FETCH("FETCH"), FOR("FOR"), FOREIGN("FOREIGN"), FROM("FROM"), FULL("FULL"),
+
+ GRANT("GRANT"), GROUP("GROUP"),
+
+ HAVING("HAVING"),
+
+ IDENTIFIED("IDENTIFIED"), IMMEDIATE("IMMEDIATE"), INNER("INNER"), INTERSECT("INTERSECT"), IS("IS"),
+
+ JOIN("JOIN"),
+
+ LIKE("LIKE"), LIMIT("LIMIT"),
+
+ MINUS("MINUS"),
+
+ NATURAL("NATURAL"), NOT("NOT"), NULL("NULL"),
+
+ OFFSET("OFFSET"), ON("ON"), ORDER("ORDER"),
+
+ PRIMARY("PRIMARY"),
+
+ ROWNUM("ROWNUM"), ROWS("ROWS"),
+
+ SELECT("SELECT"), SYSDATE("SYSDATE"), SYSTIME("SYSTIME"), SYSTIMESTAMP("SYSTIMESTAMP"),
+
+ TODAY("TODAY"), TRUE("TRUE"),
+
+ UNION("UNION"), UNIQUE("UNIQUE"),
+
+ WHERE("WHERE"), WITH("WITH");
+
+
+ /** The keyword name. */
+ private final String name;
+
+ /**
+ * Instantiates a new enum of reserved keyword.
+ * @param name the keyword
+ */
+ private ReservedKeywordH2(String name) {
+ this.name = name;
+ }
+
+ public static boolean isReserved(String name) {
+ String temp = name.toUpperCase();
+ for (ReservedKeywordH2 keyword : values()) {
+ if (temp.equals(keyword.name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordMSSQL.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordMSSQL.java
new file mode 100644
index 0000000..934a84c
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordMSSQL.java
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2019 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.reservedkeywords;
+
+/**
+ * This enum lists all ms sql reserved keywords.
+ */
+public enum ReservedKeywordMSSQL {
+
+ /** MSSQL keywords*/
+ ABSOLUTE("ABSOLUTE"), ACTION("ACTION"), ADA("ADA"), ADD("ADD"), ALL("ALL"), ALLOCATE("ALLOCATE"), ALTER("ALTER"), AND("AND"), ANY("ANY"),
+ ARE("ARE"), AS("AS"), ASC("ASC"), ASSERTION("ASSERTION"), AT("AT"), AUTHORIZATION("AUTHORIZATION"), AVG("AVG"),
+
+ BEGIN("BEGIN"), BETWEEN("BETWEEN"), BIT("BIT"), BIT_LENGTH("BIT_LENGTH"), BOTH("BOTH"), BY("BY"),
+
+ CASCADE("CASCADE"), CASCADED("CASCADED"), CASE("CASE"), CAST("CAST"), CATALOG("CATALOG"), CHAR("CHAR"), CHAR_LENGTH("CHAR_LENGTH"), CHARACTER("CHARACTER"),
+ CHARACTER_LENGTH("CHARACTER_LENGTH"), CHECK("CHECK"), CLOSE("CLOSE"), COALESCE("COALESCE"), COLLATE("COLLATE"), COLLATION("COLLATION"), COLUMN("COLUMN"),
+ COMMIT("COMMIT"), CONNECT("CONNECT"), CONNECTION("CONNECTION"), CONSTRAINT("CONSTRAINT"), CONSTRAINTS("CONSTRAINTS"), CONTINUE("CONTINUE"), CONVERT("CONVERT"),
+ CORRESPONDING("CORRESPONDING"), COUNT("COUNT"), CREATE("CREATE"), CROSS("CROSS"), CURRENT("CURRENT"), CURRENT_DATE("CURRENT_DATE"), CURRENT_TIME("CURRENT_TIME"),
+ CURRENT_TIMESTAMP("CURRENT_TIMESTAMP"), CURRENT_USER("CURRENT_USER"), CURSOR("CURSOR"),
+
+ DATE("DATE"), DAY("DAY"), DEALLOCATE("DEALLOCATE"), DEC("DEC"), DECIMAL("DECIMAL"), DECLARE("DECLARE"), DEFAULT("DEFAULT"), DEFERRABLE("DEFERRABLE"),
+ DEFERRED("DEFERRED"), DELETE("DELETE"), DESC("DESC"), DESCRIBE("DESCRIBE"), DESCRIPTOR("DESCRIPTOR"), DIAGNOSTICS("DIAGNOSTICS"), DISCONNECT("DISCONNECT"),
+ DISTINCT("DISTINCT"), DOMAIN("DOMAIN"), DOUBLE("DOUBLE"), DROP("DROP"),
+
+ ELSE("ELSE"), END("END"), END_EXEC("END-EXEC"), ESCAPE("ESCAPE"), EXCEPT("EXCEPT"), EXCEPTION("EXCEPTION"), EXEC("EXEC"), EXECUTE("EXECUTE"), EXISTS("EXISTS"), EXTERNAL("EXTERNAL"), EXTRACT("EXTRACT"),
+
+ FALSE("FALSE"), FETCH("FETCH"), FIRST("FIRST"), FLOAT("FLOAT"), FOR("FOR"), FOREIGN("FOREIGN"), FORTRAN("FORTRAN"), FOUND("FOUND"), FROM("FROM"), FULL("FULL"),
+
+ GET("GET"), GLOBAL("GLOBAL"), GO("GO"), GOTO("GOTO"), GRANT("GRANT"), GROUP("GROUP"),
+
+ HAVING("HAVING"), HOUR("HOUR"),
+
+ IDENTITY("IDENTITY"), IMMEDIATE("IMMEDIATE"), IN("IN"), INCLUDE("INCLUDE"), INDEX("INDEX"), INDICATOR("INDICATOR"), INITIALLY("INITIALLY"), INNER("INNER"), INPUT("INPUT"),
+ INSENSITIVE("INSENSITIVE"), INSERT("INSERT"), INT("INT"), INTEGER("INTEGER"), INTERSECT("INTERSECT"), INTERVAL("INTERVAL"), INTO("INTO"), IS("IS"), ISOLATION("ISOLATION"),
+
+ JOIN("JOIN"),
+
+ KEY("KEY"),
+
+ LANGUAGE("LANGUAGE"), LAST("LAST"), LEADING("LEADING"), LEFT("LEFT"), LEVEL("LEVEL"), LIKE("LIKE"), LOCAL("LOCAL"), LOWER("LOWER"),
+
+ MATCH("MATCH"), MAX("MAX"), MIN("MIN"), MINUTE("MINUTE"), MODULE("MODULE"), MONTH("MONTH"),
+
+ NAMES("NAMES"), NATIONAL("NATIONAL"), NATURAL("NATURAL"), NCHAR("NCHAR"), NEXT("NEXT"), NO("NO"), NONE("NONE"), NOT("NOT"), NULL("NULL"), NULLIF("NULLIF"), NUMERIC("NUMERIC"),
+
+ OCTET_LENGTH("OCTET_LENGTH"), OF("OF"), ON("ON"), ONLY("ONLY"), OPEN("OPEN"), OPTION("OPTION"), OR("OR"), ORDER("ORDER"), OUTER("OUTER"), OUTPUT("OUTPUT"), OVERLAPS("OVERLAPS"),
+
+ PAD("PAD"), PARTIAL("PARTIAL"), PASCAL("PASCAL"), POSITION("POSITION"), PRECISION("PRECISION"), PREPARE("PREPARE"), PRESERVE("PRESERVE"),
+ PRIMARY("PRIMARY"), PRIOR("PRIOR"), PRIVILEGES("PRIVILEGES"), PROCEDURE("PROCEDURE"), PUBLIC("PUBLIC"),
+
+ READ("READ"), REAL("REAL"), REFERENCES("REFERENCES"), RELATIVE("RELATIVE"), RESTRICT("RESTRICT"), REVOKE("REVOKE"), RIGHT("RIGHT"), ROLLBACK("ROLLBACK"), ROWS("ROWS"),
+
+ SCHEMA("SCHEMA"), SCROLL("SCROLL"),
+ SECOND("SECOND"), SECTION("SECTION"), SELECT("SELECT"), SESSION("SESSION"), SESSION_USER("SESSION_USER"), SET("SET"), SIZE("SIZE"), SMALLINT("SMALLINT"),
+ SOME("SOME"), SPACE("SPACE"), SQL("SQL"), SQLCA("SQLCA"), SQLCODE("SQLCODE"), SQLERROR("SQLERROR"), SQLSTATE("SQLSTATE"), SQLWARNING("SQLWARNING"),
+ SUBSTRING("SUBSTRING"), SUM("SUM"), SYSTEM_USER("SYSTEM_USER"),
+
+ TABLE("TABLE"), TEMPORARY("TEMPORARY"), THEN("THEN"), TIME("TIME"), TIMESTAMP("TIMESTAMP"), TIMEZONE_HOUR("TIMEZONE_HOUR"), TIMEZONE_MINUTE("TIMEZONE_MINUTE"),
+ TO("TO"), TRAILING("TRAILING"), TRANSACTION("TRANSACTION"), TRANSLATE("TRANSLATE"),TRANSLATION("TRANSLATION"), TRIM("TRIM"), TRUE("TRUE"),
+
+ UNION("UNION"), UNIQUE("UNIQUE"), UNKNOWN("UNKNOWN"), UPDATE("UPDATE"), UPPER("UPPER"), USAGE("USAGE"), USER("USER"), USING("USING"),
+
+ VALUE("VALUE"), VALUES("VALUES"), VARCHAR("VARCHAR"), VARYING("VARYING"), VIEW("VIEW"),
+
+ WHEN("WHEN"), WHENEVER("WHENEVER"), WHERE("WHERE"), WITH("WITH"), WORK("WORK"), WRITE("WRITE"), YEAR("YEAR"), ZONE("ZONE");
+
+
+ /** The keyword name. */
+ private final String name;
+
+ /**
+ * Instantiates a new enum of reserved keyword.
+ * @param name the keyword
+ */
+ private ReservedKeywordMSSQL(String name) {
+ this.name = name;
+ }
+
+ public static boolean isReserved(String name) {
+ String temp = name.toUpperCase();
+ for (ReservedKeywordMSSQL keyword : values()) {
+ if (temp.equals(keyword.name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordMYSQL.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordMYSQL.java
new file mode 100644
index 0000000..ee20f33
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordMYSQL.java
@@ -0,0 +1,109 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2019 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.reservedkeywords;
+
+/**
+ * This enum lists all my sql reserved keywords.
+ */
+public enum ReservedKeywordMYSQL {
+
+ /** MySQL keywords*/
+ ACCESSIBLE("ACCESSIBLE"), ADD("ADD"), ALL("ALL"), ALTER("ALTER"), ANALYZE("ANALYZE"), AND("AND"), AS("AS"), ASC("ASC"), ASENSITIVE("ASENSITIVE"),
+
+ BEFORE("BEFORE"), BETWEEN("BETWEEN"), BIGINT("BIGINT"), BINARY("BINARY"), BLOB("BLOB"), BOTH("BOTH"), BY("BY"),
+
+ CALL("CALL"), CASCADE("CASCADE"),CASE("CASE"), CHANGE("CHANGE"),CHAR("CHAR"),CHARACTER("CHARACTER"), CHECK("CHECK"), COLLATE("COLLATE"), COLUMN("COLUMN"),
+ CONDITION("CONDITION"), CONSTRAINT("CONSTRAINT"),CONTINUE("CONTINUE"), CONVERT("CONVERT"), CREATE("CREATE"), CROSS("CROSS"), CUBE("CUBE"), CUME_DIST("CUME_DIST"),
+ CURRENT_DATE("CURRENT_DATE"), CURRENT_TIME("CURRENT_TIME"), CURRENT_TIMESTAMP("CURRENT_TIMESTAMP"), CURRENT_USER("CURRENT_USER"),CURSOR("CURSOR"), CURSOR_NAME("CURSOR_NAME"),
+
+ DATABASE("DATABASE"), DATABASES("DATABASES"), DAY_HOUR("DAY_HOUR"), DAY_MICROSECOND("DAY_MICROSECOND"), DAY_MINUTE("DAY_MINUTE"), DAY_SECOND("DAY_SECOND"), DEC("DEC"),
+ DECIMAL("DECIMAL"), DECLARE("DECLARE"), DEFAULT("DEFAULT"), DELAYED("DELAYED"), DELETE("DELETE"), DENSE_RANK("DENSE_RANK"),DESC("DESC"), DESCRIBE("DESCRIBE"), DETERMINISTIC("DETERMINISTIC"),
+ DISTINCT("DISTINCT"), DISTINCTROW("DISTINCTROW"), DIV("DIV"), DOUBLE("DOUBLE"), DROP("DROP"),DUAL("DUAL"),
+
+ EACH("EACH"), ELSE("ELSE"), ELSEIF("ELSEIF"), EMPTY("EMPTY"), ENCLOSED("ENCLOSED"), ESCAPED("ESCAPED"), EXCEPT ("EXCEPT "), EXISTS("EXISTS"), EXIT("EXIT"), EXPLAIN("EXPLAIN"),
+
+ FALSE("FALSE"), FETCH("FETCH"), FIRST_VALUE("FIRST_VALUE "), FLOAT("FLOAT"), FLOAT4("FLOAT4"), FLOAT8("FLOAT8"), FOR("FOR"), FORCE("FORCE"), FOREIGN("FOREIGN"), FROM("FROM"), FULLTEXT("FULLTEXT"), FUNCTION("FUNCTION"),
+
+ GENERATED("GENERATED"), GET("GET"), GET_MASTER_PUBLIC_KEY("GET_MASTER_PUBLIC_KEY"), GRANT("GRANT"), GROUP("GROUP"), GROUPING ("GROUPING "), GROUPS ("GROUPS "),
+
+ HAVING("HAVING"), HIGH_PRIORITY("HIGH_PRIORITY"), HOUR_MICROSECOND("HOUR_MICROSECOND"), HOUR_MINUTE("HOUR_MINUTE"), HOUR_SECOND("HOUR_SECOND"),
+
+ IF("IF"), IGNORE("IGNORE"), IN("IN"), INDEX("INDEX"), INFILE("INFILE"),INNER("INNER"), INOUT("INOUT"), INSENSITIVE("INSENSITIVE"), INSERT("INSERT"),
+ INT("INT"), INT1("INT1"), INT2("INT2"), INT3("INT3"), INT4("INT4"), INT8("INT8"), INTEGER("INTEGER"), INTERVAL("INTERVAL"), INTO("INTO"), IO_AFTER_GTIDS("IO_AFTER_GTIDS"),
+ IO_BEFORE_GTIDS("IO_BEFORE_GTIDS"), IS("IS"), ITERATE("ITERATE"),
+
+ JOIN("JOIN"), JSON_TABLE ("JSON_TABLE "),
+
+ KEY("KEY"), KEYS("KEYS"), KILL("KILL"),
+
+ LAG ("LAG "), LAST_VALUE("LAST_VALUE"), LATERAL ("LATERAL "), LEAD ("LEAD "), LEADING("LEADING"), LEAVE("LEAVE"), LEFT("LEFT"), LIKE("LIKE"), LIMIT("LIMIT"), LINEAR("LINEAR"),
+ LINES("LINES"), LOAD("LOAD"), LOCALTIME("LOCALTIME"), LOCALTIMESTAMP("LOCALTIMESTAMP"), LOCK("LOCK"), LONG("LONG"), LONGBLOB("LONGBLOB"), LONGTEXT("LONGTEXT"), LOOP("LOOP"), LOW_PRIORITY("LOW_PRIORITY"),
+
+ MASTER_BIND("MASTER_BIND"), MASTER_SSL_VERIFY_SERVER_CERT("MASTER_SSL_VERIFY_SERVER_CERT"), MATCH("MATCH"), MAXVALUE("MAXVALUE"), MEDIUMBLOB("MEDIUMBLOB"), MEDIUMINT("MEDIUMINT"),
+ MEDIUMTEXT("MEDIUMTEXT"), MIDDLEINT("MIDDLEINT"), MINUTE_MICROSECOND("MINUTE_MICROSECOND"), MINUTE_SECOND("MINUTE_SECOND"), MOD("MOD"), MODIFIES("MODIFIES"),
+
+ NATURAL("NATURAL"), NOT("NOT"), NO_WRITE_TO_BINLOG("NO_WRITE_TO_BINLOG"), NTH_VALUE("NTH_VALUE "), NTILE("NTILE "), NULL("NULL"), NUMERIC("NUMERIC"),
+
+ OF("OF"), ON("ON"), OPTIMIZE("OPTIMIZE"), OPTIMIZER_COSTS("OPTIMIZER_COSTS"), OPTION("OPTION"), OPTIONALLY("OPTIONALLY"), OR("OR"), ORDER("ORDER"),
+ OUT("OUT"), OUTER("OUTER"), OUTFILE("OUTFILE"), OVER("OVER"),
+
+ PARTITION("PARTITION"), PERCENT_RANK("PERCENT_RANK"), PRECISION("PRECISION"), PRIMARY("PRIMARY"), PROCEDURE("PROCEDURE"), PURGE("PURGE"),
+
+ RANGE("RANGE"), RANK("RANK"), READ("READ"), READS("READS"), READ_WRITE("READ_WRITE"), REAL("REAL"), RECURSIVE ("RECURSIVE "), REFERENCES("REFERENCES"), RESOURCE("RESOURCE"), REGEXP("REGEXP"),
+ RELEASE("RELEASE"), RENAME("RENAME"), REPEAT("REPEAT"), REPLACE("REPLACE"), REQUIRE("REQUIRE"), RESIGNAL("RESIGNAL"), RESTRICT("RESTRICT"), RETURN("RETURN"), REVOKE("REVOKE"), RIGHT("RIGHT"),
+ RLIKE("RLIKE"), ROW("ROW"), ROWS("ROWS"), ROW_NUMBER("ROW_NUMBER"),
+
+ SCHEMA("SCHEMA"), SCHEMAS("SCHEMAS"), SECOND_MICROSECOND("SECOND_MICROSECOND"), SELECT("SELECT"), SENSITIVE("SENSITIVE"), SEPARATOR("SEPARATOR"), SET("SET"), SHOW("SHOW"),
+ SIGNAL("SIGNAL"), SMALLINT("SMALLINT"), SPATIAL("SPATIAL"), SPECIFIC("SPECIFIC"), SQL("SQL"), SQLEXCEPTION("SQLEXCEPTION"), SQLSTATE("SQLSTATE"), SQLWARNING("SQLWARNING"),
+ SQL_BIG_RESULT("SQL_BIG_RESULT"), SQL_CALC_FOUND_ROWS("SQL_CALC_FOUND_ROWS"), SQL_SMALL_RESULT("SQL_SMALL_RESULT"), SSL("SSL"), STARTING("STARTING"), STORED("STORED"), STRAIGHT_JOIN("STRAIGHT_JOIN"), SYSTEM("SYSTEM"),
+
+ TABLE("TABLE"), TERMINATED("TERMINATED"), THEN("THEN"), TINYBLOB("TINYBLOB"), TINYINT("TINYINT"), TINYTEXT("TINYTEXT"), TO("TO"), TRAILING("TRAILING"), TRIGGER("TRIGGER"), TRUE("TRUE"),
+
+ UNDO("UNDO"), UNION("UNION"), UNIQUE("UNIQUE"), UNLOCK("UNLOCK"), UNSIGNED("UNSIGNED"), UPDATE("UPDATE"), USAGE("USAGE"), USE("USE"), USING("USING"), UTC_DATE("UTC_DATE"), UTC_TIME("UTC_TIME"), UTC_TIMESTAMP("UTC_TIMESTAMP"),
+
+ VALUES("VALUES"), VARBINARY("VARBINARY"), VARCHAR("VARCHAR"), VARCHARACTER("VARCHARACTER"), VARYING("VARYING"), VIRTUAL("VIRTUAL"),
+
+ WHEN("WHEN"), WHERE("WHERE"), WHILE("WHILE"), WINDOW("WINDOW"), WITH("WITH"), WRITE("WRITE"),
+
+ XOR("XOR"),
+
+ YEAR_MONTH("YEAR_MONTH"),
+
+ ZEROFILL("ZEROFILL");
+
+
+ /** The keyword name. */
+ private final String name;
+
+ /**
+ * Instantiates a new enum of reserved keyword.
+ *
+ * @param name
+ * the keyword
+ */
+ private ReservedKeywordMYSQL(String name) {
+ this.name = name;
+ }
+
+ public static boolean isReserved(String name) {
+ String temp = name.toUpperCase();
+ for (ReservedKeywordMYSQL keyword : values()) {
+ if (temp.equals(keyword.name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordOracle.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordOracle.java
new file mode 100644
index 0000000..302c084
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordOracle.java
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2019 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.reservedkeywords;
+
+/**
+ * This enum lists all oracle reserved keywords.
+ */
+public enum ReservedKeywordOracle {
+
+ /** Oracle keywords*/
+ ACCESS("ACCESS"), ADD("ADD"), ALL("ALL"), ALTER("ALTER"), AND("AND"), ANY("ANY"), AS("AS"), ASC("ASC"), AUDIT("AUDIT"),
+
+ BETWEEN("BETWEEN"), BY("BY"),
+
+ CHAR("CHAR"), CHECK("CHECK"), CLUSTER("CLUSTER"), COLUMN("COLUMN"), COMMENT("COMMENT"), COMPRESS("COMPRESS"), CONNECT("CONNECT"), CREATE("CREATE"), CURRENT("CURRENT"),
+
+ DATE("DATE"), DECIMAL("DECIMAL"), DEFAULT("DEFAULT"), DELETE("DELETE"), DESC("DESC"), DISTINCT("DISTINCT"), DROP("DROP"),
+
+ ELSE("ELSE"), EXCLUSIVE("EXCLUSIVE"), EXISTS("EXISTS"),
+
+ FILE("FILE"), FLOAT("FLOAT"), FOR("FOR"), FROM("FROM"),
+
+ GRANT("GRANT"), GROUP("GROUP"),
+
+ HAVING("HAVING"),
+
+ IDENTIFIED("IDENTIFIED"), IMMEDIATE("IMMEDIATE"), IN("IN"), INCREMENT("INCREMENT"), INDEX("INDEX"), INITIAL("INITIAL"), INSERT("INSERT"), INTEGER("INTEGER"), INTERSECT("INTERSECT"), INTO("INTO"), IS("IS"),
+
+ LEVEL("LEVEL"), LIKE("LIKE"), LOCK("LOCK"), LONG("LONG"),
+
+ MAXEXTENTS("MAXEXTENTS"), MINUS("MINUS"), MODE("MODE"), MODIFY("MODIFY"),
+
+ NOAUDIT("NOAUDIT"), NOCOMPRESS("NOCOMPRESS"), NOT("NOT"), NOWAIT("NOWAIT"), NULL("NULL"), NUMBER("NUMBER"),
+
+ OF("OF"), OFFLINE("OFFLINE"), ON("ON"), ONLINE("ONLINE"), OPTION("OPTION"), OR("OR"), ORDER("ORDER"),
+
+ PCTFREE("PCTFREE"), PRIOR("PRIOR"), PRIVILEGES("PRIVILEGES"), PUBLIC("PUBLIC"),
+
+ RAW("RAW"), RENAME("RENAME"), RESOURCE("RESOURCE"), REVOKE("REVOKE"), ROW("ROW"), ROWID("ROWID"), ROWLABEL("ROWLABEL"), ROWNUM("ROWNUM"), ROWS("ROWS"),
+
+ SELECT("SELECT"), SESSION("SESSION"), SET("SET"),SHARE("SHARE"), SIZE("SIZE"), SMALLINT("SMALLINT"), SQL("SQL"), START("START"), SUCCESSFUL("SUCCESSFUL"), SYNONYM("SYNONYM"), SYSDATE("SYSDATE"),
+
+ TABLE("TABLE"), THEN("THEN"), TO("TO"), TRIGGER("TRIGGER"),
+
+ UID("UID"), UNION("UNION"), UNIQUE("UNIQUE"), UPDATE("UPDATE"), USER("USER"),
+
+ VALIDATE("VALIDATE"), VALUES("VALUES"), VARCHAR("VARCHAR"), VARCHAR2("VARCHAR2"), VIEW("VIEW"),
+
+ WHENEVER("WHENEVER"), WHERE("WHERE"), WITH("WITH");
+
+
+ /** The keyword name. */
+ private final String name;
+
+ /**
+ * Instantiates a new enum of reserved keyword.
+ * @param name the keyword
+ */
+ private ReservedKeywordOracle(String name) {
+ this.name = name;
+ }
+
+ public static boolean isReserved(String name) {
+ String temp = name.toUpperCase();
+ for (ReservedKeywordOracle keyword : values()) {
+ if (temp.equals(keyword.name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordPostgresSQL.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordPostgresSQL.java
new file mode 100644
index 0000000..ed26714
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/reservedkeywords/ReservedKeywordPostgresSQL.java
@@ -0,0 +1,90 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2019 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.reservedkeywords;
+
+/**
+ * This enum lists all postgresSQL reserved keywords.
+ */
+public enum ReservedKeywordPostgresSQL {
+
+ /** PostgresSQL keywords */
+ ALL("ALL"), ANALYSE("ANALYSE"), ANALYZE("ANALYZE"), AND("AND"), ANY("ANY"), ARRAY("ARRAY"), AS("AS"), ASC("ASC"), ASYMMETRIC("ASYMMETRIC"), AUTHORIZATION("AUTHORIZATION"),
+
+ BETWEEN("BETWEEN"), BINARY("BINARY"), BOTH("BOTH"),
+
+ CASE("CASE"), CAST("CAST"), CHECK("CHECK"), COLLATE("COLLATE"), COLUMN("COLUMN"), CONSTRAINT("CONSTRAINT"), CREATE(
+ "CREATE"), CURRENT_DATE("CURRENT_DATE"), CURRENT_ROLE("CURRENT_ROLE"), CURRENT_TIME(
+ "CURRENT_TIME"), CURRENT_TIMESTAMP("CURRENT_TIMESTAMP"), CURRENT_USER("CURRENT_USER"),
+
+ DEFAULT("DEFAULT"), DEFERRABLE("DEFERRABLE"), DESC("DESC"), DISTINCT("DISTINCT"), DO("DO"),
+
+ ELSE("ELSE"), END("END"), EXCEPT("EXCEPT"),
+
+ FALSE("FALSE"), FOR("FOR"), FOREIGN("FOREIGN"), FREEZE("FREEZE"), FROM("FROM"), FULL("FULL"),
+
+ GRANT("GRANT"), GROUP("GROUP"),
+
+ HAVING("HAVING"),
+
+ ILIKE("ILIKE"), IN("IN"), INITIALLY("INITIALLY"), INNER("INNER"), INTERSECT("INTERSECT"), INTO("INTO"), IS(
+ "IS"), ISNULL("ISNULL"),
+
+ JOIN("JOIN"),
+
+ LEADING("LEADING"), LEFT("LEFT"), LIKE("LIKE"), LIMIT("LIMIT"), LOCALTIME("LOCALTIME"), LOCALTIMESTAMP(
+ "LOCALTIMESTAMP"),
+
+ NATURAL("NATURAL"), NEW("NEW"), NOT("NOT"), NOTNULL("NOTNULL"), NULL("NULL"),
+
+ OFF("OFF"), OFFSET("OFFSET"), OLD("OLD"), ON("ON"), ONLY("ONLY"), OR("OR"), ORDER("ORDER"), OUTER(
+ "OUTER"), OVERLAPS("OVERLAPS"),
+
+ PLACING("PLACING"), PRIMARY("PRIMARY"),
+
+ REFERENCES("REFERENCES"), RETURNING("RETURNING"), RIGHT("RIGHT"),
+
+ SELECT("SELECT"), SESSION_USER("SESSION_USER"), SIMILAR("SIMILAR"), SOME("SOME"), SYMMETRIC("SYMMETRIC"),
+
+ TABLE("TABLE"), THEN("THEN"), TO("TO"), TRAILING("TRAILING"), TRUE("TRUE"),
+
+ UNION("UNION"), UNIQUE("UNIQUE"), USER("USER"), USING("USING"),
+
+ VERBOSE("VERBOSE"),
+
+ WHEN("WHEN"), WHERE("WHERE");
+
+ /** The keyword name. */
+ private final String name;
+
+ /**
+ * Instantiates a new enum of reserved keyword.
+ *
+ * @param name
+ * the keyword
+ */
+ private ReservedKeywordPostgresSQL(String name) {
+ this.name = name;
+ }
+
+ public static boolean isReserved(String name) {
+ String temp = name.toUpperCase();
+ for (ReservedKeywordPostgresSQL keyword : values()) {
+ if (temp.equals(keyword.name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DatabaseVendor.java
new file mode 100644
index 0000000..4de168a
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DatabaseVendor.java
@@ -0,0 +1,317 @@
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Properties;
+
+/**
+ * The base database vendor class.
+ */
+public class DatabaseVendor implements Comparable<DatabaseVendor>{
+
+ class VARIABLE { // NOSONAR
+ protected static final String VENDOR = "%%VENDOR%%";
+ protected static final String TYPE = "%%TYPE%%";
+ protected static final String SERVER = "%%SERVER%%";
+ protected static final String SERVERINSTANCE = "%%INSTANCE%%";
+ protected static final String PORT = "%%PORT%%";
+ protected static final String DATABASE = "%%DATABASE%%";
+ protected static final String DATABASESCHEMA = "%%DATABASESCHEMA%%";
+ protected static final String USERHOME = "%%USERHOME%%";
+ protected static final String TIMEZONE = "%%TIMEZONE%%";
+ protected static final String USERNAME = "%%USERNAME%%";
+ protected static final String PASSWORD = "%%PASSWORD%%";
+ }
+
+ /** The Constant ONE_ROW_ONE_COLUMN_TABLE. */
+ public static final String ONE_ROW_ONE_COLUMN_TABLE = "{{ONE_ROW_ONE_COLUMN_TABLE}}";
+
+ /** The Constant ONE_ROW_ONE_COLUMN_TABLE_DERBY. */
+ public static final String ONE_ROW_ONE_COLUMN_TABLE_DERBY = "SYSIBM.SYSDUMMY1";
+
+ /** The Constant ONE_ROW_ONE_COLUMN_TABLE_H2. */
+ public static final String ONE_ROW_ONE_COLUMN_TABLE_H2 = "DUAL";
+
+ /** The Constant ONE_ROW_ONE_COLUMN_TABLE_MYSQL. */
+ public static final String ONE_ROW_ONE_COLUMN_TABLE_MYSQL = "DUAL";
+
+ /** The Constant ONE_ROW_ONE_COLUMN_TABLE_MYSQL. */
+ public static final String ONE_ROW_ONE_COLUMN_TABLE_POSTGRESQL = "DUAL";
+
+ /** The Constant ONE_ROW_ONE_COLUMN_TABLE_ORACLE. */
+ public static final String ONE_ROW_ONE_COLUMN_TABLE_ORACLE = "DUAL";
+
+ private final String NAME;
+
+ public DatabaseVendor(String name) {
+ this.NAME = name;
+ }
+
+ public int getfTableNameLength() {
+ return -1;
+ }
+
+ public int getfColumnNameLength() {
+ return -1;
+ }
+
+ public int getfIndexNameLength() {
+ return -1;
+ }
+
+ /**
+ * Apply sql specifications.
+ *
+ * @param sqlStatement
+ * the sql statement
+ * @return applied vendor specific SQL statement
+ */
+ public String applySqlSpecifications(String sqlStatement) {
+ return null;
+ }
+
+ /**
+ * Gets the to date SQL method.
+ *
+ * @return applied vendor specific 'to date' SQL statement prefix
+ */
+ @Deprecated
+ public String getToDateSQLMethod() {
+ return "to_date";
+ }
+
+ /**
+ * Gets the to timestamp SQL method.
+ *
+ * @return applied vendor specific 'to timestamp' SQL statement prefix
+ */
+ @Deprecated
+ public String getToTimestampSQLMethod() {
+ return "to_timestamp";
+ }
+
+ /**
+ * Convert to date SQL.
+ *
+ * @param date
+ * the date
+ * @return applied vendor specific 'to date' SQL statement part
+ */
+ public String convertToDateSQL(Date date) {
+ return "to_date('" + date.toString().replace(".0", "") + "','YYYY-MM-DD HH24:MI:SS')";
+ }
+
+ /**
+ * Convert to timestamp SQL.
+ *
+ * @param date
+ * the date
+ * @return applied vendor specific 'to date' SQL statement part
+ */
+ public String convertToTimestampSQL(Timestamp date) {
+ return "to_timestamp('" + date.toString().replace(".0", "") + "','YYYY-MM-DD HH24:MI:SS')";
+ }
+
+ /**
+ * Apply schema name specifications.
+ *
+ * @param schemaName
+ * the schema name
+ * @return the string
+ */
+ public String applySchemaNameSpecifications(String databaseName, String userName) {
+ // cut off the leading path and remove all remaining / \ . :
+ return databaseName.replaceAll(".*[/\\\\]", "").replaceAll("~[/\\\\]", "").replaceAll("[/\\\\\\.:]", "");
+ }
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ public boolean isInMemory() {
+ return false;
+ }
+
+ /**
+ * Gets the driver vendor.
+ *
+ * @return the driver vendor
+ */
+ public String getDriverVendor() {
+ return null;
+ }
+
+ /**
+ * Gets the driver type.
+ *
+ * @return the driver type
+ */
+ public String getDriverType() {
+ return null;
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ public String getDriverClass() {
+ return null;
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ public String getJdbcUrlFormat() {
+ return null;
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ public String getHibernateDialect() {
+ return null;
+ }
+
+ /**
+ * Gets the product features.
+ *
+ * @return the product features
+ */
+ public String getProductFeatures() {
+ return null;
+ }
+
+ /**
+ * Gets the product configurations.
+ *
+ * @return the product configurations
+ */
+ public String getProductConfigurations() {
+ return null;
+ }
+
+ /**
+ * Gets the entity property base ID.
+ *
+ * @return the entity property base ID
+ */
+ public String getEntityPropertyBaseID() {
+ return "id int";
+ }
+
+ /**
+ * Gets the entity property base UUID.
+ *
+ * @return the entity property base UUID
+ */
+ public String getEntityPropertyBaseUUID() {
+ return "uuid String";
+ }
+
+ /**
+ * Gets the persistence batch writing.
+ *
+ * @return the persistence batch writing
+ */
+ public String getPersistenceBatchWriting() {
+ return "JDBC";
+ }
+
+ /**
+ * Jdbc url.
+ *
+ * @param driverVendor
+ * the driver vendor
+ * @param driverType
+ * the driver type
+ * @param serverName
+ * the server name
+ * @param serverPort
+ * the server port
+ * @param databaseName
+ * the database name
+ * @param jdbUrlFormat
+ * the jdb url format
+ * @param timezone
+ * the timezone
+ * @param username
+ * the username
+ * @param password
+ * the password
+ * @return the string
+ */
+ public String jdbcUrl(String driverVendor, String driverType, String serverName, int serverPort,
+ String databaseName, String jdbUrlFormat, String timezone, String username, String password) {
+ if ((driverVendor == null) || driverVendor.trim().isEmpty()) {
+ driverVendor = getDriverType(); // NOSONAR
+ }
+ if ((driverType == null) || driverType.trim().isEmpty()) {
+ driverType = getDriverType(); // NOSONAR
+ }
+ if (serverName == null) {
+ serverName = "???"; // NOSONAR
+ }
+ // for sqlserver ....
+ String serverInstance = "";
+ int idx=serverName.indexOf('\\');
+ if ( idx >= 0 ) {
+ serverInstance=serverName.substring(idx+1);
+ serverName=serverName.substring(0,idx);
+ }
+
+ if (serverPort == 0) {
+ serverPort = -1; // NOSONAR
+ }
+
+ String format = ((jdbUrlFormat != null) && !jdbUrlFormat.isEmpty()) ? jdbUrlFormat : getJdbcUrlFormat();
+ String retcode = format // NOSONAR
+ .replaceAll(VARIABLE.VENDOR, driverVendor).replaceAll(VARIABLE.TYPE, driverType)
+ .replaceAll(VARIABLE.SERVER, serverName).replaceAll(VARIABLE.PORT, ((Integer) serverPort).toString())
+ .replaceAll(VARIABLE.DATABASE, databaseName)
+ .replaceAll(VARIABLE.DATABASESCHEMA, applySchemaNameSpecifications(databaseName,username))
+ .replaceAll(VARIABLE.SERVERINSTANCE, serverInstance)
+ .replaceAll(VARIABLE.USERHOME, System.getProperty("user.home").replace(java.io.File.separator, "/")+"/")
+ .replaceAll(VARIABLE.TIMEZONE, timezone)
+ .replaceAll(VARIABLE.USERNAME, username)
+ .replaceAll(VARIABLE.PASSWORD, password);
+
+ return retcode;
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ public boolean supportsPropertyKey(String key) {
+ return false;
+ }
+
+ /**
+ * Init database vendor specific properties
+ *
+ * @return
+ */
+ public Properties initSpecificProperties() {
+ Properties properties = new Properties();
+ return properties;
+ }
+
+ public String name() {
+ return NAME;
+ }
+
+ @Override
+ public int compareTo(DatabaseVendor o) {
+ return o.name().compareTo(this.name());
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyClientDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyClientDatabaseVendor.java
new file mode 100644
index 0000000..0279383
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyClientDatabaseVendor.java
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The Derby client database vendor.
+ */
+public class DerbyClientDatabaseVendor extends DerbyDatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("attributesAsPassword", "connectionAttributes", "createDatabase",
+ "dataSourceName", "databaseName", "description", "logWriter", "loginTimeout", "password", "shutdownDatabase", "user");
+
+ /**
+ * Constructor.
+ */
+ public DerbyClientDatabaseVendor() {
+ super("DERBY_CLIENT");
+ }
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return false;
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ @Override
+ public String getDriverClass() {
+ return "org.apache.derby.jdbc.ClientDriver";
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ return "jdbc:derby://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + "/" + VARIABLE.DATABASE + ";create=true";
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ @Override
+ public String getHibernateDialect() {
+ return "org.hibernate.dialect.DerbyDialect";
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyDatabaseVendor.java
new file mode 100644
index 0000000..bc88a4e
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyDatabaseVendor.java
@@ -0,0 +1,131 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Properties;
+
+/**
+ * The Derby database vendor.
+ */
+public class DerbyDatabaseVendor extends DatabaseVendor {
+
+ /**
+ * Constructor.
+ */
+ public DerbyDatabaseVendor(String name) {
+ super(name);
+ }
+
+ /**
+ * Gets the driver vendor.
+ *
+ * @return the driver vendor
+ */
+ @Override
+ public String getDriverVendor() {
+ return "derby";
+ }
+
+ /**
+ * Gets the driver type.
+ *
+ * @return the driver type
+ */
+ @Override
+ public String getDriverType() {
+ return "";
+ }
+
+ /**
+ * Gets the product features.
+ *
+ * @return the product features
+ */
+ @Override
+ public String getProductFeatures() {
+ return " <feature id=\"org.eclipse.osbp.dependencies.feature.derby\"/>";
+ }
+
+ /**
+ * Gets the product configurations.
+ *
+ * @return the product configurations
+ */
+ @Override
+ public String getProductConfigurations() {
+ return " <plugin id=\"org.eclipse.gemini.dbaccess.derby\" autoStart=\"true\" startLevel=\"2\" />";
+ }
+
+ @Override
+ public String getToTimestampSQLMethod() {
+ return "to_timestamp";
+ }
+
+ @Override
+ public String convertToTimestampSQL(Timestamp date) {
+ return "to_timestamp('" + date.toString().replace(".0", "") + "','YYYY-MM-DD HH24:MI:SS')";
+ }
+
+ @Override
+ public String getToDateSQLMethod() {
+ return "date";
+ }
+
+ @Override
+ public String convertToDateSQL(Date date) {
+ return "date('" + date.toString().replace(".0", "") + "')";
+ }
+
+
+ @Override
+ public int getfTableNameLength() {
+ // according to
+ // https://db.apache.org/derby/docs/10.8/ref/rrefidlengthlimits.html
+ return 128;
+ }
+
+ @Override
+ public int getfColumnNameLength() {
+ // according to
+ // https://db.apache.org/derby/docs/10.8/ref/rrefidlengthlimits.html
+ return 128;
+ }
+
+ @Override
+ public int getfIndexNameLength() {
+ // according to
+ // https://db.apache.org/derby/docs/10.8/ref/rrefidlengthlimits.html
+ return 128;
+ }
+
+ /**
+ * Init database vendor specific properties
+ *
+ * @return
+ */
+ @Override
+ public Properties initSpecificProperties() {
+ Properties properties = new Properties();
+ properties.put("createDatabase", "create");
+ return properties;
+ }
+
+ @Override
+ public String applySqlSpecifications(String sqlStatement) {
+ return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_DERBY);
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyInMemoryDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyInMemoryDatabaseVendor.java
new file mode 100644
index 0000000..4272c64
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyInMemoryDatabaseVendor.java
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The Derby in-memory database vendor.
+ */
+public class DerbyInMemoryDatabaseVendor extends DerbyDatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("attributesAsPassword", "connectionAttributes", "createDatabase",
+ "dataSourceName", "databaseName", "description", "logWriter", "loginTimeout", "password", "shutdownDatabase", "user");
+
+ /**
+ * Constructor.
+ */
+ public DerbyInMemoryDatabaseVendor() {
+ super("DERBY_IN_MEMORY");
+ }
+
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return true;
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ @Override
+ public String getDriverClass() {
+ return "org.apache.derby.jdbc.EmbeddedDriver";
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlp17453.html
+ // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlpinmemdb.html
+ // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlp40653.html
+ return "jdbc:derby:memory:" + VARIABLE.DATABASE + ";create=true" + "";
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ @Override
+ public String getHibernateDialect() {
+ return "org.hibernate.dialect.DerbyTenSevenDialect";
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyLocalFileDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyLocalFileDatabaseVendor.java
new file mode 100644
index 0000000..b7af45b
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/DerbyLocalFileDatabaseVendor.java
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The Derby local file database vendor.
+ */
+public class DerbyLocalFileDatabaseVendor extends DerbyDatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("attributesAsPassword", "connectionAttributes", "createDatabase",
+ "dataSourceName", "databaseName", "description", "logWriter", "loginTimeout", "password", "shutdownDatabase", "user");
+
+ /**
+ * Constructor.
+ */
+ public DerbyLocalFileDatabaseVendor() {
+ super("DERBY_LOCAL_FILE");
+ }
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return false;
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ @Override
+ public String getDriverClass() {
+ return "org.apache.derby.jdbc.EmbeddedDriver";
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlp17453.html
+ // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlpinmemdb.html
+ // https://db.apache.org/derby/docs/10.8/devguide/cdevdvlp40653.html
+ return "jdbc:derby:directory:" + VARIABLE.DATABASE + ";create=true" + "";
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ @Override
+ public String getHibernateDialect() {
+ return "org.hibernate.dialect.DerbyTenSevenDialect";
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+ @Override
+ public String applySchemaNameSpecifications(String databaseName, String userName) {
+ // remove '/' oder '\'
+ return databaseName.replaceAll("[/\\\\\\.:]", "");
+ }
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/H2DatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/H2DatabaseVendor.java
new file mode 100644
index 0000000..8fe05ed
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/H2DatabaseVendor.java
@@ -0,0 +1,180 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The H2 database vendor.
+ */
+public class H2DatabaseVendor extends DatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("ONSConfiguration", "TNSEntryName", "URL", "connectionCacheName",
+ "connectionCacheProperties", "connectionCachingEnabled", "connectionProperties", "dataSourceName",
+ "databaseName", "description", "driverType", "explicitCachingEnabled", "fastConnectionFailoverEnabled",
+ "implicitCachingEnabled", "logWriter", "loginTimeout", "maxStatements", "networkProtocol", "password",
+ "portNumber", "serverName", "serviceName", "user");
+
+ /**
+ * Constructor.
+ */
+ public H2DatabaseVendor(String name) {
+ super(name);
+ }
+
+ /**
+ * Gets the driver vendor.
+ *
+ * @return the driver vendor
+ */
+ @Override
+ public String getDriverVendor() {
+ return "h2";
+ }
+
+ /**
+ * Gets the driver type.
+ *
+ * @return the driver type
+ */
+ @Override
+ public String getDriverType() {
+ return "";
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ @Override
+ public String getDriverClass() {
+ return "org.h2.Driver";
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ return "jdbc:" + VARIABLE.VENDOR + ":" + VARIABLE.TYPE + ":@" + VARIABLE.SERVER + ":" + VARIABLE.PORT + ":"
+ + VARIABLE.DATABASE;
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ @Override
+ public String getHibernateDialect() {
+ return "org.hibernate.dialect.H2Dialect";
+ }
+
+ /**
+ * Gets the product features.
+ *
+ * @return the product features
+ */
+ @Override
+ public String getProductFeatures() {
+ return " <feature id=\"org.eclipse.osbp.dependencies.feature.h2\"/>\n";
+ }
+
+ /**
+ * Gets the product configurations.
+ *
+ * @return the product configurations
+ */
+ @Override
+ public String getProductConfigurations() {
+ return " <plugin id=\"org.eclipse.gemini.dbaccess.h2\" autoStart=\"true\" startLevel=\"2\" />";
+ }
+
+ @Override
+ public String applySqlSpecifications(String sqlStatement) {
+ return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_H2);
+ }
+
+ @Override
+ public int getfTableNameLength() {
+ // only for convenience, normally no limit according to
+ // http://www.h2database.com/html/advanced.html#limits_limitations
+ return 128;
+ }
+
+ @Override
+ public int getfColumnNameLength() {
+ // only for convenience, normally no limit according to
+ // http://www.h2database.com/html/advanced.html#limits_limitations
+ return 128;
+ }
+
+ @Override
+ public int getfIndexNameLength() {
+ // only for convenience, normally no limit according to
+ // http://www.h2database.com/html/advanced.html#limits_limitations
+ return 128;
+ }
+
+ @Override
+ public String convertToTimestampSQL(Timestamp date) {
+ return "'" + date.toString().replace(".0", "") + "'";
+ }
+
+ /**
+ * in H2 there are no schema names!
+ */
+ @Override
+ public String applySchemaNameSpecifications(String databaseName, String userName) {
+ return "DEFAULT";
+ }
+
+ @Override
+ public String convertToDateSQL(Date date) {
+ return "'" + date.toString().replace(".0", "") + "'";
+ }
+
+ /**
+ * Gets the entity property base ID.
+ *
+ * @return the entity property base ID
+ */
+ public String getEntityPropertyBaseID() {
+ // /** do NOT use <code>int</code> for id in H2, because table SEQUENCE
+ // doesn't exist also discussed at
+ // http://stackoverflow.com/questions/9909893/jpa-how-to-annotate-id-so-its-autoincrements-without-sequence-table*/
+ // "/** do NOT use <code>int</code> for id in H2, because table SEQUENCE
+ // doesn't exist */
+ return "uuid String";
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/H2InMemoryDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/H2InMemoryDatabaseVendor.java
new file mode 100644
index 0000000..40aec5e
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/H2InMemoryDatabaseVendor.java
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The H2 in memory database vendor.
+ */
+public class H2InMemoryDatabaseVendor extends H2DatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("driverType", "URL", "description", "logWriter", "loginTimeout",
+ "password", "passwordChars", "user");
+
+ /**
+ * Constructor.
+ */
+ public H2InMemoryDatabaseVendor() {
+ super("H2_IN_MEMORY");
+ }
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return true;
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ return "jdbc:h2:mem:" + VARIABLE.DATABASE
+ // http://h2database.com/html/features.html#execute_sql_on_connection
+ + ";DB_CLOSE_DELAY=-1" + ";INIT="
+ // create schema on initial startup
+ + "CREATE SCHEMA IF NOT EXISTS " + VARIABLE.DATABASESCHEMA
+ // SEPARATOR between multipe SQL commandos
+ + "\\;"
+ // use this schema as default
+ + "SET SCHEMA " + VARIABLE.DATABASESCHEMA
+ // SEPARATOR between multipe SQL commandos
+ + "\\;" + "SET AUTOCOMMIT=TRUE"
+ // http://h2database.com/html/features.html#auto_mixed_mode
+ // H2 can't mix memory AND AUTO-SERVER - +";AUTO_SERVER=TRUE"
+ // http://h2database.com/html/features.html#in_memory_databases
+ + "";
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/H2LocalFileDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/H2LocalFileDatabaseVendor.java
new file mode 100644
index 0000000..1a631af
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/H2LocalFileDatabaseVendor.java
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The H2 local file database vendor.
+ */
+public class H2LocalFileDatabaseVendor extends H2DatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("URL", "description", "logWriter", "loginTimeout", "password",
+ "passwordChars", "user");
+
+ /**
+ * Constructor.
+ */
+ public H2LocalFileDatabaseVendor() {
+ super("H2_LOCAL_FILE");
+ }
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return false;
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ return "jdbc:h2:file:" + VARIABLE.DATABASE // http://h2database.com/html/features.html#execute_sql_on_connection
+ + ";INIT="
+ // create schema on initial startup
+ + "CREATE SCHEMA IF NOT EXISTS " + VARIABLE.DATABASESCHEMA
+ // SEPARATOR between multipe SQL commandos
+ + "\\;"
+ // use this schema as default
+ + "SET SCHEMA " + VARIABLE.DATABASESCHEMA
+ // SEPARATOR between multipe SQL commandos
+ + "\\;" + "SET AUTOCOMMIT=TRUE"
+ // http://h2database.com/html/features.html#auto_mixed_mode
+ + "";
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MSSQLDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MSSQLDatabaseVendor.java
new file mode 100644
index 0000000..97f49ac
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MSSQLDatabaseVendor.java
@@ -0,0 +1,185 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The MSSQL database vendor.
+ */
+public class MSSQLDatabaseVendor extends DatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("FIPS", "FIPSProvider", "GSSCredentials",
+ "JASSConfigurationName", "URL", "accessToken", "applicationIntent", "applicationName", "authentication",
+ "authenticationScheme", "columnEncryptionSetting", "databaseName", "description",
+ "enablePrepareOnFirstPreparedStatementCall", "encrypt", "failoverPartner", "hostNameInCertificate",
+ "instanceName", "integratedSecurity", "keyStoreAuthentication", "keyStoreLocation", "keyStoreSecret",
+ "lastUpdateCount", "lockTimeout", "logWriter", "loginTimeout", "multiSubnetFailover", "packetSize",
+ "password", "portNumber", "queryTimeout", "responseBuffering", "selectMethod",
+ "sendStringParametersAsUnicode", "sendTimeAsDatetime", "serverName", "serverNameAsACE",
+ "serverPreparedStatementDiscardThreshold", "serverSpn", "socketTimeout", "transparentNetworkIPResolution",
+ "trustServerCertificate", "trustStore", "trustStorePassword", "trustStoreType", "user", "workstationID",
+ "xopenStates");
+
+
+ /**
+ * Constructor.
+ */
+ public MSSQLDatabaseVendor() {
+ super("MSSQL");
+ }
+
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return false;
+ }
+
+ /**
+ * Gets the driver vendor.
+ *
+ * @return the driver vendor
+ */
+ @Override
+ public String getDriverVendor() {
+ return "sqlserver";
+ }
+
+ /**
+ * Gets the driver type.
+ *
+ * @return the driver type
+ */
+ @Override
+ public String getDriverType() {
+ return "thin";
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ @Override
+ public String getDriverClass() {
+ return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ return "jdbc:sqlserver://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + ";databaseName=" + VARIABLE.DATABASE
+ + ";instanceName=" + VARIABLE.SERVERINSTANCE
+ + ";trustServerCertificate=true;Integrated Security=false;";
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ @Override
+ public String getHibernateDialect() {
+ return "org.hibernate.dialect.SQLServerDialect";
+ }
+
+ /**
+ * Gets the product features.
+ *
+ * @return the product features
+ */
+ @Override
+ public String getProductFeatures() {
+ return " <feature id=\"org.osbee.technologystack.mssql.feature\"/>\n";
+ }
+
+ /**
+ * Gets the product configurations.
+ *
+ * @return the product configurations
+ */
+ @Override
+ public String getProductConfigurations() {
+ return " <plugin id=\"org.eclipse.gemini.dbaccess.mssql\" autoStart=\"true\" startLevel=\"2\" />";
+ }
+
+ @Override
+ public String applySqlSpecifications(String sqlStatement) {
+ return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_MYSQL);
+ }
+
+ @Override
+ public int getfTableNameLength() {
+ // according to
+ // https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-2017
+ return 128;
+ }
+
+ @Override
+ public int getfColumnNameLength() {
+ // according to
+ // https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-2017
+ return 128;
+ }
+
+ @Override
+ public int getfIndexNameLength() {
+ // according to
+ // https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-2017
+ return 128;
+ }
+
+ @Override
+ public String convertToDateSQL(Date date) {
+ return "cast('" + date.toString().replace(".0", "") + "' as datetime)";
+ }
+
+ @Override
+ public String convertToTimestampSQL(Timestamp date) {
+ return "cast('" + date.toString().replace(".0", "") + "' as datetime2)";
+ }
+
+ /**
+ * in sqlserver use the default schema 'dbo'
+ */
+ @Override
+ public String applySchemaNameSpecifications(String databaseName, String userName) {
+ return "dbo";
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MYSQL8DatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MYSQL8DatabaseVendor.java
new file mode 100644
index 0000000..e8522c0
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MYSQL8DatabaseVendor.java
@@ -0,0 +1,228 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The MYSQL8 database vendor.
+ */
+public class MYSQL8DatabaseVendor extends DatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("URL", "allowLoadLocalInfile",
+ "allowMasterDownConnections", "allowMultiQueries", "allowNanAndInf", "allowPublicKeyRetrieval",
+ "allowUrlInLocalInfile", "alwaysSendSetIsolation", "authenticationPlugins", "autoClosePStmtStreams",
+ "autoDeserialize", "autoGenerateTestcaseScript", "autoReconnect", "autoReconnectForConnectionPools",
+ "autoReconnectForPools", "autoSlowLog", "blobsAreStrings", "cacheCallableStatements", "cacheCallableStmts",
+ "cachePrepStmts", "cachePreparedStatements", "cacheResultSetMetadata", "cacheServerConfiguration",
+ "callableStatementCacheSize", "callableStmtCacheSize", "capitalizeDBMDTypes", "capitalizeTypeNames",
+ "characterEncoding", "characterSetResults", "clientCertificateKeyStorePassword",
+ "clientCertificateKeyStoreType", "clientCertificateKeyStoreUrl", "clientInfoProvider",
+ "clobCharacterEncoding", "clobberStreamingResults", "compensateOnDuplicateKeyUpdateCounts",
+ "connectTimeout", "connectionAttributes", "connectionCollation", "connectionLifecycleInterceptors",
+ "continueBatchOnError", "createDatabaseIfNotExist", "databaseName", "defaultAuthenticationPlugin",
+ "defaultFetchSize", "detectCustomCollations", "detectServerPreparedStmts", "disabledAuthenticationPlugins",
+ "disconnectOnExpiredPasswords", "dontTrackOpenResources", "dumpMetadataOnColumnNotFound",
+ "dumpQueriesOnException", "dynamicCalendars", "elideSetAutoCommits", "emptyStringsConvertToZero",
+ "emulateLocators", "emulateUnsupportedPstmts", "enablePacketDebug", "enableQueryTimeouts", "encoding",
+ "exceptionInterceptors", "explainSlowQueries", "failOverReadOnly", "functionsNeverReturnBlobs",
+ "gatherPerfMetrics", "gatherPerformanceMetrics", "generateSimpleParameterMetadata",
+ "getProceduresReturnsFunctions", "holdResultsOpenOverStatementClose", "ignoreNonTxTables",
+ "includeInnodbStatusInDeadlockExceptions", "includeThreadDumpInDeadlockExceptions",
+ "includeThreadNamesAsStatementComment", "initialTimeout", "interactiveClient", "isInteractiveClient",
+ "jdbcCompliantTruncation", "jdbcCompliantTruncationForReads", "largeRowSizeThreshold",
+ "loadBalanceAutoCommitStatementRegex", "loadBalanceAutoCommitStatementThreshold",
+ "loadBalanceBlacklistTimeout", "loadBalanceConnectionGroup", "loadBalanceEnableJMX",
+ "loadBalanceExceptionChecker", "loadBalancePingTimeout", "loadBalanceSQLExceptionSubclassFailover",
+ "loadBalanceSQLStateFailover", "loadBalanceStrategy", "loadBalanceValidateConnectionOnSwapServer",
+ "localSocketAddress", "logSlowQueries", "logWriter", "logXaCommands", "logger", "loggerClassName",
+ "loginTimeout", "maintainTimeStats", "maxAllowedPacket", "maxQuerySizeToLog", "maxReconnects", "maxRows",
+ "metadataCacheSize", "netTimeoutForStreamingResults", "noAccessToProcedureBodies", "noDatetimeStringSync",
+ "noTimezoneConversionForTimeType", "nullCatalogMeansCurrent", "nullNamePatternMatchesAll",
+ "overrideSupportsIntegrityEnhancementFacility", "packetDebugBufferSize", "padCharsWithSpace", "paranoid",
+ "parseInfoCacheFactory", "password", "passwordCharacterEncoding", "pedantic",
+ "pinGlobalTxToPhysicalConnection", "populateInsertRowWithDefaultValues", "port", "portNumber",
+ "prepStmtCacheSize", "prepStmtCacheSqlLimit", "preparedStatementCacheSize",
+ "preparedStatementCacheSqlLimit", "processEscapeCodesForPrepStmts", "profileSQL", "profileSql",
+ "profilerEventHandler", "propertiesTransform", "propertiesViaRef", "queriesBeforeRetryMaster",
+ "queryTimeoutKillsConnection", "reconnectAtTxEnd", "relaxAutoCommit", "replicationEnableJMX",
+ "reportMetricsIntervalMillis", "requireSSL", "resourceId", "resultSetSizeThreshold",
+ "retainStatementAfterResultSetClose", "retriesAllDown", "rewriteBatchedStatements", "rollbackOnPooledClose",
+ "roundRobinLoadBalance", "runningCTS13", "secondsBeforeRetryMaster", "selfDestructOnPingMaxOperations",
+ "selfDestructOnPingSecondsLifetime", "serverConfigCacheFactory", "serverName", "serverTimezone",
+ "sessionVariables", "slowQueryThresholdMillis", "slowQueryThresholdNanos", "socketFactory",
+ "socketFactoryClassName", "socketTimeout", "statementInterceptors", "strictFloatingPoint", "strictUpdates",
+ "tcpKeepAlive", "tcpNoDelay", "tcpRcvBuf", "tcpSndBuf", "tcpTrafficClass", "tinyInt1isBit", "traceProtocol",
+ "transformedBitIsBoolean", "treatUtilDateAsTimestamp", "trustCertificateKeyStorePassword",
+ "trustCertificateKeyStoreType", "trustCertificateKeyStoreUrl", "ultraDevHack", "url", "useAffectedRows",
+ "useBlobToStoreUTF8OutsideBMP", "useColumnNamesInFindColumn", "useCompression", "useConfigs",
+ "useCursorFetch", "useDirectRowUnpack", "useDynamicCharsetInfo", "useFastDateParsing", "useFastIntParsing",
+ "useGmtMillisForDatetimes", "useHostsInPrivileges", "useInformationSchema", "useJDBCCompliantTimezoneShift",
+ "useJvmCharsetConverters", "useLegacyDatetimeCode", "useLocalSessionState", "useLocalTransactionState",
+ "useNanosForElapsedTime", "useOldAliasMetadataBehavior", "useOldUTF8Behavior", "useOnlyServerErrorMessages",
+ "useReadAheadInput", "useSSL", "useSSPSCompatibleTimezoneShift", "useServerPrepStmts",
+ "useServerPreparedStmts", "useSqlStateCodes", "useStreamLengthsInPrepStmts", "useTimezone",
+ "useUltraDevWorkAround", "useUnbufferedInput", "useUnicode", "useUsageAdvisor", "user",
+ "utf8OutsideBmpExcludedColumnNamePattern", "utf8OutsideBmpIncludedColumnNamePattern",
+ "verifyServerCertificate", "yearIsDateType", "zeroDateTimeBehavior");
+
+ /**
+ * Constructor.
+ */
+ public MYSQL8DatabaseVendor() {
+ super("MYSQL8");
+ }
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return false;
+ }
+
+ /**
+ * Gets the driver vendor.
+ *
+ * @return the driver vendor
+ */
+ @Override
+ public String getDriverVendor() {
+ return "mysql8";
+ }
+
+ /**
+ * Gets the driver type.
+ *
+ * @return the driver type
+ */
+ @Override
+ public String getDriverType() {
+ return "thin";
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ @Override
+ public String getDriverClass() {
+ return "com.mysql.cj.jdbc.Driver";
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ return "jdbc:mysql://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + "/" + VARIABLE.DATABASE
+ + "?useSSL=false&AllowPublicKeyRetrieval=true&useLegacyDatetimeCode=false&serverTimezone="
+ + VARIABLE.TIMEZONE;
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ @Override
+ public String getHibernateDialect() {
+ return "org.hibernate.dialect.MySQLDialect";
+ }
+
+ /**
+ * Gets the product features.
+ *
+ * @return the product features
+ */
+ @Override
+ public String getProductFeatures() {
+ return " <feature id=\"org.osbee.technologystack.mysql8.feature\"/>\n";
+ }
+
+ /**
+ * Gets the product configurations.
+ *
+ * @return the product configurations
+ */
+ @Override
+ public String getProductConfigurations() {
+ return " <plugin id=\"org.eclipse.gemini.dbaccess.mysql8\" autoStart=\"true\" startLevel=\"2\" />";
+ }
+
+ @Override
+ public int getfTableNameLength() {
+ // according to https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
+ return 63;
+ }
+
+ @Override
+ public int getfColumnNameLength() {
+ // according to https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
+ return 64;
+ }
+
+ @Override
+ public int getfIndexNameLength() {
+ // according to https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
+ return 64;
+ }
+
+ @Override
+ public String applySqlSpecifications(String sqlStatement) {
+ return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_MYSQL);
+ }
+
+ @Override
+ public String getToDateSQLMethod() {
+ return "str_to_date";
+
+ }
+
+ @Override
+ public String getToTimestampSQLMethod() {
+ return "str_to_date";
+ }
+
+ @Override
+ public String convertToDateSQL(Date date) {
+ return "str_to_date('" + date.toString().replace(".0", "") + "','%Y-%m-%d')";
+ }
+
+ @Override
+ public String convertToTimestampSQL(Timestamp date) {
+ return "str_to_date('" + date.toString().replace(".0", "") + "','%Y-%m-%d %H:%i:%s')";
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MYSQLDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MYSQLDatabaseVendor.java
new file mode 100644
index 0000000..71987b2
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MYSQLDatabaseVendor.java
@@ -0,0 +1,229 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The MYSQL5 (MariaDB) database vendor.
+ * http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html
+ * http://www.mkyong.com/jdbc/how-to-connect-to-mysql-with-jdbc-driver-java/
+ * http://www.vogella.com/tutorials/MySQLJava/article.html
+ */
+public class MYSQLDatabaseVendor extends DatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("URL", "allowLoadLocalInfile",
+ "allowMasterDownConnections", "allowMultiQueries", "allowNanAndInf", "allowUrlInLocalInfile",
+ "alwaysSendSetIsolation", "authenticationPlugins", "autoClosePStmtStreams", "autoDeserialize",
+ "autoGenerateTestcaseScript", "autoReconnect", "autoReconnectForConnectionPools", "autoReconnectForPools",
+ "autoSlowLog", "blobsAreStrings", "cacheCallableStatements", "cacheCallableStmts", "cachePrepStmts",
+ "cachePreparedStatements", "cacheResultSetMetadata", "cacheServerConfiguration",
+ "callableStatementCacheSize", "callableStmtCacheSize", "capitalizeDBMDTypes", "capitalizeTypeNames",
+ "characterEncoding", "characterSetResults", "clientCertificateKeyStorePassword",
+ "clientCertificateKeyStoreType", "clientCertificateKeyStoreUrl", "clientInfoProvider",
+ "clobCharacterEncoding", "clobberStreamingResults", "compensateOnDuplicateKeyUpdateCounts",
+ "connectTimeout", "connectionAttributes", "connectionCollation", "connectionLifecycleInterceptors",
+ "continueBatchOnError", "createDatabaseIfNotExist", "databaseName", "defaultAuthenticationPlugin",
+ "defaultFetchSize", "detectCustomCollations", "detectServerPreparedStmts", "disabledAuthenticationPlugins",
+ "disconnectOnExpiredPasswords", "dontTrackOpenResources", "dumpMetadataOnColumnNotFound",
+ "dumpQueriesOnException", "dynamicCalendars", "elideSetAutoCommits", "emptyStringsConvertToZero",
+ "emulateLocators", "emulateUnsupportedPstmts", "enablePacketDebug", "enableQueryTimeouts", "encoding",
+ "exceptionInterceptors", "explainSlowQueries", "failOverReadOnly", "functionsNeverReturnBlobs",
+ "gatherPerfMetrics", "gatherPerformanceMetrics", "generateSimpleParameterMetadata",
+ "getProceduresReturnsFunctions", "holdResultsOpenOverStatementClose", "ignoreNonTxTables",
+ "includeInnodbStatusInDeadlockExceptions", "includeThreadDumpInDeadlockExceptions",
+ "includeThreadNamesAsStatementComment", "initialTimeout", "interactiveClient", "isInteractiveClient",
+ "jdbcCompliantTruncation", "jdbcCompliantTruncationForReads", "largeRowSizeThreshold",
+ "loadBalanceAutoCommitStatementRegex", "loadBalanceAutoCommitStatementThreshold",
+ "loadBalanceBlacklistTimeout", "loadBalanceConnectionGroup", "loadBalanceEnableJMX",
+ "loadBalanceExceptionChecker", "loadBalancePingTimeout", "loadBalanceSQLExceptionSubclassFailover",
+ "loadBalanceSQLStateFailover", "loadBalanceStrategy", "loadBalanceValidateConnectionOnSwapServer",
+ "localSocketAddress", "logSlowQueries", "logWriter", "logXaCommands", "logger", "loggerClassName",
+ "loginTimeout", "maintainTimeStats", "maxAllowedPacket", "maxQuerySizeToLog", "maxReconnects", "maxRows",
+ "metadataCacheSize", "netTimeoutForStreamingResults", "noAccessToProcedureBodies", "noDatetimeStringSync",
+ "noTimezoneConversionForTimeType", "nullCatalogMeansCurrent", "nullNamePatternMatchesAll",
+ "overrideSupportsIntegrityEnhancementFacility", "packetDebugBufferSize", "padCharsWithSpace", "paranoid",
+ "parseInfoCacheFactory", "password", "passwordCharacterEncoding", "pedantic",
+ "pinGlobalTxToPhysicalConnection", "populateInsertRowWithDefaultValues", "port", "portNumber",
+ "prepStmtCacheSize", "prepStmtCacheSqlLimit", "preparedStatementCacheSize",
+ "preparedStatementCacheSqlLimit", "processEscapeCodesForPrepStmts", "profileSQL", "profileSql",
+ "profilerEventHandler", "propertiesTransform", "propertiesViaRef", "queriesBeforeRetryMaster",
+ "queryTimeoutKillsConnection", "reconnectAtTxEnd", "relaxAutoCommit", "replicationEnableJMX",
+ "reportMetricsIntervalMillis", "requireSSL", "resourceId", "resultSetSizeThreshold",
+ "retainStatementAfterResultSetClose", "retriesAllDown", "rewriteBatchedStatements", "rollbackOnPooledClose",
+ "roundRobinLoadBalance", "runningCTS13", "secondsBeforeRetryMaster", "selfDestructOnPingMaxOperations",
+ "selfDestructOnPingSecondsLifetime", "serverConfigCacheFactory", "serverName", "serverTimezone",
+ "sessionVariables", "slowQueryThresholdMillis", "slowQueryThresholdNanos", "socketFactory",
+ "socketFactoryClassName", "socketTimeout", "statementInterceptors", "strictFloatingPoint", "strictUpdates",
+ "tcpKeepAlive", "tcpNoDelay", "tcpRcvBuf", "tcpSndBuf", "tcpTrafficClass", "tinyInt1isBit", "traceProtocol",
+ "transformedBitIsBoolean", "treatUtilDateAsTimestamp", "trustCertificateKeyStorePassword",
+ "trustCertificateKeyStoreType", "trustCertificateKeyStoreUrl", "ultraDevHack", "url", "useAffectedRows",
+ "useBlobToStoreUTF8OutsideBMP", "useColumnNamesInFindColumn", "useCompression", "useConfigs",
+ "useCursorFetch", "useDirectRowUnpack", "useDynamicCharsetInfo", "useFastDateParsing", "useFastIntParsing",
+ "useGmtMillisForDatetimes", "useHostsInPrivileges", "useInformationSchema", "useJDBCCompliantTimezoneShift",
+ "useJvmCharsetConverters", "useLegacyDatetimeCode", "useLocalSessionState", "useLocalTransactionState",
+ "useNanosForElapsedTime", "useOldAliasMetadataBehavior", "useOldUTF8Behavior", "useOnlyServerErrorMessages",
+ "useReadAheadInput", "useSSL", "useSSPSCompatibleTimezoneShift", "useServerPrepStmts",
+ "useServerPreparedStmts", "useSqlStateCodes", "useStreamLengthsInPrepStmts", "useTimezone",
+ "useUltraDevWorkAround", "useUnbufferedInput", "useUnicode", "useUsageAdvisor", "user",
+ "utf8OutsideBmpExcludedColumnNamePattern", "utf8OutsideBmpIncludedColumnNamePattern",
+ "verifyServerCertificate", "yearIsDateType", "zeroDateTimeBehavior");
+
+ /**
+ * Constructor.
+ */
+ public MYSQLDatabaseVendor() {
+ super("MYSQL");
+ }
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return false;
+ }
+
+ /**
+ * Gets the driver vendor.
+ *
+ * @return the driver vendor
+ */
+ @Override
+ public String getDriverVendor() {
+ return "mysql";
+ }
+
+ /**
+ * Gets the driver type.
+ *
+ * @return the driver type
+ */
+ @Override
+ public String getDriverType() {
+ return "thin";
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ @Override
+ public String getDriverClass() {
+ return "com.mysql.jdbc.Driver";
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ return "jdbc:mysql://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + "/" + VARIABLE.DATABASE + "?useSSL=false&useLegacyDatetimeCode=false&serverTimezone=" + VARIABLE.TIMEZONE;
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ @Override
+ public String getHibernateDialect() {
+ return "org.hibernate.dialect.MySQLDialect";
+ }
+
+ /**
+ * Gets the product features.
+ *
+ * @return the product features
+ */
+ @Override
+ public String getProductFeatures() {
+ return " <feature id=\"org.osbee.technologystack.mysql.feature\"/>\n";
+ }
+
+ /**
+ * Gets the product configurations.
+ *
+ * @return the product configurations
+ */
+ @Override
+ public String getProductConfigurations() {
+ return " <plugin id=\"org.eclipse.gemini.dbaccess.mysql\" autoStart=\"true\" startLevel=\"2\" />";
+ }
+
+ @Override
+ public int getfTableNameLength() {
+ // according to https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
+ return 63;
+ }
+
+ @Override
+ public int getfColumnNameLength() {
+ // according to https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
+ return 64;
+ }
+
+ @Override
+ public int getfIndexNameLength() {
+ // according to https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
+ return 64;
+ }
+
+ @Override
+ public String applySqlSpecifications(String sqlStatement) {
+ return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_MYSQL);
+ }
+
+ @Override
+ public String getToDateSQLMethod() {
+ return "str_to_date";
+
+ }
+
+ @Override
+ public String getToTimestampSQLMethod() {
+ return "str_to_date";
+ }
+
+ @Override
+ public String convertToDateSQL(Date date) {
+ return "str_to_date('"+date.toString().replace(".0","")+"','%Y-%m-%d')";
+ }
+
+ @Override
+ public String convertToTimestampSQL(Timestamp date) {
+ return "str_to_date('"+date.toString().replace(".0","")+"','%Y-%m-%d %H:%i:%s')";
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MasterDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MasterDatabaseVendor.java
new file mode 100644
index 0000000..5921dcf
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/MasterDatabaseVendor.java
@@ -0,0 +1,154 @@
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+public abstract class MasterDatabaseVendor {
+
+ public final static DatabaseVendor DERBY_CLIENT = new DerbyClientDatabaseVendor();
+ public final static DatabaseVendor DERBY_IN_MEMORY = new DerbyInMemoryDatabaseVendor();
+ public final static DatabaseVendor DERBY_LOCAL_FILE = new DerbyLocalFileDatabaseVendor();
+ public final static DatabaseVendor H2_IN_MEMORY = new H2InMemoryDatabaseVendor();
+ public final static DatabaseVendor H2_LOCAL_FILE = new H2LocalFileDatabaseVendor();
+ public final static DatabaseVendor MSSQL = new MSSQLDatabaseVendor();
+ public final static DatabaseVendor MYSQL = new MYSQLDatabaseVendor();
+ public final static DatabaseVendor MYSQL8 = new MYSQL8DatabaseVendor();
+ public final static DatabaseVendor ORACLE = new OracleDatabaseVendor();
+ public final static DatabaseVendor POSTGRESQL = new PostgreSQLDatabaseVendor();
+
+ private static final List<DatabaseVendor> supportedVendors = Arrays.asList(DERBY_CLIENT, DERBY_IN_MEMORY,
+ DERBY_LOCAL_FILE, H2_IN_MEMORY, H2_LOCAL_FILE, MSSQL, MYSQL, MYSQL8, ORACLE, POSTGRESQL);
+
+ public static int getMaxTableNameLength() {
+ TreeSet<Integer> temp = new TreeSet<>();
+ for (DatabaseVendor v : supportedVendors) {
+ temp.add(v.getfTableNameLength());
+ }
+ return temp.first();
+ }
+
+ public static int getMaxColumnNameLength() {
+ TreeSet<Integer> temp = new TreeSet<>();
+ for (DatabaseVendor v : supportedVendors) {
+ temp.add(v.getfColumnNameLength());
+ }
+ return temp.first();
+ }
+
+ public static int getMaxIndexNameLength() {
+ TreeSet<Integer> temp = new TreeSet<>();
+ for (DatabaseVendor v : supportedVendors) {
+ temp.add(v.getfIndexNameLength());
+ }
+ return temp.first();
+ }
+
+ /**
+ * Equals ignore case.
+ *
+ * @param s1
+ * the s 1
+ * @param s2
+ * the s 2
+ * @return true, if successful
+ */
+ private static boolean equalsIgnoreCase(String s1, String s2) {
+ s1 = s1.replaceAll("_IN_", "").replaceAll("_", ""); // NOSONAR
+ s2 = s2.replaceAll("_IN_", "").replaceAll("_", ""); // NOSONAR
+ return s1.equalsIgnoreCase(s2);
+ }
+
+ /**
+ * Gets the database features.
+ *
+ * @param vendors
+ * the vendors
+ * @return the database features
+ */
+ public static String getDatabaseFeatures(Set<DatabaseVendor> vendors) {
+ ArrayList<String> result = new ArrayList<>();
+ for (DatabaseVendor vendor : vendors) {
+ result.add(vendor.getProductFeatures());
+ }
+ return String.join("\n", result);
+ }
+
+ /**
+ * Gets the necessary configurations.
+ *
+ * @param vendors
+ * the vendors
+ * @return the necessary configurations
+ */
+ public static String getNecessaryConfigurations(Set<DatabaseVendor> vendors) {
+ ArrayList<String> result = new ArrayList<>();
+ for (DatabaseVendor vendor : vendors) {
+ result.add(vendor.getProductConfigurations());
+ }
+ return String.join("\n", result);
+ }
+
+ /**
+ * Gets the unnecessary configurations.
+ *
+ * @param vendors
+ * the vendors
+ * @return the unnecessary configurations
+ */
+ public static String getUnnecessaryConfigurations(Set<DatabaseVendor> vendors) {
+ ArrayList<String> result = new ArrayList<>();
+ for (DatabaseVendor vendor : vendors) {
+ if (!vendors.contains(vendor)) {
+ result.add(vendor.getProductConfigurations());
+ }
+ }
+ return String.join("\n", result);
+ }
+
+ /**
+ * By name.
+ *
+ * @param vendorName
+ * the vendor name
+ * @return the enum database vendor
+ */
+ public static DatabaseVendor byName(String vendorName) { // NOSONAR
+ return byName(vendorName, vendorName, vendorName);
+ }
+
+ /**
+ * By name.
+ *
+ * @param vendorName
+ * the vendor name
+ * @param driverVendor
+ * the driver vendor
+ * @param dataBaseName
+ * the data base name
+ * @return the enum database vendor
+ */
+ public static DatabaseVendor byName(String vendorName, String driverVendor, String dataBaseName) { // NOSONAR
+ for (DatabaseVendor step : supportedVendors) {
+ if (equalsIgnoreCase(step.name(), vendorName) || equalsIgnoreCase(step.getDriverVendor(), vendorName)) {
+ return step;
+ }
+ }
+ for (DatabaseVendor step : supportedVendors) {
+ if (equalsIgnoreCase(step.name(), dataBaseName) || equalsIgnoreCase(step.getDriverVendor(), dataBaseName)) {
+ return step;
+ }
+ if (equalsIgnoreCase(step.name(), driverVendor) || equalsIgnoreCase(step.getDriverVendor(), driverVendor)) {
+ return step;
+ }
+ }
+ return ORACLE;
+ }
+
+ public static List<DatabaseVendor> getSupportedDatabaseVendors(){
+ return supportedVendors;
+ }
+
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/OracleDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/OracleDatabaseVendor.java
new file mode 100644
index 0000000..1de471d
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/OracleDatabaseVendor.java
@@ -0,0 +1,177 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The Oracle database vendor.
+ */
+public class OracleDatabaseVendor extends DatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("ONSConfiguration", "TNSEntryName", "URL", "connectionCacheName",
+ "connectionCacheProperties", "connectionCachingEnabled", "connectionProperties", "dataSourceName",
+ "databaseName", "description", "driverType", "explicitCachingEnabled", "fastConnectionFailoverEnabled",
+ "implicitCachingEnabled", "logWriter", "loginTimeout", "maxStatements", "networkProtocol", "password",
+ "portNumber", "serverName", "serviceName", "user");
+
+ /**
+ * Constructor.
+ */
+ public OracleDatabaseVendor() {
+ super("ORACLE");
+ }
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return false;
+ }
+
+ /**
+ * Gets the driver vendor.
+ *
+ * @return the driver vendor
+ */
+ @Override
+ public String getDriverVendor() {
+ return "oracle";
+ }
+
+ /**
+ * Gets the driver type.
+ *
+ * @return the driver type
+ */
+ @Override
+ public String getDriverType() {
+ return "thin";
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ @Override
+ public String getDriverClass() {
+ return "oracle.jdbc.OracleDriver";
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ return "jdbc:" + VARIABLE.VENDOR + ":" + VARIABLE.TYPE + ":@" + VARIABLE.SERVER + ":" + VARIABLE.PORT + ":" + VARIABLE.DATABASE;
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ @Override
+ public String getHibernateDialect() {
+ return "org.hibernate.dialect.Oracle10gDialect";
+ }
+
+ /**
+ * Gets the product features.
+ *
+ * @return the product features
+ */
+ @Override
+ public String getProductFeatures() {
+ return " <feature id=\"net.osbee.dependencies.feature.oracle\"/>\n";
+ }
+
+ /**
+ * Gets the product configurations.
+ *
+ * @return the product configurations
+ */
+ @Override
+ public String getProductConfigurations() {
+ return " <plugin id=\"org.eclipse.gemini.dbaccess.oracle\" autoStart=\"true\" startLevel=\"2\" />";
+ }
+
+ /**
+ * Gets the persistence batch writing.
+ *
+ * @return the persistence batch writing
+ */
+ @Override
+ public String getPersistenceBatchWriting() {
+ return "Oracle-JDBC";
+ }
+
+ @Override
+ public String applySqlSpecifications(String sqlStatement) {
+ return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_ORACLE);
+ }
+
+ @Override
+ public String getToTimestampSQLMethod() {
+ return "to_timestamp";
+ }
+
+ @Override
+ public int getfTableNameLength() {
+ // according to
+ // https://oracle-base.com/articles/12c/long-identifiers-12cr2#backwards-compatibility
+ return 30;
+ }
+
+ @Override
+ public int getfColumnNameLength() {
+ // according to
+ // https://oracle-base.com/articles/12c/long-identifiers-12cr2#backwards-compatibility
+ return 30;
+ }
+
+ @Override
+ public int getfIndexNameLength() {
+ // according to
+ // https://oracle-base.com/articles/12c/long-identifiers-12cr2#backwards-compatibility
+ return 30;
+ }
+
+ /**
+ * in ORACLE the schema name is the user name
+ */
+ @Override
+ public String applySchemaNameSpecifications(String databaseName, String userName) {
+ return userName;
+ }
+}
diff --git a/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/PostgreSQLDatabaseVendor.java b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/PostgreSQLDatabaseVendor.java
new file mode 100644
index 0000000..6c0e1ef
--- /dev/null
+++ b/org.eclipse.osbp.preferences/src/org/eclipse/osbp/preferences/databases/vendors/PostgreSQLDatabaseVendor.java
@@ -0,0 +1,199 @@
+/******************************************************************************
+ * *
+ * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany *
+ * *
+ * All rights reserved. This program and the accompanying materials *
+ * are made available under the terms of the Eclipse Public License v1.0 *
+ * which accompanies this distribution, and is available at *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * *
+ *============================================================================*
+ * Initial contribution: *
+ * Loetz GmbH & Co. KG, Loetz GmbH & Co KG *
+ ******************************************************************************/
+package org.eclipse.osbp.preferences.databases.vendors;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * The Postgres SQL database vendor.
+ * https://jdbc.postgresql.org/documentation/80/index.html
+ */
+public class PostgreSQLDatabaseVendor extends DatabaseVendor {
+
+ private final List<String> fPropertyKeys = Arrays.asList("allowEncodingChanges", "applicationName",
+ "assumeMinServerVersion", "autosave", "binaryTransfer", "binaryTransferDisable", "binaryTransferEnable",
+ "cancelSignalTimeout", "connectTimeout", "currentSchema", "databaseMetadataCacheFields",
+ "databaseMetadataCacheFieldsMiB", "databaseName", "defaultAutoCommit", "defaultRowFetchSize",
+ "disableColumnSanitiser", "fromReference", "gssLib", "hostRecheckSeconds", "jaasApplicationName",
+ "jaasLogin", "kerberosServerName", "loadBalanceHosts", "logUnclosedConnections", "logWriter", "loggerFile",
+ "loggerLevel", "loginTimeout", "password", "portNumber", "preferQueryMode", "prepareThreshold",
+ "preparedStatementCacheQueries", "preparedStatementCacheSizeMiB", "protocolVersion",
+ "reWriteBatchedInserts", "readOnly", "receiveBufferSize", "replication", "sendBufferSize", "serverName",
+ "socketFactory", "socketFactoryArg", "socketTimeout", "ssl", "sslCert", "sslFactoryArg",
+ "sslHostnameVerifier", "sslKey", "sslMode", "sslPassword", "sslPasswordCallback", "sslRootCert",
+ "sslfactory", "sspiServiceClass", "stringType", "targetServerType", "tcpKeepAlive", "unknownLength", "url",
+ "useSpNego", "user");
+
+ /**
+ * Constructor.
+ */
+ public PostgreSQLDatabaseVendor() {
+ super("POSTGRESQL");
+ }
+
+ /**
+ * Checks if is in memory.
+ *
+ * @return true, if is in memory
+ */
+ @Override
+ public boolean isInMemory() {
+ return false;
+ }
+
+ /**
+ * Gets the driver vendor.
+ *
+ * @return the driver vendor
+ */
+ @Override
+ public String getDriverVendor() {
+ return "postgresql";
+ }
+
+ /**
+ * Gets the driver type.
+ *
+ * @return the driver type
+ */
+ @Override
+ public String getDriverType() {
+ return "thin";
+ }
+
+ /**
+ * Gets the driver class.
+ *
+ * @return the driver class
+ */
+ @Override
+ public String getDriverClass() {
+ return "org.postgresql.Driver";
+ }
+
+ /**
+ * Gets the jdbc url format.
+ *
+ * @return the jdbc url
+ */
+ @Override
+ public String getJdbcUrlFormat() {
+ return "jdbc:postgresql://" + VARIABLE.SERVER + ":" + VARIABLE.PORT + "/" + VARIABLE.DATABASE + "?ssl=false;defaultAutoCommit=false";
+ }
+
+ /**
+ * Supports property key.
+ *
+ * @param key
+ * the key
+ * @return true, if successful
+ */
+ @Override
+ public boolean supportsPropertyKey(String key) {
+ return fPropertyKeys.contains(key);
+ }
+
+ /**
+ * Gets the hibernate dialect.
+ *
+ * @return the hibernate dialect
+ */
+ @Override
+ public String getHibernateDialect() {
+ return "org.hibernate.dialect.PostgreSQLDialect";
+ }
+
+ /**
+ * Gets the product features.
+ *
+ * @return the product features
+ */
+ @Override
+ public String getProductFeatures() {
+ return " <feature id=\"org.osbee.technologystack.postgresql.feature\"/>\n";
+ }
+
+ /**
+ * Gets the product configurations.
+ *
+ * @return the product configurations
+ */
+ @Override
+ public String getProductConfigurations() {
+ return " <plugin id=\"org.eclipse.gemini.dbaccess.postgresql\" autoStart=\"true\" startLevel=\"2\" />";
+ }
+
+ @Override
+ public int getfTableNameLength() {
+ // according to
+ // https://www.postgresql.org/docs/9.4/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
+ return 63;
+ }
+
+ @Override
+ public int getfColumnNameLength() {
+ // according to
+ // https://www.postgresql.org/docs/9.4/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
+ return 63;
+ }
+
+ @Override
+ public int getfIndexNameLength() {
+ // according to
+ // https://www.postgresql.org/docs/9.4/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
+ return 63;
+ }
+
+ @Override
+ public String applySqlSpecifications(String sqlStatement) {
+ return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_POSTGRESQL);
+ }
+
+ /* see https://jdbc.postgresql.org/documentation/80/escapes-datetime.html */
+ @Override
+ public String convertToDateSQL(Date date) {
+ return "{d '" + date.toString() + "'}";
+ }
+
+ @Override
+ public String convertToTimestampSQL(Timestamp date) {
+ return "{ts'" + date.toString() + "'}";
+ }
+
+ /**
+ * in postgreSQL we use the default schema 'public'
+ */
+ @Override
+ public String applySchemaNameSpecifications(String databaseName, String userName) {
+ return "public";
+ }
+
+ /**
+ * Init database vendor specific properties
+ *
+ * @return
+ */
+ @Override
+ public Properties initSpecificProperties() {
+ Properties properties = new Properties();
+ properties.put("defaultAutoCommit", "false");
+ return properties;
+ }
+
+
+}
diff --git a/org.eclipse.osbp.preferences/xtend-gen/org/eclipse/osbp/preferences/ProductFileConfigurations.java b/org.eclipse.osbp.preferences/xtend-gen/org/eclipse/osbp/preferences/ProductFileConfigurations.java
index 558bdd5..a50bffa 100644
--- a/org.eclipse.osbp.preferences/xtend-gen/org/eclipse/osbp/preferences/ProductFileConfigurations.java
+++ b/org.eclipse.osbp.preferences/xtend-gen/org/eclipse/osbp/preferences/ProductFileConfigurations.java
@@ -13,9 +13,9 @@
*/
package org.eclipse.osbp.preferences;
-import org.eclipse.osbp.preferences.EnumDatabaseVendor;
import org.eclipse.osbp.preferences.ProductConfigurationPrefs;
import org.eclipse.osbp.preferences.ProductFileBase;
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor;
import org.eclipse.xtend2.lib.StringConcatenation;
/**
@@ -114,6 +114,6 @@
return this.removeDuplicates(
asString.replace(
"${{NECESSARY_DATA_BASE_VENDOR_CONFIGURATIONS}}",
- EnumDatabaseVendor.getNecessaryConfigurations(this.dataBaseVendors)));
+ MasterDatabaseVendor.getNecessaryConfigurations(this.dataBaseVendors)));
}
}
diff --git a/org.eclipse.osbp.preferences/xtend-gen/org/eclipse/osbp/preferences/ProductFileFeatures.java b/org.eclipse.osbp.preferences/xtend-gen/org/eclipse/osbp/preferences/ProductFileFeatures.java
index 570efc9..0743485 100644
--- a/org.eclipse.osbp.preferences/xtend-gen/org/eclipse/osbp/preferences/ProductFileFeatures.java
+++ b/org.eclipse.osbp.preferences/xtend-gen/org/eclipse/osbp/preferences/ProductFileFeatures.java
@@ -16,9 +16,9 @@
import org.eclipse.core.runtime.IBundleGroup;
import org.eclipse.core.runtime.IBundleGroupProvider;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.osbp.preferences.EnumDatabaseVendor;
import org.eclipse.osbp.preferences.ProductConfigurationPrefs;
import org.eclipse.osbp.preferences.ProductFileBase;
+import org.eclipse.osbp.preferences.databases.vendors.MasterDatabaseVendor;
import org.eclipse.xtend2.lib.StringConcatenation;
/**
@@ -63,7 +63,7 @@
return this.removeDuplicates(
asString.replace(
"${{DATA_BASE_VENDOR_FEATURES}}",
- EnumDatabaseVendor.getDatabaseFeatures(this.dataBaseVendors)));
+ MasterDatabaseVendor.getDatabaseFeatures(this.dataBaseVendors)));
}
private String getRuntimeSoftwareFeature() {
@@ -90,7 +90,7 @@
}
}
if (netOsbee) {
- return "\t<feature id=\"net.osbee.softwarefactory.runtime.feature\"/>";
+ return "\t<feature id=\"net.osbee.softwarefactory.runtime.feature\"/>\n\t<feature id=\"net.osbee.softwarefactory.runtime.pos.feature\"/>";
} else {
if (orgOsbee) {
return "\t<feature id=\"org.osbee.softwarefactory.runtime.feature\"/>";