public class LoggerContextAdmin extends javax.management.NotificationBroadcasterSupport implements LoggerContextAdminMBean, java.beans.PropertyChangeListener
LoggerContextAdminMBean interface.| Modifier and Type | Field and Description |
|---|---|
private static int |
BUFFER_SIZE |
private static StatusLogger |
LOGGER |
private LoggerContext |
loggerContext |
private javax.management.ObjectName |
objectName |
private static int |
PAGE |
private java.util.concurrent.atomic.AtomicLong |
sequenceNo |
private static int |
TEXT_BUFFER |
NOTIF_TYPE_RECONFIGURED, PATTERN| Constructor and 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. |
| Modifier and Type | Method and Description |
|---|---|
private static javax.management.MBeanNotificationInfo |
createNotificationInfo() |
private Configuration |
getConfig() |
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. |
private long |
nextSeqNo() |
private long |
now() |
void |
propertyChange(java.beans.PropertyChangeEvent evt) |
private java.lang.String |
readContents(java.io.InputStream in,
java.nio.charset.Charset charset)
Returns the contents of the specified input stream as a String.
|
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.
|
private static final int PAGE
private static final int TEXT_BUFFER
private static final int BUFFER_SIZE
private static final StatusLogger LOGGER
private final java.util.concurrent.atomic.AtomicLong sequenceNo
private final javax.management.ObjectName objectName
private final LoggerContext loggerContext
public LoggerContextAdmin(LoggerContext loggerContext, java.util.concurrent.Executor executor)
LoggerContextAdmin with the Executor to be used for sending Notification
s asynchronously to listeners.executor - used to send notifications asynchronouslyloggerContext - the instrumented objectprivate static javax.management.MBeanNotificationInfo createNotificationInfo()
public java.lang.String getStatus()
LoggerContextAdminMBeanLoggerContext.getStatus in interface LoggerContextAdminMBeanpublic java.lang.String getName()
LoggerContextAdminMBeanLoggerContext.getName in interface LoggerContextAdminMBeanLoggerContext.private Configuration getConfig()
public java.lang.String getConfigLocationUri()
LoggerContextAdminMBeangetConfigLocationUri in interface LoggerContextAdminMBeanpublic void setConfigLocationUri(java.lang.String configLocation)
throws java.net.URISyntaxException,
java.io.IOException
LoggerContextAdminMBeanLoggerContext to reconfigure.setConfigLocationUri in interface LoggerContextAdminMBeanconfigLocation - location of the configuration file in
URI format.java.net.URISyntaxException - if the format of the specified
configLocationURI is incorrectjava.io.IOException - if an error occurred reading the specified locationpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange in interface java.beans.PropertyChangeListenerpublic java.lang.String getConfigText()
throws java.io.IOException
LoggerContextAdminMBeansetConfigText. If reading a file, this method assumes the file's
character encoding is UTF-8.getConfigText in interface LoggerContextAdminMBeanjava.io.IOException - if a problem occurred reading the contents of the
config file.public java.lang.String getConfigText(java.lang.String charsetName)
throws java.io.IOException
LoggerContextAdminMBeansetConfigText.getConfigText in interface LoggerContextAdminMBeancharsetName - the encoding to use to convert the file's bytes into
the resulting string.java.io.IOException - if a problem occurred reading the contents of the
config file.private java.lang.String readContents(java.io.InputStream in,
java.nio.charset.Charset charset)
throws java.io.IOException
in - stream to read fromcharset - MUST not be nulljava.io.IOException - if a problem occurred reading from the stream.public void setConfigText(java.lang.String configText,
java.lang.String charsetName)
LoggerContextAdminMBeanLoggerContext to be reconfigured with the specified text.setConfigText in interface LoggerContextAdminMBeanconfigText - the configuration text in XML or JSON formatcharsetName - name of the Charset used to convert the
specified configText to bytespublic java.lang.String getConfigName()
LoggerContextAdminMBeangetConfigName in interface LoggerContextAdminMBeanpublic java.lang.String getConfigClassName()
LoggerContextAdminMBeanConfiguration of the instrumented
LoggerContext.getConfigClassName in interface LoggerContextAdminMBeanConfiguration.public java.lang.String getConfigFilter()
LoggerContextAdminMBeanConfiguration of the instrumented LoggerContext.getConfigFilter in interface LoggerContextAdminMBeanpublic java.util.Map<java.lang.String,java.lang.String> getConfigProperties()
LoggerContextAdminMBeangetConfigProperties in interface LoggerContextAdminMBeanpublic javax.management.ObjectName getObjectName()
ObjectName of this mbean.getObjectName in interface LoggerContextAdminMBeanObjectNameLoggerContextAdminMBean.PATTERNprivate long nextSeqNo()
private long now()