You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2005/08/13 08:30:06 UTC

svn commit: r232430 - in /geronimo/trunk/modules: j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/ jetty/src/java/org/apache/geronimo/jetty/ jetty/src/java/org/apache/geronimo/jetty/connector/ jetty/src/test/org/apache/geronimo/jetty/connect...

Author: ammulder
Date: Fri Aug 12 23:29:55 2005
New Revision: 232430

URL: http://svn.apache.org/viewcvs?rev=232430&view=rev
Log:
Add GeronimoManagedBean interface with StateManageable and getObjectName
  methods
 - implement it in all proxies with a suitable ClassLoader
 - implement the methods as kernel calls from the proxy method interceptors
 - update the web container/connectors to not implement StateManageable
   directly since their proxies will get it instead
 - remove start and startRecursive handling from GBeanInstance
 - unbreak proxies based on classes (for proxies that implement a class and
   one or more interfaces), with updated tests

Added:
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/GeronimoManagedBean.java   (with props)
Modified:
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java
    geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java
    geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java
    geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java

Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java Fri Aug 12 23:29:55 2005
@@ -26,7 +26,7 @@
  *
  * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16 Sep 2004) $
  */
-public interface NetworkConnector extends StateManageable {
+public interface NetworkConnector {
     /**
      * Gets the network protocol that this connector handles.
      */
@@ -63,12 +63,4 @@
      * are set separately using setHost and setPort.
      */
     InetSocketAddress getListenAddress();
-
-    /**
-     * Gets the unique name of this object.  The object name must comply with
-     * the ObjectName specification in the JMX specification.
-     *
-     * @return the unique name of this object within the server
-     */
-    String getObjectName();
 }

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java Fri Aug 12 23:29:55 2005
@@ -52,7 +52,7 @@
 /**
  * @version $Rev$ $Date$
  */
-public class JettyContainerImpl implements JettyContainer, SoapHandler, StateManageable, GBeanLifecycle {
+public class JettyContainerImpl implements JettyContainer, SoapHandler, GBeanLifecycle {
     private final static Log log = LogFactory.getLog(JettyContainerImpl.class);
     private final Server server;
     private final Map webServices = new HashMap();
@@ -234,6 +234,7 @@
             connector = new GBeanData(name, HTTPConnector.GBEAN_INFO);
         } else if(protocol.equals(PROTOCOL_HTTPS)) {
             connector = new GBeanData(name, HTTPSConnector.GBEAN_INFO);
+            //todo: default HTTPS settings
         } else if(protocol.equals(PROTOCOL_AJP)) {
             connector = new GBeanData(name, AJP13Connector.GBEAN_INFO);
         } else {
@@ -241,6 +242,8 @@
         }
         connector.setAttribute("host", host);
         connector.setAttribute("port", new Integer(port));
+        connector.setAttribute("minThreads", new Integer(10));
+        connector.setAttribute("maxThreads", new Integer(50));
         connector.setReferencePattern("JettyContainer", myName);
         ObjectName config = Util.getConfiguration(kernel, myName);
         try {
@@ -324,38 +327,6 @@
         }
     }
 
-    public int getState() {
-        try {
-            return kernel.getGBeanState(myName);
-        } catch (GBeanNotFoundException e) {
-            return State.STOPPED_INDEX;
-        }
-    }
-
-    public State getStateInstance() {
-        return State.fromInt(getState());
-    }
-
-    public long getStartTime() {
-        try {
-            return kernel.getGBeanStartTime(myName);
-        } catch (GBeanNotFoundException e) {
-            return -1;
-        }
-    }
-
-    public void start() throws Exception, IllegalStateException {
-        // Kernel intercepts this
-    }
-
-    public void startRecursive() throws Exception, IllegalStateException {
-        // Kernel intercepts this
-    }
-
-    public void stop() throws Exception, IllegalStateException {
-        kernel.stopGBean(myName);
-    }
-
     public static final GBeanInfo GBEAN_INFO;
 
     static {
@@ -390,7 +361,6 @@
 
         infoBuilder.addInterface(SoapHandler.class);
         infoBuilder.addInterface(JettyContainer.class);
-        infoBuilder.addInterface(StateManageable.class);
         infoBuilder.setConstructor(new String[]{"kernel","objectName"});
 
         GBEAN_INFO = infoBuilder.getBeanInfo();

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java Fri Aug 12 23:29:55 2005
@@ -20,7 +20,6 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.jetty.JettyContainer;
-import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
 import org.mortbay.http.ajp.AJP13Listener;
 
@@ -28,8 +27,8 @@
  * @version $Rev$ $Date$
  */
 public class AJP13Connector extends JettyConnector {
-    public AJP13Connector(JettyContainer container, String objectName, Kernel kernel) {
-        super(container, new AJP13Listener(), objectName, kernel);
+    public AJP13Connector(JettyContainer container) {
+        super(container, new AJP13Listener());
     }
 
     public String getProtocol() {
@@ -40,7 +39,7 @@
 
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty Connector AJP13", AJP13Connector.class, JettyConnector.GBEAN_INFO);
-        infoFactory.setConstructor(new String[]{"JettyContainer","objectName","kernel"});
+        infoFactory.setConstructor(new String[]{"JettyContainer"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java Fri Aug 12 23:29:55 2005
@@ -20,7 +20,6 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.jetty.JettyContainer;
-import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
 import org.mortbay.http.SocketListener;
 
@@ -28,8 +27,8 @@
  * @version $Rev$ $Date$
  */
 public class HTTPConnector extends JettyConnector {
-    public HTTPConnector(JettyContainer container, String objectName, Kernel kernel) {
-        super(container, new SocketListener(), objectName, kernel);
+    public HTTPConnector(JettyContainer container) {
+        super(container, new SocketListener());
     }
 
     public String getProtocol() {
@@ -40,7 +39,7 @@
 
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty Connector HTTP", HTTPConnector.class, JettyConnector.GBEAN_INFO);
-        infoFactory.setConstructor(new String[]{"JettyContainer","objectName","kernel"});
+        infoFactory.setConstructor(new String[]{"JettyContainer"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java Fri Aug 12 23:29:55 2005
@@ -27,7 +27,6 @@
 import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
 import org.apache.geronimo.jetty.JettyContainer;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.geronimo.kernel.Kernel;
 
 /**
  * Implementation of a HTTPS connector based on Jetty's SslConnector (which uses pure JSSE).
@@ -40,8 +39,8 @@
     private String keystore;
     private String algorithm;
 
-    public HTTPSConnector(JettyContainer container, ServerInfo serverInfo, String objectName, Kernel kernel) {
-        super(container, new SslListener(), objectName, kernel);
+    public HTTPSConnector(JettyContainer container, ServerInfo serverInfo) {
+        super(container, new SslListener());
         this.serverInfo = serverInfo;
         https = (SslListener) listener;
     }
@@ -129,7 +128,7 @@
         infoFactory.addAttribute("password", String.class, true);
         infoFactory.addAttribute("secureProtocol", String.class, true);
         infoFactory.addReference("ServerInfo", ServerInfo.class, NameFactory.GERONIMO_SERVICE);
-        infoFactory.setConstructor(new String[]{"JettyContainer", "ServerInfo", "objectName", "kernel"});
+        infoFactory.setConstructor(new String[]{"JettyContainer", "ServerInfo"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java Fri Aug 12 23:29:55 2005
@@ -20,18 +20,12 @@
 import java.net.UnknownHostException;
 import java.net.InetSocketAddress;
 
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.jetty.JettyContainer;
 import org.apache.geronimo.jetty.JettyWebConnector;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.management.StateManageable;
-import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.Kernel;
 import org.mortbay.http.HttpListener;
 import org.mortbay.util.ThreadedServer;
 
@@ -41,8 +35,6 @@
 public abstract class JettyConnector implements GBeanLifecycle, JettyWebConnector {
     private final JettyContainer container;
     protected final HttpListener listener;
-    private final ObjectName objectName;
-    private final Kernel kernel;
 
     /**
      * Only used to allow declaration as a reference.
@@ -50,34 +42,16 @@
     public JettyConnector() {
         container = null;
         listener = null;
-        objectName = null;
-        kernel = null;
     }
 
-    public JettyConnector(JettyContainer container, String objectName, Kernel kernel) {
+    public JettyConnector(JettyContainer container) {
         this.container = container;
         this.listener = null;
-        this.kernel = kernel;
-        try {
-            this.objectName = ObjectName.getInstance(objectName);
-        } catch (MalformedObjectNameException e) {
-            throw new IllegalArgumentException(e.getMessage());
-        }
     }
 
-    public JettyConnector(JettyContainer container, HttpListener listener, String objectName, Kernel kernel) {
+    public JettyConnector(JettyContainer container, HttpListener listener) {
         this.container = container;
         this.listener = listener;
-        this.kernel = kernel;
-        try {
-            this.objectName = ObjectName.getInstance(objectName);
-        } catch (MalformedObjectNameException e) {
-            throw new IllegalArgumentException(e.getMessage());
-        }
-    }
-
-    public String getObjectName() {
-        return objectName.getCanonicalName();
     }
 
     public String getDefaultScheme() {
@@ -203,45 +177,11 @@
         }
     }
 
-    public int getState() {
-        try {
-            return kernel.getGBeanState(objectName);
-        } catch (GBeanNotFoundException e) {
-            return State.STOPPED_INDEX;
-        }
-    }
-
-    public State getStateInstance() {
-        return State.fromInt(getState());
-    }
-
-    public long getStartTime() {
-        try {
-            return kernel.getGBeanStartTime(objectName);
-        } catch (GBeanNotFoundException e) {
-            return -1;
-        }
-    }
-
-    public void start() throws Exception, IllegalStateException {
-        // Kernel intercepts this
-    }
-
-    public void startRecursive() throws Exception, IllegalStateException {
-        // Kernel intercepts this
-    }
-
-    public void stop() throws Exception, IllegalStateException {
-        kernel.stopGBean(objectName);
-    }
-
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty HTTP Connector", JettyConnector.class);
         infoFactory.addAttribute("defaultScheme", String.class, false);
-        infoFactory.addAttribute("objectName", String.class, false);
-        infoFactory.addAttribute("kernel", Kernel.class, false);
         infoFactory.addAttribute("host", String.class, true);
         infoFactory.addAttribute("port", int.class, true);
         infoFactory.addAttribute("minThreads", int.class, true);
@@ -251,8 +191,7 @@
         infoFactory.addAttribute("listenAddress", InetSocketAddress.class, false);
         infoFactory.addReference("JettyContainer", JettyContainer.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.addInterface(JettyWebConnector.class);
-        infoFactory.addInterface(StateManageable.class);
-        infoFactory.setConstructor(new String[] {"JettyContainer","objectName","kernel"});
+        infoFactory.setConstructor(new String[] {"JettyContainer"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 }

Modified: geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java (original)
+++ geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java Fri Aug 12 23:29:55 2005
@@ -35,6 +35,6 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        connector = new HTTPConnector(null, "foo:bar=baz", null);
+        connector = new HTTPConnector(null);
     }
 }

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java Fri Aug 12 23:29:55 2005
@@ -242,23 +242,10 @@
             referenceIndex.put(references[i].getName(), new Integer(i));
         }
 
-        // framework operations
-        GBeanOperation opStart = GBeanOperation.createFrameworkOperation(this, "start", Collections.EMPTY_LIST, new MethodInvoker() {
-            public Object invoke(Object target, Object[] arguments) throws Exception {
-                GBeanInstance.this.kernel.startGBean(objectName);
-                return null;
-            }
-        });
-        GBeanOperation opStartRecursive = GBeanOperation.createFrameworkOperation(this, "startRecursive", Collections.EMPTY_LIST, new MethodInvoker() {
-            public Object invoke(Object target, Object[] arguments) throws Exception {
-                GBeanInstance.this.kernel.startRecursiveGBean(objectName);
-                return null;
-            }
-        });
+        // framework operations -- all framework operations have currently been removed
+
         // operations
         Map operationsMap = new HashMap();
-        operationsMap.put(new GOperationSignature("start", new String[0]), opStart);
-        operationsMap.put(new GOperationSignature("startRecursive", new String[0]), opStartRecursive);
         for (Iterator iterator = gbeanInfo.getOperations().iterator(); iterator.hasNext();) {
             GOperationInfo operationInfo = (GOperationInfo) iterator.next();
             GOperationSignature signature = new GOperationSignature(operationInfo.getName(), operationInfo.getParameterList());

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java Fri Aug 12 23:29:55 2005
@@ -35,9 +35,13 @@
 import org.apache.commons.logging.LogFactory;
 
 /**
+ * Creates proxies that communicate directly with a Kernel located in the same
+ * JVM as the client.
+ *
  * @version $Rev$ $Date$
  */
 public class BasicProxyManager implements ProxyManager {
+    private final String MANAGED_BEAN_NAME = "org.apache.geronimo.kernel.proxy.GeronimoManagedBean";
     private final static Log log = LogFactory.getLog(BasicProxyManager.class);
     private final Kernel kernel;
 
@@ -50,11 +54,42 @@
 
     public synchronized ProxyFactory createProxyFactory(Class type) {
         assert type != null: "type is null";
-        return new ManagedProxyFactory(type);
+        if(type.getClassLoader() == null) {
+            // Can't load GeronimoManagedBean if the incoming type doesn't have a ClassLoader set
+            log.debug("Unable to add GeronimoManagedBean to proxy for "+type.getName()+" (no CL)");
+            return new ManagedProxyFactory(type);
+        } else {
+            try {
+                final Class managedBean = type.getClassLoader().loadClass(MANAGED_BEAN_NAME);
+                return new ManagedProxyFactory(new Class[]{type, managedBean});
+            } catch (ClassNotFoundException e) {
+                log.debug("Unable to add GeronimoManagedBean to proxy for "+type.getName()+" (not in CL)");
+                return new ManagedProxyFactory(type);
+            }
+        }
     }
 
     public synchronized ProxyFactory createProxyFactory(Class[] type) {
         assert type != null: "type is null";
+        assert type.length > 0: "interface list is empty";
+        Class managedBean = null;
+        for (int i = 0; i < type.length; i++) {
+            if(type[i].getClassLoader() != null) {
+                try {
+                    managedBean = type[i].getClassLoader().loadClass(MANAGED_BEAN_NAME);
+                    break;
+                } catch (ClassNotFoundException e) {} // OK, we'll try the next one
+            }
+        }
+        if(managedBean != null) {
+            Class[] adjusted = new Class[type.length+1];
+            System.arraycopy(type, 0, adjusted, 0, type.length);
+            adjusted[type.length] = managedBean;
+            type = adjusted;
+        } else {
+            // Can't load GeronimoManagedBean if the incoming type doesn't have a ClassLoader set
+            log.debug("Unable to add GeronimoManagedBean to proxy (no proxy classes have ClassLoaders)");
+        }
         return new ManagedProxyFactory(type);
     }
 
@@ -91,9 +126,6 @@
         if(required == null && (optional == null || optional.length == 0)) {
             throw new IllegalArgumentException("Cannot create proxy for no interfaces");
         }
-        if(required != null && !required.isInterface()) {
-            throw new IllegalArgumentException("Cannot create a proxy for a class (only interfaces) -- "+required.getName());
-        }
         List list = new ArrayList();
         if(required != null) {
             list.add(required);
@@ -103,9 +135,6 @@
                 GBeanInfo info = kernel.getGBeanInfo(target);
                 Set set = info.getInterfaces();
                 for (int i = 0; i < optional.length; i++) {
-                    if (!optional[i].isInterface()) {
-                        throw new IllegalArgumentException("Cannot create a proxy for a class (only interfaces) -- " + optional[i].getName());
-                    }
                     if (set.contains(optional[i].getName())) {
                         list.add(optional[i]);
                     }
@@ -114,6 +143,9 @@
                 throw new IllegalArgumentException("Could not get GBeanInfo for target object: " + target);
             }
         }
+        if(list.size() == 0) {
+            return null;
+        }
         return createProxyFactory((Class[]) list.toArray(new Class[list.size()])).createProxy(target);
     }
 
@@ -171,11 +203,18 @@
             }
             if(type.length == 0) {
                 throw new IllegalArgumentException("Cannot generate proxy for 0 interfaces!");
-            } else if(type.length == 1) {
+            } else if(type.length == 1) { // Unlikely (as a result of GeronimoManagedBean)
                 enhancer.setSuperclass(type[0]);
             } else {
-                enhancer.setSuperclass(Object.class);
-                enhancer.setInterfaces(type);
+                if(type[0].isInterface()) {
+                    enhancer.setSuperclass(Object.class);
+                    enhancer.setInterfaces(type);
+                } else { // there's a class and reduceInterfaces put the class in the first spot
+                    Class[] intfs = new Class[type.length-1];
+                    System.arraycopy(type, 1, intfs, 0, intfs.length);
+                    enhancer.setSuperclass(type[0]);
+                    enhancer.setInterfaces(intfs);
+                }
             }
             enhancer.setCallbackType(MethodInterceptor.class);
             enhancer.setUseFactory(false);
@@ -198,18 +237,28 @@
         /**
          * If there are multiple interfaces, and some of them extend each other,
          * eliminate the superclass in favor of the subclasses that extend them.
+         *
+         * If one of the entries is a class (not an interface), make sure it's
+         * the first one in the array.  If more than one of the entries is a
+         * class, throws an IllegalArgumentException
+         *
          * @param source the original list of interfaces
          * @return the equal or smaller list of interfaces
          */
         private Class[] reduceInterfaces(Class[] source) {
             boolean changed = false;
+            Class cls = null;
             for (int i = 0; i < source.length-1; i++) {
                 Class original = source[i];
                 if(original == null) {
                     continue;
                 }
                 if(!original.isInterface()) {
-                    throw new IllegalArgumentException(original.getName()+" is not an interface; cannot generate proxy");
+                    if(cls != null) {
+                        throw new IllegalArgumentException(original.getName()+" is not an interface (already have "+cls.getName()+"); can only have one non-interface class for proxy");
+                    } else {
+                        cls = original;
+                    }
                 }
                 for (int j = i+1; j < source.length; j++) {
                     Class other = source[j];
@@ -217,23 +266,41 @@
                         continue;
                     }
                     if(!other.isInterface()) {
-                        throw new IllegalArgumentException(other.getName()+" is not an interface; cannot generate proxy");
+                        if(cls != null) {
+                            throw new IllegalArgumentException(other.getName()+" is not an interface (already have "+cls.getName()+"); can only have one non-interface class for proxy");
+                        } else {
+                            cls = other;
+                        }
                     }
                     if(other.isAssignableFrom(original)) {
-                        other = null;
+                        source[j] = null; // clear out "other"
                         changed = true;
                     } else if(original.isAssignableFrom(other)) {
-                        original = null;
+                        source[i] = null; // clear out "original"
                         changed = true;
                         break; // the original has been eliminated; move on to the next original
                     }
                 }
             }
 
+            if(cls != null) {
+                if(cls != source[0]) {
+                    for (int i = 0; i < source.length; i++) {
+                        if(cls == source[i]) {
+                            Class temp = source[0];
+                            source[0] = source[i];
+                            source[i] = temp;
+                            break;
+                        }
+                    }
+                    changed = true;
+                }
+            }
+
             if(!changed) {
                 return source;
             }
-            List list = new ArrayList(source.length-1);
+            List list = new ArrayList(source.length);
             for (int i = 0; i < source.length; i++) {
                 if(source[i] != null) {
                     list.add(source[i]);

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java Fri Aug 12 23:29:55 2005
@@ -36,8 +36,10 @@
 import org.apache.geronimo.gbean.runtime.GBeanInstance;
 import org.apache.geronimo.gbean.runtime.RawInvoker;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.proxy.DeadProxyException;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
+import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
 
 /**
  * @version $Rev: 106345 $ $Date: 2004-11-23 12:37:03 -0800 (Tue, 23 Nov 2004) $
@@ -108,6 +110,15 @@
             invokers[getSuperIndex(proxyType, proxyType.getMethod("equals", new Class[]{Object.class}))] = new EqualsInvoke(kernel.getProxyManager());
             invokers[getSuperIndex(proxyType, proxyType.getMethod("hashCode", null))] = new HashCodeInvoke();
             invokers[getSuperIndex(proxyType, proxyType.getMethod("toString", null))] = new ToStringInvoke(proxyType.getName());
+            if(GeronimoManagedBean.class.isAssignableFrom(proxyType)) {
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("getState", null))] = new GetStateInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("getStateInstance", null))] = new GetStateInstanceInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("start", null))] = new StartInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("startRecursive", null))] = new StartRecursiveInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("stop", null))] = new StopInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("getStartTime", null))] = new GetStartTimeInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("getObjectName", null))] = new GetObjectNameInvoke();
+            }
         } catch (Exception e) {
             // this can not happen... all classes must implement equals, hashCode and toString
             throw new AssertionError(e);
@@ -303,6 +314,87 @@
 
         public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
             return interfaceName + objectName + "]";
+        }
+    }
+
+    static final class GetStateInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public GetStateInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            return new Integer(kernel.getGBeanState(objectName));
+        }
+    }
+
+    static final class GetStateInstanceInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public GetStateInstanceInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            return State.fromInt(kernel.getGBeanState(objectName));
+        }
+    }
+
+    static final class StartInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public StartInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            kernel.startRecursiveGBean(objectName);
+            return null;
+        }
+    }
+
+    static final class StartRecursiveInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public StartRecursiveInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            kernel.startRecursiveGBean(objectName);
+            return null;
+        }
+    }
+
+    static final class GetStartTimeInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public GetStartTimeInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            return new Long(kernel.getGBeanStartTime(objectName));
+        }
+    }
+
+    static final class StopInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public StopInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            kernel.stopGBean(objectName);
+            return null;
+        }
+    }
+
+    static final class GetObjectNameInvoke implements ProxyInvoker {
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            return objectName.getCanonicalName();
         }
     }
 }

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java Fri Aug 12 23:29:55 2005
@@ -26,12 +26,14 @@
 import net.sf.cglib.proxy.MethodProxy;
 import net.sf.cglib.reflect.FastClass;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.basic.KernelGetAttributeInvoker;
 import org.apache.geronimo.kernel.basic.KernelOperationInvoker;
 import org.apache.geronimo.kernel.basic.KernelSetAttributeInvoker;
 import org.apache.geronimo.kernel.basic.ProxyInvoker;
 import org.apache.geronimo.kernel.proxy.DeadProxyException;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
+import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
 
 /**
  * @version $Rev: 106345 $ $Date: 2004-11-23 12:37:03 -0800 (Tue, 23 Nov 2004) $
@@ -106,6 +108,15 @@
             invokers[getSuperIndex(proxyType, proxyType.getMethod("equals", new Class[]{Object.class}))] = new EqualsInvoke(kernel.getProxyManager());
             invokers[getSuperIndex(proxyType, proxyType.getMethod("hashCode", null))] = new HashCodeInvoke();
             invokers[getSuperIndex(proxyType, proxyType.getMethod("toString", null))] = new ToStringInvoke(proxyType.getName());
+            if(GeronimoManagedBean.class.isAssignableFrom(proxyType)) {
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("getState", null))] = new GetStateInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("getStateInstance", null))] = new GetStateInstanceInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("start", null))] = new StartInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("startRecursive", null))] = new StartRecursiveInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("stop", null))] = new StopInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("getStartTime", null))] = new GetStartTimeInvoke(kernel);
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("getObjectName", null))] = new GetObjectNameInvoke();
+            }
         } catch (Exception e) {
             // this can not happen... all classes must implement equals, hashCode and toString
             throw new AssertionError(e);
@@ -188,6 +199,87 @@
 
         public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
             return interfaceName + objectName + "]";
+        }
+    }
+
+    static final class GetStateInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public GetStateInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            return new Integer(kernel.getGBeanState(objectName));
+        }
+    }
+
+    static final class GetStateInstanceInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public GetStateInstanceInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            return State.fromInt(kernel.getGBeanState(objectName));
+        }
+    }
+
+    static final class StartInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public StartInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            kernel.startRecursiveGBean(objectName);
+            return null;
+        }
+    }
+
+    static final class StartRecursiveInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public StartRecursiveInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            kernel.startRecursiveGBean(objectName);
+            return null;
+        }
+    }
+
+    static final class GetStartTimeInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public GetStartTimeInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            return new Long(kernel.getGBeanStartTime(objectName));
+        }
+    }
+
+    static final class StopInvoke implements ProxyInvoker {
+        private Kernel kernel;
+
+        public StopInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            kernel.stopGBean(objectName);
+            return null;
+        }
+    }
+
+    static final class GetObjectNameInvoke implements ProxyInvoker {
+        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+            return objectName.getCanonicalName();
         }
     }
 }

Added: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/GeronimoManagedBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/GeronimoManagedBean.java?rev=232430&view=auto
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/GeronimoManagedBean.java (added)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/GeronimoManagedBean.java Fri Aug 12 23:29:55 2005
@@ -0,0 +1,111 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.kernel.proxy;
+
+import org.apache.geronimo.kernel.management.State;
+
+/**
+ * Interface provided by proxies generated by the Geronimo proxy managers.
+ * This lets a client call any of these methods on a proxy representing
+ * any Geronimo GBean.  However, this should not be used on any arbitrary
+ * GBean reference, as it might not be a proxy generated by Geronimo (for
+ * example, if you're running the GBean in Spring).
+ *
+ * Note that this includes the content of the JSR-77 StateManageable type,
+ * as well as getObjectName from the JSR-77 J2EEManagedObject type.
+ * However, it is not explicitly related to JSR-77 as that is not required
+ * in order to use the Geronimo kernel.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public interface GeronimoManagedBean {
+    /**
+     * Gets the unique name of this object.  The object name must comply with the ObjectName specification
+     * in the JMX specification and the restrictions in the J2EEManagementInterface.
+     *
+     * @return the unique name of this object within the server
+     */
+    String getObjectName();
+
+    /**
+     * Gets the state of this component as an int.
+     * The int return is required by the JSR77 specification.
+     *
+     * @return the current state of this component
+     * @see #getStateInstance to obtain the State instance
+     */
+    int getState();
+
+    /**
+     * Gets the state of this component as a State instance.
+     *
+     * @return the current state of this component
+     */
+    State getStateInstance();
+
+    /**
+     * Gets the start time of this component
+     *
+     * @return time in milliseonds since epoch that this component was started.
+     */
+    long getStartTime();
+
+
+    /**
+     * Transitions the component to the starting state.  This method has access to the
+     * container.
+     * <p/>
+     * Normally a component uses this to cache data from other components. The other components will
+     * have been created at this stage, but not necessairly started and may not be ready to have methods
+     * invoked on them.
+     *
+     * @throws Exception if a problem occurs during the transition
+     * @throws IllegalStateException if this interceptor is not in the stopped or failed state
+     */
+    void start() throws Exception, IllegalStateException;
+
+    /**
+     * Transitions the component to the starting state.  This method has access to the
+     * container.
+     * <p/>
+     * If this Component is a Container, then startRecursive is called on all child Components
+     * that are in the STOPPED or FAILED state.
+     * Normally a component uses this to cache data from other components. The other components will
+     * have been created at this stage, but not necessairly started and may not be ready to have methods
+     * invoked on them.
+     *
+     * @throws Exception if a problem occurs during the transition
+     * @throws IllegalStateException if this interceptor is not in the STOPPED or FAILED state
+     */
+    void startRecursive() throws Exception, IllegalStateException;
+
+    /**
+     * Transitions the component to the stopping state.  This method has access to the
+     * container.
+     * <p/>
+     * If this is Component is a Container, then all its child components must be in the
+     * STOPPED or FAILED State.
+     * <p/>
+     * Normally a component uses this to drop references to data cached in the start method.
+     * The other components will not necessairly have been stopped at this stage and may not be ready
+     * to have methods invoked on them.
+     *
+     * @throws Exception if a problem occurs during the transition
+     * @throws IllegalStateException if this interceptor is not in the STOPPED or FAILED state
+     */
+    void stop() throws Exception, IllegalStateException;
+}

Propchange: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/GeronimoManagedBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java Fri Aug 12 23:29:55 2005
@@ -20,12 +20,18 @@
 import javax.management.MalformedObjectNameException;
 
 /**
- * Manages kernel proxies
+ * Manages kernel proxies.  Note that all proxies will include an
+ * implementation of GeronimoManagedBean.
+ *
+ * @see org.apache.geronimo.kernel.proxy.GeronimoManagedBean
+ *
  * @version $Rev$ $Date$
  */
 public interface ProxyManager {
     /**
-     * Create a proxy factory which will generate proxies of the specified type
+     * Create a proxy factory which will generate proxies of the specified type,
+     * plus GeronimoManagedBean.
+     *
      * @param type the type of the proxies to create
      * @return the proxy factory
      */
@@ -34,8 +40,8 @@
     /**
      * Create a proxy for the specified target.  The proxy will implement
      * all of the interfaces that the underlying GBean specifies in its
-     * GBeanInfo.  If there are no interfaces in the GBeanInfo, this method
-     * will return null.
+     * GBeanInfo, plus GeronimoManagedBean.  If there are no interfaces in
+     * the GBeanInfo, this method will return null.
      *
      * @param target the target object name
      * @param loader the ClassLoader used to load the interfaces used by the
@@ -47,8 +53,8 @@
     /**
      * Create proxies for the specified targets.  The proxies will implement
      * all of the interfaces that the underlying GBeans specify in their
-     * GBeanInfo.  If there are no interfaces in the GBeanInfo, this method
-     * will return a null in that spot in the array.
+     * GBeanInfo, plus GeronimoManagedBean.  If there are no interfaces in the
+     * GBeanInfo, this method will return a null in that spot in the array.
      *
      * @param objectNameStrings An array of ObjectNames, each in String form
      * @param loader the ClassLoader used to load the interfaces used by the
@@ -61,7 +67,7 @@
 
     /**
      * Create a proxy for the specified target, implementing the specified
-     * interface.
+     * interface, plus GeronimoManagedBean.
      *
      * @param target the target object name
      * @param type the type of the proxy to create
@@ -73,7 +79,9 @@
      * Create a proxy for the specified target, implementing a variable
      * number of interfaces.  It's possible to specify one interface that must
      * be included, and also to specify a number of variable interfaces that
-     * the proxy should implement if the underlying GBean supports them. 
+     * the proxy should implement if the underlying GBean supports them.  Each
+     * proxy will also implement GeronimoManagedBean in addition to any
+     * interfaces provided as arguments.
      *
      * @param target the target object name
      * @param required an interface that the proxy must implement.  This may be
@@ -95,7 +103,9 @@
      * Create a proxy for the specified target, implementing a variable
      * number of interfaces.  It's possible to specify one interface that must
      * be included, and also to specify a number of variable interfaces that
-     * the proxy should implement if the underlying GBean supports them.
+     * the proxy should implement if the underlying GBean supports them.  Each
+     * proxy will also implement GeronimoManagedBean in addition to any
+     * interfaces provided as arguments.
      *
      * @param objectNameStrings An array of ObjectNames, each in String form
      * @param required an interface that the proxies must implement.  This may

Modified: geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java (original)
+++ geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java Fri Aug 12 23:29:55 2005
@@ -27,6 +27,7 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
+import org.apache.geronimo.kernel.basic.BasicProxyManager;
 
 /**
  * @version $Rev$ $Date$
@@ -158,10 +159,8 @@
         assertFalse(test instanceof MockChildInterface2);
         assertFalse(test instanceof Comparable);
 
-        try {
-            test = mgr.createProxy(name, null, new Class[]{Comparable.class}); // no implementable interface
-            fail();
-        }catch(IllegalArgumentException e) {}
+        test = mgr.createProxy(name, null, new Class[]{Comparable.class}); // no implementable interface
+        assertNull(test);
 
         try {
             test = mgr.createProxy(name, null, new Class[0]); // no interface
@@ -173,15 +172,15 @@
             fail();
         }catch(IllegalArgumentException e) {}
 
-        try {
-            test = mgr.createProxy(name, Class.class, null); // class not interface
-            fail();
-        }catch(IllegalArgumentException e) {}
+        test = mgr.createProxy(name, MockGBean.class, null); // class not interface
+        test = mgr.createProxy(name, MockGBean.class, new Class[]{MockEndpoint.class}); // class and interface
 
-        try {
-            test = mgr.createProxy(name, null, new Class[]{Class.class}); // class not interface
-            fail();
-        }catch(IllegalArgumentException e) {}
+        if(mgr instanceof BasicProxyManager) {
+            try { // two classes
+                test = ((BasicProxyManager)mgr).createProxyFactory(new Class[]{MockGBean.class, Object.class}).createProxy(name);
+                fail();
+            }catch(IllegalArgumentException e) {}
+        }
     }
 
     protected void setUp() throws Exception {

Modified: geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java?rev=232430&r1=232429&r2=232430&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java (original)
+++ geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java Fri Aug 12 23:29:55 2005
@@ -90,6 +90,11 @@
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 
+    public MockGBean() { // present so we can test creating a class-based proxy
+        name = null;
+        finalInt = 0;
+    }
+
     public MockGBean(String name, int finalInt) {
         this.name = name;
         this.finalInt = finalInt;