Package org.jolokia.jvmagent
Class JolokiaServerConfig
- java.lang.Object
-
- org.jolokia.jvmagent.JolokiaServerConfig
-
- Direct Known Subclasses:
JvmAgentConfig
public class JolokiaServerConfig extends Object
Configuration required for the JolokiaServer- Since:
- 28.12.12
- Author:
- roland, nevenr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JolokiaServerConfig()
Empty constructor useful for subclasses which want to do their own initialization.JolokiaServerConfig(Map<String,String> pConfig)
Constructor which prepares the server configuration from a map of given config options (key: option name, value: option value).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InetAddress
getAddress()
Address to bind to, which is either used from the configuration option "host" or by default fromInetAddress.getLocalHost()
Authenticator
getAuthenticator()
Return a basic authenticator if user or password is given in the configuration.int
getBacklog()
Backlog of the HTTP server, which is the number of requests to keep before throwing them awayString
getCaCert()
Get a path to a CA PEM file which is used to verify client certificates.List<String>
getClientPrincipals()
String
getContextPath()
Context path under which the agent is reachable.protected Map<String,String>
getDefaultConfig()
Read in the default configuration from a properties resourceString
getExecutor()
Executor to use as provided by the 'executor' option or "single" as defaultboolean
getExtendedClientCheck()
org.jolokia.server.core.config.Configuration
getJolokiaConfig()
Get the Jolokia runtime configurationString
getKeyManagerAlgorithm()
String
getKeystore()
Name of the keystore for 'https', if anychar[]
getKeystorePassword()
Password for keystore if a keystore is used.String
getKeyStoreType()
int
getPort()
Port for the server to listen toString
getProtocol()
Protocol to useString
getSecureSocketProtocol()
String
getServerCert()
Get the path to a server cert which is presented clients when using TLS.String
getServerKey()
Get the path to a the cert which has the private server key.String
getServerKeyAlgorithm()
The algorithm to use for extracting the private server key.String[]
getSSLCipherSuites()
The list of enabled SSL / TLS cipher suitesString[]
getSSLProtocols()
The list of enabled SSL / TLS protocols to serve withString
getThreadNamePrefix()
Thread name prefix that executor will use while creating new thread(s).int
getThreadNr()
Thread number to use when executor model is "fixed"String
getTrustManagerAlgorithm()
protected void
init(Map<String,String> pConfig, Map<String,String> pDefaultConfig)
Initializationprotected void
initConfigAndValidate(Map<String,String> agentConfig)
protected Map<String,String>
readPropertiesFromInputStream(InputStream pIs, String pLabel)
void
updateHTTPSSettingsFromContext(SSLContext sslContext)
Filter the list of protocols and ciphers to those supported by the given SSLContextboolean
useHttps()
Whether or not to use https as the procolboolean
useSslClientAuthentication()
When the protocol is 'https' then this property indicates whether SSL client certificate authentication should be used or not
-
-
-
Constructor Detail
-
JolokiaServerConfig
public JolokiaServerConfig(Map<String,String> pConfig)
Constructor which prepares the server configuration from a map of given config options (key: option name, value: option value). Also, default values are used for any parameter not provided (getDefaultConfig()
). The given configuration consist of two parts: Any global options as defined inConfigKey
are used for setting up the agent. All other options are taken for preparing the HTTP server under which the agent is served. The known properties are described in the reference manual. All other options are ignored.- Parameters:
pConfig
- the configuration options to use.
-
JolokiaServerConfig
protected JolokiaServerConfig()
Empty constructor useful for subclasses which want to do their own initialization. Note that the subclass must callinit(java.util.Map<java.lang.String, java.lang.String>, java.util.Map<java.lang.String, java.lang.String>)
on its own.
-
-
Method Detail
-
init
protected final void init(Map<String,String> pConfig, Map<String,String> pDefaultConfig)
Initialization- Parameters:
pConfig
- original configpDefaultConfig
- default config used as background
-
getDefaultConfig
protected final Map<String,String> getDefaultConfig()
Read in the default configuration from a properties resource- Returns:
- the default configuration
-
getJolokiaConfig
public org.jolokia.server.core.config.Configuration getJolokiaConfig()
Get the Jolokia runtime configuration- Returns:
- jolokia configuration
-
getProtocol
public String getProtocol()
Protocol to use- Returns:
- protocol either 'http' or 'https'
-
useHttps
public boolean useHttps()
Whether or not to use https as the procol- Returns:
- true when using https as the protocol
-
getAddress
public InetAddress getAddress()
Address to bind to, which is either used from the configuration option "host" or by default fromInetAddress.getLocalHost()
- Returns:
- the host's address
-
getPort
public int getPort()
Port for the server to listen to- Returns:
- port
-
getAuthenticator
public Authenticator getAuthenticator()
Return a basic authenticator if user or password is given in the configuration. You can override this method if you want to provide an own authenticator.- Returns:
- an authenticator if authentication is switched on, or null if no authentication should be used.
-
getBacklog
public int getBacklog()
Backlog of the HTTP server, which is the number of requests to keep before throwing them away- Returns:
- backlog
-
getContextPath
public String getContextPath()
Context path under which the agent is reachable. This path will always end with a "/" for technical reasons.- Returns:
- the context path.
-
getExecutor
public String getExecutor()
Executor to use as provided by the 'executor' option or "single" as default- Returns:
- the executor model ("fixed", "single" or "cached")
-
getThreadNamePrefix
public String getThreadNamePrefix()
Thread name prefix that executor will use while creating new thread(s).- Returns:
- the thread(s) name prefix
-
getThreadNr
public int getThreadNr()
Thread number to use when executor model is "fixed"- Returns:
- number of fixed threads
-
useSslClientAuthentication
public boolean useSslClientAuthentication()
When the protocol is 'https' then this property indicates whether SSL client certificate authentication should be used or not- Returns:
- true when ssl client authentication should be used
-
getKeystore
public String getKeystore()
Name of the keystore for 'https', if any- Returns:
- name of keystore.
-
getKeystorePassword
public char[] getKeystorePassword()
Password for keystore if a keystore is used. If not given, no password is assumed. If certs are not loaded from a keystore but from PEM files directly, then this password is used for the private server key- Returns:
- the keystore password as char array or an empty array of no password is given
-
getCaCert
public String getCaCert()
Get a path to a CA PEM file which is used to verify client certificates. This path is only used whengetKeystore()
is not set.- Returns:
- the file path where the ca cert is located.
-
getServerCert
public String getServerCert()
Get the path to a server cert which is presented clients when using TLS. This is only used whengetKeystore()
is not set.- Returns:
- the file path where the server cert is located.
-
getServerKey
public String getServerKey()
Get the path to a the cert which has the private server key. This is only used whengetKeystore()
is not set.- Returns:
- the file path where the private server cert is located.
-
getServerKeyAlgorithm
public String getServerKeyAlgorithm()
The algorithm to use for extracting the private server key.- Returns:
- the server key algorithm
-
getSSLProtocols
public String[] getSSLProtocols()
The list of enabled SSL / TLS protocols to serve with- Returns:
- the array of enabled protocols
-
getSSLCipherSuites
public String[] getSSLCipherSuites()
The list of enabled SSL / TLS cipher suites- Returns:
- the array of cipher suites
-
updateHTTPSSettingsFromContext
public void updateHTTPSSettingsFromContext(SSLContext sslContext)
Filter the list of protocols and ciphers to those supported by the given SSLContext- Parameters:
sslContext
- the SSLContext to pull information from
-
readPropertiesFromInputStream
protected final Map<String,String> readPropertiesFromInputStream(InputStream pIs, String pLabel)
-
getSecureSocketProtocol
public String getSecureSocketProtocol()
-
getKeyManagerAlgorithm
public String getKeyManagerAlgorithm()
-
getTrustManagerAlgorithm
public String getTrustManagerAlgorithm()
-
getKeyStoreType
public String getKeyStoreType()
-
getExtendedClientCheck
public boolean getExtendedClientCheck()
-
-