Package org.apache.mina.integration.jmx
Class ObjectMBean<T>
java.lang.Object
org.apache.mina.integration.jmx.ObjectMBean<T>
- Type Parameters:
T- the type of the managed object
- All Implemented Interfaces:
DynamicMBean,MBeanRegistration,ModelMBean,ModelMBeanNotificationBroadcaster,NotificationBroadcaster,PersistentMBean
- Direct Known Subclasses:
IoFilterMBean,IoServiceMBean,IoSessionMBean
A
ModelMBean wrapper implementation for a POJO.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MBeanInfoprotected static final org.slf4j.Loggerprivate ObjectNameprivate final Map<String,PropertyDescriptor> private MBeanServerprivate final Tprivate static final Map<ObjectName,Object> private final TransportMetadataprivate final ognl.TypeConverter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttributeChangeNotificationListener(NotificationListener listener, String name, Object handback) private voidaddAttributes(List<ModelMBeanAttributeInfo> attributes, Object object) private voidaddAttributes(List<ModelMBeanAttributeInfo> attributes, Object object, Class<?> type, String prefix) protected voidaddExtraAttributes(List<ModelMBeanAttributeInfo> attributes) protected voidaddExtraOperations(List<ModelMBeanOperationInfo> operations) voidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) private voidaddOperations(List<ModelMBeanOperationInfo> operations, Object object) private ObjectconvertCollection(Object src, Collection<Object> dst) private ObjectconvertCollection(Object src, Map<Object, Object> dst) private Class<?>convertType(Class<?> type, String attrName, Class<?> attrType, boolean writable) private ObjectconvertValue(Class<?> type, String attrName, Object v, boolean writable) private MBeanInfocreateModelMBeanInfo(T source) private voidexpandAttribute(List<ModelMBeanAttributeInfo> attributes, Object object, String prefix, PropertyDescriptor pdesc) private ObjectgetAttribute(Object object, String fqan, Class<?> attrType) final ObjectgetAttribute(String fqan) protected ObjectgetAttribute0(String fqan) private Class<?>getAttributeClass(String signature) final AttributeListgetAttributes(String[] names) protected Class<?>getElementType(Class<?> type, String attrName) private StringgetLeafAttributeName(String fqan) protected Class<?>getMapKeyType(Class<?> type, String attrName) protected Class<?>getMapValueType(Class<?> type, String attrName) final MBeanInfofinal ObjectNamegetName()private Objectprotected PropertyEditorgetPropertyEditor(Class<?> type, String attrName, Class<?> attrType) final MBeanServerfinal Tstatic ObjectgetSource(ObjectName oname) Get the monitored objectfinal Objectprotected Objectprotected booleanisExpandable(Class<?> type, String attrName) protected booleanisOperation(String methodName, Class<?>[] paramTypes) protected booleanisReadable(Class<?> type, String attrName) private booleanisWritable(Class<?> type, PropertyDescriptor pdesc) protected booleanisWritable(Class<?> type, String attrName) voidload()final voidfinal voidpostRegister(Boolean registrationDone) final voidfinal ObjectNamepreRegister(MBeanServer server, ObjectName name) voidremoveAttributeChangeNotificationListener(NotificationListener listener, String name) voidvoidsendAttributeChangeNotification(AttributeChangeNotification notification) voidsendAttributeChangeNotification(Attribute oldValue, Attribute newValue) voidsendNotification(String message) voidsendNotification(Notification notification) final voidsetAttribute(Attribute attribute) protected voidsetAttribute0(String attrName, Object attrValue) final AttributeListsetAttributes(AttributeList attributes) final voidsetManagedResource(Object resource, String type) final voidvoidstore()private voidfinal StringtoString()
-
Field Details
-
sources
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
source
-
transportMetadata
-
info
-
propertyDescriptors
-
typeConverter
private final ognl.TypeConverter typeConverter -
server
-
name
-
-
Constructor Details
-
ObjectMBean
Creates a new instance with the specified POJO.- Parameters:
source- The original POJO
-
-
Method Details
-
getSource
Get the monitored object- Parameters:
oname- The object name- Returns:
- The monitored object
-
getAttribute
public final Object getAttribute(String fqan) throws AttributeNotFoundException, MBeanException, ReflectionException - Specified by:
getAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionMBeanExceptionReflectionException
-
setAttribute
public final void setAttribute(Attribute attribute) throws AttributeNotFoundException, MBeanException, ReflectionException - Specified by:
setAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionMBeanExceptionReflectionException
-
invoke
public final Object invoke(String name, Object[] params, String[] signature) throws MBeanException, ReflectionException - Specified by:
invokein interfaceDynamicMBean- Throws:
MBeanExceptionReflectionException
-
getSource
- Returns:
- The monitored object
-
getServer
- Returns:
- The MBrean server
-
getName
- Returns:
- The monitored object name
-
getMBeanInfo
- Specified by:
getMBeanInfoin interfaceDynamicMBean
-
getAttributes
- Specified by:
getAttributesin interfaceDynamicMBean
-
setAttributes
- Specified by:
setAttributesin interfaceDynamicMBean
-
setManagedResource
public final void setManagedResource(Object resource, String type) throws InstanceNotFoundException, InvalidTargetObjectTypeException, MBeanException - Specified by:
setManagedResourcein interfaceModelMBean- Throws:
InstanceNotFoundExceptionInvalidTargetObjectTypeExceptionMBeanException
-
setModelMBeanInfo
- Specified by:
setModelMBeanInfoin interfaceModelMBean- Throws:
MBeanException
-
toString
-
addAttributeChangeNotificationListener
public void addAttributeChangeNotificationListener(NotificationListener listener, String name, Object handback) - Specified by:
addAttributeChangeNotificationListenerin interfaceModelMBeanNotificationBroadcaster
-
removeAttributeChangeNotificationListener
public void removeAttributeChangeNotificationListener(NotificationListener listener, String name) throws ListenerNotFoundException - Specified by:
removeAttributeChangeNotificationListenerin interfaceModelMBeanNotificationBroadcaster- Throws:
ListenerNotFoundException
-
sendAttributeChangeNotification
public void sendAttributeChangeNotification(AttributeChangeNotification notification) throws MBeanException - Specified by:
sendAttributeChangeNotificationin interfaceModelMBeanNotificationBroadcaster- Throws:
MBeanException
-
sendAttributeChangeNotification
public void sendAttributeChangeNotification(Attribute oldValue, Attribute newValue) throws MBeanException - Specified by:
sendAttributeChangeNotificationin interfaceModelMBeanNotificationBroadcaster- Throws:
MBeanException
-
sendNotification
- Specified by:
sendNotificationin interfaceModelMBeanNotificationBroadcaster- Throws:
MBeanException
-
sendNotification
- Specified by:
sendNotificationin interfaceModelMBeanNotificationBroadcaster- Throws:
MBeanException
-
addNotificationListener
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException - Specified by:
addNotificationListenerin interfaceNotificationBroadcaster- Throws:
IllegalArgumentException
-
getNotificationInfo
- Specified by:
getNotificationInfoin interfaceNotificationBroadcaster
-
removeNotificationListener
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException - Specified by:
removeNotificationListenerin interfaceNotificationBroadcaster- Throws:
ListenerNotFoundException
-
load
- Specified by:
loadin interfacePersistentMBean- Throws:
InstanceNotFoundExceptionMBeanExceptionRuntimeOperationsException
-
store
- Specified by:
storein interfacePersistentMBean- Throws:
InstanceNotFoundExceptionMBeanExceptionRuntimeOperationsException
-
preRegister
- Specified by:
preRegisterin interfaceMBeanRegistration- Throws:
Exception
-
postRegister
- Specified by:
postRegisterin interfaceMBeanRegistration
-
preDeregister
- Specified by:
preDeregisterin interfaceMBeanRegistration- Throws:
Exception
-
postDeregister
public final void postDeregister()- Specified by:
postDeregisterin interfaceMBeanRegistration
-
createModelMBeanInfo
-
addAttributes
-
addAttributes
private void addAttributes(List<ModelMBeanAttributeInfo> attributes, Object object, Class<?> type, String prefix) -
isWritable
-
expandAttribute
private void expandAttribute(List<ModelMBeanAttributeInfo> attributes, Object object, String prefix, PropertyDescriptor pdesc) -
addOperations
-
getParent
- Throws:
ognl.OgnlException
-
getLeafAttributeName
-
getAttributeClass
- Throws:
ClassNotFoundException
-
getAttribute
private Object getAttribute(Object object, String fqan, Class<?> attrType) throws ognl.OgnlException - Throws:
ognl.OgnlException
-
convertType
-
convertValue
-
convertCollection
-
convertCollection
-
throwMBeanException
- Throws:
MBeanException
-
getAttribute0
- Throws:
Exception
-
setAttribute0
- Throws:
Exception
-
invoke0
- Throws:
Exception
-
isReadable
-
isWritable
-
getElementType
-
getMapKeyType
-
getMapValueType
-
isExpandable
-
isOperation
-
addExtraAttributes
-
addExtraOperations
-
getPropertyEditor
-