Package org.jolokia.jvmagent
Class JolokiaServerConfig
java.lang.Object
org.jolokia.jvmagent.JolokiaServerConfig
- Direct Known Subclasses:
JvmAgentConfig
Configuration required for the JolokiaServer
- Since:
- 28.12.12
- Author:
- roland, nevenr
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty constructor useful for subclasses which want to do their own initialization.JolokiaServerConfig(Map<String, String> pConfig) JolokiaServerConfig(Map<String, String> pConfig, org.jolokia.server.core.config.SystemPropertyMode systemPropertyMode) Constructor which prepares the server configuration from a map of given config options (key: option name, value: option value). -
Method Summary
Modifier and TypeMethodDescriptionAddress to bind to, which is either used from the configuration option "host" or by default fromInetAddress.getLocalHost()Return a basic authenticator if user or password is given in the configuration.intBacklog of the HTTP server, which is the number of requests to keep before throwing them awayGet a path to a CA PEM file which is used to verify client certificates.Context path under which the agent is reachable.Read in the default configuration from a properties resourceExecutor to use as provided by the 'executor' option or "single" as defaultbooleanorg.jolokia.server.core.config.ConfigurationGet the Jolokia runtime configurationName of the keystore for 'https', if anychar[]Password for keystore if a keystore is used.intgetPort()Port for the server to listen toProtocol to useGet the path to a server cert which is presented clients when using TLS.Get the path to a the cert which has the private server key.The algorithm to use for extracting the private server key.String[]The list of enabled SSL / TLS cipher suitesString[]The list of enabled SSL / TLS protocols to serve withThread name prefix that executor will use while creating new thread(s).intThread number to use when executor model is "fixed"protected final voidinit(Map<String, String> pConfig, Map<String, String> pDefaultConfig, org.jolokia.server.core.config.SystemPropertyMode systemPropertyMode) Initializationprotected voidInitialization ofauthenticator(s)used by JDK HTTP Server.protected voidinitConfigAndValidate(Map<String, String> agentConfig) booleanisLazy()Check whether to initialize Jolokia lazily (on first request) or immediatelyreadPropertiesFromInputStream(InputStream pIs, String pLabel) voidsetClassLoader(ClassLoader loader) JVM Jolokia agent may set different class loader to use for loading services (from/META-INF/jolokia/servicesusing this method.voidupdateHTTPSSettingsFromContext(SSLContext sslContext) Filter the list of protocols and ciphers to those supported by the given SSLContextintWhether to startWatchServiceto monitor certificate files.booleanuseHttps()Whether or not to use https as the procolbooleanWhen the protocol is 'https' then this property indicates whether SSL client certificate authentication should be used or not
-
Constructor Details
-
JolokiaServerConfig
public JolokiaServerConfig(Map<String, String> pConfig, org.jolokia.server.core.config.SystemPropertyMode systemPropertyMode) 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 in
ConfigKeyare 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.systemPropertyMode-
-
JolokiaServerConfig
-
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>, org.jolokia.server.core.config.SystemPropertyMode)on its own.
-
-
Method Details
-
init
protected final void init(Map<String, String> pConfig, Map<String, String> pDefaultConfig, org.jolokia.server.core.config.SystemPropertyMode systemPropertyMode) Initialization- Parameters:
pConfig- original configpDefaultConfig- default config used as backgroundsystemPropertyMode-
-
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
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
-
useCertificateReload
public int useCertificateReload()Whether to startWatchServiceto monitor certificate files. Value higher than 0 is the interval for checking the CRC of watched files. If CRC changes, the server is restarted.- Returns:
-
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
-
isLazy
public boolean isLazy()Check whether to initialize Jolokia lazily (on first request) or immediately- Returns:
-
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
Context path under which the agent is reachable. This path will always end with a "/" for technical reasons.- Returns:
- the context path.
-
getExecutor
Executor to use as provided by the 'executor' option or "single" as default- Returns:
- the executor model ("fixed", "single" or "cached")
-
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
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
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
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
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
The algorithm to use for extracting the private server key.- Returns:
- the server key algorithm
-
getSSLProtocols
The list of enabled SSL / TLS protocols to serve with- Returns:
- the array of enabled protocols
-
getSSLCipherSuites
The list of enabled SSL / TLS cipher suites- Returns:
- the array of cipher suites
-
updateHTTPSSettingsFromContext
Filter the list of protocols and ciphers to those supported by the given SSLContext- Parameters:
sslContext- the SSLContext to pull information from
-
initConfigAndValidate
-
initAuthenticator
protected void initAuthenticator()Initialization ofauthenticator(s)used by JDK HTTP Server. -
readPropertiesFromInputStream
-
getSecureSocketProtocol
-
getKeyManagerAlgorithm
-
getTrustManagerAlgorithm
-
getKeyStoreType
-
getClientPrincipals
-
getExtendedClientCheck
public boolean getExtendedClientCheck() -
setClassLoader
JVM Jolokia agent may set different class loader to use for loading services (from/META-INF/jolokia/servicesusing this method. The classloader may be provided/detected by one of theServerDetectors.- Parameters:
loader-
-
getClassLoader
-