[jboss-cvs] JBossAS SVN: r82254 - in projects/demos/microcontainer/trunk/models/src/main: resources/META-INF and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Dec 13 05:15:07 EST 2008
Author: alesj
Date: 2008-12-13 05:15:07 -0500 (Sat, 13 Dec 2008)
New Revision: 82254
Added:
projects/demos/microcontainer/trunk/models/src/main/java/org/jboss/demos/models/jmx/MBeanServerQuery.java
projects/demos/microcontainer/trunk/models/src/main/resources/META-INF/z-mbeanquery-beans.xml
Log:
Add mbean query checker.
Added: projects/demos/microcontainer/trunk/models/src/main/java/org/jboss/demos/models/jmx/MBeanServerQuery.java
===================================================================
--- projects/demos/microcontainer/trunk/models/src/main/java/org/jboss/demos/models/jmx/MBeanServerQuery.java (rev 0)
+++ projects/demos/microcontainer/trunk/models/src/main/java/org/jboss/demos/models/jmx/MBeanServerQuery.java 2008-12-13 10:15:07 UTC (rev 82254)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.demos.models.jmx;
+
+import java.util.Set;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.QueryExp;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MBeanServerQuery
+{
+ private Logger log = Logger.getLogger(getClass());
+ private MBeanServer server;
+
+ public MBeanServerQuery(MBeanServer server)
+ {
+ if (server == null)
+ throw new IllegalArgumentException("Null server");
+
+ this.server = server;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Set<ObjectName> executeQuery(ObjectName name, QueryExp exp)
+ {
+ return server.queryNames(name, exp);
+ }
+
+ public void start()
+ {
+ Set<ObjectName> currentMBeans = executeQuery(null, null);
+ log.info("Listing all mbeans:");
+ int count = 0;
+ for (ObjectName on : currentMBeans)
+ {
+ log.info((++count) + ". " + on);
+ }
+ }
+}
Copied: projects/demos/microcontainer/trunk/models/src/main/resources/META-INF/z-mbeanquery-beans.xml (from rev 78584, projects/demos/microcontainer/trunk/models/src/main/resources/META-INF/spring-beans.xml)
===================================================================
--- projects/demos/microcontainer/trunk/models/src/main/resources/META-INF/z-mbeanquery-beans.xml (rev 0)
+++ projects/demos/microcontainer/trunk/models/src/main/resources/META-INF/z-mbeanquery-beans.xml 2008-12-13 10:15:07 UTC (rev 82254)
@@ -0,0 +1,9 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="MBeanQuery" class="org.jboss.demos.models.jmx.MBeanServerQuery">
+ <constructor>
+ <parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+ </constructor>
+ </bean>
+
+</deployment>
\ No newline at end of file
Property changes on: projects/demos/microcontainer/trunk/models/src/main/resources/META-INF/z-mbeanquery-beans.xml
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the jboss-cvs-commits
mailing list