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 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 ConfigKey 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.
      systemPropertyMode -
    • JolokiaServerConfig

      public JolokiaServerConfig(Map<String,String> pConfig)
    • JolokiaServerConfig

      protected JolokiaServerConfig()
      Empty constructor useful for subclasses which want to do their own initialization. Note that the subclass must call init(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 config
      pDefaultConfig - default config used as background
      systemPropertyMode -
    • 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
    • useCertificateReload

      public int useCertificateReload()
      Whether to start WatchService to 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

      public InetAddress getAddress()
      Address to bind to, which is either used from the configuration option "host" or by default from InetAddress.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

      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 when getKeystore() 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 when getKeystore() 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 when getKeystore() 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
    • initConfigAndValidate

      protected void initConfigAndValidate(Map<String,String> agentConfig)
    • initAuthenticator

      protected void initAuthenticator()
    • 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()
    • getClientPrincipals

      public List<String> getClientPrincipals()
    • getExtendedClientCheck

      public boolean getExtendedClientCheck()
    • setClassLoader

      public void setClassLoader(ClassLoader loader)
      JVM Jolokia agent may set different class loader to use for loading services (from /META-INF/jolokia/services using this method. The classloader may be provided/detected by one of the ServerDetectors.
      Parameters:
      loader -
    • getClassLoader

      public ClassLoader getClassLoader()