| /** |
| * |
| * 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 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.preferences; |
| |
| import java.util.ArrayList; |
| import java.util.List; |
| import java.util.Set; |
| |
| 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 PORT = "%%PORT%%"; |
| protected static final String DATABASE = "%%DATABASE%%"; |
| protected static final String USERHOME = "%%USERHOME%%"; |
| } |
| |
| public enum EnumDatabaseVendor { |
| /*... |
| // 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", |
| "driverType, URL, description, logWriter, loginTimeout, password, passwordChars, url, user", |
| "org.hibernate.dialect.DerbyTenSevenDialect", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.derby\" autoStart=\"true\" startLevel=\"2\" />", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.derby\"/>\n"+ |
| " <plugin id=\"org.apache.derby\"/>", |
| "id int", |
| "uuid String" |
| ) { |
| @Override |
| public String applySqlSpecifications(String sqlStatement) { |
| return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_DERBY); |
| } |
| }, |
| // https://db.apache.org/derby/papers/DerbyTut/embedded_intro.html |
| // 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.USERHOME+"/"+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", |
| "driverType, URL, description, logWriter, loginTimeout, password, passwordChars, url, user", |
| "org.hibernate.dialect.DerbyTenSevenDialect", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.derby\" autoStart=\"true\" startLevel=\"2\" />", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.derby\"/>\n"+ |
| " <plugin id=\"org.apache.derby\"/>", |
| "id int", |
| "uuid String" |
| ) { |
| @Override |
| public String applySqlSpecifications(String sqlStatement) { |
| return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_DERBY); |
| } |
| }, |
| // https://karussell.wordpress.com/2009/06/09/hibernate-cfg-xml-settings-for-derby-oracle-and-h2/ |
| // 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", |
| "driverType, URL, description, logWriter, loginTimeout, password, passwordChars, url, user", |
| "org.hibernate.dialect.DerbyDialect", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.derby\" autoStart=\"true\" startLevel=\"2\" />", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.derby\"/>\n"+ |
| " <plugin id=\"org.apache.derby\"/>", |
| "id int", |
| "uuid String" |
| ) { |
| @Override |
| public String applySqlSpecifications(String sqlStatement) { |
| return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_DERBY); |
| } |
| }, |
| // 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 |
| +";LOCK_MODE=0" |
| +";INIT=" |
| // create schema on initial startup |
| +"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 |
| +"\\;" |
| // ??? set autocommit to false due to own implemented commit statements ?!? |
| +"SET AUTOCOMMIT=FALSE" |
| // 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 |
| +";DB_CLOSE_DELAY=-1" |
| +"", |
| "JDBC", |
| "driverType, URL, description, logWriter, loginTimeout, password, passwordChars, url, user", |
| "org.hibernate.dialect.H2Dialect", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.h2\" autoStart=\"true\" startLevel=\"2\" />", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.h2\"/>\n"+ |
| " <plugin id=\"org.h2\"/>\n"+ |
| " <plugin id=\"org.ops4j.pax.jdbc.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" |
| ) { |
| @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 schemaName) { |
| return null; |
| } |
| }, |
| // http://www.h2database.com/html/features.html#database_url |
| H2_LOCAL_FILE (false, "h2", "", "org.h2.Driver", |
| "jdbc:h2:file:"+VARIABLE.USERHOME+"/"+VARIABLE.DATABASE |
| // http://h2database.com/html/features.html#execute_sql_on_connection |
| +";LOCK_MODE=0" |
| +";INIT=" |
| // create schema on initial startup |
| +"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 |
| +"\\;" |
| // ??? set autocommit to false due to own implemented commit statements ?!? |
| +"SET AUTOCOMMIT=FALSE" |
| // http://h2database.com/html/features.html#auto_mixed_mode |
| +";AUTO_SERVER=TRUE" |
| +"", |
| "JDBC", |
| "driverType, URL, description, logWriter, loginTimeout, password, passwordChars, url, user", |
| "org.hibernate.dialect.H2Dialect", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.h2\" autoStart=\"true\" startLevel=\"2\" />", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.h2\"/>\n"+ |
| " <plugin id=\"org.h2\"/>\n"+ |
| " <plugin id=\"org.ops4j.pax.jdbc.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" |
| ) { |
| @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 schemaName) { |
| return "APP"; |
| } |
| }, |
| // 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/ |
| // - http://www.vogella.com/tutorials/MySQLJava/article.html |
| MYSQL (false, "mysql", "thin", "com.mysql.jdbc.Driver", |
| "jdbc:"+VARIABLE.VENDOR+"://"+VARIABLE.SERVER+":"+VARIABLE.PORT+"/"+VARIABLE.DATABASE, |
| "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\" />", |
| " <plugin id=\"com.mysql.jdbc\"/>\n"+ |
| " <plugin id=\"org.eclipse.gemini.dbaccess.mysql\"/>", |
| "id int", |
| "uuid String" |
| ) { |
| @Override |
| public String applySqlSpecifications(String sqlStatement) { |
| return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_MYSQL); |
| } |
| }, |
| ORACLE (false, "oracle", "thin", "oracle.jdbc.OracleDriver", |
| "jdbc:"+VARIABLE.VENDOR+":"+VARIABLE.TYPE+":@"+VARIABLE.SERVER+":"+VARIABLE.PORT+":"+VARIABLE.DATABASE, |
| "Oracle-JDBC", |
| null, |
| "org.hibernate.dialect.Oracle10gDialect", |
| " <plugin id=\"org.eclipse.gemini.dbaccess.oracle\" autoStart=\"true\" startLevel=\"2\" />", |
| " <plugin id=\"oracleJdbc.osgi\"/>\n"+ |
| " <plugin id=\"org.eclipse.gemini.dbaccess.oracle\"/>", |
| "id int", |
| "uuid String" |
| ) { |
| @Override |
| public String applySqlSpecifications(String sqlStatement) { |
| return sqlStatement.replace(ONE_ROW_ONE_COLUMN_TABLE, ONE_ROW_ONE_COLUMN_TABLE_ORACLE); |
| } |
| }; |
| |
| private final boolean fIsInMemory; |
| private final String fDriverVendor; |
| private final String fDriverType; |
| private final String fDriverClass; |
| private final String fJdbcUrlFormat; |
| private final String fPersistenceBatchWriting; |
| private final String fHibernateDialect; |
| private final String fProductPlugins; |
| private final String fProductConfigurations; |
| private final String fEntityPropertyBaseID; |
| private final String fEntityPropertyBaseUUID; |
| private final List<String> fPropertyKeys; |
| |
| private EnumDatabaseVendor(boolean isInMemory, String driverVendor, String driverType, String driverClass, String jdbcUrlFormat, String persistenceBatchWriting, String propertyKeys, String hibernateDialect, String productConfigurations, String productPlugins, String entityPropertyBaseID, String entityPropertyBaseUUID) { |
| 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; |
| fProductPlugins = productPlugins; |
| fProductConfigurations = productConfigurations; |
| fEntityPropertyBaseID = entityPropertyBaseID; |
| fEntityPropertyBaseUUID = entityPropertyBaseUUID; |
| } |
| |
| private static boolean equalsIgnoreCase(String s1, String s2) { |
| s1 = s1.replaceAll("_IN_", "").replaceAll("_", ""); // NOSONAR |
| s2 = s2.replaceAll("_IN_", "").replaceAll("_", ""); // NOSONAR |
| return s1.equalsIgnoreCase(s2); |
| } |
| |
| public static String getNecessaryPlugins(Set<EnumDatabaseVendor> vendors) { |
| ArrayList<String> result = new ArrayList<String>(); |
| for (EnumDatabaseVendor vendor : vendors) { |
| result.add(vendor.getProductPlugins()); |
| } |
| return String.join("\n", result); |
| } |
| |
| public static String getUnnecessaryPlugins(Set<EnumDatabaseVendor> vendors) { |
| ArrayList<String> result = new ArrayList<String>(); |
| for (EnumDatabaseVendor vendor : values()) { |
| if (!vendors.contains(vendor)) { |
| result.add(vendor.getProductPlugins()); |
| } |
| } |
| return String.join("\n", result); |
| } |
| |
| public static String getNecessaryConfigurations(Set<EnumDatabaseVendor> vendors) { |
| ArrayList<String> result = new ArrayList<String>(); |
| for (EnumDatabaseVendor vendor : vendors) { |
| result.add(vendor.getProductConfigurations()); |
| } |
| return String.join("\n", result); |
| } |
| |
| public static String getUnnecessaryConfigurations(Set<EnumDatabaseVendor> vendors) { |
| ArrayList<String> result = new ArrayList<String>(); |
| for (EnumDatabaseVendor vendor : values()) { |
| if (!vendors.contains(vendor)) { |
| result.add(vendor.getProductConfigurations()); |
| } |
| } |
| return String.join("\n", result); |
| } |
| |
| public static EnumDatabaseVendor byName(String vendorName) { // NOSONAR |
| return byName(vendorName, vendorName, vendorName); |
| } |
| |
| 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; |
| } |
| |
| public static final String ONE_ROW_ONE_COLUMN_TABLE = "{{ONE_ROW_ONE_COLUMN_TABLE}}"; |
| public static final String ONE_ROW_ONE_COLUMN_TABLE_DERBY = "SYSIBM.SYSDUMMY1"; |
| public static final String ONE_ROW_ONE_COLUMN_TABLE_H2 = "DUAL"; |
| public static final String ONE_ROW_ONE_COLUMN_TABLE_MYSQL = "DUAL"; |
| public static final String ONE_ROW_ONE_COLUMN_TABLE_ORACLE = "DUAL"; |
| |
| /** |
| * @param sqlStatement |
| * @return applied vendor specific SQL statement |
| */ |
| abstract public String applySqlSpecifications(String sqlStatement); |
| |
| public String applySchemaNameSpecifications(String schemaName) { |
| return schemaName; |
| } |
| |
| public boolean isInMemory() { |
| return fIsInMemory; |
| } |
| |
| public String getDriverVendor() { |
| return fDriverVendor; |
| } |
| |
| public String getDriverType() { |
| return fDriverType; |
| } |
| |
| public String getDriverClass() { |
| return fDriverClass; |
| } |
| |
| public String getHibernateDialect() { |
| return fHibernateDialect; |
| } |
| |
| public String getProductPlugins() { |
| return fProductPlugins; |
| } |
| |
| public String getProductConfigurations() { |
| return fProductConfigurations; |
| } |
| |
| public String getEntityPropertyBaseID() { |
| return fEntityPropertyBaseID; |
| } |
| |
| public String getEntityPropertyBaseUUID() { |
| return fEntityPropertyBaseUUID; |
| } |
| |
| public String getPersistenceBatchWriting() { |
| return fPersistenceBatchWriting; |
| } |
| |
| public String jdbcUrl(String driverVendor, String driverType, String serverName, int serverPort, String databaseName, String jdbUrlFormat) { |
| if ((driverVendor == null) || driverVendor.trim().isEmpty()) { |
| driverVendor = fDriverVendor; // NOSONAR |
| } |
| if ((driverType == null) || driverType.trim().isEmpty()) { |
| driverType = fDriverType; // NOSONAR |
| } |
| if (serverName == null) { |
| serverName = "???"; // NOSONAR |
| } |
| 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.USERHOME, System.getProperty("user.home").replace(java.io.File.separator,"/")) |
| ; |
| return retcode; |
| } |
| |
| public boolean supportsPropertyKey(String key) { |
| if (fPropertyKeys.isEmpty()) { |
| return true; |
| } |
| else { |
| return fPropertyKeys.contains(key); |
| } |
| } |
| } |