geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r386515 [2/2] - in /geronimo/branches/1.1: applications/jmxdebug/src/java/org/apache/geronimo/jmxdebug/web/beanlib/ modules/kernel/src/java/org/apache/geronimo/gbean/ modules/kernel/src/java/org/apache/geronimo/gbean/runtime/ modules/kernel...
Date Fri, 17 Mar 2006 03:10:11 GMT
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/KernelDelegate.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/KernelDelegate.java?rev=386515&r1=386514&r2=386515&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/KernelDelegate.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/KernelDelegate.java Thu Mar 16 19:10:09 2006
@@ -62,7 +62,55 @@
     }
 
     public Naming getNaming() {
-        throw new UnsupportedOperationException();
+        return (Naming) getKernelAttribute("naming");
+    }
+
+    public Object getGBean(AbstractName name) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            return invokeKernel("getGBean", new Object[] {name}, new String[] {AbstractName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public Object getGBean(String shortName) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            return invokeKernel("getGBean", new Object[] {shortName}, new String[] {String.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public Object getGBean(Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            return invokeKernel("getGBean", new Object[] {type}, new String[] {Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public Object getGBean(String shortName, Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            return invokeKernel("getGBean", new Object[] {shortName, type}, new String[] {String.class.getName(), Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
     }
 
     public void loadGBean(GBeanData gbeanData, ClassLoader classLoader) throws GBeanAlreadyExistsException {
@@ -101,6 +149,42 @@
         }
     }
 
+    public void startGBean(String shortName) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("startGBean", new Object[] {shortName}, new String[] {String.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public void startGBean(Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("startGBean", new Object[] {type}, new String[] {Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public void startGBean(String shortName, Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("startGBean", new Object[] {shortName, type}, new String[] {String.class.getName(), Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public void startRecursiveGBean(ObjectName name) throws GBeanNotFoundException {
         try {
             invokeKernel("startRecursiveGBean", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -125,6 +209,83 @@
         }
     }
 
+    public void startRecursiveGBean(String shortName) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("startRecursiveGBean", new Object[] {shortName}, new String[] {String.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public void startRecursiveGBean(Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("startRecursiveGBean", new Object[] {type}, new String[] {Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public void startRecursiveGBean(String shortName, Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("startRecursiveGBean", new Object[] {shortName, type}, new String[] {String.class.getName(), Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public boolean isRunning(AbstractName name) {
+        try {
+            return ((Boolean) invokeKernel("isRunning", new Object[]{name}, new String[]{AbstractName.class.getName()})).booleanValue();
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+     }
+
+    public boolean isRunning(String shortName) {
+        try {
+            return ((Boolean) invokeKernel("isRunning", new Object[]{shortName}, new String[]{String.class.getName()})).booleanValue();
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public boolean isRunning(Class type) {
+        try {
+            return ((Boolean) invokeKernel("isRunning", new Object[]{type}, new String[]{Class.class.getName()})).booleanValue();
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public boolean isRunning(String shortName, Class type) {
+        try {
+            return ((Boolean) invokeKernel("isRunning", new Object[]{shortName, type}, new String[]{String.class.getName(), Class.class.getName()})).booleanValue();
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+
     public void stopGBean(ObjectName name) throws GBeanNotFoundException {
         try {
             invokeKernel("stopGBean", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -149,6 +310,42 @@
         }
     }
 
+    public void stopGBean(String shortName) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("stopGBean", new Object[] {shortName}, new String[] {String.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public void stopGBean(Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("stopGBean", new Object[] {type}, new String[] {Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public void stopGBean(String shortName, Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("stopGBean", new Object[] {shortName, type}, new String[] {String.class.getName(), Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public void unloadGBean(ObjectName name) throws GBeanNotFoundException {
         try {
             invokeKernel("unloadGBean", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -173,6 +370,42 @@
         }
     }
 
+    public void unloadGBean(String shortName) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("unloadGBean", new Object[] {shortName}, new String[] {String.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public void unloadGBean(Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("unloadGBean", new Object[] {type}, new String[] {Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public void unloadGBean(String shortName, Class type) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("unloadGBean", new Object[] {shortName, type}, new String[] {String.class.getName(), Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public int getGBeanState(ObjectName name) throws GBeanNotFoundException {
         try {
             return ((Integer) invokeKernel("getGBeanState", new Object[]{name}, new String[]{ObjectName.class.getName()})).intValue();
@@ -197,6 +430,42 @@
         }
     }
 
+    public int getGBeanState(String shortName) throws GBeanNotFoundException {
+        try {
+            return ((Integer) invokeKernel("getGBeanState", new Object[]{shortName}, new String[]{String.class.getName()})).intValue();
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public int getGBeanState(Class type) throws GBeanNotFoundException {
+        try {
+            return ((Integer) invokeKernel("getGBeanState", new Object[]{type}, new String[]{Class.class.getName()})).intValue();
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public int getGBeanState(String shortName, Class type) throws GBeanNotFoundException {
+        try {
+            return ((Integer) invokeKernel("getGBeanState", new Object[]{shortName, type}, new String[]{String.class.getName(), Class.class.getName()})).intValue();
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public long getGBeanStartTime(ObjectName name) throws GBeanNotFoundException {
         try {
             return ((Long) invokeKernel("getGBeanStartTime", new Object[]{name}, new String[]{ObjectName.class.getName()})).longValue();
@@ -221,6 +490,42 @@
         }
     }
 
+    public long getGBeanStartTime(String shortName) throws GBeanNotFoundException {
+        try {
+            return ((Long) invokeKernel("getGBeanStartTime", new Object[]{shortName}, new String[]{String.class.getName()})).longValue();
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public long getGBeanStartTime(Class type) throws GBeanNotFoundException {
+        try {
+            return ((Long) invokeKernel("getGBeanStartTime", new Object[]{type}, new String[]{Class.class.getName()})).longValue();
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public long getGBeanStartTime(String shortName, Class type) throws GBeanNotFoundException {
+        try {
+            return ((Long) invokeKernel("getGBeanStartTime", new Object[]{shortName, type}, new String[]{String.class.getName(), Class.class.getName()})).longValue();
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public boolean isGBeanEnabled(ObjectName name) throws GBeanNotFoundException {
         try {
             return ((Boolean) invokeKernel("isGBeanEnabled", new Object[] {name}, new String[] {ObjectName.class.getName()})).booleanValue();
@@ -277,6 +582,18 @@
         return invokeKernel("getAttribute", new Object[]{abstractName, attributeName}, new String[]{AbstractName.class.getName(), String.class.getName()});
     }
 
+    public Object getAttribute(String shortName, String attributeName) throws GBeanNotFoundException, NoSuchAttributeException, Exception {
+        return invokeKernel("getAttribute", new Object[]{shortName, attributeName}, new String[]{String.class.getName(), String.class.getName()});
+    }
+
+    public Object getAttribute(Class type, String attributeName) throws GBeanNotFoundException, NoSuchAttributeException, Exception {
+        return invokeKernel("getAttribute", new Object[]{type, attributeName}, new String[]{Class.class.getName(), String.class.getName()});
+    }
+
+    public Object getAttribute(String shortName, Class type, String attributeName) throws GBeanNotFoundException, NoSuchAttributeException, Exception {
+        return invokeKernel("getAttribute", new Object[]{shortName, type, attributeName}, new String[]{String.class.getName(), Class.class.getName(), String.class.getName()});
+    }
+
     public void setAttribute(ObjectName objectName, String attributeName, Object attributeValue) throws Exception {
         invokeKernel("setAttribute", new Object[]{objectName, attributeName, attributeValue}, new String[]{ObjectName.class.getName(), String.class.getName(), Object.class.getName()});
     }
@@ -285,6 +602,18 @@
         invokeKernel("setAttribute", new Object[]{abstractName, attributeName, attributeValue}, new String[]{AbstractName.class.getName(), String.class.getName(), Object.class.getName()});
     }
 
+    public void setAttribute(String shortName, String attributeName, Object attributeValue) throws GBeanNotFoundException, NoSuchAttributeException, Exception {
+        invokeKernel("setAttribute", new Object[]{shortName, attributeName, attributeValue}, new String[]{String.class.getName(), String.class.getName(), Object.class.getName()});
+    }
+
+    public void setAttribute(Class type, String attributeName, Object attributeValue) throws GBeanNotFoundException, NoSuchAttributeException, Exception {
+        invokeKernel("setAttribute", new Object[]{type, attributeName, attributeValue}, new String[]{Class.class.getName(), String.class.getName(), Object.class.getName()});
+    }
+
+    public void setAttribute(String shortName, Class type, String attributeName, Object attributeValue) throws GBeanNotFoundException, NoSuchAttributeException, Exception {
+        invokeKernel("setAttribute", new Object[]{shortName, type, attributeName, attributeValue}, new String[]{String.class.getName(), Class.class.getName(), String.class.getName(), Object.class.getName()});
+    }
+
     public Object invoke(ObjectName objectName, String methodName) throws Exception {
         return invokeKernel("invoke", new Object[]{objectName, methodName}, new String[]{ObjectName.class.getName(), String.class.getName()});
     }
@@ -293,6 +622,18 @@
         return invokeKernel("invoke", new Object[]{abstractName, methodName}, new String[]{AbstractName.class.getName(), String.class.getName()});
     }
 
+    public Object invoke(String shortName, String methodName) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception {
+        return invokeKernel("invoke", new Object[]{shortName, methodName}, new String[]{String.class.getName(), String.class.getName()});
+    }
+
+    public Object invoke(Class type, String methodName) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception {
+        return invokeKernel("invoke", new Object[]{type, methodName}, new String[]{Class.class.getName(), String.class.getName()});
+    }
+
+    public Object invoke(String shortName, Class type, String methodName) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception {
+        return invokeKernel("invoke", new Object[]{shortName, type, methodName}, new String[]{String.class.getName(), Class.class.getName(), String.class.getName()});
+    }
+
     public Object invoke(ObjectName objectName, String methodName, Object[] args, String[] types) throws Exception {
         return invokeKernel("invoke", new Object[]{objectName, methodName, args, types}, new String[]{ObjectName.class.getName(), String.class.getName(), Object[].class.getName(), String[].class.getName()});
     }
@@ -301,6 +642,18 @@
         return invokeKernel("invoke", new Object[]{abstractName, methodName, args, types}, new String[]{AbstractName.class.getName(), String.class.getName(), Object[].class.getName(), String[].class.getName()});
     }
 
+    public Object invoke(String shortName, String methodName, Object[] args, String[] types) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception {
+        return invokeKernel("invoke", new Object[]{shortName, methodName, args, types}, new String[]{String.class.getName(), String.class.getName(), Object[].class.getName(), String[].class.getName()});
+    }
+
+    public Object invoke(Class type, String methodName, Object[] args, String[] types) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception {
+        return invokeKernel("invoke", new Object[]{type, methodName, args, types}, new String[]{Class.class.getName(), String.class.getName(), Object[].class.getName(), String[].class.getName()});
+    }
+
+    public Object invoke(String shortName, Class type, String methodName, Object[] args, String[] types) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception {
+        return invokeKernel("invoke", new Object[]{shortName, type, methodName, args, types}, new String[]{String.class.getName(), Class.class.getName(), String.class.getName(), Object[].class.getName(), String[].class.getName()});
+    }
+
     public boolean isLoaded(ObjectName name) {
         try {
             return ((Boolean) invokeKernel("isLoaded", new Object[]{name}, new String[]{ObjectName.class.getName()})).booleanValue();
@@ -321,6 +674,36 @@
         }
      }
 
+    public boolean isLoaded(String shortName) {
+        try {
+            return ((Boolean) invokeKernel("isLoaded", new Object[]{shortName}, new String[]{String.class.getName()})).booleanValue();
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public boolean isLoaded(Class type) {
+        try {
+            return ((Boolean) invokeKernel("isLoaded", new Object[]{type}, new String[]{Class.class.getName()})).booleanValue();
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public boolean isLoaded(String shortName, Class type) {
+        try {
+            return ((Boolean) invokeKernel("isLoaded", new Object[]{shortName, type}, new String[]{String.class.getName(), Class.class.getName()})).booleanValue();
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public GBeanInfo getGBeanInfo(ObjectName name) throws GBeanNotFoundException {
         try {
             return (GBeanInfo) invokeKernel("getGBeanInfo", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -345,6 +728,42 @@
         }
     }
 
+    public GBeanInfo getGBeanInfo(String shortName) throws GBeanNotFoundException {
+        try {
+            return (GBeanInfo) invokeKernel("getGBeanInfo", new Object[] {shortName}, new String[] {String.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public GBeanInfo getGBeanInfo(Class type) throws GBeanNotFoundException {
+        try {
+            return (GBeanInfo) invokeKernel("getGBeanInfo", new Object[] {type}, new String[] {Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public GBeanInfo getGBeanInfo(String shortName, Class type) throws GBeanNotFoundException {
+        try {
+            return (GBeanInfo) invokeKernel("getGBeanInfo", new Object[] {shortName, type}, new String[] {String.class.getName(), Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public Set listGBeans(ObjectName pattern) {
         try {
             return (Set) invokeKernel("listGBeans", new Object[] {pattern}, new String[] {ObjectName.class.getName()});
@@ -417,6 +836,54 @@
         }
     }
 
+    public ClassLoader getClassLoaderFor(AbstractName name) throws GBeanNotFoundException {
+        try {
+            return (ClassLoader) invokeKernel("getClassLoaderFor", new Object[] {name}, new String[] {ObjectName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public ClassLoader getClassLoaderFor(String shortName) throws GBeanNotFoundException {
+        try {
+            return (ClassLoader) invokeKernel("getClassLoaderFor", new Object[] {shortName}, new String[] {String.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public ClassLoader getClassLoaderFor(Class type) throws GBeanNotFoundException {
+        try {
+            return (ClassLoader) invokeKernel("getClassLoaderFor", new Object[] {type}, new String[] {Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public ClassLoader getClassLoaderFor(String shortName, Class type) throws GBeanNotFoundException {
+        try {
+            return (ClassLoader) invokeKernel("getClassLoaderFor", new Object[] {shortName, type}, new String[] {String.class.getName(), Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public GBeanData getGBeanData(ObjectName name) throws GBeanNotFoundException {
         try {
             return (GBeanData) invokeKernel("getGBeanData", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -441,8 +908,49 @@
         }
     }
 
+    public GBeanData getGBeanData(String shortName) throws GBeanNotFoundException, InternalKernelException {
+        try {
+            return (GBeanData) invokeKernel("getGBeanData", new Object[] {shortName}, new String[] {String.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public GBeanData getGBeanData(Class type) throws GBeanNotFoundException, InternalKernelException {
+        try {
+            return (GBeanData) invokeKernel("getGBeanData", new Object[] {type}, new String[] {Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
+    public GBeanData getGBeanData(String shortName, Class type) throws GBeanNotFoundException, InternalKernelException {
+        try {
+            return (GBeanData) invokeKernel("getGBeanData", new Object[] {shortName, type}, new String[] {String.class.getName(), Class.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public AbstractName getAbstractNameFor(Object service) {
         return proxyManager.getProxyTarget(service);
+    }
+
+    public String getShortNameFor(Object service) {
+        AbstractName name = getAbstractNameFor(service);
+        return (String) name.getName().get("name");
     }
 
     public boolean isRunning() {

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanInfoFactoryTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanInfoFactoryTest.java?rev=386515&r1=386514&r2=386515&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanInfoFactoryTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanInfoFactoryTest.java Thu Mar 16 19:10:09 2006
@@ -68,8 +68,8 @@
         GBeanInfoBuilder gbeanInfoFactory = new GBeanInfoBuilder(MockGBean.class, MockGBean.getGBeanInfo());
         assertEquals(MockGBean.class.getName(), gbeanInfoFactory.getBeanInfo().getName());
         assertEquals(MockGBean.class.getName(), gbeanInfoFactory.getBeanInfo().getClassName());
-        assertEquals(2, gbeanInfoFactory.getBeanInfo().getAttributes().size());
-        assertEquals(0, gbeanInfoFactory.getBeanInfo().getOperations().size());
+        assertEquals(6, gbeanInfoFactory.getBeanInfo().getAttributes().size());
+        assertEquals(11, gbeanInfoFactory.getBeanInfo().getOperations().size());
     }
 
     /*
@@ -80,37 +80,26 @@
 
         gbeanInfoFactory = new GBeanInfoBuilder(MockGBean.class);
         gbeanInfoFactory.addInterface(Serializable.class);
-        assertTrue(gbeanInfoFactory.getBeanInfo().getAttributes().size() == 0);
-        assertTrue(gbeanInfoFactory.getBeanInfo().getOperations().size() == 0);
+        assertEquals(4, gbeanInfoFactory.getBeanInfo().getAttributes().size());
+        assertEquals(11, gbeanInfoFactory.getBeanInfo().getOperations().size());
 
         gbeanInfoFactory = new GBeanInfoBuilder(MockGBean.class);
         gbeanInfoFactory.addInterface(GBeanLifecycle.class);
         GBeanInfo gbeanInfo = gbeanInfoFactory.getBeanInfo();
-        assertTrue(gbeanInfo.getAttributes().size() == 0);
-        assertTrue(gbeanInfo.getOperations().size() == 3);
+        assertEquals(4, gbeanInfoFactory.getBeanInfo().getAttributes().size());
+        assertEquals(11, gbeanInfoFactory.getBeanInfo().getOperations().size());
 
         gbeanInfoFactory = new GBeanInfoBuilder(MockGBean.class);
         gbeanInfoFactory.addInterface(SetterOnlyInterface.class);
         gbeanInfo = gbeanInfoFactory.getBeanInfo();
-        assertEquals(1, gbeanInfo.getAttributes().size());
-        GAttributeInfo gattrInfo = (GAttributeInfo) gbeanInfo.getAttributes().iterator().next();
+        assertEquals(4, gbeanInfo.getAttributes().size());
+        GAttributeInfo gattrInfo = gbeanInfo.getAttribute("int");
         assertEquals("int", gattrInfo.getName());
         assertEquals("setInt", gattrInfo.getSetterName());
-        assertNull(gattrInfo.getGetterName());
-
-        Set opsSet = gbeanInfo.getOperations();
-        assertEquals(0, opsSet.size());
-
-        gbeanInfoFactory.addInterface(GetterOnlyInterface.class);
-        gbeanInfo = gbeanInfoFactory.getBeanInfo();
-        assertEquals(1, gbeanInfo.getAttributes().size());
-        gattrInfo = (GAttributeInfo) gbeanInfo.getAttributes().iterator().next();
-        assertEquals("int", gattrInfo.getName());
         assertEquals("getInt", gattrInfo.getGetterName());
-        assertEquals("setInt", gattrInfo.getSetterName());
-        opsSet = gbeanInfo.getOperations();
-        assertEquals(0, opsSet.size());
 
+        Set opsSet = gbeanInfo.getOperations();
+        assertEquals(11, opsSet.size());
     }
 
     private static interface SetterOnlyInterface {

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanInfoTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanInfoTest.java?rev=386515&r1=386514&r2=386515&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanInfoTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanInfoTest.java Thu Mar 16 19:10:09 2006
@@ -60,7 +60,7 @@
 
     public void testGetAttributeSet() {
         Set attrSet = gbeanInfo.getAttributes();
-        assertEquals(4, attrSet.size());
+        assertEquals(7, attrSet.size());
         assertTrue(attrSet.contains(persistentAttrInfo));
         assertTrue(attrSet.contains(nonPersistentAttrInfo));
     }
@@ -80,7 +80,7 @@
 
     public void testGetOperationsSet() {
         Set gbeanOpSet = gbeanInfo.getOperations();
-        assertEquals(1, gbeanOpSet.size());
+        assertEquals(9, gbeanOpSet.size());
         assertTrue(gbeanOpSet.contains(opInfo));
     }
 

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ClassloadingTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ClassloadingTest.java?rev=386515&r1=386514&r2=386515&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ClassloadingTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ClassloadingTest.java Thu Mar 16 19:10:09 2006
@@ -17,7 +17,12 @@
 
 package org.apache.geronimo.kernel;
 
+import java.util.Set;
+import java.util.LinkedHashSet;
+import java.io.Serializable;
+
 import junit.framework.TestCase;
+import org.apache.geronimo.kernel.basic.BasicKernel;
 
 /**
  * Unit test for {@link org.apache.geronimo.kernel.ClassLoading} class.
@@ -114,6 +119,83 @@
         y = loadClass(x);
         assertEquals(t, y);
 
+    }
+
+    public void testGetAllTypes() throws Exception {
+        Set allTypes = ClassLoading.getAllTypes(MockGBean.class);
+        assertTrue(allTypes.contains(MockGBean.class));
+        assertTrue(allTypes.contains(Object.class));
+        assertTrue(allTypes.contains(MockEndpoint.class));
+        assertTrue(allTypes.contains(MockParentInterface1.class));
+        assertTrue(allTypes.contains(MockParentInterface2.class));
+        assertTrue(allTypes.contains(MockChildInterface1.class));
+        assertTrue(allTypes.contains(MockChildInterface2.class));
+        assertFalse(allTypes.contains(Comparable.class));
+    }
+
+    public void testReduceInterfaces() throws Exception {
+        Set types = new LinkedHashSet();
+
+        // single class
+        types.add(MockGBean.class);
+        types = ClassLoading.reduceInterfaces(types);
+        assertTrue(types.contains(MockGBean.class));
+        assertFalse(types.contains(Object.class));
+        assertFalse(types.contains(MockEndpoint.class));
+        assertFalse(types.contains(MockParentInterface1.class));
+        assertFalse(types.contains(MockParentInterface2.class));
+        assertFalse(types.contains(MockChildInterface1.class));
+        assertFalse(types.contains(MockChildInterface2.class));
+        assertFalse(types.contains(Comparable.class));
+
+        // all types
+        types = ClassLoading.getAllTypes(MockGBean.class);
+        types = ClassLoading.reduceInterfaces(types);
+        assertTrue(types.contains(MockGBean.class));
+        assertFalse(types.contains(Object.class));
+        assertFalse(types.contains(MockEndpoint.class));
+        assertFalse(types.contains(MockParentInterface1.class));
+        assertFalse(types.contains(MockParentInterface2.class));
+        assertFalse(types.contains(MockChildInterface1.class));
+        assertFalse(types.contains(MockChildInterface2.class));
+        assertFalse(types.contains(Comparable.class));
+
+        // double all types
+        types = ClassLoading.getAllTypes(MockGBean.class);
+        types.addAll(ClassLoading.getAllTypes(MockGBean.class));
+        types = ClassLoading.reduceInterfaces(types);
+        assertTrue(types.contains(MockGBean.class));
+        assertFalse(types.contains(Object.class));
+        assertFalse(types.contains(MockEndpoint.class));
+        assertFalse(types.contains(MockParentInterface1.class));
+        assertFalse(types.contains(MockParentInterface2.class));
+        assertFalse(types.contains(MockChildInterface1.class));
+        assertFalse(types.contains(MockChildInterface2.class));
+        assertFalse(types.contains(Comparable.class));
+
+        // extra interfaces
+        types = ClassLoading.getAllTypes(MockGBean.class);
+        types.addAll(ClassLoading.getAllTypes(Kernel.class));
+        types.addAll(ClassLoading.getAllTypes(Serializable.class));
+        types = ClassLoading.reduceInterfaces(types);
+        assertTrue(types.contains(Kernel.class));
+        assertTrue(types.contains(Serializable.class));
+        assertTrue(types.contains(MockGBean.class));
+        assertFalse(types.contains(Object.class));
+        assertFalse(types.contains(MockEndpoint.class));
+        assertFalse(types.contains(MockParentInterface1.class));
+        assertFalse(types.contains(MockParentInterface2.class));
+        assertFalse(types.contains(MockChildInterface1.class));
+        assertFalse(types.contains(MockChildInterface2.class));
+        assertFalse(types.contains(Comparable.class));
+
+        // two different types
+        types = ClassLoading.getAllTypes(MockGBean.class);
+        try {
+            types.addAll(ClassLoading.getAllTypes(BasicKernel.class));
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
     }
 
     private Class loadClass(String name) {

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java?rev=386515&r1=386514&r2=386515&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java Thu Mar 16 19:10:09 2006
@@ -22,6 +22,9 @@
 import java.util.Set;
 
 import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import junit.extensions.TestSetup;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
@@ -30,20 +33,79 @@
 import org.apache.geronimo.kernel.proxy.ProxyFactory;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.jmx.KernelDelegate;
+import org.apache.geronimo.kernel.jmx.MBeanServerDelegate;
 import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PatternLayout;
 
 /**
- * @version $Rev$ $Date$
+ * @version $Rev: 386505 $ $Date$
  */
 public class GBeanTest extends TestCase {
+    private static KernelWraper kernelWraper = new KernelWraper();
+    private Kernel realKernel;
     private Kernel kernel;
 
+    /**
+     * Test with plain unwrapped kernel
+     */
+    private static class KernelWraper {
+        public Kernel wrap(Kernel kernel) {
+            return kernel;
+        }
+    }
+
+    /**
+     * Test with kernel wrapped in KernelGBean
+     */
+    private static class GBeanKernelLifecycle extends KernelWraper {
+        public Kernel wrap(Kernel kernel) {
+            return new KernelGBean(kernel);
+        }
+    }
+
+    /**
+     * Test with kernel wrapped in KernelDelegate
+     */
+    private static class JmxKernelLifecycle extends KernelWraper {
+        public Kernel wrap(Kernel kernel) {
+            MBeanServerDelegate mbeanServer = new MBeanServerDelegate(kernel);
+            return new KernelDelegate(mbeanServer);
+        }
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new TestSuite();
+        TestSuite inner = new TestSuite(GBeanTest.class);
+
+        suite.addTest(new TestSetup(inner) {
+            protected void setUp() throws Exception {
+                super.setUp();
+                kernelWraper = new KernelWraper();
+            }
+        });
+
+        suite.addTest(new TestSetup(inner) {
+            protected void setUp() throws Exception {
+                super.setUp();
+                kernelWraper = new GBeanKernelLifecycle();
+            }
+        });
+
+        suite.addTest(new TestSetup(inner) {
+            protected void setUp() throws Exception {
+                super.setUp();
+                kernelWraper = new JmxKernelLifecycle();
+            }
+        });
+        return suite;
+    }
+
     public void testListGBeans() throws Exception {
         GBeanData gbean = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
-        
+
         kernel.loadGBean(gbean, getClass().getClassLoader());
         kernel.startGBean(gbean.getAbstractName());
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean.getAbstractName()));
@@ -53,12 +115,239 @@
         assertEquals(gbean.getAbstractName(), gbeans.iterator().next());
     }
 
+    public void testLifeCycle() throws Exception {
+        GBeanData gbean = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
+        gbean.setAttribute("finalInt", new Integer(123));
+
+        // abstract name
+        assertFalse(kernel.isLoaded(gbean.getAbstractName()));
+        assertFalse(kernel.isRunning(gbean.getAbstractName()));
+
+        kernel.loadGBean(gbean, getClass().getClassLoader());
+        assertTrue(kernel.isLoaded(gbean.getAbstractName()));
+        assertFalse(kernel.isRunning(gbean.getAbstractName()));
+
+        kernel.startGBean(gbean.getAbstractName());
+        assertTrue(kernel.isLoaded(gbean.getAbstractName()));
+        assertTrue(kernel.isRunning(gbean.getAbstractName()));
+
+        kernel.stopGBean(gbean.getAbstractName());
+        assertTrue(kernel.isLoaded(gbean.getAbstractName()));
+        assertFalse(kernel.isRunning(gbean.getAbstractName()));
+
+        kernel.unloadGBean(gbean.getAbstractName());
+        assertFalse(kernel.isLoaded(gbean.getAbstractName()));
+        assertFalse(kernel.isRunning(gbean.getAbstractName()));
+
+
+        // short name
+        assertFalse(kernel.isLoaded("name"));
+        assertFalse(kernel.isRunning("name"));
+
+        kernel.loadGBean(gbean, getClass().getClassLoader());
+        assertTrue(kernel.isLoaded("name"));
+        assertFalse(kernel.isRunning("name"));
+
+        kernel.startGBean("name");
+        assertTrue(kernel.isLoaded("name"));
+        assertTrue(kernel.isRunning("name"));
+
+        kernel.stopGBean("name");
+        assertTrue(kernel.isLoaded("name"));
+        assertFalse(kernel.isRunning("name"));
+
+        kernel.unloadGBean("name");
+        assertFalse(kernel.isLoaded("name"));
+        assertFalse(kernel.isRunning("name"));
+
+
+        // type
+        assertFalse(kernel.isLoaded(MockGBean.class));
+        assertFalse(kernel.isRunning(MockGBean.class));
+
+        kernel.loadGBean(gbean, getClass().getClassLoader());
+        assertTrue(kernel.isLoaded(MockGBean.class));
+        assertFalse(kernel.isRunning(MockGBean.class));
+
+        kernel.startGBean(MockGBean.class);
+        assertTrue(kernel.isLoaded(MockGBean.class));
+        assertTrue(kernel.isRunning(MockGBean.class));
+
+        kernel.stopGBean(MockGBean.class);
+        assertTrue(kernel.isLoaded(MockGBean.class));
+        assertFalse(kernel.isRunning(MockGBean.class));
+
+        kernel.unloadGBean(MockGBean.class);
+        assertFalse(kernel.isLoaded(MockGBean.class));
+        assertFalse(kernel.isRunning(MockGBean.class));
+
+
+        // short name and type
+        assertFalse(kernel.isLoaded("name", MockGBean.class));
+        assertFalse(kernel.isRunning("name", MockGBean.class));
+
+        kernel.loadGBean(gbean, getClass().getClassLoader());
+        assertTrue(kernel.isLoaded("name", MockGBean.class));
+        assertFalse(kernel.isRunning("name", MockGBean.class));
+
+        kernel.startGBean("name", MockGBean.class);
+        assertTrue(kernel.isLoaded("name", MockGBean.class));
+        assertTrue(kernel.isRunning("name", MockGBean.class));
+
+        kernel.stopGBean("name", MockGBean.class);
+        assertTrue(kernel.isLoaded("name", MockGBean.class));
+        assertFalse(kernel.isRunning("name", MockGBean.class));
+
+        kernel.unloadGBean("name", MockGBean.class);
+        assertFalse(kernel.isLoaded("name", MockGBean.class));
+        assertFalse(kernel.isRunning("name", MockGBean.class));
+    }
+
+    public void testGetGBean() throws Exception {
+        GBeanData gbean = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
+        gbean.setAttribute("finalInt", new Integer(123));
+
+        kernel.loadGBean(gbean, getClass().getClassLoader());
+        kernel.startGBean(gbean.getAbstractName());
+        assertTrue(kernel.isRunning(gbean.getAbstractName()));
+
+        // abstract name
+        MockGBean mockGBean = (MockGBean) kernel.getGBean(gbean.getAbstractName());
+        assertEquals(123, mockGBean.getFinalInt());
+        assertNull(kernel.getProxyManager().getProxyTarget(mockGBean));
+
+        // short name
+        mockGBean = (MockGBean) kernel.getGBean("name");
+        assertEquals(123, mockGBean.getFinalInt());
+        assertNull(kernel.getProxyManager().getProxyTarget(mockGBean));
+
+        // type
+        mockGBean = (MockGBean) kernel.getGBean(MockGBean.class);
+        assertEquals(123, mockGBean.getFinalInt());
+        assertNull(kernel.getProxyManager().getProxyTarget(mockGBean));
+
+        // short name and type
+        mockGBean = (MockGBean) kernel.getGBean("name", MockGBean.class);
+        assertEquals(123, mockGBean.getFinalInt());
+        assertNull(kernel.getProxyManager().getProxyTarget(mockGBean));
+    }
+
+    public void testInvoke() throws Exception {
+        GBeanData gbean = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
+        String testValue = "test-value";
+        String otherValue = "other-value";
+        gbean.setAttribute("value", testValue);
+
+        kernel.loadGBean(gbean, getClass().getClassLoader());
+        kernel.startGBean(gbean.getAbstractName());
+        assertTrue(kernel.isRunning(gbean.getAbstractName()));
+        MockGBean mockGBean = (MockGBean) kernel.getGBean(gbean.getAbstractName());
+
+        //
+        // abstract name
+        //
+
+        // get and set on gbean
+        assertEquals(testValue, mockGBean.getValue());
+        mockGBean.setValue(otherValue);
+        assertEquals(otherValue, mockGBean.getValue());
+        mockGBean.setValue(testValue);
+
+        // get and set with kernel
+        assertEquals(testValue, kernel.getAttribute(gbean.getAbstractName(), "value"));
+        kernel.setAttribute(gbean.getAbstractName(), "value", otherValue);
+        assertEquals(otherValue, kernel.getAttribute(gbean.getAbstractName(), "value"));
+        kernel.setAttribute(gbean.getAbstractName(), "value", testValue);
+        assertEquals(testValue, kernel.getAttribute(gbean.getAbstractName(), "value"));
+
+        // invoke
+        assertEquals(testValue, mockGBean.fetchValue());
+        assertEquals(testValue, kernel.invoke(gbean.getAbstractName(), "fetchValue"));
+        assertEquals(testValue, mockGBean.doSomething(testValue));
+        assertEquals(testValue, kernel.invoke(gbean.getAbstractName(), "doSomething", new Object[] {testValue}, new String[] {String.class.getName()}));
+        assertEquals(testValue, mockGBean.getValue());
+
+        //
+        // short name
+        //
+
+        // get and set on gbean
+        assertEquals(testValue, mockGBean.getValue());
+        mockGBean.setValue(otherValue);
+        assertEquals(otherValue, mockGBean.getValue());
+        mockGBean.setValue(testValue);
+
+        // get and set with kernel
+        assertEquals(testValue, kernel.getAttribute("name", "value"));
+        kernel.setAttribute("name", "value", otherValue);
+        assertEquals(otherValue, kernel.getAttribute("name", "value"));
+        kernel.setAttribute("name", "value", testValue);
+        assertEquals(testValue, kernel.getAttribute("name", "value"));
+
+        // invoke
+        assertEquals(testValue, mockGBean.fetchValue());
+        assertEquals(testValue, kernel.invoke("name", "fetchValue"));
+        assertEquals(testValue, mockGBean.doSomething(testValue));
+        assertEquals(testValue, kernel.invoke("name", "doSomething", new Object[] {testValue}, new String[] {String.class.getName()}));
+        assertEquals(testValue, mockGBean.getValue());
+
+        //
+        // type
+        //
+
+        // get and set on gbean
+        assertEquals(testValue, mockGBean.getValue());
+        mockGBean.setValue(otherValue);
+        assertEquals(otherValue, mockGBean.getValue());
+        mockGBean.setValue(testValue);
+
+        // get and set with kernel
+        assertEquals(testValue, kernel.getAttribute(MockGBean.class, "value"));
+        kernel.setAttribute(MockGBean.class, "value", otherValue);
+        assertEquals(otherValue, kernel.getAttribute(MockGBean.class, "value"));
+        kernel.setAttribute(MockGBean.class, "value", testValue);
+        assertEquals(testValue, kernel.getAttribute(MockGBean.class, "value"));
+
+        // invoke
+        assertEquals(testValue, mockGBean.fetchValue());
+        assertEquals(testValue, kernel.invoke(MockGBean.class, "fetchValue"));
+        assertEquals(testValue, mockGBean.doSomething(testValue));
+        assertEquals(testValue, kernel.invoke(MockGBean.class, "doSomething", new Object[] {testValue}, new String[] {String.class.getName()}));
+        assertEquals(testValue, mockGBean.getValue());
+
+        //
+        // short name and type
+        //
+
+        // get and set on gbean
+        assertEquals(testValue, mockGBean.getValue());
+        mockGBean.setValue(otherValue);
+        assertEquals(otherValue, mockGBean.getValue());
+        mockGBean.setValue(testValue);
+
+        // get and set with kernel
+        assertEquals(testValue, kernel.getAttribute("name", MockGBean.class, "value"));
+        kernel.setAttribute("name", MockGBean.class, "value", otherValue);
+        assertEquals(otherValue, kernel.getAttribute("name", MockGBean.class, "value"));
+        kernel.setAttribute("name", MockGBean.class, "value", testValue);
+        assertEquals(testValue, kernel.getAttribute("name", MockGBean.class, "value"));
+
+        // invoke
+        assertEquals(testValue, mockGBean.fetchValue());
+        assertEquals(testValue, kernel.invoke("name", MockGBean.class, "fetchValue"));
+        assertEquals(testValue, mockGBean.doSomething(testValue));
+        assertEquals(testValue, kernel.invoke("name", MockGBean.class, "doSomething", new Object[] {testValue}, new String[] {String.class.getName()}));
+        assertEquals(testValue, mockGBean.getValue());
+
+    }
+
     public void testLoad() throws Exception {
         ClassLoader cl = getClass().getClassLoader();
         ClassLoader myCl = new URLClassLoader(new URL[0], cl);
         GBeanData gbean = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
         gbean.setAttribute("name", "Test");
         gbean.setAttribute("finalInt", new Integer(123));
+
         kernel.loadGBean(gbean, myCl);
         kernel.startGBean(gbean.getAbstractName());
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean.getAbstractName()));
@@ -73,8 +362,8 @@
         // handles this directly the implementation method will never be called
         kernel.getAttribute(gbean.getAbstractName(), "classLoader");
 
-        assertSame(kernel, kernel.getAttribute(gbean.getAbstractName(), "kernel"));
-        assertSame(kernel, kernel.getAttribute(gbean.getAbstractName(), "actualKernel"));
+        assertSame(realKernel, kernel.getAttribute(gbean.getAbstractName(), "kernel"));
+        assertSame(realKernel, kernel.getAttribute(gbean.getAbstractName(), "actualKernel"));
 
         kernel.stopGBean(gbean.getAbstractName());
         kernel.unloadGBean(gbean.getAbstractName());
@@ -96,6 +385,26 @@
         assertEquals("endpointCheck", kernel.invoke(gbean2.getAbstractName(), "checkEndpoint", null, null));
     }
 
+    public void testNoProxyEndpoint() throws Exception {
+        ClassLoader cl = MockGBean.class.getClassLoader();
+        GBeanData gbean1 = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
+        gbean1.setAttribute("finalInt", new Integer(123));
+        kernel.loadGBean(gbean1, cl);
+        kernel.startGBean(gbean1.getAbstractName());
+
+        GBeanData gbean2 = buildGBeanData("name", "test2", MockGBean.getGBeanInfo());
+        gbean2.setAttribute("finalInt", new Integer(123));
+        gbean2.setReferencePattern("MockEndpoint", gbean1.getAbstractName());
+        kernel.loadGBean(gbean2, cl);
+        kernel.startGBean(gbean2.getAbstractName());
+
+
+        MockGBean mockGBean1 = (MockGBean) kernel.getGBean(gbean1.getAbstractName());
+        MockGBean mockGBean2 = (MockGBean) kernel.getGBean(gbean2.getAbstractName());
+        // this can only be tested of no proxy is on
+//        assertSame(mockGBean2.getMockEndpoint(), mockGBean1);
+    }
+
     public void testProxiesInterfaces() throws Exception {
         ClassLoader cl = getClass().getClassLoader();
         ClassLoader myCl = new URLClassLoader(new URL[0], cl);
@@ -194,8 +503,8 @@
         }
 
         try {
-            // two classes
-            test = mgr.createProxyFactory(new Class[]{MockGBean.class, Object.class}, cl).createProxy(gbean.getAbstractName());
+            // two non-assibnable classes
+            test = mgr.createProxyFactory(new Class[]{MockGBean.class, String.class}, cl).createProxy(gbean.getAbstractName());
             fail();
         } catch (IllegalArgumentException e) {
         }
@@ -205,12 +514,15 @@
         super.setUp();
         Logger.getRootLogger().addAppender(new ConsoleAppender(new PatternLayout("%p [%t] %m %n")));
         Logger.getRootLogger().setLevel(Level.DEBUG);
-        kernel = KernelFactory.newInstance().createKernel("test");
-        kernel.boot();
+        realKernel = KernelFactory.newInstance().createKernel("test");
+        realKernel.boot();
+        kernel = kernelWraper.wrap(realKernel);
     }
 
     protected void tearDown() throws Exception {
-        kernel.shutdown();
+        realKernel.shutdown();
+        realKernel = null;
+        kernel = null;
         super.tearDown();
     }
 

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java?rev=386515&r1=386514&r2=386515&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java Thu Mar 16 19:10:09 2006
@@ -75,6 +75,7 @@
         infoFactory.addOperation("checkEndpoint");
         infoFactory.addOperation("checkEndpointCollection");
         infoFactory.addOperation("doSomething", new Class[]{String.class});
+        infoFactory.addOperation("fetchValue");
 
         infoFactory.addInterface(MockEndpoint.class, new String[]{"mutableInt"});
         infoFactory.addInterface(MockParentInterface1.class, new String[]{"value"});
@@ -231,6 +232,10 @@
     }
 
     public String getValue() {
+        return value;
+    }
+
+    public String fetchValue() {
         return value;
     }
 



Mime
View raw message