Interface JolokiaContext

All Superinterfaces:
LogHandler, Restrictor
All Known Implementing Classes:
JolokiaContextImpl

public interface JolokiaContext extends LogHandler, Restrictor
The context providing access to all Jolokia internal services. This context will be given through during request handling to the various methods. It is also a restrictor used for access restriction handling and responsible for logging aspects.
Since:
09.04.13
Author:
roland
  • Method Details

    • getServices

      <T extends JolokiaService<?>> SortedSet<T> getServices(Class<T> pType)
      Get Jolokia services of a certain kind. The returned list might be empty, but never null. The set is sorted according to the service order (see JolokiaService.getOrder()).
      Parameters:
      pType - requested service type
      Returns:
      sorted set of services or an empty set
    • getService

      <T extends JolokiaService<?>> T getService(Class<T> pType)
      Get a single service. If more than one service of the given type has been registered, return the one with the highest order. If no one has been registered return null
      Parameters:
      pType - requested service type
      Returns:
      the requested service or null if none has been registered
    • getMandatoryService

      <T extends JolokiaService<?>> T getMandatoryService(Class<T> pType)
      Get a single, mandatory, service. If not present, then an exception is thrown. Also, an exception is raised if more than one service exist
      Parameters:
      pType - requested service type
      Returns:
      the requested service
      Throws:
      IllegalStateException - if no service is present
    • getConfig

      String getConfig(ConfigKey pKey)
      Get a configuration value if set as configuration or the default value if not
      Parameters:
      pKey - the configuration key to lookup
      Returns:
      the configuration value or the default value if no configuration was given.
    • getConfig

      String getConfig(ConfigKey pKey, boolean checkSysOrEnv)
      Get a configuration value if set as configuration or the default value if not
      Parameters:
      pKey - the configuration key to lookup
      checkSysOrEnv - whether system property / environment variable should be checked first
      Returns:
      the configuration value or the default value if no configuration was given.
    • getConfigKeys

      Set<ConfigKey> getConfigKeys()
      Get all keys stored in this configuration
    • getAgentDetails

      AgentDetails getAgentDetails()
      Get the details which specify the current agent. The returned details should not be kept but instead each time details are needed this interface should be queried again.
      Returns:
      the details for this agent.
    • registerMBean

      Register an MBean which gets automatically unregistered during shutdown.
      Parameters:
      pMBean - MBean to register
      pOptionalName - optional name under which the bean should be registered. If not provided, it depends on whether the MBean to register implements MBeanRegistration or not.
      Returns:
      the name under which the MBean is registered.
      Throws:
      MalformedObjectNameException
      NotCompliantMBeanException
      InstanceAlreadyExistsException
      MBeanRegistrationException
    • unregisterMBean

      void unregisterMBean(ObjectName pObjectName) throws MBeanRegistrationException
      Unregister an MBean explicitly. This is typically not necessary but becomes necessary if a module goes down without shutting down the agen
      Parameters:
      pObjectName - name of the mbean to unregister
      Throws:
      MBeanRegistrationException
    • getMBeanServerAccess

      MBeanServerAccess getMBeanServerAccess()
      Get an MBeanServerAccess for easy access of the JMX subsystem even when there are multiple MBeanServers available. It uses a template mechanism with callback
      Returns:
      the executor to use