/
JdbcDatabasePlatformFactory.java
519 lines (476 loc) · 24.1 KB
/
JdbcDatabasePlatformFactory.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
package org.jumpmind.db.platform;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.lang.reflect.Constructor;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
import javax.sql.DataSource;
import org.apache.commons.lang.StringUtils;
import org.h2.util.JdbcUtils;
import org.jumpmind.db.platform.ase.AseDatabasePlatform;
import org.jumpmind.db.platform.db2.Db2As400DatabasePlatform;
import org.jumpmind.db.platform.db2.Db2DatabasePlatform;
import org.jumpmind.db.platform.db2.Db2zOsDatabasePlatform;
import org.jumpmind.db.platform.derby.DerbyDatabasePlatform;
import org.jumpmind.db.platform.firebird.FirebirdDatabasePlatform;
import org.jumpmind.db.platform.firebird.FirebirdDialect1DatabasePlatform;
import org.jumpmind.db.platform.generic.GenericJdbcDatabasePlatform;
import org.jumpmind.db.platform.greenplum.GreenplumPlatform;
import org.jumpmind.db.platform.h2.H2DatabasePlatform;
import org.jumpmind.db.platform.hana.HanaDatabasePlatform;
import org.jumpmind.db.platform.hbase.HbasePlatform;
import org.jumpmind.db.platform.hsqldb.HsqlDbDatabasePlatform;
import org.jumpmind.db.platform.hsqldb2.HsqlDb2DatabasePlatform;
import org.jumpmind.db.platform.informix.InformixDatabasePlatform;
import org.jumpmind.db.platform.interbase.InterbaseDatabasePlatform;
import org.jumpmind.db.platform.mariadb.MariaDBDatabasePlatform;
import org.jumpmind.db.platform.mssql.MsSql2000DatabasePlatform;
import org.jumpmind.db.platform.mssql.MsSql2005DatabasePlatform;
import org.jumpmind.db.platform.mssql.MsSql2008DatabasePlatform;
import org.jumpmind.db.platform.mysql.MySqlDatabasePlatform;
import org.jumpmind.db.platform.nuodb.NuoDbDatabasePlatform;
import org.jumpmind.db.platform.oracle.Oracle122DatabasePlatform;
import org.jumpmind.db.platform.oracle.OracleDatabasePlatform;
import org.jumpmind.db.platform.postgresql.PostgreSql95DatabasePlatform;
import org.jumpmind.db.platform.postgresql.PostgreSqlDatabasePlatform;
import org.jumpmind.db.platform.raima.RaimaDatabasePlatform;
import org.jumpmind.db.platform.redshift.RedshiftDatabasePlatform;
import org.jumpmind.db.platform.sqlanywhere.SqlAnywhereDatabasePlatform;
import org.jumpmind.db.platform.sqlite.SqliteDatabasePlatform;
import org.jumpmind.db.platform.tibero.TiberoDatabasePlatform;
import org.jumpmind.db.platform.voltdb.VoltDbDatabasePlatform;
import org.jumpmind.db.sql.SqlException;
import org.jumpmind.db.sql.SqlTemplateSettings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* A factory of {@link IDatabasePlatform} instances based on a case
* insensitive database name. Note that this is a convenience class as the platforms
* can also simply be created via their constructors.
*/
public class JdbcDatabasePlatformFactory {
/* The database name -> platform map. */
private static Map<String, Class<? extends IDatabasePlatform>> platforms = new HashMap<String, Class<? extends IDatabasePlatform>>();
/*
* Maps the sub-protocl part of a jdbc connection url to a OJB platform
* name.
*/
private static Map<String, Class<? extends IDatabasePlatform>> jdbcSubProtocolToPlatform = new HashMap<String, Class<? extends IDatabasePlatform>>();
private static final Logger log = LoggerFactory.getLogger(JdbcDatabasePlatformFactory.class);
static {
addPlatform(platforms, "H2", H2DatabasePlatform.class);
addPlatform(platforms, "H21", H2DatabasePlatform.class);
addPlatform(platforms, "Informix Dynamic Server11", InformixDatabasePlatform.class);
addPlatform(platforms, "Informix Dynamic Server", InformixDatabasePlatform.class);
addPlatform(platforms, "Apache Derby", DerbyDatabasePlatform.class);
addPlatform(platforms, "Firebird", FirebirdDatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.GREENPLUM, GreenplumPlatform.class);
addPlatform(platforms, DatabaseNamesConstants.FIREBIRD_DIALECT1, FirebirdDialect1DatabasePlatform.class);
addPlatform(platforms, "HsqlDb", HsqlDbDatabasePlatform.class);
addPlatform(platforms, "HSQL Database Engine2", HsqlDb2DatabasePlatform.class);
addPlatform(platforms, "Interbase", InterbaseDatabasePlatform.class);
addPlatform(platforms, "MariaDB", MariaDBDatabasePlatform.class);
addPlatform(platforms, "microsoft sql server8", MsSql2000DatabasePlatform.class);
addPlatform(platforms, "microsoft sql server9", MsSql2005DatabasePlatform.class);
addPlatform(platforms, "microsoft sql server10", MsSql2008DatabasePlatform.class);
addPlatform(platforms, "microsoft sql server11", MsSql2008DatabasePlatform.class);
addPlatform(platforms, "microsoft sql server", MsSql2008DatabasePlatform.class);
addPlatform(platforms, "MySQL", MySqlDatabasePlatform.class);
addPlatform(platforms, "Oracle", OracleDatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.ORACLE122, Oracle122DatabasePlatform.class);
addPlatform(platforms, "PostgreSql", PostgreSqlDatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.POSTGRESQL95, PostgreSql95DatabasePlatform.class);
addPlatform(platforms, "Adaptive Server Enterprise", AseDatabasePlatform.class);
addPlatform(platforms, "Adaptive Server Anywhere", SqlAnywhereDatabasePlatform.class);
addPlatform(platforms, "SQL Anywhere", SqlAnywhereDatabasePlatform.class);
addPlatform(platforms, "DB2", Db2DatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.DB2ZOS, Db2zOsDatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.DB2AS400, Db2As400DatabasePlatform.class);
addPlatform(platforms, "SQLite", SqliteDatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.REDSHIFT, RedshiftDatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.VOLTDB, VoltDbDatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.NUODB, NuoDbDatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.TIBERO, TiberoDatabasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.RAIMA, RaimaDatabasePlatform.class);
addPlatform(platforms, "phoenix", HbasePlatform.class);
addPlatform(platforms, DatabaseNamesConstants.HANA, HanaDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(Db2DatabasePlatform.JDBC_SUBPROTOCOL, Db2DatabasePlatform.class);
jdbcSubProtocolToPlatform.put(DerbyDatabasePlatform.JDBC_SUBPROTOCOL, DerbyDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(FirebirdDatabasePlatform.JDBC_SUBPROTOCOL,
FirebirdDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(HsqlDbDatabasePlatform.JDBC_SUBPROTOCOL, HsqlDbDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(InterbaseDatabasePlatform.JDBC_SUBPROTOCOL,
InterbaseDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(MsSql2000DatabasePlatform.JDBC_SUBPROTOCOL, MsSql2000DatabasePlatform.class);
jdbcSubProtocolToPlatform.put(MsSql2005DatabasePlatform.JDBC_SUBPROTOCOL, MsSql2005DatabasePlatform.class);
jdbcSubProtocolToPlatform.put(MsSql2008DatabasePlatform.JDBC_SUBPROTOCOL, MsSql2008DatabasePlatform.class);
jdbcSubProtocolToPlatform.put(MySqlDatabasePlatform.JDBC_SUBPROTOCOL, MySqlDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(OracleDatabasePlatform.JDBC_SUBPROTOCOL_THIN,
OracleDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(OracleDatabasePlatform.JDBC_SUBPROTOCOL_OCI8,
OracleDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(OracleDatabasePlatform.JDBC_SUBPROTOCOL_THIN_OLD,
OracleDatabasePlatform.class);
jdbcSubProtocolToPlatform.put("polite", OracleDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(PostgreSqlDatabasePlatform.JDBC_SUBPROTOCOL,
PostgreSqlDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(AseDatabasePlatform.JDBC_SUBPROTOCOL, AseDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(FirebirdDatabasePlatform.JDBC_SUBPROTOCOL,
FirebirdDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(NuoDbDatabasePlatform.JDBC_SUBPROTOCOL, NuoDbDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(TiberoDatabasePlatform.JDBC_SUBPROTOCOL_THIN,
TiberoDatabasePlatform.class);
jdbcSubProtocolToPlatform.put(RaimaDatabasePlatform.JDBC_SUBPROTOCOL, RaimaDatabasePlatform.class);
}
public static synchronized IDatabasePlatform createNewPlatformInstance(DataSource dataSource, SqlTemplateSettings settings, boolean delimitedIdentifierMode, boolean caseSensitive)
throws DdlException {
return createNewPlatformInstance(dataSource, settings, delimitedIdentifierMode, caseSensitive, false);
}
/*
* Creates a new platform for the specified database. Note that this method installs
* the data source in the returned platform instance.
*
* @param dataSource The data source for the database
* @param log The logger that the platform should use
*
* @return The platform or <code>null</code> if the database is not
* supported
*/
public static synchronized IDatabasePlatform createNewPlatformInstance(DataSource dataSource, SqlTemplateSettings settings, boolean delimitedIdentifierMode, boolean caseSensitive, boolean isLoadOnly)
throws DdlException {
// connects to the database and uses actual metadata info to get db name
// and version to determine platform
String[] nameVersion = determineDatabaseNameVersionSubprotocol(dataSource, isLoadOnly);
Class<? extends IDatabasePlatform> clazz = findPlatformClass(nameVersion);
try {
Constructor<? extends IDatabasePlatform> construtor = clazz.getConstructor(DataSource.class, SqlTemplateSettings.class);
IDatabasePlatform platform = construtor.newInstance(dataSource, settings);
log.info("The IDatabasePlatform being used is " + platform.getClass().getCanonicalName());
platform.getDdlBuilder().setDelimitedIdentifierModeOn(delimitedIdentifierMode);
platform.getDdlBuilder().setCaseSensitive(caseSensitive);
return platform;
} catch (Exception e) {
throw new DdlException("Could not create a platform of type " + nameVersion[0], e);
}
}
protected static synchronized Class<? extends IDatabasePlatform> findPlatformClass(
String[] nameVersion) {
Class<? extends IDatabasePlatform> platformClass = platforms.get(String.format("%s%s",
nameVersion[0], nameVersion[1]).toLowerCase());
if (platformClass == null) {
platformClass = platforms.get(nameVersion[0].toLowerCase());
}
if (platformClass == null) {
platformClass = jdbcSubProtocolToPlatform.get(nameVersion[2]);
}
if (platformClass == null) {
platformClass = GenericJdbcDatabasePlatform.class;
}
return platformClass;
}
public static String[] determineDatabaseNameVersionSubprotocol(DataSource dataSource) {
return determineDatabaseNameVersionSubprotocol(dataSource, false);
}
public static String[] determineDatabaseNameVersionSubprotocol(DataSource dataSource, boolean isLoadOnly) {
Connection connection = null;
String[] nameVersion = new String[3];
try {
connection = dataSource.getConnection();
DatabaseMetaData metaData = connection.getMetaData();
nameVersion[0] = metaData.getDatabaseProductName();
nameVersion[1] = Integer.toString(metaData.getDatabaseMajorVersion());
final String PREFIX = "jdbc:";
String url = metaData.getURL();
if (StringUtils.isNotBlank(url) && url.length() > PREFIX.length()) {
url = url.substring(PREFIX.length());
if (url.indexOf(":") > 0) {
url = url.substring(0, url.indexOf(":"));
}
}
nameVersion[2] = url;
/*
* if the productName is PostgreSQL, it could be either PostgreSQL
* or Greenplum
*/
/* query the metadata to determine which one it is */
if (nameVersion[0].equalsIgnoreCase("PostgreSql")) {
if (isGreenplumDatabase(connection)) {
nameVersion[0] = DatabaseNamesConstants.GREENPLUM;
nameVersion[1] = Integer.toString(getGreenplumVersion(connection));
} else if (isRedshiftDatabase(connection)) {
nameVersion[0] = DatabaseNamesConstants.REDSHIFT;
} else if (metaData.getDatabaseMajorVersion() > 9
|| (metaData.getDatabaseMajorVersion() == 9 && metaData.getDatabaseMinorVersion() >= 5)) {
nameVersion[0] = DatabaseNamesConstants.POSTGRESQL95;
}
}
/*
* if the productName is MySQL, it could be either MysSQL or MariaDB
* query the metadata to determine which one it is
*/
if (nameVersion[0].equalsIgnoreCase(DatabaseNamesConstants.MYSQL)) {
if (isMariaDBDatabase(connection)) {
nameVersion[0] = DatabaseNamesConstants.MARIADB;
}
}
if (nameVersion[2].equalsIgnoreCase("as400")) {
nameVersion[0] = DatabaseNamesConstants.DB2AS400;
}
if (nameVersion[0].toLowerCase().indexOf(DatabaseNamesConstants.DB2) != -1 && nameVersion[2].equalsIgnoreCase("db2")) {
String productVersion = getDatabaseProductVersion(dataSource);
if (nameVersion[0].toUpperCase().indexOf("Z") != -1
|| (productVersion != null && productVersion.startsWith("DSN"))) {
nameVersion[0] = DatabaseNamesConstants.DB2ZOS;
} else {
nameVersion[0] = DatabaseNamesConstants.DB2;
}
}
if (nameVersion[0].equalsIgnoreCase("AS") && nameVersion[2].equalsIgnoreCase("db2")) {
nameVersion[0] = DatabaseNamesConstants.DB2AS400;
}
if (nameVersion[0].toLowerCase().startsWith(DatabaseNamesConstants.FIREBIRD)) {
if (isFirebirdDialect1(connection)) {
nameVersion[0] = DatabaseNamesConstants.FIREBIRD_DIALECT1;
}
}
if(nameVersion[0].equalsIgnoreCase(DatabaseNamesConstants.ORACLE)) {
int majorVersion = Integer.valueOf(metaData.getDatabaseMajorVersion());
int minorVersion = Integer.valueOf(metaData.getDatabaseMinorVersion());
if(majorVersion > 12 || (majorVersion == 12 && minorVersion >= 2)) {
nameVersion[0] = DatabaseNamesConstants.ORACLE122;
}
}
log.info("Detected database '" + nameVersion[0] + "', version '" + nameVersion[1] + "', protocol '" + nameVersion[2] + "'");
return nameVersion;
} catch (Throwable ex) {
if (!isLoadOnly) {
throw new SqlException("Error while reading the database metadata: "
+ ex.getMessage(), ex);
} else {
return nameVersion;
}
} finally {
if (connection != null) {
try {
connection.close();
} catch (SQLException ex) {
// we ignore this one
}
}
}
}
private static boolean isGreenplumDatabase(Connection connection) {
Statement stmt = null;
ResultSet rs = null;
int greenplumCount = 0;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(GreenplumPlatform.SQL_GET_GREENPLUM_COUNT);
if (rs.next()) {
greenplumCount = rs.getInt(1);
}
} catch (SQLException ex) {
throw new RuntimeException(ex);
} finally {
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
} catch (SQLException ex) {
}
}
return greenplumCount > 0;
}
private static boolean isRedshiftDatabase(Connection connection) {
boolean isRedshift = false;
try {
DatabaseMetaData dmd = connection.getMetaData();
dmd.getMaxColumnsInIndex();
if (dmd.getDriverName().toUpperCase().contains("REDSHIFT")) {
isRedshift = true;
}
} catch (SQLException ex) {
if (ex.getSQLState().equals("99999")) {
isRedshift = true;
}
}
return isRedshift;
}
private static boolean isFirebirdDialect1(Connection connection) {
boolean isDialect1 = false;
Statement stmt = null;
ResultSet rs = null;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery("select current_time from rdb$database");
rs.next();
} catch (SQLException ex) {
isDialect1 = true;
try {
JdbcUtils.closeSilently(rs);
rs = stmt.executeQuery("select cast(1 as numeric(10,0)) from rdb$database");
rs.next();
} catch (SQLException e) {
log.error("The client sql dialect does not match the database, which is not a supported mode. You must add ?sql_dialect=1 to the end of the JDBC URL.");
}
} finally {
JdbcUtils.closeSilently(rs);
JdbcUtils.closeSilently(stmt);
}
return isDialect1;
}
private static boolean isMariaDBDatabase(Connection connection) {
Statement stmt = null;
ResultSet rs = null;
String productName = null;
boolean isMariaDB = false;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(MariaDBDatabasePlatform.SQL_GET_MARIADB_NAME);
while (rs.next()) {
productName = rs.getString(1);
}
if (productName != null && StringUtils.containsIgnoreCase(productName, DatabaseNamesConstants.MARIADB)) {
isMariaDB = true;
}
} catch (SQLException ex) {
// ignore the exception, if it is caught, then this is most likely
// not a mariadb database
} finally {
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
} catch (SQLException ex) {
}
}
return isMariaDB;
}
private static int getGreenplumVersion(Connection connection) {
Statement stmt = null;
ResultSet rs = null;
String versionName = null;
int productVersion = 0;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(GreenplumPlatform.SQL_GET_GREENPLUM_VERSION);
while (rs.next()) {
versionName = rs.getString(1);
}
// take up to the first "." for version number
if (versionName.indexOf('.') != -1) {
versionName = versionName.substring(0, versionName.indexOf('.'));
}
try {
productVersion = Integer.parseInt(versionName);
} catch (NumberFormatException ex) {
// if we can't convert this to a version number, leave it 0
}
} catch (SQLException ex) {
// ignore the exception, if it is caught, then this is most likely
// not
// a greenplum database
} finally {
try {
rs.close();
stmt.close();
} catch (SQLException ex) {
}
}
return productVersion;
}
public static String getDatabaseProductVersion(DataSource dataSource) {
Connection connection = null;
try {
connection = dataSource.getConnection();
DatabaseMetaData metaData = connection.getMetaData();
return metaData.getDatabaseProductVersion();
} catch (SQLException ex) {
throw new SqlException("Error while reading the database metadata: "
+ ex.getMessage(), ex);
} finally {
if (connection != null) {
try {
connection.close();
} catch (SQLException ex) {
// we ignore this one
}
}
}
}
public static int getDatabaseMajorVersion(DataSource dataSource) {
Connection connection = null;
try {
connection = dataSource.getConnection();
DatabaseMetaData metaData = connection.getMetaData();
return metaData.getDatabaseMajorVersion();
} catch (SQLException ex) {
throw new SqlException("Error while reading the database metadata: "
+ ex.getMessage(), ex);
} finally {
if (connection != null) {
try {
connection.close();
} catch (SQLException ex) {
// we ignore this one
}
}
}
}
public static int getDatabaseMinorVersion(DataSource dataSource) {
Connection connection = null;
try {
connection = dataSource.getConnection();
DatabaseMetaData metaData = connection.getMetaData();
return metaData.getDatabaseMinorVersion();
} catch (SQLException ex) {
throw new SqlException("Error while reading the database metadata: "
+ ex.getMessage(), ex);
} finally {
if (connection != null) {
try {
connection.close();
} catch (SQLException ex) {
// we ignore this one
}
}
}
}
private static synchronized void addPlatform(
Map<String, Class<? extends IDatabasePlatform>> platformMap, String platformName,
Class<? extends IDatabasePlatform> platformClass) {
if (!IDatabasePlatform.class.isAssignableFrom(platformClass)) {
throw new IllegalArgumentException("Cannot register class " + platformClass.getName()
+ " because it does not implement the " + IDatabasePlatform.class.getName()
+ " interface");
}
platformMap.put(platformName.toLowerCase(), platformClass);
}
}