diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7a7781a5c..420a8b933 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -9,7 +9,7 @@ You need for `ezyfox` to your Github
- must include unit test and coverage 100%
- should have 6 files or less
- don't change old code style if it has no problem
-
+
### 3. resolve review comment if we have any
Please don't use force push after push resolved comments code
diff --git a/assembly.xml b/assembly.xml
index 1a84be639..69e0178eb 100644
--- a/assembly.xml
+++ b/assembly.xml
@@ -1,16 +1,16 @@
- bin
- false
-
- dir
-
+ bin
+ false
+
+ dir
+
-
-
- true
- lib
-
-
+
+
+ true
+ lib
+
+
-
\ No newline at end of file
+
diff --git a/ezyfox-server-boot/assembly.xml b/ezyfox-server-boot/assembly.xml
index 1a84be639..69e0178eb 100644
--- a/ezyfox-server-boot/assembly.xml
+++ b/ezyfox-server-boot/assembly.xml
@@ -1,16 +1,16 @@
- bin
- false
-
- dir
-
+ bin
+ false
+
+ dir
+
-
-
- true
- lib
-
-
+
+
+ true
+ lib
+
+
-
\ No newline at end of file
+
diff --git a/ezyfox-server-boot/pom.xml b/ezyfox-server-boot/pom.xml
index 86a16b1f4..2a0d2e2dc 100644
--- a/ezyfox-server-boot/pom.xml
+++ b/ezyfox-server-boot/pom.xml
@@ -1,22 +1,22 @@
- 4.0.0
-
- com.tvd12
- ezyfox-server
- 1.2.3
-
- ezyfox-server-boot
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+
+ com.tvd12
+ ezyfox-server
+ 1.2.3
+
+ ezyfox-server-boot
+
+ ezyfox-server-boot
+ https://youngmonkeys.org/project/ezyfox-sever/
+
+
+
+ com.tvd12
+ ezyfox-server-core
+ ${project.version}
+
+
- ezyfox-server-boot
- https://youngmonkeys.org/project/ezyfox-sever/
-
-
-
- com.tvd12
- ezyfox-server-core
- ${project.version}
-
-
-
diff --git a/ezyfox-server-boot/src/main/java/com/tvd12/ezyfoxserver/EzyEmptyHttpBootstrap.java b/ezyfox-server-boot/src/main/java/com/tvd12/ezyfoxserver/EzyEmptyHttpBootstrap.java
index aa4b82ae6..af9686187 100644
--- a/ezyfox-server-boot/src/main/java/com/tvd12/ezyfoxserver/EzyEmptyHttpBootstrap.java
+++ b/ezyfox-server-boot/src/main/java/com/tvd12/ezyfoxserver/EzyEmptyHttpBootstrap.java
@@ -6,13 +6,13 @@
public class EzyEmptyHttpBootstrap implements EzyHttpBootstrap {
- @Setter
- protected EzyServerContext serverContext;
-
- @Override
- public void start() throws Exception {}
+ @Setter
+ protected EzyServerContext serverContext;
- @Override
- public void destroy() {}
+ @Override
+ public void start() throws Exception {}
+
+ @Override
+ public void destroy() {}
}
diff --git a/ezyfox-server-boot/src/main/java/com/tvd12/ezyfoxserver/EzyHttpServerBootstrap.java b/ezyfox-server-boot/src/main/java/com/tvd12/ezyfoxserver/EzyHttpServerBootstrap.java
index cecf4f7f7..af9575f91 100644
--- a/ezyfox-server-boot/src/main/java/com/tvd12/ezyfoxserver/EzyHttpServerBootstrap.java
+++ b/ezyfox-server-boot/src/main/java/com/tvd12/ezyfoxserver/EzyHttpServerBootstrap.java
@@ -6,29 +6,29 @@
public abstract class EzyHttpServerBootstrap extends EzyServerBootstrap {
- private EzyHttpBootstrap httpBootstrap;
-
- protected void startHttpBootstrap() throws Exception {
- EzyHttpSetting setting = getHttpSetting();
- if(!setting.isActive()) return;
- logger.debug("starting http server bootstrap ....");
- httpBootstrap = newHttpBottstrap();
- httpBootstrap.start();
- logger.debug("http server bootstrap has started");
- }
-
- private EzyHttpBootstrap newHttpBottstrap() {
- EzyEmptyHttpBootstrap bootstrap = new EzyEmptyHttpBootstrap();
- bootstrap.setServerContext(context);
- return bootstrap;
- }
-
- @Override
- public void destroy() {
- super.destroy();
- if(httpBootstrap != null)
- processWithLogException(() -> httpBootstrap.destroy());
- this.httpBootstrap = null;
- }
-
+ private EzyHttpBootstrap httpBootstrap;
+
+ protected void startHttpBootstrap() throws Exception {
+ EzyHttpSetting setting = getHttpSetting();
+ if(!setting.isActive()) return;
+ logger.debug("starting http server bootstrap ....");
+ httpBootstrap = newHttpBottstrap();
+ httpBootstrap.start();
+ logger.debug("http server bootstrap has started");
+ }
+
+ private EzyHttpBootstrap newHttpBottstrap() {
+ EzyEmptyHttpBootstrap bootstrap = new EzyEmptyHttpBootstrap();
+ bootstrap.setServerContext(context);
+ return bootstrap;
+ }
+
+ @Override
+ public void destroy() {
+ super.destroy();
+ if(httpBootstrap != null)
+ processWithLogException(() -> httpBootstrap.destroy());
+ this.httpBootstrap = null;
+ }
+
}
diff --git a/ezyfox-server-boot/src/test/java/com/tvd12/ezyfoxserver/testing/EzyHttpServerBootstrapBuilderTest.java b/ezyfox-server-boot/src/test/java/com/tvd12/ezyfoxserver/testing/EzyHttpServerBootstrapBuilderTest.java
index 97701eabe..d3d9320b8 100644
--- a/ezyfox-server-boot/src/test/java/com/tvd12/ezyfoxserver/testing/EzyHttpServerBootstrapBuilderTest.java
+++ b/ezyfox-server-boot/src/test/java/com/tvd12/ezyfoxserver/testing/EzyHttpServerBootstrapBuilderTest.java
@@ -8,17 +8,17 @@
public class EzyHttpServerBootstrapBuilderTest extends BaseTest {
- @Test
- public void test() {
- new ExEzyHttpServerBootstrapBuilder();
- }
-
- public static class ExEzyHttpServerBootstrapBuilder extends EzyHttpServerBootstrapBuilder {
+ @Test
+ public void test() {
+ new ExEzyHttpServerBootstrapBuilder();
+ }
+
+ public static class ExEzyHttpServerBootstrapBuilder extends EzyHttpServerBootstrapBuilder {
- @Override
- protected EzyServerBootstrap newServerBootstrap() {
- return null;
- }
-
- }
+ @Override
+ protected EzyServerBootstrap newServerBootstrap() {
+ return null;
+ }
+
+ }
}
diff --git a/ezyfox-server-boot/src/test/java/com/tvd12/ezyfoxserver/testing/EzyHttpServerBootstrapTest.java b/ezyfox-server-boot/src/test/java/com/tvd12/ezyfoxserver/testing/EzyHttpServerBootstrapTest.java
index 1776be848..9d147b2cc 100644
--- a/ezyfox-server-boot/src/test/java/com/tvd12/ezyfoxserver/testing/EzyHttpServerBootstrapTest.java
+++ b/ezyfox-server-boot/src/test/java/com/tvd12/ezyfoxserver/testing/EzyHttpServerBootstrapTest.java
@@ -14,37 +14,37 @@
public class EzyHttpServerBootstrapTest extends BaseTest {
- @Test
- public void test() {
- EzyServerContext serverContext = mock(EzyServerContext.class);
- EzySimpleSettings settings = new EzySimpleSettings();
- EzySimpleServer server = new EzySimpleServer();
- server.setSettings(settings);
- when(serverContext.getServer()).thenReturn(server);
- EzyEmptyHttpBootstrap httpBootstrap = new EzyEmptyHttpBootstrap();
- httpBootstrap.setServerContext(serverContext);
- ExEzyHttpServerBootstrap bootstrap = new ExEzyHttpServerBootstrap();
- bootstrap.setContext(serverContext);
- MethodInvoker.create()
- .object(bootstrap)
- .method("startHttpBootstrap")
- .invoke();
-
- settings.getHttp().setActive(true);
- MethodInvoker.create()
- .object(bootstrap)
- .method("startHttpBootstrap")
- .invoke();
- bootstrap.destroy();
- bootstrap.destroy();
- }
-
- public static class ExEzyHttpServerBootstrap extends EzyHttpServerBootstrap {
+ @Test
+ public void test() {
+ EzyServerContext serverContext = mock(EzyServerContext.class);
+ EzySimpleSettings settings = new EzySimpleSettings();
+ EzySimpleServer server = new EzySimpleServer();
+ server.setSettings(settings);
+ when(serverContext.getServer()).thenReturn(server);
+ EzyEmptyHttpBootstrap httpBootstrap = new EzyEmptyHttpBootstrap();
+ httpBootstrap.setServerContext(serverContext);
+ ExEzyHttpServerBootstrap bootstrap = new ExEzyHttpServerBootstrap();
+ bootstrap.setContext(serverContext);
+ MethodInvoker.create()
+ .object(bootstrap)
+ .method("startHttpBootstrap")
+ .invoke();
+
+ settings.getHttp().setActive(true);
+ MethodInvoker.create()
+ .object(bootstrap)
+ .method("startHttpBootstrap")
+ .invoke();
+ bootstrap.destroy();
+ bootstrap.destroy();
+ }
+
+ public static class ExEzyHttpServerBootstrap extends EzyHttpServerBootstrap {
- @Override
- protected void startOtherBootstraps(Runnable callback) throws Exception {
- }
-
- }
-
+ @Override
+ protected void startOtherBootstraps(Runnable callback) throws Exception {
+ }
+
+ }
+
}
diff --git a/ezyfox-server-boot/src/test/resources/AllTests.tng.xml b/ezyfox-server-boot/src/test/resources/AllTests.tng.xml
index 3f571ed5b..cc4f77dda 100644
--- a/ezyfox-server-boot/src/test/resources/AllTests.tng.xml
+++ b/ezyfox-server-boot/src/test/resources/AllTests.tng.xml
@@ -1,9 +1,9 @@
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
diff --git a/ezyfox-server-core/assembly.xml b/ezyfox-server-core/assembly.xml
index 1a84be639..69e0178eb 100644
--- a/ezyfox-server-core/assembly.xml
+++ b/ezyfox-server-core/assembly.xml
@@ -1,16 +1,16 @@
- bin
- false
-
- dir
-
+ bin
+ false
+
+ dir
+
-
-
- true
- lib
-
-
+
+
+ true
+ lib
+
+
-
\ No newline at end of file
+
diff --git a/ezyfox-server-core/pom.xml b/ezyfox-server-core/pom.xml
index 6ffd74010..749bfa911 100644
--- a/ezyfox-server-core/pom.xml
+++ b/ezyfox-server-core/pom.xml
@@ -1,48 +1,48 @@
- 4.0.0
-
- com.tvd12
- ezyfox-server
- 1.2.3
-
- ezyfox-server-core
- ezyfox-server-core
- https://youngmonkeys.org/project/ezyfox-sever/
-
-
-
- com.tvd12
- ezyfox-codec
- ${project.version}
-
-
- com.tvd12
- ezyfox-mapping
- ${project.version}
-
-
- com.tvd12
- ezyfox-tools
- ${project.version}
- test
-
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ 4.0.0
+
+ com.tvd12
+ ezyfox-server
+ 1.2.3
+
+ ezyfox-server-core
+ ezyfox-server-core
+ https://youngmonkeys.org/project/ezyfox-sever/
-
-
-
- src/main/resources
-
- ezy-settings-1.0.0.xsd
- ezy-settings.xml
- ezy-zone-settings-1.0.0.xsd
- ezy-zone-settings.xml
-
-
-
-
+
+
+ com.tvd12
+ ezyfox-codec
+ ${project.version}
+
+
+ com.tvd12
+ ezyfox-mapping
+ ${project.version}
+
+
+ com.tvd12
+ ezyfox-tools
+ ${project.version}
+ test
+
+
+
+
+
+
+ src/main/resources
+
+ ezy-settings-1.0.0.xsd
+ ezy-settings.xml
+ ezy-zone-settings-1.0.0.xsd
+ ezy-zone-settings.xml
+
+
+
+
diff --git a/ezyfox-server-core/settings/logback.xml b/ezyfox-server-core/settings/logback.xml
index 9ac216fee..a1a5e2c5f 100644
--- a/ezyfox-server-core/settings/logback.xml
+++ b/ezyfox-server-core/settings/logback.xml
@@ -28,4 +28,4 @@
-
\ No newline at end of file
+
diff --git a/ezyfox-server-core/settings/ssl-config.properties b/ezyfox-server-core/settings/ssl-config.properties
index 914e17bfe..bb2fc449b 100644
--- a/ezyfox-server-core/settings/ssl-config.properties
+++ b/ezyfox-server-core/settings/ssl-config.properties
@@ -1,3 +1,3 @@
ssl.key_store="ssl/ssl-key-store.txt"
ssl.keystore_password=ssl/ssl-keystore-password.txt
-ssl.certificate_password=ssl/ssl-certificate-password.txt
\ No newline at end of file
+ssl.certificate_password=ssl/ssl-certificate-password.txt
diff --git a/ezyfox-server-core/settings/ssl/ssl-certificate-password.txt b/ezyfox-server-core/settings/ssl/ssl-certificate-password.txt
index 536aca34d..d97c5eada 100644
--- a/ezyfox-server-core/settings/ssl/ssl-certificate-password.txt
+++ b/ezyfox-server-core/settings/ssl/ssl-certificate-password.txt
@@ -1 +1 @@
-secret
\ No newline at end of file
+secret
diff --git a/ezyfox-server-core/settings/ssl/ssl-key-store.txt b/ezyfox-server-core/settings/ssl/ssl-key-store.txt
index 439ef0da4..27c1b25b2 100644
Binary files a/ezyfox-server-core/settings/ssl/ssl-key-store.txt and b/ezyfox-server-core/settings/ssl/ssl-key-store.txt differ
diff --git a/ezyfox-server-core/settings/ssl/ssl-keystore-password.txt b/ezyfox-server-core/settings/ssl/ssl-keystore-password.txt
index 536aca34d..d97c5eada 100644
--- a/ezyfox-server-core/settings/ssl/ssl-keystore-password.txt
+++ b/ezyfox-server-core/settings/ssl/ssl-keystore-password.txt
@@ -1 +1 @@
-secret
\ No newline at end of file
+secret
diff --git a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyBootstrap.java b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyBootstrap.java
index 5c98a0586..293913d04 100644
--- a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyBootstrap.java
+++ b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyBootstrap.java
@@ -14,29 +14,29 @@ public class EzyBootstrap
extends EzyLoggable
implements EzyStartable, EzyDestroyable {
- protected final EzyServerContext context;
+ protected final EzyServerContext context;
- protected EzyBootstrap(Builder builder) {
- this.context = builder.context;
+ protected EzyBootstrap(Builder builder) {
+ this.context = builder.context;
}
-
- @Override
- public void start() throws Exception {
- notifyServerInitializing();
- startAllZones();
- startSessionManager();
- }
-
- protected void notifyServerInitializing() {
- EzyServerInitializingEvent event = new EzySimpleServerInitializingEvent();
- context.handleEvent(EzyEventType.SERVER_INITIALIZING, event);
- }
-
+
+ @Override
+ public void start() throws Exception {
+ notifyServerInitializing();
+ startAllZones();
+ startSessionManager();
+ }
+
+ protected void notifyServerInitializing() {
+ EzyServerInitializingEvent event = new EzySimpleServerInitializingEvent();
+ context.handleEvent(EzyEventType.SERVER_INITIALIZING, event);
+ }
+
@Override
- public void destroy() {
- // do nothing
- }
-
+ public void destroy() {
+ // do nothing
+ }
+
private void startAllZones() {
EzyZonesStarter.Builder builder = newZonesStarterBuilder()
.serverContext(context);
@@ -47,29 +47,29 @@ private void startAllZones() {
protected EzyZonesStarter.Builder newZonesStarterBuilder() {
return new EzyZonesStarter.Builder();
}
-
- @SuppressWarnings("rawtypes")
+
+ @SuppressWarnings("rawtypes")
protected void startSessionManager() throws Exception {
- EzySessionManager sessionManager
- = context.getServer().getSessionManager();
- ((EzyStartable)sessionManager).start();
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder implements EzyBuilder {
- protected EzyServerContext context;
-
- public Builder context(EzyServerContext context) {
- this.context = context;
- return this;
- }
-
- @Override
- public EzyBootstrap build() {
- return new EzyBootstrap(this);
- }
- }
+ EzySessionManager sessionManager
+ = context.getServer().getSessionManager();
+ ((EzyStartable)sessionManager).start();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder implements EzyBuilder {
+ protected EzyServerContext context;
+
+ public Builder context(EzyServerContext context) {
+ this.context = context;
+ return this;
+ }
+
+ @Override
+ public EzyBootstrap build() {
+ return new EzyBootstrap(this);
+ }
+ }
}
diff --git a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyComponent.java b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyComponent.java
index 5caba1271..7b3e094fa 100644
--- a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyComponent.java
+++ b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyComponent.java
@@ -22,7 +22,7 @@ public class EzyComponent implements EzyExceptionHandlersFetcher, EzyDestroyable
@Override
public void destroy() {
- if(eventControllers != null)
+ if(eventControllers != null)
processWithLogException(() -> eventControllers.destroy());
this.eventControllers = null;
}
diff --git a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyEnvironment.java b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyEnvironment.java
index d0b9b7290..75887fb29 100644
--- a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyEnvironment.java
+++ b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyEnvironment.java
@@ -4,6 +4,6 @@
public class EzyEnvironment extends EzyEntity {
- public static final String SERVER_PORT = "ezyfox.server.port";
- public static final String DATE_FORMAT_PATTERN = "DATE_FORMAT_PATTERN";
+ public static final String SERVER_PORT = "ezyfox.server.port";
+ public static final String DATE_FORMAT_PATTERN = "DATE_FORMAT_PATTERN";
}
diff --git a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyLoader.java b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyLoader.java
index 6647d040a..32ee464a8 100644
--- a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyLoader.java
+++ b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyLoader.java
@@ -42,16 +42,16 @@ public abstract class EzyLoader extends EzyLoggable {
public EzyServer load() {
EzySettings settings = readSettings();
- EzySimpleServer answer = new EzySimpleServer();
- answer.setConfig(config);
- answer.setSettings(settings);
- answer.setClassLoader(classLoader);
- answer.setAppClassLoaders(newAppClassLoaders());
- answer.setStatistics(newStatistics());
- answer.setControllers(newControllers());
- answer.setSessionManager(newSessionManagers(settings));
- answer.setEventControllers(newEventControllers(settings.getEventControllers()));
- return answer;
+ EzySimpleServer answer = new EzySimpleServer();
+ answer.setConfig(config);
+ answer.setSettings(settings);
+ answer.setClassLoader(classLoader);
+ answer.setAppClassLoaders(newAppClassLoaders());
+ answer.setStatistics(newStatistics());
+ answer.setControllers(newControllers());
+ answer.setSessionManager(newSessionManagers(settings));
+ answer.setEventControllers(newEventControllers(settings.getEventControllers()));
+ return answer;
}
protected EzySettings readSettings() {
@@ -129,7 +129,7 @@ protected String getEntriesPath() {
}
protected String getAppsPath() {
- return getPath(getHomePath(), EzyFolderNamesSetting.APPS);
+ return getPath(getHomePath(), EzyFolderNamesSetting.APPS);
}
protected String getPath(String first, String... more) {
@@ -146,8 +146,8 @@ public EzyLoader classLoader(ClassLoader classLoader) {
}
public EzyLoader config(EzyConfig config) {
- this.config = config;
- return this;
+ this.config = config;
+ return this;
}
public EzyLoader settingsDecorator(EzySettingsDecorator settingsDecorator) {
diff --git a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyRunner.java b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyRunner.java
index 723601747..0483c2a70 100644
--- a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyRunner.java
+++ b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyRunner.java
@@ -23,8 +23,8 @@ public void run(String[] args) throws Exception {
}
protected void validateArguments(String[] args) {
- if(args.length == 0)
- throw new IllegalStateException("must specific config.properties file");
+ if(args.length == 0)
+ throw new IllegalStateException("must specific config.properties file");
}
protected void startSystem(String[] args) throws Exception {
diff --git a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyServerBootstrap.java b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyServerBootstrap.java
index b899202a0..3dff76a78 100644
--- a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyServerBootstrap.java
+++ b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzyServerBootstrap.java
@@ -25,88 +25,88 @@
public abstract class EzyServerBootstrap
extends EzyLoggable
implements EzyStartable, EzyDestroyable {
-
- @Setter
- @Getter
- protected EzyServerContext context;
- @Setter
- protected EzyBootstrap localBootstrap;
-
- @Override
- public void start() throws Exception {
- setupServer();
- startLocalBootstrap();
- startHttpBootstrap();
- startOtherBootstraps(() -> this.notifyServerReady());
- }
-
- protected void setupServer() {
- }
-
- protected void startHttpBootstrap() throws Exception {
- }
-
- protected abstract void startOtherBootstraps(Runnable callback) throws Exception;
-
- @Override
- public void destroy() {
- processWithLogException(() -> localBootstrap.destroy());
- }
-
- protected void startLocalBootstrap() throws Exception {
- logger.debug("starting local bootstrap ....");
- localBootstrap.start();
- logger.debug("local bootstrap has started");
- }
-
- protected final void notifyServerReady() {
- printBanner();
- notifyServerReady0();
- }
-
- protected final void printBanner() {
- if(getServerConfig().isPrintBanner()) {
- String bannerFile = getServerConfig().getBannerFile();
- logger.info("\n{}\n", new EzyBannerPrinter().getBannerText(bannerFile));
- }
- }
-
- protected void notifyServerReady0() {
- EzyEvent event = new EzySimpleServerReadyEvent();
+
+ @Setter
+ @Getter
+ protected EzyServerContext context;
+ @Setter
+ protected EzyBootstrap localBootstrap;
+
+ @Override
+ public void start() throws Exception {
+ setupServer();
+ startLocalBootstrap();
+ startHttpBootstrap();
+ startOtherBootstraps(() -> this.notifyServerReady());
+ }
+
+ protected void setupServer() {
+ }
+
+ protected void startHttpBootstrap() throws Exception {
+ }
+
+ protected abstract void startOtherBootstraps(Runnable callback) throws Exception;
+
+ @Override
+ public void destroy() {
+ processWithLogException(() -> localBootstrap.destroy());
+ }
+
+ protected void startLocalBootstrap() throws Exception {
+ logger.debug("starting local bootstrap ....");
+ localBootstrap.start();
+ logger.debug("local bootstrap has started");
+ }
+
+ protected final void notifyServerReady() {
+ printBanner();
+ notifyServerReady0();
+ }
+
+ protected final void printBanner() {
+ if(getServerConfig().isPrintBanner()) {
+ String bannerFile = getServerConfig().getBannerFile();
+ logger.info("\n{}\n", new EzyBannerPrinter().getBannerText(bannerFile));
+ }
+ }
+
+ protected void notifyServerReady0() {
+ EzyEvent event = new EzySimpleServerReadyEvent();
context.handleEvent(EzyEventType.SERVER_READY, event);
context.broadcast(EzyEventType.SERVER_READY, event, true);
- }
-
- protected EzyServer getServer() {
- return context.getServer();
- }
-
- protected EzyConfig getServerConfig() {
- return getServer().getConfig();
- }
-
- protected EzySettings getServerSettings() {
- return getServer().getSettings();
- }
-
- protected EzyHttpSetting getHttpSetting() {
- return getServerSettings().getHttp();
- }
-
- protected EzySocketSetting getSocketSetting() {
+ }
+
+ protected EzyServer getServer() {
+ return context.getServer();
+ }
+
+ protected EzyConfig getServerConfig() {
+ return getServer().getConfig();
+ }
+
+ protected EzySettings getServerSettings() {
+ return getServer().getSettings();
+ }
+
+ protected EzyHttpSetting getHttpSetting() {
+ return getServerSettings().getHttp();
+ }
+
+ protected EzySocketSetting getSocketSetting() {
return getServerSettings().getSocket();
}
-
- protected EzyUdpSetting getUdpSetting() {
+
+ protected EzyUdpSetting getUdpSetting() {
return getServerSettings().getUdp();
}
-
- protected EzyWebSocketSetting getWebSocketSetting() {
+
+ protected EzyWebSocketSetting getWebSocketSetting() {
return getServerSettings().getWebsocket();
}
-
- protected EzyThreadPoolSizeSetting getThreadPoolSizeSetting() {
- return getServerSettings().getThreadPoolSize();
- }
-
+
+ protected EzyThreadPoolSizeSetting getThreadPoolSizeSetting() {
+ return getServerSettings().getThreadPoolSize();
+ }
+
}
diff --git a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzySimpleServer.java b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzySimpleServer.java
index ab7454c5b..da748a5a1 100644
--- a/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzySimpleServer.java
+++ b/ezyfox-server-core/src/main/java/com/tvd12/ezyfoxserver/EzySimpleServer.java
@@ -31,35 +31,35 @@ public class EzySimpleServer
extends EzyComponent
implements EzyServer, EzyResponseApiAware, EzyStreamingApiAware, EzySessionManagerAware, EzyDestroyable {
- protected EzyConfig config;
- protected EzySettings settings;
- protected ClassLoader classLoader;
- protected EzyStatistics statistics;
- protected EzyServerControllers controllers;
+ protected EzyConfig config;
+ protected EzySettings settings;
+ protected ClassLoader classLoader;
+ protected EzyStatistics statistics;
+ protected EzyServerControllers controllers;
protected EzyResponseApi responseApi;
- protected EzyStreamingApi streamingApi;
- protected EzySessionManager sessionManager;
+ protected EzyStreamingApi streamingApi;
+ protected EzySessionManager sessionManager;
protected Map appClassLoaders;
-
- @Override
- public String getVersion() {
- return "1.0.0";
- }
-
- @Override
- public void destroy() {
- super.destroy();
- ((EzyDestroyable)sessionManager).destroy();
- }
-
- @Override
- public String toString() {
- EzyJsonWriter writer = new EzySimpleJsonWriter();
- String json = writer.writeAsString(this);
- return json;
- }
-
- @Override
+
+ @Override
+ public String getVersion() {
+ return "1.0.0";
+ }
+
+ @Override
+ public void destroy() {
+ super.destroy();
+ ((EzyDestroyable)sessionManager).destroy();
+ }
+
+ @Override
+ public String toString() {
+ EzyJsonWriter writer = new EzySimpleJsonWriter();
+ String json = writer.writeAsString(this);
+ return json;
+ }
+
+ @Override
public Map