geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject svn commit: rev 55295 - in geronimo/trunk/modules/kernel/src/java/org/apache/geronimo: gbean/jmx kernel
Date Fri, 22 Oct 2004 01:48:51 GMT
Author: jboynes
Date: Thu Oct 21 18:48:50 2004
New Revision: 55295

Modified:
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java
Log:
allow clients to get a gbean's info; primarily intended to enumerate the attributes of a DynamicGBean

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java	Thu
Oct 21 18:48:50 2004
@@ -823,6 +823,17 @@
                             }
                         }));
 
+        attributesMap.put("gbeanInfo",
+                new GBeanMBeanAttribute((GBeanMBeanAttribute) attributesMap.get("gbeanInfo"),
+                        this,
+                        "gbeanInfo",
+                        GBeanInfo.class,
+                        new MethodInvoker() {
+                            public Object invoke(Object target, Object[] arguments) throws
Exception {
+                                return getGBeanInfo();
+                            }
+                        }));
+
         attributesMap.put("classLoader",
                 new GBeanMBeanAttribute((GBeanMBeanAttribute) attributesMap.get("classLoader"),
                         this,

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java	Thu Oct
21 18:48:50 2004
@@ -43,6 +43,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
@@ -247,6 +248,18 @@
 
     public boolean isLoaded(ObjectName name) {
         return mbServer != null && mbServer.isRegistered(name);
+    }
+
+    public GBeanInfo getGBeanInfo(ObjectName name) throws InstanceNotFoundException {
+        try {
+            return (GBeanInfo) getAttribute(name, "gbeanInfo");
+        } catch (InstanceNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new RuntimeException(e); 
+        }
     }
 
     public void loadGBean(ObjectName name, GBeanMBean gbean) throws InstanceAlreadyExistsException,
InvalidConfigException {

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java	Thu
Oct 21 18:48:50 2004
@@ -27,6 +27,7 @@
 import javax.management.ObjectName;
 
 import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
@@ -127,6 +128,14 @@
     Object invoke(ObjectName objectName, String methodName, Object[] args, String[] types)
throws Exception;
 
     boolean isLoaded(ObjectName name);
+
+    /**
+     * Return the GBean info for a gbean instance.
+     * @param name the name of the gbean whose info should be returned
+     * @return the info for that instance
+     * @throws InstanceNotFoundException if there is no instance with the supplied name
+     */
+    GBeanInfo getGBeanInfo(ObjectName name) throws InstanceNotFoundException;
 
     /**
      * Return the names of GBeans that match the query.

Mime
View raw message