public class SpincastConfigPropsFileBased extends SpincastConfig implements ISpincastConfig, IFreeKeyConfig
| Modifier and Type | Field and Description |
|---|---|
static String |
APP_PROPERTIES_KEY_ENVIRONMENT_IS_DEBUG |
static String |
APP_PROPERTIES_KEY_ENVIRONMENT_NAME |
static String |
APP_PROPERTIES_KEY_HTTP_SERVER_PORT |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_KEYPASS |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_PATH |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_STOREPASS |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_TYPE |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_PORT |
static String |
APP_PROPERTIES_KEY_SERVER_HOST |
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
SpincastConfigPropsFileBased(ISpincastUtils spincastUtils,
String[] mainArgs,
ISpincastConfigPropsFileBasedConfig pluginConfig)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected Properties |
getAppProperties()
Here is the algorithm used to find the configuration file :
1) If getSpecificAppPropertiesFilePath() is not
null,
we use it as the path. |
String |
getConfig(String key)
Gets a String configuration and throws an exception if the
specified key is not found.
|
protected Object |
getConfig(String key,
Object defaultValue,
boolean useDefaultValue)
Gets a configuration.
|
String |
getConfig(String key,
String defaultValue)
Gets a String configuration and uses the specified default value if the
key is not found.
|
Boolean |
getConfigBoolean(String key)
Gets a boolean configuration and throws an exception if the
specified key is not found.
|
Boolean |
getConfigBoolean(String key,
Boolean defaultValue)
Gets a boolean configuration and uses the specified default value if the
key is not found.
|
Integer |
getConfigInteger(String key)
Gets a integer configuration and throws an exception if the
specified key is not found.
|
Integer |
getConfigInteger(String key,
Integer defaultValue)
Gets a integer configuration and uses the specified default value if the
key is not found.
|
protected String |
getConfigKeyEnvironmentIsDebug() |
protected String |
getConfigKeyEnvironmentName() |
protected String |
getConfigKeyHttpServerPort() |
protected String |
getConfigKeyHttpsServerKeystoreKeyPass() |
protected String |
getConfigKeyHttpsServerKeystorePath() |
protected String |
getConfigKeyHttpsServerKeystoreStorePass() |
protected String |
getConfigKeyHttpsServerKeystoreType() |
protected String |
getConfigKeyHttpsServerPort() |
protected String |
getConfigKeyServerHost() |
String |
getEnvironmentName()
Returns the name of the environment.
|
protected String |
getFoundPropertiesFilePath()
The path to the acutally found .properties file.
|
int |
getHttpServerPort()
The HTTP (unsecure) port on which the server will listen on.
|
String |
getHttpsKeyStoreKeypass()
The "keypass" of the
KeyStore, for SSL. |
String |
getHttpsKeyStorePath()
The path to the
KeyStore, for SSL. |
String |
getHttpsKeyStoreStorePass()
The "storepass" of the
KeyStore, for SSL. |
String |
getHttpsKeyStoreType()
The type of the
KeyStore, for SSL. |
int |
getHttpsServerPort()
The HTTPS (secure) port on which the server will listen on.
|
protected String[] |
getMainArgs() |
protected ISpincastConfigPropsFileBasedConfig |
getPluginConfig() |
String |
getServerHost()
The host/IP on which the server will listen to.
|
protected String |
getSpecificAppPropertiesFilePath() |
protected ISpincastUtils |
getSpincastUtils() |
boolean |
isDebugEnabled()
Let this to
true on development environment,
where errors can be publicly displayed, where cache can
be disabled, etc. |
protected String |
lookForPropsFileSpecificPath()
Look for a specific .properties file.
|
getContentTypesToSkipGziping, getDefaultLocale, getRouteForwardingMaxNumber, getServerMaxRequestBodyBytes, getSpincastWritableDir, isRoutesCaseSensitiveclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetContentTypesToSkipGziping, getDefaultLocale, getRouteForwardingMaxNumber, getServerMaxRequestBodyBytes, getSpincastWritableDir, isRoutesCaseSensitiveprotected final org.slf4j.Logger logger
public static final String APP_PROPERTIES_KEY_ENVIRONMENT_NAME
public static final String APP_PROPERTIES_KEY_ENVIRONMENT_IS_DEBUG
public static final String APP_PROPERTIES_KEY_SERVER_HOST
public static final String APP_PROPERTIES_KEY_HTTP_SERVER_PORT
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_PORT
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_PATH
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_TYPE
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_STOREPASS
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_KEYPASS
@Inject public SpincastConfigPropsFileBased(ISpincastUtils spincastUtils, @Nullable String[] mainArgs, ISpincastConfigPropsFileBasedConfig pluginConfig)
protected ISpincastConfigPropsFileBasedConfig getPluginConfig()
protected ISpincastUtils getSpincastUtils()
protected String[] getMainArgs()
protected String getSpecificAppPropertiesFilePath()
protected String lookForPropsFileSpecificPath()
protected String getFoundPropertiesFilePath()
null if
none was found.protected String getConfigKeyEnvironmentName()
protected String getConfigKeyEnvironmentIsDebug()
protected String getConfigKeyServerHost()
protected String getConfigKeyHttpServerPort()
protected String getConfigKeyHttpsServerPort()
protected String getConfigKeyHttpsServerKeystorePath()
protected String getConfigKeyHttpsServerKeystoreType()
protected String getConfigKeyHttpsServerKeystoreStorePass()
protected String getConfigKeyHttpsServerKeystoreKeyPass()
protected Properties getAppProperties()
null,
we use it as the path.
2) Otherwise, we try to find the configuration file next to the ".jar"
itself.
3) It we didn't found the configuration file next to the ".jar" file,
or if there is no .jar file (the code is running from an IDE, for example),
then we fallback to the default configurations which are defined in the
SpincastConfig base class.public String getConfig(String key)
getConfig in interface IFreeKeyConfigpublic String getConfig(String key, String defaultValue)
getConfig in interface IFreeKeyConfigpublic Boolean getConfigBoolean(String key)
getConfigBoolean in interface IFreeKeyConfigpublic Boolean getConfigBoolean(String key, Boolean defaultValue)
getConfigBoolean in interface IFreeKeyConfigpublic Integer getConfigInteger(String key)
getConfigInteger in interface IFreeKeyConfigpublic Integer getConfigInteger(String key, Integer defaultValue)
getConfigInteger in interface IFreeKeyConfigprotected Object getConfig(String key, Object defaultValue, boolean useDefaultValue)
public String getEnvironmentName()
ISpincastConfiglocal.getEnvironmentName in interface ISpincastConfiggetEnvironmentName in class SpincastConfigpublic boolean isDebugEnabled()
ISpincastConfigtrue on development environment,
where errors can be publicly displayed, where cache can
be disabled, etc. In production set it to false
The default value is true.isDebugEnabled in interface ISpincastConfigisDebugEnabled in class SpincastConfigtrue if debug mode is enabled.public String getServerHost()
ISpincastConfig0.0.0.0.getServerHost in interface ISpincastConfiggetServerHost in class SpincastConfigpublic int getHttpServerPort()
ISpincastConfig44419 so HTTP
is enabled by default.getHttpServerPort in interface ISpincastConfiggetHttpServerPort in class SpincastConfigpublic int getHttpsServerPort()
ISpincastConfig-1 so HTTPS
is not enabled by default.getHttpsServerPort in interface ISpincastConfiggetHttpsServerPort in class SpincastConfigpublic String getHttpsKeyStorePath()
ISpincastConfigKeyStore, for SSL. Can be a
classpath path or and absolute path.
The classpath will be checked first.
Only used if getHttpsServerPort() returns a port > 0.
The default value is null.getHttpsKeyStorePath in interface ISpincastConfiggetHttpsKeyStorePath in class SpincastConfigKeyStorepublic String getHttpsKeyStoreType()
ISpincastConfigKeyStore, for SSL.
For example: "JKS".
Only used if getHttpsServerPort() returns a port > 0.
The default value is null.getHttpsKeyStoreType in interface ISpincastConfiggetHttpsKeyStoreType in class SpincastConfigKeyStorepublic String getHttpsKeyStoreStorePass()
ISpincastConfigKeyStore, for SSL.
Only used if getHttpsServerPort() returns a port > 0.
The default value is null.getHttpsKeyStoreStorePass in interface ISpincastConfiggetHttpsKeyStoreStorePass in class SpincastConfigKeyStorepublic String getHttpsKeyStoreKeypass()
ISpincastConfigKeyStore, for SSL.
Only used if getHttpsServerPort() returns a port > 0.
The default value is null.getHttpsKeyStoreKeypass in interface ISpincastConfiggetHttpsKeyStoreKeypass in class SpincastConfigKeyStoreCopyright © 2016. All rights reserved.