[DEV] clean
This commit is contained in:
parent
77de4e1fd7
commit
45c0312a87
@ -37,15 +37,15 @@ public class WebLauncher {
|
|||||||
final static Logger LOGGER = LoggerFactory.getLogger(WebLauncher.class);
|
final static Logger LOGGER = LoggerFactory.getLogger(WebLauncher.class);
|
||||||
protected UpdateJwtPublicKey keyUpdater = null;
|
protected UpdateJwtPublicKey keyUpdater = null;
|
||||||
protected HttpServer server = null;
|
protected HttpServer server = null;
|
||||||
|
|
||||||
public WebLauncher() {
|
public WebLauncher() {
|
||||||
ConfigBaseVariable.bdDatabase = "karusic";
|
ConfigBaseVariable.bdDatabase = "karusic";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static URI getBaseURI() {
|
private static URI getBaseURI() {
|
||||||
return UriBuilder.fromUri(ConfigBaseVariable.getlocalAddress()).build();
|
return UriBuilder.fromUri(ConfigBaseVariable.getlocalAddress()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void migrateDB() throws Exception {
|
public void migrateDB() throws Exception {
|
||||||
WebLauncher.LOGGER.info("Create migration engine");
|
WebLauncher.LOGGER.info("Create migration engine");
|
||||||
final MigrationEngine migrationEngine = new MigrationEngine();
|
final MigrationEngine migrationEngine = new MigrationEngine();
|
||||||
@ -54,10 +54,10 @@ public class WebLauncher {
|
|||||||
WebLauncher.LOGGER.info("Add migration since last version");
|
WebLauncher.LOGGER.info("Add migration since last version");
|
||||||
// NOTHING for now
|
// NOTHING for now
|
||||||
WebLauncher.LOGGER.info("Migrate the DB [START]");
|
WebLauncher.LOGGER.info("Migrate the DB [START]");
|
||||||
migrationEngine.migrate(GlobalConfiguration.dbConfig);
|
migrationEngine.migrateWaitAdmin(GlobalConfiguration.dbConfig);
|
||||||
WebLauncher.LOGGER.info("Migrate the DB [STOP]");
|
WebLauncher.LOGGER.info("Migrate the DB [STOP]");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(final String[] args) throws Exception {
|
public static void main(final String[] args) throws Exception {
|
||||||
WebLauncher.LOGGER.info("[START] application wake UP");
|
WebLauncher.LOGGER.info("[START] application wake UP");
|
||||||
final WebLauncher launcher = new WebLauncher();
|
final WebLauncher launcher = new WebLauncher();
|
||||||
@ -70,13 +70,13 @@ public class WebLauncher {
|
|||||||
launcher.stopOther();
|
launcher.stopOther();
|
||||||
WebLauncher.LOGGER.info("STOP the REST server:");
|
WebLauncher.LOGGER.info("STOP the REST server:");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process() throws InterruptedException {
|
public void process() throws InterruptedException {
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
// Configure resources
|
// Configure resources
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
final ResourceConfig rc = new ResourceConfig();
|
final ResourceConfig rc = new ResourceConfig();
|
||||||
|
|
||||||
// add multipart models ..
|
// add multipart models ..
|
||||||
rc.register(MultiPartFeature.class);
|
rc.register(MultiPartFeature.class);
|
||||||
// global authentication system
|
// global authentication system
|
||||||
@ -98,15 +98,15 @@ public class WebLauncher {
|
|||||||
rc.register(PlaylistResource.class);
|
rc.register(PlaylistResource.class);
|
||||||
rc.register(TrackResource.class);
|
rc.register(TrackResource.class);
|
||||||
rc.register(DataResource.class);
|
rc.register(DataResource.class);
|
||||||
|
|
||||||
rc.register(HealthCheck.class);
|
rc.register(HealthCheck.class);
|
||||||
rc.register(Front.class);
|
rc.register(Front.class);
|
||||||
|
|
||||||
// add jackson to be discover when we are ins standalone server
|
// add jackson to be discover when we are ins standalone server
|
||||||
rc.register(JacksonFeature.class);
|
rc.register(JacksonFeature.class);
|
||||||
// enable this to show low level request
|
// enable this to show low level request
|
||||||
//rc.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, Level.WARNING.getName());
|
//rc.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, Level.WARNING.getName());
|
||||||
|
|
||||||
//System.out.println("Connect on the BDD:");
|
//System.out.println("Connect on the BDD:");
|
||||||
//System.out.println(" getDBHost: '" + ConfigVariable.getDBHost() + "'");
|
//System.out.println(" getDBHost: '" + ConfigVariable.getDBHost() + "'");
|
||||||
//System.out.println(" getDBPort: '" + ConfigVariable.getDBPort() + "'");
|
//System.out.println(" getDBPort: '" + ConfigVariable.getDBPort() + "'");
|
||||||
@ -124,13 +124,13 @@ public class WebLauncher {
|
|||||||
serverLink.shutdownNow();
|
serverLink.shutdownNow();
|
||||||
}
|
}
|
||||||
}, "shutdownHook"));
|
}, "shutdownHook"));
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
// start periodic update of the token ...
|
// start periodic update of the token ...
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
this.keyUpdater = new UpdateJwtPublicKey();
|
this.keyUpdater = new UpdateJwtPublicKey();
|
||||||
this.keyUpdater.start();
|
this.keyUpdater.start();
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
// run JERSEY
|
// run JERSEY
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
@ -142,14 +142,14 @@ public class WebLauncher {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
if (this.server != null) {
|
if (this.server != null) {
|
||||||
this.server.shutdownNow();
|
this.server.shutdownNow();
|
||||||
this.server = null;
|
this.server = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopOther() {
|
public void stopOther() {
|
||||||
this.keyUpdater.kill();
|
this.keyUpdater.kill();
|
||||||
try {
|
try {
|
||||||
|
@ -17,8 +17,13 @@ public class Initialization extends MigrationSqlStep {
|
|||||||
public String getName() {
|
public String getName() {
|
||||||
return "Initialization";
|
return "Initialization";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Initialization() throws Exception {
|
public Initialization() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateStep() throws Exception {
|
||||||
addClass(Album.class);
|
addClass(Album.class);
|
||||||
addClass(Artist.class);
|
addClass(Artist.class);
|
||||||
addClass(Data.class);
|
addClass(Data.class);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user