-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
156 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
ndatabase-core/src/main/java/com/nivixx/ndatabase/core/config/NDatabaseConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.nivixx.ndatabase.core.config; | ||
|
||
import com.nivixx.ndatabase.dbms.mariadb.MariaDBConfig; | ||
import com.nivixx.ndatabase.dbms.mongodb.MongoDBConfig; | ||
import com.nivixx.ndatabase.dbms.mysql.MysqlConfig; | ||
import com.nivixx.ndatabase.dbms.sqlite.SqliteConfig; | ||
|
||
import java.util.Objects; | ||
|
||
public class NDatabaseConfig { | ||
|
||
protected DatabaseType databaseType = DatabaseType.SQLITE; | ||
|
||
protected MariaDBConfig mariaDBConfig; | ||
protected MysqlConfig mysqlConfig; | ||
protected SqliteConfig sqliteConfig; | ||
protected MongoDBConfig mongoDBConfig; | ||
|
||
protected boolean isDebugMode = false; | ||
protected int idleThreadPoolSize = 1; | ||
|
||
public void verifyConfig() { | ||
if(databaseType == null) { | ||
throw new IllegalArgumentException("Database Type not provided in the configuration"); | ||
} | ||
if(databaseType == DatabaseType.MYSQL) { | ||
Objects.requireNonNull(mysqlConfig.getHost(), "mysql host is null, check your mysql configuration"); | ||
Objects.requireNonNull(mysqlConfig.getDatabaseName(), "mysql database name is null, check your mysql configuration"); | ||
Objects.requireNonNull(mysqlConfig.getUser(), "mysql user is null, check your mysql configuration"); | ||
Objects.requireNonNull(mysqlConfig.getPass(), "mysql pass is null, check your mysql configuration"); | ||
} | ||
} | ||
|
||
public MariaDBConfig getMariaDBConfig() { | ||
return mariaDBConfig; | ||
} | ||
|
||
public void setMariaDBConfig(MariaDBConfig mariaDBConfig) { | ||
this.mariaDBConfig = mariaDBConfig; | ||
} | ||
|
||
public MongoDBConfig getMongoDBConfig() { | ||
return mongoDBConfig; | ||
} | ||
|
||
public void setMongoDBConfig(MongoDBConfig mongoDBConfig) { | ||
this.mongoDBConfig = mongoDBConfig; | ||
} | ||
|
||
public boolean isDebugMode() { | ||
return isDebugMode; | ||
} | ||
|
||
public void setDebugMode(boolean debugMode) { | ||
isDebugMode = debugMode; | ||
} | ||
|
||
public DatabaseType getDatabaseType() { | ||
return databaseType; | ||
} | ||
|
||
public void setDatabaseType(DatabaseType databaseType) { | ||
this.databaseType = databaseType; | ||
} | ||
|
||
public MysqlConfig getMysqlConfig() { | ||
return mysqlConfig; | ||
} | ||
|
||
public void setMysqlConfig(MysqlConfig mysqlConfig) { | ||
this.mysqlConfig = mysqlConfig; | ||
} | ||
|
||
public SqliteConfig getSqliteConfig() { | ||
return sqliteConfig; | ||
} | ||
|
||
public void setSqliteConfig(SqliteConfig sqliteConfig) { | ||
this.sqliteConfig = sqliteConfig; | ||
} | ||
|
||
public int getIdleThreadPoolSize() { | ||
return idleThreadPoolSize; | ||
} | ||
|
||
public void setIdleThreadPoolSize(int idleThreadPoolSize) { | ||
this.idleThreadPoolSize = idleThreadPoolSize; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.