Compare commits
No commits in common. "c7eadc607dc63a29a2f279406d32c89e2bce35cb" and "da3c467569f11a21e5e209d9e7950598f9d3aa6e" have entirely different histories.
c7eadc607d
...
da3c467569
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>kangaroo-and-rabbit</groupId>
|
<groupId>kangaroo-and-rabbit</groupId>
|
||||||
<artifactId>archidata</artifactId>
|
<artifactId>archidata</artifactId>
|
||||||
<version>0.23.6</version>
|
<version>0.23.4</version>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
<maven.compiler.version>3.1</maven.compiler.version>
|
<maven.compiler.version>3.1</maven.compiler.version>
|
||||||
|
@ -11,7 +11,6 @@ import org.kar.archidata.dataAccess.DataFactory;
|
|||||||
import org.kar.archidata.dataAccess.QueryOptions;
|
import org.kar.archidata.dataAccess.QueryOptions;
|
||||||
import org.kar.archidata.db.DbConfig;
|
import org.kar.archidata.db.DbConfig;
|
||||||
import org.kar.archidata.migration.model.Migration;
|
import org.kar.archidata.migration.model.Migration;
|
||||||
import org.kar.archidata.tools.ConfigBaseVariable;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -131,40 +130,35 @@ public class MigrationEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createTableIfAbleOrWaitAdmin(final DbConfig configInput) throws MigrationException {
|
private void createTableIfAbleOrWaitAdmin(final DbConfig configInput) throws MigrationException {
|
||||||
if (ConfigBaseVariable.getDBAbleToCreate()) {
|
final DbConfig config = configInput.clone();
|
||||||
final DbConfig config = configInput.clone();
|
config.setDbName(null);
|
||||||
config.setDbName(null);
|
final String dbName = configInput.getDbName();
|
||||||
final String dbName = configInput.getDbName();
|
LOGGER.info("Verify existance of '{}'", dbName);
|
||||||
LOGGER.info("Verify existance of '{}'", dbName);
|
try (final DBAccess da = DBAccess.createInterface(config)) {
|
||||||
try (final DBAccess da = DBAccess.createInterface(config)) {
|
boolean exist = da.isDBExist(dbName);
|
||||||
boolean exist = da.isDBExist(dbName);
|
if (!exist) {
|
||||||
if (!exist) {
|
LOGGER.warn("DB: '{}' DOES NOT EXIST ==> create one", dbName);
|
||||||
LOGGER.warn("DB: '{}' DOES NOT EXIST ==> create one", dbName);
|
// create the local DB:
|
||||||
// create the local DB:
|
da.createDB(dbName);
|
||||||
da.createDB(dbName);
|
}
|
||||||
|
exist = da.isDBExist(dbName);
|
||||||
|
while (!exist) {
|
||||||
|
LOGGER.error("DB: '{}' DOES NOT EXIST after trying to create one ", dbName);
|
||||||
|
LOGGER.error("Waiting administrator create a new one, we check after 30 seconds...");
|
||||||
|
try {
|
||||||
|
Thread.sleep(30000);
|
||||||
|
} catch (final InterruptedException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
exist = da.isDBExist(dbName);
|
exist = da.isDBExist(dbName);
|
||||||
while (!exist) {
|
|
||||||
LOGGER.error("DB: '{}' DOES NOT EXIST after trying to create one ", dbName);
|
|
||||||
LOGGER.error("Waiting administrator create a new one, we check after 30 seconds...");
|
|
||||||
try {
|
|
||||||
Thread.sleep(30000);
|
|
||||||
} catch (final InterruptedException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
exist = da.isDBExist(dbName);
|
|
||||||
}
|
|
||||||
} catch (final InternalServerErrorException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new MigrationException("TODO ...");
|
|
||||||
} catch (final IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new MigrationException("TODO ...");
|
|
||||||
}
|
}
|
||||||
} else {
|
} catch (final InternalServerErrorException e) {
|
||||||
final String dbName = configInput.getDbName();
|
e.printStackTrace();
|
||||||
LOGGER.warn("DB: '{}' is not check if it EXIST", dbName);
|
throw new MigrationException("TODO ...");
|
||||||
|
} catch (final IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new MigrationException("TODO ...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package org.kar.archidata.tools;
|
|||||||
public class ConfigBaseVariable {
|
public class ConfigBaseVariable {
|
||||||
static public String tmpDataFolder;
|
static public String tmpDataFolder;
|
||||||
static public String dataFolder;
|
static public String dataFolder;
|
||||||
static public String dbAbleToCreate;
|
|
||||||
static public String dbType;
|
static public String dbType;
|
||||||
static public String dbHost;
|
static public String dbHost;
|
||||||
static public String dbPort;
|
static public String dbPort;
|
||||||
@ -24,7 +23,6 @@ public class ConfigBaseVariable {
|
|||||||
public static void clearAllValue() {
|
public static void clearAllValue() {
|
||||||
tmpDataFolder = System.getenv("DATA_TMP_FOLDER");
|
tmpDataFolder = System.getenv("DATA_TMP_FOLDER");
|
||||||
dataFolder = System.getenv("DATA_FOLDER");
|
dataFolder = System.getenv("DATA_FOLDER");
|
||||||
dbAbleToCreate = System.getenv("DB_ABLE_TO_CREATE");
|
|
||||||
dbType = System.getenv("DB_TYPE");
|
dbType = System.getenv("DB_TYPE");
|
||||||
dbHost = System.getenv("DB_HOST");
|
dbHost = System.getenv("DB_HOST");
|
||||||
dbPort = System.getenv("DB_PORT");
|
dbPort = System.getenv("DB_PORT");
|
||||||
@ -60,13 +58,6 @@ public class ConfigBaseVariable {
|
|||||||
return dataFolder;
|
return dataFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getDBAbleToCreate() {
|
|
||||||
if (dbAbleToCreate == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return Boolean.getBoolean(dbAbleToCreate);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDBType() {
|
public static String getDBType() {
|
||||||
if (dbType == null) {
|
if (dbType == null) {
|
||||||
return "mysql";
|
return "mysql";
|
||||||
|
@ -1 +1 @@
|
|||||||
0.23.6
|
0.23.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user