1- package org .seasar .doma .quarkus .runtime ;
1+ package org .seasar .doma .quarkus .deployment ;
22
3+ import io .quarkus .runtime .annotations .ConfigGroup ;
34import io .quarkus .runtime .annotations .ConfigItem ;
45import io .quarkus .runtime .annotations .ConfigRoot ;
56import java .util .Optional ;
6- import java .util .function .Supplier ;
77import org .seasar .doma .jdbc .Config ;
8- import org .seasar .doma .jdbc .GreedyCacheSqlFileRepository ;
9- import org .seasar .doma .jdbc .Naming ;
10- import org .seasar .doma .jdbc .NoCacheSqlFileRepository ;
11- import org .seasar .doma .jdbc .SqlFileRepository ;
128import org .seasar .doma .jdbc .SqlLogType ;
13- import org .seasar .doma .jdbc .dialect .Dialect ;
14- import org .seasar .doma .jdbc .dialect .H2Dialect ;
15- import org .seasar .doma .jdbc .dialect .MssqlDialect ;
16- import org .seasar .doma .jdbc .dialect .MysqlDialect ;
17- import org .seasar .doma .jdbc .dialect .PostgresDialect ;
18- import org .seasar .doma .jdbc .dialect .StandardDialect ;
9+ import org .seasar .doma .quarkus .runtime .DomaSettings ;
1910
2011@ ConfigRoot
21- public class DomaConfiguration {
12+ public class DomaBuildTimeConfig {
13+
14+ public static final String SQL_LOAD_SCRIPT_DEFAULT = "import.sql" ;
15+ public static final String SQL_LOAD_SCRIPT_NO_FILE = "no-file" ;
2216
2317 /**
2418 * The SQL dialect.
2519 *
2620 * @see Config#getDialect()
2721 */
2822 @ ConfigItem (defaultValueDocumentation = "depends on 'quarkus.datasource.db-kind'" )
29- public Optional <DialectType > dialect ;
23+ public Optional <DomaSettings . DialectType > dialect ;
3024
3125 /**
3226 * The SQL file repository.
3327 *
3428 * @see Config#getSqlFileRepository()
3529 */
3630 @ ConfigItem (defaultValue = "greedy-cache" )
37- public SqlFileRepositoryType sqlFileRepository ;
31+ public DomaSettings . SqlFileRepositoryType sqlFileRepository ;
3832
3933 /**
4034 * The naming convention controller.
4135 *
4236 * @see Config#getNaming()
4337 */
4438 @ ConfigItem (defaultValue = "none" )
45- public NamingType naming ;
39+ public DomaSettings . NamingType naming ;
4640
4741 /**
4842 * The SQL log type that determines the SQL log format in exceptions.
@@ -107,7 +101,32 @@ public class DomaConfiguration {
107101 public Optional <String > sqlLoadScript ;
108102
109103 /** The log configuration. */
110- @ ConfigItem public LogConfiguration log ;
104+ @ ConfigItem public LogBuildTimeConfig log ;
105+
106+ @ ConfigGroup
107+ public static class LogBuildTimeConfig {
108+
109+ /** Shows SQL logs. */
110+ @ ConfigItem public boolean sql ;
111+
112+ /** Shows DAO logs. */
113+ @ ConfigItem public boolean dao ;
114+
115+ /** Shows the logs of the failure to close JDBC resource. */
116+ @ ConfigItem public boolean closingFailure ;
117+
118+ @ Override
119+ public String toString () {
120+ return "DomaConfigurationLog{"
121+ + "sql="
122+ + sql
123+ + ", dao="
124+ + dao
125+ + ", closingFailure="
126+ + closingFailure
127+ + '}' ;
128+ }
129+ }
111130
112131 @ Override
113132 public String toString () {
@@ -134,55 +153,4 @@ public String toString() {
134153 + log
135154 + '}' ;
136155 }
137-
138- public enum DialectType {
139- STANDARD (StandardDialect ::new ),
140- MSSQL (MssqlDialect ::new ),
141- MYSQL (MysqlDialect ::new ),
142- POSTGRES (PostgresDialect ::new ),
143- H2 (H2Dialect ::new );
144-
145- private final Supplier <Dialect > constructor ;
146-
147- DialectType (Supplier <Dialect > constructor ) {
148- this .constructor = constructor ;
149- }
150-
151- public Dialect create () {
152- return this .constructor .get ();
153- }
154- }
155-
156- public enum SqlFileRepositoryType {
157- NO_CACHE (NoCacheSqlFileRepository ::new ),
158- GREEDY_CACHE (GreedyCacheSqlFileRepository ::new );
159-
160- private final Supplier <SqlFileRepository > constructor ;
161-
162- SqlFileRepositoryType (Supplier <SqlFileRepository > constructor ) {
163- this .constructor = constructor ;
164- }
165-
166- public SqlFileRepository create () {
167- return this .constructor .get ();
168- }
169- }
170-
171- public enum NamingType {
172- NONE (Naming .NONE ),
173- LOWER_CASE (Naming .LOWER_CASE ),
174- UPPER_CASE (Naming .UPPER_CASE ),
175- SNAKE_LOWER_CASE (Naming .SNAKE_LOWER_CASE ),
176- SNAKE_UPPER_CASE (Naming .SNAKE_UPPER_CASE );
177-
178- private final Naming naming ;
179-
180- NamingType (Naming naming ) {
181- this .naming = naming ;
182- }
183-
184- public Naming naming () {
185- return this .naming ;
186- }
187- }
188156}
0 commit comments