Package org.summerboot.jexpress.boot
Class SummerApplication
java.lang.Object
org.summerboot.jexpress.boot.cli.BootCLI
org.summerboot.jexpress.boot.SummerApplication
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidbeforeStart(org.apache.commons.cli.CommandLine cli) callback before NIO bindingstatic SummerApplication<T extends SummerApplication>
Tbind_AlertMessenger(Class<? extends PostOffice> postOfficeClass) To override the default email sender instance with the app<T extends SummerApplication>
Tbind_BootConfig(String configFileName, JExpressConfig config) To bind a configuration file implemented by a JExpressConfig instance, which will be loaded and managed by SummerBoot Application<T extends SummerApplication>
Tbind_BootConfig(String configFileName, JExpressConfig config, String mockName, boolean registerWhenMockIsEnabled) To bind a configuration file implemented by a JExpressConfig instance, which will be loaded and managed by SummerBoot Application<T extends SummerApplication>
Tbind_GuiceModule(com.google.inject.AbstractModule appModule) To bind Google Guice IoC container with the app<T extends SummerApplication>
Tbind_NIOHandler(Class<? extends io.netty.channel.ChannelHandler> channelHandlerClass) <T extends SummerApplication>
Tbind_NIOHandler(Class<? extends io.netty.channel.ChannelHandler> channelHandlerClass, String channelHandlerBindingName) To bind a unique named NIO Request Handler with the appstatic com.google.inject.ModulebuildModule(com.google.inject.AbstractModule appModule, Class callerClass) For Unit Testing only<T extends SummerApplication>
Tenable_CLI_ListErrorCodes(Class errorCodeClass, boolean checkDuplicated) To enable -errorcode CLI to list all error codes<T extends SummerApplication>
Tenable_CLI_ListPOIs(Class poiNameClass, boolean checkDuplicated) To enable -poi CLI to list all POI names<T extends SummerApplication>
Tenable_CLI_MockMode(Class<? extends Enum<?>> enumClass) To enable mock mode<T extends SummerApplication>
Tenable_CLI_MockMode(String... mockItemNames) To enable mock mode<T extends SummerApplication>
Tenable_CLI_ViewConfig(Class... cs) To enable viewing config setting using CLI<T extends SummerApplication>
Tenable_Ping_HealthCheck(String contextRoot, String pingPath) To enable load balancer health check on the provided path via HTTP GET request<T extends SummerApplication>
Tenable_Ping_HealthCheck(String contextRoot, String pingPath, Class<? extends HealthInspector> healthInspectorClass) Override load balancer health check path and inspectorprotected Classstatic Stringcom.google.inject.Injectorprotected voidinitCLIs_App(org.apache.commons.cli.Options options) callback to init customized CLIsprotected booleanstatic booleanisMockMode(String mockItemName) Check if a given name is provided in command line -mock optionprotected voidlocadCustomizedConfigs(Path configFolder) callback to initialize based on customized config files in configDirprotected voidprocessCLIs_App(org.apache.commons.cli.CommandLine cli) callback to process customized CLIsvoidTo run the SummerBoot ApplicationvoidMethods inherited from class org.summerboot.jexpress.boot.cli.BootCLI
initCLIs_BootDefault, processCLIs_BootDefault
-
Field Details
-
log
protected static org.apache.logging.log4j.Logger log
-
-
Constructor Details
-
SummerApplication
protected SummerApplication()
-
-
Method Details
-
bind
-
buildModule
public static com.google.inject.Module buildModule(com.google.inject.AbstractModule appModule, Class callerClass) For Unit Testing only- Parameters:
appModule- application Google Inject Guice modulecallerClass- the main class- Returns:
- combined (app and framework) Google Inject Guice module
-
isMockMode
Check if a given name is provided in command line -mock option- Parameters:
mockItemName-- Returns:
- true if mockItemName is available in command line args
-mock <mockItemName1, mockItemName2, ...>
-
getAppMockOptions
-
getCallerRootPackageName
-
getCfgDefaultRB
-
getEnvName
-
getCfgConfigDir
-
getCfgEnvFolderPrefix
-
getIocInjector
public com.google.inject.Injector getIocInjector() -
bind_AlertMessenger
public <T extends SummerApplication> T bind_AlertMessenger(Class<? extends PostOffice> postOfficeClass) To override the default email sender instance with the app- Type Parameters:
T-- Parameters:
postOfficeClass-- Returns:
-
bind_GuiceModule
To bind Google Guice IoC container with the app- Type Parameters:
T-- Parameters:
appModule-- Returns:
-
bind_NIOHandler
public <T extends SummerApplication> T bind_NIOHandler(Class<? extends io.netty.channel.ChannelHandler> channelHandlerClass) -
bind_NIOHandler
public <T extends SummerApplication> T bind_NIOHandler(Class<? extends io.netty.channel.ChannelHandler> channelHandlerClass, String channelHandlerBindingName) To bind a unique named NIO Request Handler with the app- Type Parameters:
T-- Parameters:
channelHandlerClass-channelHandlerBindingName-- Returns:
-
bind_BootConfig
public <T extends SummerApplication> T bind_BootConfig(String configFileName, JExpressConfig config) To bind a configuration file implemented by a JExpressConfig instance, which will be loaded and managed by SummerBoot Application- Type Parameters:
T-- Parameters:
configFileName- file name only, without file pathconfig- the JExpressConfig instance- Returns:
-
bind_BootConfig
public <T extends SummerApplication> T bind_BootConfig(String configFileName, JExpressConfig config, String mockName, boolean registerWhenMockIsEnabled) To bind a configuration file implemented by a JExpressConfig instance, which will be loaded and managed by SummerBoot Application- Type Parameters:
T-- Parameters:
configFileName-config-mockName-registerWhenMockIsEnabled-- Returns:
-
enable_CLI_ListErrorCodes
public <T extends SummerApplication> T enable_CLI_ListErrorCodes(Class errorCodeClass, boolean checkDuplicated) throws IllegalArgumentException, IllegalAccessException, com.fasterxml.jackson.core.JsonProcessingException To enable -errorcode CLI to list all error codes- Type Parameters:
T-- Parameters:
errorCodeClass-checkDuplicated- check duplicated if true- Returns:
- Throws:
IllegalArgumentExceptionIllegalAccessExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
enable_CLI_ListPOIs
public <T extends SummerApplication> T enable_CLI_ListPOIs(Class poiNameClass, boolean checkDuplicated) throws IllegalArgumentException, IllegalAccessException, com.fasterxml.jackson.core.JsonProcessingException To enable -poi CLI to list all POI names- Type Parameters:
T-- Parameters:
poiNameClass-checkDuplicated- check duplicated if true- Returns:
- Throws:
IllegalArgumentExceptionIllegalAccessExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
enable_CLI_MockMode
To enable mock mode- Type Parameters:
T-- Parameters:
enumClass- the enum contains mock items- Returns:
-
enable_CLI_MockMode
To enable mock mode- Type Parameters:
T-- Parameters:
mockItemNames- the mock item names- Returns:
-
enable_CLI_ViewConfig
To enable viewing config setting using CLI- Type Parameters:
T-- Parameters:
cs-- Returns:
-
enable_Ping_HealthCheck
To enable load balancer health check on the provided path via HTTP GET request- Type Parameters:
T-- Parameters:
contextRoot- the contect root like "myroot/myservice"pingPath- the ping command like "/ping", the the load balancer will do the health check vis GET /myroot/myservice/ping- Returns:
-
enable_Ping_HealthCheck
public <T extends SummerApplication> T enable_Ping_HealthCheck(String contextRoot, String pingPath, Class<? extends HealthInspector> healthInspectorClass) Override load balancer health check path and inspector- Type Parameters:
T-- Parameters:
contextRoot-pingPath-healthInspectorClass-- Returns:
-
run
To run the SummerBoot Application- Parameters:
args-version-- Throws:
Exception
-
run
- Parameters:
args-version-startNIO-- Throws:
Exception
-
initCLIs_App
protected void initCLIs_App(org.apache.commons.cli.Options options) callback to init customized CLIs- Parameters:
options-
-
processCLIs_App
protected void processCLIs_App(org.apache.commons.cli.CommandLine cli) callback to process customized CLIs- Parameters:
cli-
-
getAddtionalI18n
- Returns:
- i18n class
-
locadCustomizedConfigs
callback to initialize based on customized config files in configDir- Parameters:
configFolder-- Throws:
Exception
-
beforeStart
callback before NIO binding- Parameters:
cli-- Throws:
Exception
-
isJMXRequired
protected boolean isJMXRequired()
-