From 45c0312a8754d9cd0a34a0452328923190b05803 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 24 Nov 2023 00:05:01 +0100 Subject: [PATCH] [DEV] clean --- back/src/org/kar/karusic/WebLauncher.java | 28 +++++++++---------- .../kar/karusic/migration/Initialization.java | 9 ++++-- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/back/src/org/kar/karusic/WebLauncher.java b/back/src/org/kar/karusic/WebLauncher.java index 97a792d..f50ffa6 100755 --- a/back/src/org/kar/karusic/WebLauncher.java +++ b/back/src/org/kar/karusic/WebLauncher.java @@ -37,15 +37,15 @@ public class WebLauncher { final static Logger LOGGER = LoggerFactory.getLogger(WebLauncher.class); protected UpdateJwtPublicKey keyUpdater = null; protected HttpServer server = null; - + public WebLauncher() { ConfigBaseVariable.bdDatabase = "karusic"; } - + private static URI getBaseURI() { return UriBuilder.fromUri(ConfigBaseVariable.getlocalAddress()).build(); } - + public void migrateDB() throws Exception { WebLauncher.LOGGER.info("Create migration engine"); final MigrationEngine migrationEngine = new MigrationEngine(); @@ -54,10 +54,10 @@ public class WebLauncher { WebLauncher.LOGGER.info("Add migration since last version"); // NOTHING for now WebLauncher.LOGGER.info("Migrate the DB [START]"); - migrationEngine.migrate(GlobalConfiguration.dbConfig); + migrationEngine.migrateWaitAdmin(GlobalConfiguration.dbConfig); WebLauncher.LOGGER.info("Migrate the DB [STOP]"); } - + public static void main(final String[] args) throws Exception { WebLauncher.LOGGER.info("[START] application wake UP"); final WebLauncher launcher = new WebLauncher(); @@ -70,13 +70,13 @@ public class WebLauncher { launcher.stopOther(); WebLauncher.LOGGER.info("STOP the REST server:"); } - + public void process() throws InterruptedException { // =================================================================== // Configure resources // =================================================================== final ResourceConfig rc = new ResourceConfig(); - + // add multipart models .. rc.register(MultiPartFeature.class); // global authentication system @@ -98,15 +98,15 @@ public class WebLauncher { rc.register(PlaylistResource.class); rc.register(TrackResource.class); rc.register(DataResource.class); - + rc.register(HealthCheck.class); rc.register(Front.class); - + // add jackson to be discover when we are ins standalone server rc.register(JacksonFeature.class); // enable this to show low level request //rc.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, Level.WARNING.getName()); - + //System.out.println("Connect on the BDD:"); //System.out.println(" getDBHost: '" + ConfigVariable.getDBHost() + "'"); //System.out.println(" getDBPort: '" + ConfigVariable.getDBPort() + "'"); @@ -124,13 +124,13 @@ public class WebLauncher { serverLink.shutdownNow(); } }, "shutdownHook")); - + // =================================================================== // start periodic update of the token ... // =================================================================== this.keyUpdater = new UpdateJwtPublicKey(); this.keyUpdater.start(); - + // =================================================================== // run JERSEY // =================================================================== @@ -142,14 +142,14 @@ public class WebLauncher { e.printStackTrace(); } } - + public void stop() { if (this.server != null) { this.server.shutdownNow(); this.server = null; } } - + public void stopOther() { this.keyUpdater.kill(); try { diff --git a/back/src/org/kar/karusic/migration/Initialization.java b/back/src/org/kar/karusic/migration/Initialization.java index 305b712..5108231 100644 --- a/back/src/org/kar/karusic/migration/Initialization.java +++ b/back/src/org/kar/karusic/migration/Initialization.java @@ -17,8 +17,13 @@ public class Initialization extends MigrationSqlStep { public String getName() { return "Initialization"; } - - public Initialization() throws Exception { + + public Initialization() { + + } + + @Override + public void generateStep() throws Exception { addClass(Album.class); addClass(Artist.class); addClass(Data.class);