Package org.apache.logging.log4j.jmx.gui
Class Client
- java.lang.Object
-
- org.apache.logging.log4j.jmx.gui.Client
-
public class Client extends java.lang.Object
This class allows client-side code to perform operations on remote (server-side) MBeans via proxies.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.management.MBeanServerConnection
connection
private javax.management.remote.JMXConnector
connector
-
Constructor Summary
Constructors Constructor Description Client(javax.management.MBeanServerConnection mBeanServerConnection)
Constructs a newClient
object and creates proxies for all known remote MBeans.Client(javax.management.remote.JMXConnector connector)
Constructs a newClient
object and creates proxies for all known remote MBeans.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the client connection to its server.private java.util.Set<javax.management.ObjectName>
find(java.lang.String pattern)
javax.management.MBeanServerConnection
getConnection()
Returns the MBean server connection through which to communicate with the remote mbeans.LoggerContextAdminMBean
getLoggerContextAdmin(javax.management.ObjectName name)
java.util.List<LoggerContextAdminMBean>
getLoggerContextAdmins()
Returns a list of proxies that allow operations to be performed on the remoteLoggerContextAdminMBean
s.StatusLoggerAdminMBean
getStatusLoggerAdmin(java.lang.String contextName)
Returns theStatusLoggerAdminMBean
associated with the specified context name, ornull
.javax.management.ObjectName
getStatusLoggerObjectName(javax.management.ObjectName loggerContextObjName)
Returns theObjectName
of theStatusLoggerAdminMBean
associated with the specifiedLoggerContextAdminMBean
.private void
init()
boolean
isLoggerContext(javax.management.ObjectName mbeanName)
Returnstrue
if the specifiedObjectName
is for aLoggerContextAdminMBean
,false
otherwise.
-
-
-
Constructor Detail
-
Client
public Client(javax.management.remote.JMXConnector connector) throws javax.management.MalformedObjectNameException, java.io.IOException
Constructs a newClient
object and creates proxies for all known remote MBeans.- Parameters:
connector
- used to create the MBean server connection through which to communicate with the remote mbeans- Throws:
javax.management.MalformedObjectNameException
- if a problem occurred identifying one of the remote mbeansjava.io.IOException
- if the connection failed
-
Client
public Client(javax.management.MBeanServerConnection mBeanServerConnection) throws javax.management.MalformedObjectNameException, java.io.IOException
Constructs a newClient
object and creates proxies for all known remote MBeans.- Parameters:
mBeanServerConnection
- the MBean server connection through which to communicate with the remote mbeans- Throws:
javax.management.MalformedObjectNameException
- if a problem occurred identifying one of the remote mbeansjava.io.IOException
- if the connection failed
-
-
Method Detail
-
init
private void init() throws javax.management.MalformedObjectNameException, java.io.IOException
- Throws:
javax.management.MalformedObjectNameException
java.io.IOException
-
find
private java.util.Set<javax.management.ObjectName> find(java.lang.String pattern) throws javax.management.JMException, java.io.IOException
- Throws:
javax.management.JMException
java.io.IOException
-
getLoggerContextAdmins
public java.util.List<LoggerContextAdminMBean> getLoggerContextAdmins() throws javax.management.JMException, java.io.IOException
Returns a list of proxies that allow operations to be performed on the remoteLoggerContextAdminMBean
s.- Returns:
- a list of proxies to the remote
LoggerContextAdminMBean
s - Throws:
java.io.IOException
- If an I/O error occurredjavax.management.JMException
- If a management error occurred
-
getLoggerContextAdmin
public LoggerContextAdminMBean getLoggerContextAdmin(javax.management.ObjectName name)
-
close
public void close()
Closes the client connection to its server. Any ongoing or new requests to the MBeanServerConnection will fail.
-
getConnection
public javax.management.MBeanServerConnection getConnection()
Returns the MBean server connection through which to communicate with the remote mbeans.- Returns:
- the MBean server connection
-
getStatusLoggerAdmin
public StatusLoggerAdminMBean getStatusLoggerAdmin(java.lang.String contextName) throws javax.management.MalformedObjectNameException, java.io.IOException
Returns theStatusLoggerAdminMBean
associated with the specified context name, ornull
.- Parameters:
contextName
- search key- Returns:
- StatusLoggerAdminMBean or null
- Throws:
javax.management.MalformedObjectNameException
- If an object name is malformedjava.io.IOException
- If an I/O error occurred
-
isLoggerContext
public boolean isLoggerContext(javax.management.ObjectName mbeanName)
Returnstrue
if the specifiedObjectName
is for aLoggerContextAdminMBean
,false
otherwise.- Parameters:
mbeanName
- theObjectName
to check.- Returns:
true
if the specifiedObjectName
is for aLoggerContextAdminMBean
,false
otherwise
-
getStatusLoggerObjectName
public javax.management.ObjectName getStatusLoggerObjectName(javax.management.ObjectName loggerContextObjName)
Returns theObjectName
of theStatusLoggerAdminMBean
associated with the specifiedLoggerContextAdminMBean
.- Parameters:
loggerContextObjName
- theObjectName
of aLoggerContextAdminMBean
- Returns:
ObjectName
of theStatusLoggerAdminMBean
-
-