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()
LoggerContextAdminMBean
LoggerContext
.getStatus
in interface LoggerContextAdminMBean
public java.lang.String getName()
LoggerContextAdminMBean
LoggerContext
.getName
in interface LoggerContextAdminMBean
LoggerContext
.private Configuration getConfig()
public java.lang.String getConfigLocationUri()
LoggerContextAdminMBean
getConfigLocationUri
in interface LoggerContextAdminMBean
public void setConfigLocationUri(java.lang.String configLocation) throws java.net.URISyntaxException, java.io.IOException
LoggerContextAdminMBean
LoggerContext
to reconfigure.setConfigLocationUri
in interface LoggerContextAdminMBean
configLocation
- 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.PropertyChangeListener
public java.lang.String getConfigText() throws java.io.IOException
LoggerContextAdminMBean
setConfigText
. If reading a file, this method assumes the file's
character encoding is UTF-8.getConfigText
in interface LoggerContextAdminMBean
java.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
LoggerContextAdminMBean
setConfigText
.getConfigText
in interface LoggerContextAdminMBean
charsetName
- 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)
LoggerContextAdminMBean
LoggerContext
to be reconfigured with the specified text.setConfigText
in interface LoggerContextAdminMBean
configText
- the configuration text in XML or JSON formatcharsetName
- name of the Charset
used to convert the
specified configText to bytespublic java.lang.String getConfigName()
LoggerContextAdminMBean
getConfigName
in interface LoggerContextAdminMBean
public java.lang.String getConfigClassName()
LoggerContextAdminMBean
Configuration
of the instrumented
LoggerContext.getConfigClassName
in interface LoggerContextAdminMBean
Configuration
.public java.lang.String getConfigFilter()
LoggerContextAdminMBean
Configuration
of the instrumented LoggerContext.getConfigFilter
in interface LoggerContextAdminMBean
public java.util.Map<java.lang.String,java.lang.String> getConfigProperties()
LoggerContextAdminMBean
getConfigProperties
in interface LoggerContextAdminMBean
public javax.management.ObjectName getObjectName()
ObjectName
of this mbean.getObjectName
in interface LoggerContextAdminMBean
ObjectName
LoggerContextAdminMBean.PATTERN
private long nextSeqNo()
private long now()