Class LoggerContextAdmin

  • All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.util.EventListener, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, LoggerContextAdminMBean

    public class LoggerContextAdmin
    extends javax.management.NotificationBroadcasterSupport
    implements LoggerContextAdminMBean, java.beans.PropertyChangeListener
    Implementation of the LoggerContextAdminMBean interface.
    • Constructor Summary

      Constructors 
      Constructor Description
      LoggerContextAdmin​(LoggerContext loggerContext, java.util.concurrent.Executor executor)
      Constructs a new LoggerContextAdmin with the Executor to be used for sending Notification s asynchronously to listeners.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getConfigClassName()
      Returns the class name of the Configuration of the instrumented LoggerContext.
      java.lang.String getConfigFilter()
      Returns a string description of all Filters configured in the Configuration of the instrumented LoggerContext.
      java.lang.String getConfigLocationUri()
      Returns the configuration location URI as a String.
      java.lang.String getConfigName()
      Returns the name of the Configuration of the instrumented LoggerContext.
      java.util.Map<java.lang.String,​java.lang.String> getConfigProperties()
      Returns a map with configured properties.
      java.lang.String getConfigText()
      Returns the configuration text, which may be the contents of the configuration file or the text that was last set with a call to setConfigText.
      java.lang.String getConfigText​(java.lang.String charsetName)
      Returns the configuration text, which may be the contents of the configuration file or the text that was last set with a call to setConfigText.
      java.lang.String getName()
      Returns the name of the instrumented LoggerContext.
      javax.management.ObjectName getObjectName()
      Returns the ObjectName of this mbean.
      java.lang.String getStatus()
      Returns the status of the instrumented LoggerContext.
      void propertyChange​(java.beans.PropertyChangeEvent evt)  
      void setConfigLocationUri​(java.lang.String configLocation)
      Sets the configuration location to the specified URI.
      void setConfigText​(java.lang.String configText, java.lang.String charsetName)
      Sets the configuration text.
      • Methods inherited from class javax.management.NotificationBroadcasterSupport

        addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LoggerContextAdmin

        public LoggerContextAdmin​(LoggerContext loggerContext,
                                  java.util.concurrent.Executor executor)
        Constructs a new LoggerContextAdmin with the Executor to be used for sending Notification s asynchronously to listeners.
        Parameters:
        executor - used to send notifications asynchronously
        loggerContext - the instrumented object
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: LoggerContextAdminMBean
        Returns the name of the instrumented LoggerContext.
        Specified by:
        getName in interface LoggerContextAdminMBean
        Returns:
        the name of the instrumented LoggerContext.
      • setConfigLocationUri

        public void setConfigLocationUri​(java.lang.String configLocation)
                                  throws java.net.URISyntaxException,
                                         java.io.IOException
        Description copied from interface: LoggerContextAdminMBean
        Sets the configuration location to the specified URI. This will cause the instrumented LoggerContext to reconfigure.
        Specified by:
        setConfigLocationUri in interface LoggerContextAdminMBean
        Parameters:
        configLocation - location of the configuration file in URI format.
        Throws:
        java.net.URISyntaxException - if the format of the specified configLocationURI is incorrect
        java.io.IOException - if an error occurred reading the specified location
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent evt)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • getConfigText

        public java.lang.String getConfigText()
                                       throws java.io.IOException
        Description copied from interface: LoggerContextAdminMBean
        Returns the configuration text, which may be the contents of the configuration file or the text that was last set with a call to setConfigText. If reading a file, this method assumes the file's character encoding is UTF-8.
        Specified by:
        getConfigText in interface LoggerContextAdminMBean
        Returns:
        the configuration text
        Throws:
        java.io.IOException - if a problem occurred reading the contents of the config file.
      • getConfigText

        public java.lang.String getConfigText​(java.lang.String charsetName)
                                       throws java.io.IOException
        Description copied from interface: LoggerContextAdminMBean
        Returns the configuration text, which may be the contents of the configuration file or the text that was last set with a call to setConfigText.
        Specified by:
        getConfigText in interface LoggerContextAdminMBean
        Parameters:
        charsetName - the encoding to use to convert the file's bytes into the resulting string.
        Returns:
        the configuration text
        Throws:
        java.io.IOException - if a problem occurred reading the contents of the config file.
      • setConfigText

        public void setConfigText​(java.lang.String configText,
                                  java.lang.String charsetName)
        Description copied from interface: LoggerContextAdminMBean
        Sets the configuration text. This does not replace the contents of the configuration file, but does cause the instrumented LoggerContext to be reconfigured with the specified text.
        Specified by:
        setConfigText in interface LoggerContextAdminMBean
        Parameters:
        configText - the configuration text in XML or JSON format
        charsetName - name of the Charset used to convert the specified configText to bytes
      • getConfigClassName

        public java.lang.String getConfigClassName()
        Description copied from interface: LoggerContextAdminMBean
        Returns the class name of the Configuration of the instrumented LoggerContext.
        Specified by:
        getConfigClassName in interface LoggerContextAdminMBean
        Returns:
        the class name of the Configuration.
      • getConfigFilter

        public java.lang.String getConfigFilter()
        Description copied from interface: LoggerContextAdminMBean
        Returns a string description of all Filters configured in the Configuration of the instrumented LoggerContext.
        Specified by:
        getConfigFilter in interface LoggerContextAdminMBean
        Returns:
        a string description of all Filters configured