7
7
import me .cobeine .sqlava .connection .auth .AuthenticatedConnection ;
8
8
import me .cobeine .sqlava .connection .auth .BasicMySQLCredentials ;
9
9
import me .cobeine .sqlava .connection .auth .CredentialsKey ;
10
- import me .cobeine .sqlava .connection .auth .CredentialsRecord ;
10
+ import me .cobeine .sqlava .connection .auth .CredentialsHolder ;
11
11
import me .cobeine .sqlava .connection .database .query .PreparedQuery ;
12
12
import me .cobeine .sqlava .connection .database .query .Query ;
13
13
import me .cobeine .sqlava .connection .database .table .TableCommands ;
26
26
public class MySQLConnection implements AuthenticatedConnection <HikariDataSource >, PooledConnection <HikariDataSource , Connection >{
27
27
28
28
private ConnectionPool <HikariDataSource ,Connection > pool ;
29
- private final CredentialsRecord credentialsRecord ;
29
+ private final CredentialsHolder credentialsHolder ;
30
30
private final Logger logger ;
31
31
private HikariDataSource dataSource ;
32
32
private final TableCommands TableCommands ;
33
33
34
- public MySQLConnection (CredentialsRecord record ) {
35
- this .credentialsRecord = record ;
34
+ public MySQLConnection (CredentialsHolder record ) {
35
+ this .credentialsHolder = record ;
36
36
this .TableCommands = new TableCommands (this );
37
37
logger = Logger .getLogger (this .getClass ().getName ());
38
38
}
@@ -48,24 +48,24 @@ public void connect(Callback<Integer, Exception> callback) {
48
48
@ Override
49
49
public ConnectionResult connect () {
50
50
HikariConfig config = new HikariConfig ();
51
- if (credentialsRecord .getProperty (BasicMySQLCredentials .DATASOURCE_CLASS_NAME ,String .class ) != null ) {
52
- config .setDataSourceClassName (credentialsRecord .getProperty (BasicMySQLCredentials .DATASOURCE_CLASS_NAME , String .class ));
51
+ if (credentialsHolder .getProperty (BasicMySQLCredentials .DATASOURCE_CLASS_NAME ,String .class ) != null ) {
52
+ config .setDataSourceClassName (credentialsHolder .getProperty (BasicMySQLCredentials .DATASOURCE_CLASS_NAME , String .class ));
53
53
}
54
- if (credentialsRecord .getProperty (BasicMySQLCredentials .DRIVER , String .class ) != null ) {
55
- config .setDriverClassName (credentialsRecord .getProperty (BasicMySQLCredentials .DRIVER , String .class ));
54
+ if (credentialsHolder .getProperty (BasicMySQLCredentials .DRIVER , String .class ) != null ) {
55
+ config .setDriverClassName (credentialsHolder .getProperty (BasicMySQLCredentials .DRIVER , String .class ));
56
56
}
57
- if (credentialsRecord .getProperty (BasicMySQLCredentials .JDBC_URL ,String .class ) != null ) {
58
- config .setJdbcUrl (credentialsRecord .getProperty (BasicMySQLCredentials .JDBC_URL ,String .class ));
57
+ if (credentialsHolder .getProperty (BasicMySQLCredentials .JDBC_URL ,String .class ) != null ) {
58
+ config .setJdbcUrl (credentialsHolder .getProperty (BasicMySQLCredentials .JDBC_URL ,String .class ));
59
59
}
60
- if (credentialsRecord .getProperty (BasicMySQLCredentials .MAX_LIFETIME ,Integer .class ) != null ) {
61
- config .setMaxLifetime (credentialsRecord .getProperty (BasicMySQLCredentials .MAX_LIFETIME ,Integer .class ));
60
+ if (credentialsHolder .getProperty (BasicMySQLCredentials .MAX_LIFETIME ,Integer .class ) != null ) {
61
+ config .setMaxLifetime (credentialsHolder .getProperty (BasicMySQLCredentials .MAX_LIFETIME ,Integer .class ));
62
62
}
63
- if (credentialsRecord .getProperty (BasicMySQLCredentials .POOL_SIZE ,Integer .class ) != null ) {
64
- config .setMaximumPoolSize (credentialsRecord .getProperty (BasicMySQLCredentials .POOL_SIZE , Integer .class ));
63
+ if (credentialsHolder .getProperty (BasicMySQLCredentials .POOL_SIZE ,Integer .class ) != null ) {
64
+ config .setMaximumPoolSize (credentialsHolder .getProperty (BasicMySQLCredentials .POOL_SIZE , Integer .class ));
65
65
}
66
- for (CredentialsKey credentialsKey : credentialsRecord .keySet ()) {
66
+ for (CredentialsKey credentialsKey : credentialsHolder .keySet ()) {
67
67
if (credentialsKey .isProperty ()) {
68
- config .addDataSourceProperty (credentialsKey .getKey (), credentialsRecord .getProperty (credentialsKey ,credentialsKey .getDataType ()));
68
+ config .addDataSourceProperty (credentialsKey .getKey (), credentialsHolder .getProperty (credentialsKey ,credentialsKey .getDataType ()));
69
69
}
70
70
}
71
71
0 commit comments