mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 14:55:28 +00:00
Refactor extract separate modules for each platform from ebean-api dbplatform
This commit is contained in:
1 parent
514bba4130
commit
e71e16c1ee
259 files changed
+3183
-1125
No files matched your search
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>platforms</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.16.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-platform-hsqldb</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>12.16.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,49 @@
|
||||
package io.ebean.platform.hsqldb;
|
||||
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.DatabasePlatformProvider;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
|
||||
/**
|
||||
* HSqlDB platform provider.
|
||||
*/
|
||||
public class HSqlDbPlatformProvider implements DatabasePlatformProvider {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HSqlDb";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(String name) {
|
||||
return name.equals("hsqldb");
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabasePlatform create(String name) {
|
||||
return new HsqldbPlatform();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchByProductName(String productName) {
|
||||
return productName.contains("hsql database engine");
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabasePlatform create(int majorVersion, int minorVersion, DatabaseMetaData meta, Connection connection) {
|
||||
return new HsqldbPlatform();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchPlatform(Platform platform) {
|
||||
return Platform.HSQLDB.equals(platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabasePlatform create(Platform platform) {
|
||||
return new HsqldbPlatform();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.ebean.platform.hsqldb;
|
||||
|
||||
import io.ebean.BackgroundExecutor;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.DbPlatformType;
|
||||
import io.ebean.config.dbplatform.DbType;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.config.dbplatform.PlatformIdGenerator;
|
||||
import io.ebean.platform.h2.H2DbEncrypt;
|
||||
import io.ebean.platform.h2.H2SequenceIdGenerator;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* H2 specific platform.
|
||||
*/
|
||||
public class HsqldbPlatform extends DatabasePlatform {
|
||||
|
||||
public HsqldbPlatform() {
|
||||
super();
|
||||
this.platform = Platform.HSQLDB;
|
||||
this.dbEncrypt = new H2DbEncrypt();
|
||||
this.truncateTable = "delete from %s";
|
||||
this.dbIdentity.setIdType(IdType.IDENTITY);
|
||||
this.dbIdentity.setSupportsGetGeneratedKeys(true);
|
||||
this.dbIdentity.setSupportsSequence(true);
|
||||
this.dbIdentity.setSupportsIdentity(true);
|
||||
|
||||
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformIdGenerator createSequenceIdGenerator(BackgroundExecutor be, DataSource ds, int stepSize, String seqName) {
|
||||
return new H2SequenceIdGenerator(be, ds, seqName, sequenceBatchSize);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Hsqldb specific support.
|
||||
*/
|
||||
package io.ebean.platform.hsqldb;
|
||||
@@ -0,0 +1,8 @@
|
||||
module io.ebean.platform.hsqldb {
|
||||
|
||||
exports io.ebean.platform.hsqldb;
|
||||
|
||||
requires transitive io.ebean.api;
|
||||
|
||||
provides io.ebean.config.dbplatform.DatabasePlatformProvider with io.ebean.platform.hsqldb.HSqlDbPlatformProvider;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
io.ebean.platform.hsqldb.HSqlDbPlatformProvider
|
||||
Reference in new issue
Block a user