Skip to content

Commit

Permalink
Better logging load platform
Browse files Browse the repository at this point in the history
  • Loading branch information
NivixX committed Oct 28, 2024
1 parent 68995d3 commit b3758a8
Show file tree
Hide file tree
Showing 21 changed files with 156 additions and 62 deletions.
2 changes: 1 addition & 1 deletion ndatabase-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ndatabase</artifactId>
<groupId>com.nivixx</groupId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public class NDatabase {
public static NDatabaseAPI api() {
NDatabaseAPI instance = NDatabase.instance;
if (instance == null) {
throw new IllegalStateException("NDatabase has not loaded yet");
throw new IllegalStateException("NDatabase has not loaded yet. Verify that your plugin configuration include NDatabase in dependencies.");
} else {
return instance;
}
}

// Note: the NDatabaseAPI instance is set by the core module after loaded
private static void set(NDatabaseAPI nDatabaseAPI) {
static void set(NDatabaseAPI nDatabaseAPI) {
Objects.requireNonNull(nDatabaseAPI,
"The NDatabase instance is null, probably due to a Google Guice incompatibility issue with java/spigot or other plugin.");
instance = nDatabaseAPI;
Expand Down
22 changes: 11 additions & 11 deletions ndatabase-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ndatabase</artifactId>
<groupId>com.nivixx</groupId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -20,52 +20,52 @@
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-expressiontree</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-core</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-jdbc</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-mysql</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-sqlite</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-mongodb</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-mariadb</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>core-platform</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
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;
}
}
8 changes: 4 additions & 4 deletions ndatabase-dbms-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</parent>

<artifactId>ndatabase-dbms-api</artifactId>
Expand All @@ -21,19 +21,19 @@
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-expressiontree</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.nivixx</groupId>
<artifactId>core-platform</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
10 changes: 5 additions & 5 deletions ndatabase-dbms-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</parent>

<artifactId>ndatabase-dbms-core</artifactId>
Expand All @@ -21,24 +21,24 @@
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-expressiontree</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.nivixx</groupId>
<artifactId>core-platform</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
6 changes: 3 additions & 3 deletions ndatabase-dbms-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</parent>

<artifactId>ndatabase-dbms-jdbc</artifactId>
Expand All @@ -21,13 +21,13 @@
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-core</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions ndatabase-dbms-mariadb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</parent>

<artifactId>ndatabase-dbms-mariadb</artifactId>
Expand All @@ -21,13 +21,13 @@
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-jdbc</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions ndatabase-dbms-mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</parent>

<artifactId>ndatabase-dbms-mongodb</artifactId>
Expand All @@ -20,13 +20,13 @@
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-core</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down
6 changes: 3 additions & 3 deletions ndatabase-dbms-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</parent>

<artifactId>ndatabase-dbms-mysql</artifactId>
Expand All @@ -21,13 +21,13 @@
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-jdbc</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions ndatabase-dbms-sqlite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</parent>

<artifactId>ndatabase-dbms-sqlite</artifactId>
Expand All @@ -22,13 +22,13 @@
<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-api</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.nivixx</groupId>
<artifactId>ndatabase-dbms-jdbc</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>

</dependencies>
Expand Down
Loading

0 comments on commit b3758a8

Please sign in to comment.