T
- The concrete standalone implementationpublic abstract class AbstractStandalone<T extends AbstractStandalone> extends Object implements Standalone<T>, Runnable
Modifier and Type | Field and Description |
---|---|
protected List<String> |
baseUrls |
protected boolean |
configured |
protected String |
contextPath |
protected String |
externalConfigurationPath |
protected String |
host |
protected Long |
idleTimeout |
protected org.slf4j.Logger |
logger |
protected String |
name |
protected NinjaMode |
ninjaMode |
protected NinjaPropertiesImpl |
ninjaProperties |
protected OverlayedNinjaProperties |
overlayedNinjaProperties |
protected Integer |
port |
protected List<String> |
serverUrls |
protected String |
sslKeystorePassword |
protected URI |
sslKeystoreUri |
protected Integer |
sslPort |
protected String |
sslTruststorePassword |
protected URI |
sslTruststoreUri |
protected boolean |
started |
DEFAULT_CONTEXT_PATH, DEFAULT_DEV_NINJA_SSL_KEYSTORE_PASSWORD, DEFAULT_DEV_NINJA_SSL_KEYSTORE_URI, DEFAULT_DEV_NINJA_SSL_TRUSTSTORE_PASSWORD, DEFAULT_DEV_NINJA_SSL_TRUSTSTORE_URI, DEFAULT_HOST, DEFAULT_IDLE_TIMEOUT, DEFAULT_PORT, DEFAULT_SSL_PORT, DEFAULT_STANDALONE_CLASS, KEY_NINJA_CONTEXT_PATH, KEY_NINJA_HOST, KEY_NINJA_IDLE_TIMEOUT, KEY_NINJA_PORT, KEY_NINJA_SSL_KEYSTORE_PASSWORD, KEY_NINJA_SSL_KEYSTORE_URI, KEY_NINJA_SSL_PORT, KEY_NINJA_SSL_TRUSTSTORE_PASSWORD, KEY_NINJA_SSL_TRUSTSTORE_URI, KEY_NINJA_STANDALONE_CLASS
Constructor and Description |
---|
AbstractStandalone(String name) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkConfigured() |
protected void |
checkNotConfigured() |
protected void |
checkStarted() |
T |
configure()
Configures the standalone to prepare for being started.
|
T |
contextPath(String contextPath)
Sets the "context path" of the Ninja application.
|
protected String |
createBaseUrl(String scheme,
String host,
Integer port,
String context) |
protected List<String> |
createBaseUrls() |
protected String |
createServerUrl(String scheme,
String host,
Integer port) |
protected List<String> |
createServerUrls() |
protected SSLContext |
createSSLContext() |
protected abstract void |
doConfigure() |
protected abstract void |
doJoin() |
protected abstract void |
doShutdown() |
protected abstract void |
doStart() |
T |
externalConfigurationPath(String externalConfigurationPath) |
List<String> |
getBaseUrls()
Get the urls for the application that is configured to start.
|
String |
getContextPath() |
String |
getExternalConfigurationPath() |
String |
getHost() |
Long |
getIdleTimeout() |
protected String |
getLoggableIdentifier() |
String |
getName() |
NinjaMode |
getNinjaMode() |
NinjaPropertiesImpl |
getNinjaProperties()
Gets the NinjaProperties that were used to configure Ninja.
|
Integer |
getPort() |
List<String> |
getServerUrls()
Get the urls for the servers that are configured to start.
|
String |
getSslKeystorePassword() |
URI |
getSslKeystoreUri() |
Integer |
getSslPort() |
String |
getSslTruststorePassword() |
URI |
getSslTruststoreUri() |
T |
host(String host) |
T |
idleTimeout(long idleTimeout) |
boolean |
isPortEnabled()
Tests if the clear text HTTP port is enabled.
|
boolean |
isSslPortEnabled()
Tests if the SSL HTTP port is enabled.
|
T |
join()
Joins the underlying server to wait until its finished.
|
protected void |
logBaseUrls() |
T |
name(String name) |
T |
ninjaMode(NinjaMode ninjaMode) |
T |
port(int port) |
void |
run()
Configure, start, add shutdown hook, and join.
|
T |
shutdown()
Shutdown Ninja and underlying server as safely as possible (tries not
to cause exceptions to be thrown).
|
T |
sslKeystorePassword(String keystorePassword) |
T |
sslKeystoreUri(URI keystoreUri) |
T |
sslPort(int sslPort) |
T |
sslTruststorePassword(String truststorePassword) |
T |
sslTruststoreUri(URI truststoreUri) |
T |
start()
Configures (if not yet done), boots Ninja application and starts the
underlying server.
|
protected Exception |
tryToUnwrapInjectorException(Exception exception) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInjector
protected final org.slf4j.Logger logger
protected NinjaMode ninjaMode
protected String externalConfigurationPath
protected String name
protected String host
protected Integer port
protected String contextPath
protected Long idleTimeout
protected Integer sslPort
protected URI sslKeystoreUri
protected String sslKeystorePassword
protected URI sslTruststoreUri
protected String sslTruststorePassword
protected boolean configured
protected boolean started
protected NinjaPropertiesImpl ninjaProperties
protected OverlayedNinjaProperties overlayedNinjaProperties
public AbstractStandalone(String name)
public final void run()
run
in interface Runnable
run
in interface Standalone<T extends AbstractStandalone>
public final T configure() throws Exception
Standalone
configure
in interface Standalone<T extends AbstractStandalone>
Exception
- Thrown if an exception occurs during configurationpublic final T start() throws Exception
Standalone
start
in interface Standalone<T extends AbstractStandalone>
Exception
- Thrown if an exception occurs during Ninja boot or
server startpublic final T join() throws Exception
Standalone
join
in interface Standalone<T extends AbstractStandalone>
Exception
- Thrown if an exception occurs while waitingpublic final T shutdown()
Standalone
shutdown
in interface Standalone<T extends AbstractStandalone>
protected abstract void doShutdown()
protected void checkNotConfigured()
protected void checkConfigured()
protected void checkStarted()
public NinjaMode getNinjaMode()
getNinjaMode
in interface Standalone<T extends AbstractStandalone>
public T ninjaMode(NinjaMode ninjaMode)
ninjaMode
in interface Standalone<T extends AbstractStandalone>
public String getExternalConfigurationPath()
getExternalConfigurationPath
in interface Standalone<T extends AbstractStandalone>
public T externalConfigurationPath(String externalConfigurationPath)
externalConfigurationPath
in interface Standalone<T extends AbstractStandalone>
public String getName()
getName
in interface Standalone<T extends AbstractStandalone>
public T name(String name)
name
in interface Standalone<T extends AbstractStandalone>
public Integer getPort()
getPort
in interface Standalone<T extends AbstractStandalone>
public T port(int port)
port
in interface Standalone<T extends AbstractStandalone>
public String getHost()
getHost
in interface Standalone<T extends AbstractStandalone>
public T host(String host)
host
in interface Standalone<T extends AbstractStandalone>
public Long getIdleTimeout()
getIdleTimeout
in interface Standalone<T extends AbstractStandalone>
public T idleTimeout(long idleTimeout)
idleTimeout
in interface Standalone<T extends AbstractStandalone>
public String getContextPath()
getContextPath
in interface Standalone<T extends AbstractStandalone>
public T contextPath(String contextPath)
Standalone
contextPath
in interface Standalone<T extends AbstractStandalone>
contextPath
- The context path such as "/mycontext"public Integer getSslPort()
getSslPort
in interface Standalone<T extends AbstractStandalone>
public T sslPort(int sslPort)
sslPort
in interface Standalone<T extends AbstractStandalone>
public URI getSslKeystoreUri()
getSslKeystoreUri
in interface Standalone<T extends AbstractStandalone>
public T sslKeystoreUri(URI keystoreUri)
sslKeystoreUri
in interface Standalone<T extends AbstractStandalone>
public String getSslKeystorePassword()
getSslKeystorePassword
in interface Standalone<T extends AbstractStandalone>
public T sslKeystorePassword(String keystorePassword)
sslKeystorePassword
in interface Standalone<T extends AbstractStandalone>
public URI getSslTruststoreUri()
getSslTruststoreUri
in interface Standalone<T extends AbstractStandalone>
public T sslTruststoreUri(URI truststoreUri)
sslTruststoreUri
in interface Standalone<T extends AbstractStandalone>
public String getSslTruststorePassword()
getSslTruststorePassword
in interface Standalone<T extends AbstractStandalone>
public T sslTruststorePassword(String truststorePassword)
sslTruststorePassword
in interface Standalone<T extends AbstractStandalone>
public NinjaPropertiesImpl getNinjaProperties()
Standalone
getNinjaProperties
in interface Standalone<T extends AbstractStandalone>
public List<String> getServerUrls()
Standalone
getServerUrls
in interface Standalone<T extends AbstractStandalone>
Standalone.getServerUrls()
public List<String> getBaseUrls()
Standalone
getBaseUrls
in interface Standalone<T extends AbstractStandalone>
Standalone.getBaseUrls()
public boolean isPortEnabled()
Standalone
isPortEnabled
in interface Standalone<T extends AbstractStandalone>
public boolean isSslPortEnabled()
Standalone
isSslPortEnabled
in interface Standalone<T extends AbstractStandalone>
protected String createBaseUrl(String scheme, String host, Integer port, String context)
protected String getLoggableIdentifier()
protected void logBaseUrls()
protected SSLContext createSSLContext() throws Exception
Exception
Copyright © 2017 ninjaframework. All rights reserved.