[jboss-cvs] JBossAS SVN: r58352 - projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 14 14:11:21 EST 2006
Author: bstansberry at jboss.com
Date: 2006-11-14 14:11:20 -0500 (Tue, 14 Nov 2006)
New Revision: 58352
Modified:
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMX.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMXIntroduction.java
Log:
[JBMICROCONT-109] Support direct registration of beans without a StandardMBean wrapper
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMX.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMX.java 2006-11-14 18:25:24 UTC (rev 58351)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMX.java 2006-11-14 19:11:20 UTC (rev 58352)
@@ -30,12 +30,37 @@
* A temporary home for this annotation interface
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author Brian Stansberry
+ *
* @version $Revision$
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface JMX
{
+ /**
+ * The mbean interface the annotated object should expose. Ignored if
+ * {@link #registerDirectly()} is <code>true</code>.
+ *
+ * @return the mbean interface
+ */
Class exposedInterface();
+
+ /**
+ * String form of the ObjectName for the mbean.
+ *
+ * @return the object name
+ */
String name() default "";
+
+ /**
+ * Should the annotated object itself be directly registered with
+ * the MBeanServer, or should a <code>javax.management.StandardMBean</code>
+ * be created using the object and the
+ * {@link #exposedInterface() exposed interface}?
+ *
+ * @return <code>true</code> if the object should be registered directly,
+ * <code>false</code> if a StandardMBean should be created.
+ */
+ boolean registerDirectly() default false;
}
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMXIntroduction.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMXIntroduction.java 2006-11-14 18:25:24 UTC (rev 58351)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMXIntroduction.java 2006-11-14 19:11:20 UTC (rev 58352)
@@ -22,6 +22,7 @@
package org.jboss.aop.microcontainer.aspects.jmx;
import javax.management.MBeanServer;
+import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import javax.management.StandardMBean;
@@ -86,11 +87,14 @@
if ("setKernelControllerContext".equals(mi.getMethod().getName()))
{
Class intfClass = null;
+ boolean registerDirectly = false;
if (jmx != null)
{
intfClass = jmx.exposedInterface();
+ registerDirectly = jmx.registerDirectly();
}
- StandardMBean mbean = new StandardMBean(context.getTarget(), intfClass);
+ Object mbean = (registerDirectly ? context.getTarget()
+ : new StandardMBean(context.getTarget(), intfClass));
server.registerMBean(mbean, objectName);
log.info("Registered MBean " + objectName);
}
More information about the jboss-cvs-commits
mailing list