Class ServerConfig
- Direct Known Subclasses:
ServiceConfigProperties
-
Field Summary
Fields inherited from class org.eclipse.hono.config.AbstractConfig
LOG, PREFIX_FILE
-
Constructor Summary
ConstructorDescriptionCreates new properties using default values.ServerConfig
(ServerOptions options) Creates a new instance from existing options. -
Method Summary
Modifier and TypeMethodDescriptionfinal String
Gets the host name or literal IP address of the network interface that this server's secure port is configured to be bound to.final int
Gets the insecure port this server is configured to listen on.final int
getInsecurePort
(int defaultPort) Gets the insecure port this server is configured to listen on.final String
Gets the host name or literal IP address of the network interface that this server's insecure port is configured to be bound to.final int
getPort()
Gets the secure port this server is configured to listen on.final int
getPort
(int defaultPort) Gets the secure port this server is configured to listen on.boolean
Checks whether this service should listen to the insecure port.final boolean
Checks if this server requires the usage of a native TLS implementation.boolean
Checks whether this service should listen to the secure port.final boolean
isSni()
Checks if the server supports Server Name Indication for TLS connections.final boolean
Checks if the current thread is running on the Graal Substrate VM.final void
setBindAddress
(String address) Sets the host name or literal IP address of the network interface that this server's secure port should be bound to.final void
setInsecurePort
(int port) Sets the insecure port that this server should listen on.final void
setInsecurePortBindAddress
(String address) Sets the host name or literal IP address of the network interface that this server's insecure port should be bound to.final void
setInsecurePortEnabled
(boolean insecurePortEnabled) Sets whether this server should listen on the insecure port.final void
setNativeTlsRequired
(boolean nativeTlsRequired) Sets if this server should require the usage of a native TLS implementation.final void
setPort
(int port) Sets the secure port that this server should listen on.final void
setSni
(boolean sni) Sets whether the server should support Server Name Indication for TLS connections.Methods inherited from class org.eclipse.hono.config.AbstractConfig
getCertPath, getKeyCertOptions, getKeyFormat, getKeyPath, getKeyStorePassword, getKeyStorePath, getPassword, getPathSeparator, getSecureProtocols, getSupportedCipherSuites, getTrustOptions, getTrustStoreFormat, getTrustStorePassword, getTrustStorePath, isValidPort, setCertPath, setKeyFormat, setKeyPath, setKeyStorePassword, setKeyStorePath, setPathSeparator, setSecureProtocols, setSupportedCipherSuites, setTrustStoreFormat, setTrustStorePassword, setTrustStorePath
-
Constructor Details
-
ServerConfig
public ServerConfig()Creates new properties using default values. -
ServerConfig
Creates a new instance from existing options.- Parameters:
options
- The options. All of the options are copied to the newly created instance.
-
-
Method Details
-
isSubstrateVm
public final boolean isSubstrateVm()Checks if the current thread is running on the Graal Substrate VM.- Returns:
true
if the java.vm.name system property value start withSubstrate
.
-
getBindAddress
Gets the host name or literal IP address of the network interface that this server's secure port is configured to be bound to.- Returns:
- The host name.
-
setBindAddress
Sets the host name or literal IP address of the network interface that this server's secure port should be bound to.The default value of this property is
Constants.LOOPBACK_DEVICE_ADDRESS
on IPv4 stacks.- Parameters:
address
- The host name or IP address.- Throws:
NullPointerException
- if host isnull
.
-
getPort
public final int getPort()Gets the secure port this server is configured to listen on.- Returns:
- The port number.
-
getPort
public final int getPort(int defaultPort) Gets the secure port this server is configured to listen on.- Parameters:
defaultPort
- The port to use if this property has not been set explicitly.- Returns:
- The configured port number or the defaultPort if port is not set.
- See Also:
-
setPort
public final void setPort(int port) Sets the secure port that this server should listen on.If the port is set to 0 (the default value), then this server will bind to an arbitrary free port chosen by the operating system during startup.
- Parameters:
port
- The port number.- Throws:
IllegalArgumentException
- if port < 0 or port > 65535.
-
isSecurePortEnabled
public boolean isSecurePortEnabled()Checks whether this service should listen to the secure port.Subclasses may override this method in order to do more sophisticated checks.
- Returns:
true
if a valid key and certificate have been configured for this service..
-
isNativeTlsRequired
public final boolean isNativeTlsRequired()Checks if this server requires the usage of a native TLS implementation. Native TLS implementations offer in general a better performance but may not be available on all platforms. Iftrue
, the server will require the usage of a native TLS implementation. Server will not start if native implementation is not available on the current system. Iffalse
, the adapter will try to use a native TLS implementation. If no native implementation is available the default Java platform independent TLS implementation will be used.The default value of this property is
false
.- Returns:
true
if the server requires native TLS implementation.
-
setNativeTlsRequired
public final void setNativeTlsRequired(boolean nativeTlsRequired) Sets if this server should require the usage of a native TLS implementation. Native TLS implementations offer in general a better performance but may not be available on all platforms. Iftrue
, the server will require the usage of a native TLS implementation. Server will not start if native implementation is not available on the current system. Iffalse
, the adapter will try to use a native TLS implementation. If no native implementation is available the default Java platform independent TLS implementation will be used.The default value of this property is
false
.- Parameters:
nativeTlsRequired
-true
if the server requires the usage of a native TLS implementation.
-
isInsecurePortEnabled
public boolean isInsecurePortEnabled()Checks whether this service should listen to the insecure port.The default value of this property is
false
.Subclasses may override this method in order to do more sophisticated checks.
- Returns:
true
if the insecure port has been enabled explicitly usingsetInsecurePortEnabled(boolean)
or implicitly usingsetInsecurePort(int)
.
-
setInsecurePortEnabled
public final void setInsecurePortEnabled(boolean insecurePortEnabled) Sets whether this server should listen on the insecure port.The default value of this property is
false
.- Parameters:
insecurePortEnabled
-true
if the server should listen on the insecure port.
-
getInsecurePortBindAddress
Gets the host name or literal IP address of the network interface that this server's insecure port is configured to be bound to.- Returns:
- The host name.
-
setInsecurePortBindAddress
Sets the host name or literal IP address of the network interface that this server's insecure port should be bound to.The default value of this property is
Constants.LOOPBACK_DEVICE_ADDRESS
on IPv4 stacks.- Parameters:
address
- The host name or IP address.- Throws:
NullPointerException
- if address isnull
.
-
getInsecurePort
public final int getInsecurePort()Gets the insecure port this server is configured to listen on.- Returns:
- The port number.
-
getInsecurePort
public final int getInsecurePort(int defaultPort) Gets the insecure port this server is configured to listen on.- Parameters:
defaultPort
- The port to use if this property has not been set explicitly.- Returns:
- The configured port number or the defaultPort if insecurePort is not set.
- See Also:
-
setInsecurePort
public final void setInsecurePort(int port) Sets the insecure port that this server should listen on.If the port is set to 0 (the default value), then this server will bind to an arbitrary free port chosen by the operating system during startup.
Setting this property also sets the insecurePortEnabled property to
true
.- Parameters:
port
- The port number.- Throws:
IllegalArgumentException
- if port < 0 or port > 65535.
-
setSni
public final void setSni(boolean sni) Sets whether the server should support Server Name Indication for TLS connections.- Parameters:
sni
-true
if the server should support SNI.
-
isSni
public final boolean isSni()Checks if the server supports Server Name Indication for TLS connections.- Returns:
true
if the server supports SNI.
-