From b7175bee1843e2329fb2ec1c97dc552d0a575af9 Mon Sep 17 00:00:00 2001 From: Gelin Luo Date: Mon, 30 Sep 2019 21:46:30 +1000 Subject: [PATCH 1/8] update act to 1.8.28; act-sql-common to 1.5.1; tune jobId for all jobs --- CHANGELOG.md | 5 +++++ pom.xml | 4 ++-- src/main/java/act/db/ebean/EbeanAgentLoader.java | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7c0094..8f69ae6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # act-ebean-java7 CHANGE LOG +1.7.9 - 30/Sep/2019 +* update to act-1.8.28 +* update to act-sql-common-1.5.1 + + 1.7.8 - 03/Jul/2019 * update to act-1.8.25 * update to act-sql-common-1.5.0 diff --git a/pom.xml b/pom.xml index 80b0b96..d4af03a 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ org.actframework parent - 1.8.25 + 1.8.28 @@ -45,7 +45,7 @@ 8.1.1 2.1.2 - 1.5.0 + 1.5.1 diff --git a/src/main/java/act/db/ebean/EbeanAgentLoader.java b/src/main/java/act/db/ebean/EbeanAgentLoader.java index 24ef773..1894cd8 100644 --- a/src/main/java/act/db/ebean/EbeanAgentLoader.java +++ b/src/main/java/act/db/ebean/EbeanAgentLoader.java @@ -103,7 +103,9 @@ public static void loadAgent(String jarFilePath, String params) { } } finally { // ensure ebean2 EnhanceContext logout set to dump output - Act.jobManager().on(SysEventId.CLASS_LOADER_INITIALIZED, new Runnable() { + Act.jobManager().on(SysEventId.CLASS_LOADER_INITIALIZED, + S.buffer("EbeanAgentLoader - clean up for ").append(jarFilePath).toString(), + new Runnable() { @Override public void run() { System.setOut(ps); From e73cde7fc3e80db2d950ecc924b5634d3965ac4f Mon Sep 17 00:00:00 2001 From: Gelin Luo Date: Mon, 30 Sep 2019 21:47:26 +1000 Subject: [PATCH 2/8] [maven-release-plugin] prepare release act-ebean-java7-1.7.9 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d4af03a..87c7923 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ act-ebean-java7 jar - 1.7.9-SNAPSHOT + 1.7.9 ACT Ebean Provides SQL database access through Ebean ORM library (java 7+) From 256cf73093beaa1e1161110f2a5161e674cc1708 Mon Sep 17 00:00:00 2001 From: Gelin Luo Date: Mon, 30 Sep 2019 21:47:36 +1000 Subject: [PATCH 3/8] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 87c7923..43ea479 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ act-ebean-java7 jar - 1.7.9 + 1.7.10-SNAPSHOT ACT Ebean Provides SQL database access through Ebean ORM library (java 7+) From ab5de823aee18ce975d7a3645edec2f123b021e4 Mon Sep 17 00:00:00 2001 From: Gelin Luo Date: Sun, 3 Nov 2019 20:55:39 +1100 Subject: [PATCH 4/8] update to act-1.8.29 --- CHANGELOG.md | 5 ++++- pom.xml | 6 +++--- src/main/java/act/db/ebean/EbeanDao.java | 5 +++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f69ae6..b3b3ca1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,13 @@ # act-ebean-java7 CHANGE LOG +1.8.0 +* update to act-1.8.29 +* update EbeanDao - add `processLikeValue` method + 1.7.9 - 30/Sep/2019 * update to act-1.8.28 * update to act-sql-common-1.5.1 - 1.7.8 - 03/Jul/2019 * update to act-1.8.25 * update to act-sql-common-1.5.0 diff --git a/pom.xml b/pom.xml index 43ea479..a9dc97f 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ act-ebean-java7 jar - 1.7.10-SNAPSHOT + 1.8.0-SNAPSHOT ACT Ebean Provides SQL database access through Ebean ORM library (java 7+) @@ -35,7 +35,7 @@ org.actframework parent - 1.8.28 + 1.8.29 @@ -45,7 +45,7 @@ 8.1.1 2.1.2 - 1.5.1 + 1.6.0 diff --git a/src/main/java/act/db/ebean/EbeanDao.java b/src/main/java/act/db/ebean/EbeanDao.java index 290298f..9e0ce5c 100644 --- a/src/main/java/act/db/ebean/EbeanDao.java +++ b/src/main/java/act/db/ebean/EbeanDao.java @@ -583,4 +583,9 @@ public EbeanQuery q(String keys, Object... values) { public EbeanQuery createQuery(String s, Object... objects) { return q(s, objects); } + + @Override + public Object processLikeValue(String v) { + return v.contains("%") ? v : "%" + v + "%"; + } } From 32f107668115b14d021bd90fc570017eddb7a64d Mon Sep 17 00:00:00 2001 From: Gelin Luo Date: Sun, 3 Nov 2019 20:56:14 +1100 Subject: [PATCH 5/8] [maven-release-plugin] prepare release act-ebean-java7-1.8.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a9dc97f..b032ecf 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ act-ebean-java7 jar - 1.8.0-SNAPSHOT + 1.8.0 ACT Ebean Provides SQL database access through Ebean ORM library (java 7+) From 3c7b06f141e8054671c311775cacad0e264346bd Mon Sep 17 00:00:00 2001 From: Gelin Luo Date: Sun, 3 Nov 2019 20:56:26 +1100 Subject: [PATCH 6/8] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b032ecf..f5c1956 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ act-ebean-java7 jar - 1.8.0 + 1.8.1-SNAPSHOT ACT Ebean Provides SQL database access through Ebean ORM library (java 7+) From 1f6501a4c7dfd973db371c7672195da93b53f974 Mon Sep 17 00:00:00 2001 From: Gelin Luo Date: Mon, 23 Mar 2020 22:02:24 +1100 Subject: [PATCH 7/8] Allow app to define customised ebean IdGenerator #22 --- CHANGELOG.md | 3 ++ src/main/java/act/db/ebean/EbeanService.java | 2 + .../act/db/ebean/IdGeneratorRegister.java | 44 +++++++++++++++++++ src/main/resources/act.scan.list | 2 +- 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/main/java/act/db/ebean/IdGeneratorRegister.java diff --git a/CHANGELOG.md b/CHANGELOG.md index b3b3ca1..7d2c190 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # act-ebean-java7 CHANGE LOG +1.8.1 +* Allow app to define customised ebean IdGenerator #22 + 1.8.0 * update to act-1.8.29 * update EbeanDao - add `processLikeValue` method diff --git a/src/main/java/act/db/ebean/EbeanService.java b/src/main/java/act/db/ebean/EbeanService.java index 86ddedd..dd40d60 100644 --- a/src/main/java/act/db/ebean/EbeanService.java +++ b/src/main/java/act/db/ebean/EbeanService.java @@ -103,6 +103,8 @@ protected void dataSourceProvided(DataSource dataSource, DataSourceConfig dsConf ebeanConfig = new EbeanConfigAdaptor().adaptFrom(this.config, dsConfig, this); ebeanConfig.setDataSource(dataSource); } + IdGeneratorRegister rg = Act.getInstance(IdGeneratorRegister.class); + rg.registerTo(ebeanConfig); app().eventBus().trigger(new EbeanConfigLoaded(ebeanConfig)); if (readonly) { ebeanConfig.setDdlGenerate(false); diff --git a/src/main/java/act/db/ebean/IdGeneratorRegister.java b/src/main/java/act/db/ebean/IdGeneratorRegister.java new file mode 100644 index 0000000..cc6b397 --- /dev/null +++ b/src/main/java/act/db/ebean/IdGeneratorRegister.java @@ -0,0 +1,44 @@ +package act.db.ebean; + +/*- + * #%L + * ACT Ebean + * %% + * Copyright (C) 2015 - 2020 ActFramework + * %% + * Licensed 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. + * #L% + */ + + +import com.avaje.ebean.config.IdGenerator; +import com.avaje.ebean.config.ServerConfig; + +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.ArrayList; +import java.util.List; + +@Singleton +public class IdGeneratorRegister { + + @Inject + private List idGenerators = new ArrayList<>(); + + void registerTo(ServerConfig config) { + for (IdGenerator generator : idGenerators) { + config.add(generator); + } + } + +} diff --git a/src/main/resources/act.scan.list b/src/main/resources/act.scan.list index 57e4589..2ab6d2c 100644 --- a/src/main/resources/act.scan.list +++ b/src/main/resources/act.scan.list @@ -1,2 +1,2 @@ act.db.ebean.EbeanModule -act.db.jpa.EntityFinder \ No newline at end of file +act.db.ebean.IdGeneratorRegister From 09c15353be4b343106e2eb9bd99197671516b4a8 Mon Sep 17 00:00:00 2001 From: Gelin Luo Date: Tue, 24 Mar 2020 21:01:42 +1100 Subject: [PATCH 8/8] catch up act-ebean fix to #33: create new mechanism for app to configure ServerConfig --- .../java/act/db/ebean/EbeanConfigurator.java | 36 +++++++++++++++++ .../db/ebean/EbeanConfiguratorManager.java | 39 +++++++++++++++++++ src/main/java/act/db/ebean/EbeanService.java | 4 +- src/main/resources/act.scan.list | 1 + 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/main/java/act/db/ebean/EbeanConfigurator.java create mode 100644 src/main/java/act/db/ebean/EbeanConfiguratorManager.java diff --git a/src/main/java/act/db/ebean/EbeanConfigurator.java b/src/main/java/act/db/ebean/EbeanConfigurator.java new file mode 100644 index 0000000..d7b8ef3 --- /dev/null +++ b/src/main/java/act/db/ebean/EbeanConfigurator.java @@ -0,0 +1,36 @@ +package act.db.ebean; + +/*- + * #%L + * ACT Ebean + * %% + * Copyright (C) 2015 - 2020 ActFramework + * %% + * Licensed 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. + * #L% + */ + + +import com.avaje.ebean.config.ServerConfig; + +/** + * Application to implement this interface to do further + * configuration to {@link ServerConfig Ebean ServerConfig}. + */ +public interface EbeanConfigurator { + /** + * Configure the Ebean {@link ServerConfig}. + * @param ebeanConfig the Ebean config instance + */ + void configure(ServerConfig ebeanConfig); +} diff --git a/src/main/java/act/db/ebean/EbeanConfiguratorManager.java b/src/main/java/act/db/ebean/EbeanConfiguratorManager.java new file mode 100644 index 0000000..922aedb --- /dev/null +++ b/src/main/java/act/db/ebean/EbeanConfiguratorManager.java @@ -0,0 +1,39 @@ +package act.db.ebean; + +/*- + * #%L + * ACT Ebean + * %% + * Copyright (C) 2015 - 2020 ActFramework + * %% + * Licensed 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. + * #L% + */ + +import com.avaje.ebean.config.ServerConfig; + +import javax.inject.Inject; +import java.util.List; + +public class EbeanConfiguratorManager { + + @Inject + private List configurators; + + void callConfigurators(ServerConfig config) { + for (EbeanConfigurator configurator : configurators) { + configurator.configure(config); + } + } + +} diff --git a/src/main/java/act/db/ebean/EbeanService.java b/src/main/java/act/db/ebean/EbeanService.java index dd40d60..9ddd466 100644 --- a/src/main/java/act/db/ebean/EbeanService.java +++ b/src/main/java/act/db/ebean/EbeanService.java @@ -105,7 +105,9 @@ protected void dataSourceProvided(DataSource dataSource, DataSourceConfig dsConf } IdGeneratorRegister rg = Act.getInstance(IdGeneratorRegister.class); rg.registerTo(ebeanConfig); - app().eventBus().trigger(new EbeanConfigLoaded(ebeanConfig)); + EbeanConfiguratorManager configuratorManager = Act.getInstance(EbeanConfiguratorManager.class); + configuratorManager.callConfigurators(ebeanConfig); + //app().eventBus().trigger(new EbeanConfigLoaded(ebeanConfig)); if (readonly) { ebeanConfig.setDdlGenerate(false); ebeanConfig.setDdlRun(false); diff --git a/src/main/resources/act.scan.list b/src/main/resources/act.scan.list index 2ab6d2c..698965d 100644 --- a/src/main/resources/act.scan.list +++ b/src/main/resources/act.scan.list @@ -1,2 +1,3 @@ act.db.ebean.EbeanModule act.db.ebean.IdGeneratorRegister +act.db.ebean.EbeanConfiguratorManager \ No newline at end of file