Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 12591 invoked from network); 30 Nov 2004 22:56:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 30 Nov 2004 22:56:33 -0000 Received: (qmail 21517 invoked by uid 500); 30 Nov 2004 22:56:31 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 21474 invoked by uid 500); 30 Nov 2004 22:56:31 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@geronimo.apache.org Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 21428 invoked by uid 99); 30 Nov 2004 22:56:31 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 30 Nov 2004 14:56:27 -0800 Received: (qmail 12527 invoked by uid 65534); 30 Nov 2004 22:56:25 -0000 Date: 30 Nov 2004 22:56:25 -0000 Message-ID: <20041130225625.12523.qmail@minotaur.apache.org> From: dain@apache.org To: scm@geronimo.apache.org Subject: svn commit: r109251 - in geronimo/trunk/modules: axis/src/java/org/apache/geronimo/axis axis/src/test/org/apache/geronimo/axis axis/src/test/org/apache/geronimo/axis/testUtils connector/src/test/org/apache/geronimo/connector deployment/src/java/org/apache/geronimo/deployment/cli deployment/src/java/org/apache/geronimo/deployment/plugin/local j2ee/src/java/org/apache/geronimo/j2ee/mejb jetty/src/test/org/apache/geronimo/jetty kernel/src/java/org/apache/geronimo/gbean/jmx kernel/src/java/org/apache/geronimo/kernel kernel/src/java/org/apache/geronimo/kernel/config kernel/src/test/org/apache/geronimo/kernel mail/src/test/org/apache/geronimo/mail spring/src/java/org/apache/geronimo/spring system/src/java/org/apache/geronimo/system/main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: dain Date: Tue Nov 30 14:56:24 2004 New Revision: 109251 URL: http://svn.apache.org/viewcvs?view=rev&rev=109251 Log: Finished converting kernel methods to throw Geronimo specific exception insted of JMXExceptions Completed more of the Management EJB implementation Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/mejb/MEJB.java geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/BaseSecurityTest.java geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/DependencyManager.java geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java geronimo/trunk/modules/mail/src/test/org/apache/geronimo/mail/MailGBeanTest.java geronimo/trunk/modules/spring/src/java/org/apache/geronimo/spring/SpringGBean.java geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java?view=diff&rev=109251&p1=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java&r1=109250&p2=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java Tue Nov 30 14:56:24 2004 @@ -15,27 +15,6 @@ */ package org.apache.geronimo.axis; -import org.apache.axis.AxisFault; -import org.apache.axis.client.AdminClient; -import org.apache.axis.client.Call; -import org.apache.axis.utils.ClassUtils; -import org.apache.axis.utils.NetworkUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.geronimo.deployment.DeploymentException; -import org.apache.geronimo.gbean.GBeanData; -import org.apache.geronimo.gbean.jmx.GBeanMBean; -import org.apache.geronimo.kernel.Kernel; -import org.apache.geronimo.kernel.config.Configuration; -import org.apache.geronimo.kernel.config.ConfigurationStore; -import org.openejb.ContainerIndex; -import org.openejb.EJBContainer; - -import javax.ejb.EJBHome; -import javax.management.AttributeNotFoundException; -import javax.management.ObjectName; -import javax.management.ReflectionException; - import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; @@ -47,9 +26,9 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; import java.lang.reflect.Method; +import java.net.MalformedURLException; import java.net.URI; import java.net.URL; -import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; @@ -59,6 +38,26 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; +import javax.ejb.EJBHome; +import javax.management.AttributeNotFoundException; +import javax.management.ObjectName; +import javax.management.ReflectionException; + +import org.apache.axis.AxisFault; +import org.apache.axis.client.AdminClient; +import org.apache.axis.client.Call; +import org.apache.axis.utils.ClassUtils; +import org.apache.axis.utils.NetworkUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.geronimo.deployment.DeploymentException; +import org.apache.geronimo.gbean.GBeanData; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.kernel.config.Configuration; +import org.apache.geronimo.kernel.config.ConfigurationStore; +import org.openejb.ContainerIndex; +import org.openejb.EJBContainer; /** * @version $Rev$ $Date$ Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java?view=diff&rev=109251&p1=geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java&r1=109250&p2=geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java (original) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java Tue Nov 30 14:56:24 2004 @@ -20,8 +20,6 @@ import java.net.HttpURLConnection; import java.net.URL; import java.net.URLClassLoader; - -import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import org.apache.geronimo.axis.testUtils.TestingUtils; Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java?view=diff&rev=109251&p1=geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java&r1=109250&p2=geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java (original) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java Tue Nov 30 14:56:24 2004 @@ -20,15 +20,12 @@ import java.net.URL; import java.util.Collections; import java.util.Enumeration; -import java.util.List; import java.util.jar.JarFile; import java.util.zip.ZipEntry; - import javax.management.ObjectName; import javax.naming.Reference; import org.apache.geronimo.axis.AxisGeronimoUtils; -import org.apache.geronimo.axis.WSConfigBuilder; import org.apache.geronimo.axis.WSPlan; import org.apache.geronimo.deployment.DeploymentException; import org.apache.geronimo.gbean.GBeanData; Modified: geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java?view=diff&rev=109251&p1=geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java&r1=109250&p2=geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java (original) +++ geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java Tue Nov 30 14:56:24 2004 @@ -30,8 +30,6 @@ import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext; import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl; import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; -import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext; -import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl; import org.apache.geronimo.kernel.Kernel; /** Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java?view=diff&rev=109251&p1=geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java&r1=109250&p2=geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java (original) +++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java Tue Nov 30 14:56:24 2004 @@ -17,22 +17,23 @@ package org.apache.geronimo.deployment.cli; -import java.util.*; -import java.util.jar.JarFile; -import java.net.URI; import java.io.BufferedReader; -import java.io.PrintWriter; -import java.io.IOException; import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.jar.JarFile; +import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager; import javax.enterprise.deploy.spi.DeploymentManager; import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException; import javax.enterprise.deploy.spi.factories.DeploymentFactory; -import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager; import javax.management.ObjectName; -import javax.management.MalformedObjectNameException; + import org.apache.geronimo.deployment.DeploymentException; -import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl; import org.apache.geronimo.deployment.plugin.factories.AuthenticationFailedException; +import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl; import org.apache.geronimo.system.main.CommandLine; import org.apache.geronimo.system.main.CommandLineManifest; Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java?view=diff&rev=109251&p1=geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java&r1=109250&p2=geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java (original) +++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java Tue Nov 30 14:56:24 2004 @@ -105,6 +105,7 @@ } protected void doFail(Exception e) { + // todo dain: kernel does not throw any JMX exceptions anymore... do we still need this if (e instanceof MBeanException) { e = ((MBeanException)e).getTargetException(); } Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/mejb/MEJB.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/mejb/MEJB.java?view=diff&rev=109251&p1=geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/mejb/MEJB.java&r1=109250&p2=geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/mejb/MEJB.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/mejb/MEJB.java (original) +++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/mejb/MEJB.java Tue Nov 30 14:56:24 2004 @@ -16,10 +16,9 @@ */ package org.apache.geronimo.j2ee.mejb; -import java.rmi.RemoteException; +import java.util.HashSet; import java.util.Iterator; import java.util.Set; -import java.util.List; import javax.ejb.EJBHome; import javax.ejb.EJBObject; import javax.ejb.Handle; @@ -28,254 +27,227 @@ import javax.management.AttributeList; import javax.management.AttributeNotFoundException; import javax.management.InstanceNotFoundException; -import javax.management.IntrospectionException; -import javax.management.InvalidAttributeValueException; import javax.management.MBeanException; import javax.management.MBeanInfo; -import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.QueryExp; import javax.management.ReflectionException; -import javax.management.MBeanAttributeInfo; -import javax.management.MBeanConstructorInfo; -import javax.management.MBeanOperationInfo; -import javax.management.MBeanParameterInfo; -import javax.management.MBeanNotificationInfo; -import javax.management.NotificationListener; -import javax.management.NotificationFilter; -import javax.management.ListenerNotFoundException; import javax.management.j2ee.ListenerRegistration; import javax.management.j2ee.Management; import org.apache.geronimo.gbean.GBeanInfo; -import org.apache.geronimo.gbean.GAttributeInfo; -import org.apache.geronimo.gbean.GOperationInfo; -import org.apache.geronimo.gbean.GNotificationInfo; import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.gbean.jmx.GBeanJMXUtil; +import org.apache.geronimo.kernel.GBeanNotFoundException; +import org.apache.geronimo.kernel.InternalKernelException; import org.apache.geronimo.kernel.Kernel; import org.apache.geronimo.kernel.KernelMBean; +import org.apache.geronimo.kernel.NoSuchAttributeException; +import org.apache.geronimo.kernel.NoSuchOperationException; /** * GBean implementing Management interface and supplying proxies to act as the MEJB container. * * @version $Rev: $ $Date: $ */ -public class MEJB implements Management, ListenerRegistration { - +public class MEJB implements Management { private final Kernel kernel; - private static final ObjectName ALL_GBEANS_QUERY; - - static { - try { - ALL_GBEANS_QUERY = ObjectName.getInstance("*.*"); - } catch (MalformedObjectNameException e) { - throw new RuntimeException(e); - } - } public MEJB(Kernel kernel) { this.kernel = kernel; } - public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, RemoteException { + public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException { try { return kernel.getAttribute(name, attribute); - } catch (MBeanException e) { - throw e; - } catch (AttributeNotFoundException e) { - throw e; - } catch (InstanceNotFoundException e) { - throw e; - } catch (ReflectionException e) { - throw e; + } catch (NoSuchAttributeException e) { + throw new AttributeNotFoundException(attribute); + } catch (GBeanNotFoundException e) { + throw new InstanceNotFoundException(name.getCanonicalName()); + } catch (InternalKernelException e) { + throw new MBeanException(unwrapInternalKernelException(e)); } catch (Exception e) { throw new MBeanException(e); } } - public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException, RemoteException { + public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException { AttributeList attributeList = new AttributeList(attributes.length); for (int i = 0; i < attributes.length; i++) { String attribute = attributes[i]; try { - attributeList.add(i, new Attribute(attribute, kernel.getAttribute(name, attribute))); - } catch (InstanceNotFoundException e) { - throw e; - } catch (ReflectionException e) { - throw e; + Object value = kernel.getAttribute(name, attribute); + attributeList.add(i, new Attribute(attribute, value)); + } catch (NoSuchAttributeException e) { + // ignored - caller will simply find no value + } catch (GBeanNotFoundException e) { + throw new InstanceNotFoundException(name.getCanonicalName()); + } catch (InternalKernelException e) { + throw new ReflectionException(unwrapInternalKernelException(e)); } catch (Exception e) { - //ignore ? + // ignored - caller will simply find no value } } return attributeList; } - public String getDefaultDomain() throws RemoteException { + public String getDefaultDomain() { return kernel.getKernelName(); } - public Integer getMBeanCount() throws RemoteException { - return new Integer(kernel.listGBeans(ALL_GBEANS_QUERY).size()); + public Integer getMBeanCount() { + return new Integer(kernel.listGBeans((ObjectName)null).size()); } - public MBeanInfo getMBeanInfo(ObjectName name) throws IntrospectionException, InstanceNotFoundException, ReflectionException, RemoteException { - return mapToMBeanInfo(kernel.getGBeanInfo(name)); + public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, ReflectionException { + GBeanInfo gbeanInfo; + try { + gbeanInfo = kernel.getGBeanInfo(name); + } catch (GBeanNotFoundException e) { + throw new InstanceNotFoundException(name.toString()); + } catch (InternalKernelException e) { + throw new ReflectionException(unwrapInternalKernelException(e)); + } + return GBeanJMXUtil.toMBeanInfo(gbeanInfo); } - public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException, RemoteException { + public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException { try { return kernel.invoke(name, operationName, params, signature); - } catch (MBeanException e) { - throw e; - } catch (InstanceNotFoundException e) { - throw e; - } catch (ReflectionException e) { - throw e; + } catch (NoSuchOperationException e) { + throw new ReflectionException(new NoSuchMethodException(e.getMessage())); + } catch (GBeanNotFoundException e) { + throw new InstanceNotFoundException(name.getCanonicalName()); + } catch (InternalKernelException e) { + throw new MBeanException(unwrapInternalKernelException(e)); } catch (Exception e) { throw new MBeanException(e); } } - public boolean isRegistered(ObjectName name) throws RemoteException { + public boolean isRegistered(ObjectName name) { return kernel.isLoaded(name); } - public Set queryNames(ObjectName name, QueryExp query) throws RemoteException { + public Set queryNames(ObjectName pattern, QueryExp query) { if (query != null) { throw new IllegalArgumentException("NYI"); } - return kernel.listGBeans(name); + Set names = kernel.listGBeans(pattern); + if (query == null) { + return names; + } + + // todo this will not work for non MBean server based queries + // dain: I think we could create an MBeanServer wraper around + // kernel that passed though most operations to kernel and + // threw an UnsupportedOperationException for the operations + // that have no equivilent Kernel method. + query.setMBeanServer(kernel.getMBeanServer()); + + Set filteredNames = new HashSet(names.size()); + for (Iterator iterator = names.iterator(); iterator.hasNext();) { + ObjectName name = (ObjectName) iterator.next(); + try { + if (query.apply(name)) { + filteredNames.add(name); + } + } catch (Exception e) { + // reject any name that threw an exception + } + } + return filteredNames; } - public void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException, RemoteException { - try { - kernel.setAttribute(name, attribute.getName(), attribute.getValue()); - } catch (MBeanException e) { - throw e; - } catch (AttributeNotFoundException e) { - throw e; - } catch (InstanceNotFoundException e) { - throw e; - } catch (InvalidAttributeValueException e) { - throw e; - } catch (ReflectionException e) { - throw e; + public void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, MBeanException { + String attributeName = attribute.getName(); + Object attributeValue = attribute.getValue(); + try { + kernel.setAttribute(name, attributeName, attributeValue); + } catch (NoSuchAttributeException e) { + throw new AttributeNotFoundException(attributeName); + } catch (GBeanNotFoundException e) { + throw new InstanceNotFoundException(name.getCanonicalName()); + } catch (InternalKernelException e) { + throw new MBeanException(unwrapInternalKernelException(e)); } catch (Exception e) { throw new MBeanException(e); } } - public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException, RemoteException { + public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException { AttributeList set = new AttributeList(attributes.size()); for (Iterator iterator = attributes.iterator(); iterator.hasNext();) { Attribute attribute = (Attribute) iterator.next(); + String attributeName = attribute.getName(); + Object attributeValue = attribute.getValue(); try { - kernel.setAttribute(name, attribute.getName(), attribute.getValue()); + kernel.setAttribute(name, attributeName, attributeValue); set.add(attribute); - } catch (InstanceNotFoundException e) { - throw e; - } catch (ReflectionException e) { - throw e; + } catch (NoSuchAttributeException e) { + // ignored - caller will see value was not set because this attribute will not be in the attribute list + } catch (GBeanNotFoundException e) { + throw new InstanceNotFoundException(name.getCanonicalName()); + } catch (InternalKernelException e) { + throw new ReflectionException(unwrapInternalKernelException(e)); } catch (Exception e) { - //ignore ? + // ignored - caller will see value was not set because this attribute will not be in the attribute list } } return set; } - public ListenerRegistration getListenerRegistry() throws RemoteException { - throw new RuntimeException("NYI"); - } - - - //ListenerRegistration implementation - public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, RemoteException { - try { - kernel.invoke(name, "addNotificationListener", new Object[]{listener, filter, handback}, new String[]{NotificationListener.class.getName(), NotificationFilter.class.getName(), Object.class.getName()}); - } catch (InstanceNotFoundException e) { - throw e; - } catch (Exception e) { - throw new RuntimeException(e); - } + public ListenerRegistration getListenerRegistry() { + throw new UnsupportedOperationException("Not Yet Implemented"); } - public void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException, RemoteException { - try { - kernel.invoke(name, "removeNotificationListener", new Object[]{listener}, new String[]{NotificationListener.class.getName()}); - } catch (InstanceNotFoundException e) { - throw e; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - //EJBObject implementation +// //ListenerRegistration implementation +// public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException { +// try { +// kernel.invoke(name, "addNotificationListener", new Object[]{listener, filter, handback}, new String[]{NotificationListener.class.getName(), NotificationFilter.class.getName(), Object.class.getName()}); +// } catch (InstanceNotFoundException e) { +// throw e; +// } catch (Exception e) { +// throw new RuntimeException(e); +// } +// } +// +// public void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException { +// try { +// kernel.invoke(name, "removeNotificationListener", new Object[]{listener}, new String[]{NotificationListener.class.getName()}); +// } catch (InstanceNotFoundException e) { +// throw e; +// } catch (Exception e) { +// throw new RuntimeException(e); +// } +// } - public EJBHome getEJBHome() throws RemoteException { + // EJBObject implementation + public EJBHome getEJBHome() { return null; } - public Handle getHandle() throws RemoteException { + public Handle getHandle() { return null; } - public Object getPrimaryKey() throws RemoteException { + public Object getPrimaryKey() { return null; } - public boolean isIdentical(EJBObject obj) throws RemoteException { + public boolean isIdentical(EJBObject obj) { return false; } - public void remove() throws RemoteException, RemoveException { - + public void remove() throws RemoveException { } - - private MBeanInfo mapToMBeanInfo(GBeanInfo gBeanInfo) { - String className = gBeanInfo.getClassName(); - String description = "No description available"; - Set gbeanAttributes = gBeanInfo.getAttributes(); - MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[gbeanAttributes.size()]; - int a = 0; - for (Iterator iterator = gbeanAttributes.iterator(); iterator.hasNext();) { - GAttributeInfo gAttributeInfo = (GAttributeInfo) iterator.next(); - attributes[a] = new MBeanAttributeInfo(gAttributeInfo.getName(), "no description available", gAttributeInfo.getType(), gAttributeInfo.isReadable().booleanValue(), gAttributeInfo.isWritable().booleanValue(), gAttributeInfo.getGetterName().startsWith("is")); - a++; - } - - //we don't expose managed constructors - MBeanConstructorInfo[] constructors = new MBeanConstructorInfo[0]; - - Set gbeanOperations = gBeanInfo.getOperations(); - MBeanOperationInfo[] operations = new MBeanOperationInfo[gbeanOperations.size()]; - int o = 0; - for (Iterator iterator = gbeanOperations.iterator(); iterator.hasNext();) { - GOperationInfo gOperationInfo = (GOperationInfo) iterator.next(); - //list of class names - List gparameters = gOperationInfo.getParameterList(); - MBeanParameterInfo[] parameters = new MBeanParameterInfo[gparameters.size()]; - int p = 0; - for (Iterator piterator = gparameters.iterator(); piterator.hasNext();) { - String type = (String) piterator.next(); - parameters[p] = new MBeanParameterInfo("parameter" + p, type, "no description available"); - p++; - } - operations[o] = new MBeanOperationInfo(gOperationInfo.getName(), "no description available", parameters, "java.lang.Object", MBeanOperationInfo.UNKNOWN); - o++; - } - - Set gnotifications = gBeanInfo.getNotifications(); - MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[gnotifications.size()]; - int n = 0; - for (Iterator iterator = gnotifications.iterator(); iterator.hasNext();) { - GNotificationInfo gNotificationInfo = (GNotificationInfo) iterator.next(); - notifications[n] = new MBeanNotificationInfo((String[]) gNotificationInfo.getNotificationTypes().toArray(new String[gnotifications.size()]), gNotificationInfo.getName(), "no description available"); - n++; + private static Exception unwrapInternalKernelException(InternalKernelException e) { + if (e.getCause() instanceof Exception) { + return (Exception) e.getCause(); } - - MBeanInfo mbeanInfo = new MBeanInfo(className, description, attributes, constructors, operations, notifications); - return mbeanInfo; + return e; } public static final GBeanInfo GBEAN_INFO; @@ -284,7 +256,6 @@ GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(MEJB.class.getName()); infoBuilder.addAttribute("kernel", KernelMBean.class, false); infoBuilder.addInterface(Management.class); - infoBuilder.addInterface(ListenerRegistration.class); infoBuilder.setConstructor(new String[]{"kernel"}); Modified: geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/BaseSecurityTest.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/BaseSecurityTest.java?view=diff&rev=109251&p1=geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/BaseSecurityTest.java&r1=109250&p2=geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/BaseSecurityTest.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/BaseSecurityTest.java (original) +++ geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/BaseSecurityTest.java Tue Nov 30 14:56:24 2004 @@ -17,14 +17,13 @@ package org.apache.geronimo.jetty; -import javax.management.ObjectName; import java.util.Collections; import java.util.HashSet; -import java.util.Set; import java.util.Properties; +import java.util.Set; +import javax.management.ObjectName; import junit.framework.TestCase; - import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator; import org.apache.geronimo.gbean.jmx.GBeanMBean; import org.apache.geronimo.jetty.connector.HTTPConnector; Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java?view=diff&rev=109251&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java&r1=109250&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java (original) +++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java Tue Nov 30 14:56:24 2004 @@ -76,11 +76,6 @@ } /** - * Attribute name used to retrieve the GBeanData for the GBean - */ - public static final String GBEAN_DATA = "$$GBEAN_DATA$$"; - - /** * The kernel in which this server is registered. */ private Kernel kernel; Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/DependencyManager.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/DependencyManager.java?view=diff&rev=109251&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/DependencyManager.java&r1=109250&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/DependencyManager.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/DependencyManager.java (original) +++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/DependencyManager.java Tue Nov 30 14:56:24 2004 @@ -275,6 +275,7 @@ return null; } + // todo convert this over to a kernel life cycle listener.... if possible public void handleNotification(Notification n, Object handback) { String type = n.getType(); if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(type)) { Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java?view=diff&rev=109251&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java&r1=109250&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java (original) +++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java Tue Nov 30 14:56:24 2004 @@ -283,7 +283,7 @@ return proxyManager; } - public Object getAttribute(ObjectName objectName, String attributeName) throws Exception { + public Object getAttribute(ObjectName objectName, String attributeName) throws GBeanNotFoundException, NoSuchAttributeException, InternalKernelException, Exception { try { return mbServer.getAttribute(objectName, attributeName); } catch (Exception e) { @@ -292,17 +292,21 @@ throw new GBeanNotFoundException(objectName.getCanonicalName()); } else if (cause instanceof AttributeNotFoundException) { throw new NoSuchAttributeException(cause.getMessage()); + } else if (cause instanceof JMException) { + throw new InternalKernelException(cause); + } else if (cause instanceof JMRuntimeException) { + throw new InternalKernelException(cause); } else if (cause instanceof Error) { throw (Error) cause; } else if (cause instanceof Exception) { throw (Exception) cause; } else { - throw new AssertionError(cause); + throw new InternalKernelException("Unknown throwable", cause); } } } - public void setAttribute(ObjectName objectName, String attributeName, Object attributeValue) throws Exception { + public void setAttribute(ObjectName objectName, String attributeName, Object attributeValue) throws GBeanNotFoundException, NoSuchAttributeException, InternalKernelException, Exception { try { mbServer.setAttribute(objectName, new Attribute(attributeName, attributeValue)); } catch (Exception e) { @@ -311,21 +315,25 @@ throw new GBeanNotFoundException(objectName.getCanonicalName()); } else if (cause instanceof AttributeNotFoundException) { throw new NoSuchAttributeException(cause.getMessage()); + } else if (cause instanceof JMException) { + throw new InternalKernelException(cause); + } else if (cause instanceof JMRuntimeException) { + throw new InternalKernelException(cause); } else if (cause instanceof Error) { throw (Error) cause; } else if (cause instanceof Exception) { throw (Exception) cause; } else { - throw new AssertionError(cause); + throw new InternalKernelException("Unknown throwable", cause); } } } - public Object invoke(ObjectName objectName, String methodName) throws Exception { + public Object invoke(ObjectName objectName, String methodName) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception { return invoke(objectName, methodName, NO_ARGS, NO_TYPES); } - public Object invoke(ObjectName objectName, String methodName, Object[] args, String[] types) throws Exception { + public Object invoke(ObjectName objectName, String methodName, Object[] args, String[] types) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception { try { return mbServer.invoke(objectName, methodName, args, types); } catch (Exception e) { @@ -334,12 +342,16 @@ throw new GBeanNotFoundException(objectName.getCanonicalName()); } else if (cause instanceof NoSuchMethodException) { throw new NoSuchOperationException(cause.getMessage()); + } else if (cause instanceof JMException) { + throw new InternalKernelException(cause); + } else if (cause instanceof JMRuntimeException) { + throw new InternalKernelException(cause); } else if (cause instanceof Error) { throw (Error) cause; } else if (cause instanceof Exception) { throw (Exception) cause; } else { - throw new AssertionError(cause); + throw new InternalKernelException("Unknown throwable", cause); } } } @@ -353,107 +365,119 @@ public boolean isLoaded(ObjectName name) { - return mbServer != null && mbServer.isRegistered(name); + try { + return mbServer != null && mbServer.isRegistered(name); + } catch (RuntimeException e) { + throw new InternalKernelException(e); + } } - public GBeanInfo getGBeanInfo(ObjectName name) throws InstanceNotFoundException { + public GBeanInfo getGBeanInfo(ObjectName name) throws GBeanNotFoundException, InternalKernelException { try { return (GBeanInfo) getAttribute(name, "gbeanInfo"); - } catch (InstanceNotFoundException e) { + } catch (GBeanNotFoundException e) { throw e; - } catch (RuntimeException e) { + } catch (InternalKernelException e) { throw e; } catch (Exception e) { - throw new RuntimeException(e); + throw new InternalKernelException(e); } } - /** - * Gets the gbean data for the gbean held by this gbean mbean. - * @return the gbean data - * @throws InstanceNotFoundException if no such gbean exists with the specified name - */ - public GBeanData getGBeanData(ObjectName name) throws InstanceNotFoundException { + public GBeanData getGBeanData(ObjectName name) throws GBeanNotFoundException, InternalKernelException { try { - return (GBeanData) getAttribute(name, GBeanMBean.GBEAN_DATA); - } catch (InstanceNotFoundException e) { + return (GBeanData) getAttribute(name, GBeanInstance.GBEAN_DATA); + } catch (GBeanNotFoundException e) { throw e; - } catch (RuntimeException e) { + } catch (InternalKernelException e) { throw e; } catch (Exception e) { - throw (AssertionError) new AssertionError("getGBeanData can not throw checked exceptions").initCause(e); + throw new InternalKernelException(e); } } - public void loadGBean(GBeanData gbeanData, ClassLoader classLoader) throws InstanceAlreadyExistsException, InvalidConfigException { + public void loadGBean(GBeanData gbeanData, ClassLoader classLoader) throws GBeanAlreadyExistsException, InternalKernelException { try { GBeanMBean gbean = new GBeanMBean(this, gbeanData, classLoader); mbServer.registerMBean(gbean, gbeanData.getName()); - } catch (JMRuntimeException e) { - throw new InvalidConfigException("Invalid GBean configuration for " + gbeanData.getName(), unwrapJMException(e)); - } catch (JMException e) { - throw new InvalidConfigException("Invalid GBean configuration for " + gbeanData.getName(), unwrapJMException(e)); + } catch (InstanceAlreadyExistsException e) { + throw new GBeanAlreadyExistsException("A GBean is alreayd registered witht then name " + gbeanData.getName()); + } catch (Exception e) { + throw new InternalKernelException("Error loading GBean " + gbeanData.getName().getCanonicalName(), unwrapJMException(e)); } } - public void loadGBean(ObjectName name, GBeanMBean gbean) throws InstanceAlreadyExistsException, InvalidConfigException { + /** + * @deprecated use loadGBean(GBeanData gbeanData, ClassLoader classLoader) + */ + public void loadGBean(ObjectName name, GBeanMBean gbean) throws GBeanAlreadyExistsException, InternalKernelException { try { mbServer.registerMBean(gbean, name); } catch (InstanceAlreadyExistsException e) { - throw e; + throw new GBeanAlreadyExistsException(name.getCanonicalName()); } catch (Exception e) { - throw new InvalidConfigException("Invalid GBean configuration for " + name, unwrapJMException(e)); + throw new InternalKernelException("Error loading GBean " + name.getCanonicalName(), unwrapJMException(e)); } } - public void startGBean(ObjectName name) throws InstanceNotFoundException, InvalidConfigException { + public void startGBean(ObjectName name) throws GBeanNotFoundException, InternalKernelException { try { invoke(name, "start"); - } catch (InstanceNotFoundException e) { - throw e; } catch (GBeanNotFoundException e) { - throw new InstanceNotFoundException("No instance found: " + name); + throw e; + } catch (InternalKernelException e) { + throw e; + } catch (NoSuchOperationException e) { + throw new InternalKernelException("GBean is not state manageable: " + name.getCanonicalName(), e); } catch (Exception e) { - throw new InvalidConfigException("Invalid GBean configuration for " + name, unwrapJMException(e)); + throw new InternalKernelException("Invalid GBean configuration for " + name, unwrapJMException(e)); } } - public void startRecursiveGBean(ObjectName name) throws InstanceNotFoundException, InvalidConfigException { + public void startRecursiveGBean(ObjectName name) throws GBeanNotFoundException, InternalKernelException { try { invoke(name, "startRecursive"); - } catch (InstanceNotFoundException e) { - throw e; } catch (GBeanNotFoundException e) { - throw new InstanceNotFoundException("No instance found: " + name); + throw e; + } catch (InternalKernelException e) { + throw e; + } catch (NoSuchOperationException e) { + throw new InternalKernelException("GBean is not state manageable: " + name.getCanonicalName(), e); } catch (Exception e) { - throw new InvalidConfigException("Invalid GBean configuration for " + name, e); + throw new InternalKernelException("Invalid GBean configuration for " + name, e); } } - public void stopGBean(ObjectName name) throws InstanceNotFoundException, InvalidConfigException { + public void stopGBean(ObjectName name) throws GBeanNotFoundException, InternalKernelException { try { invoke(name, "stop"); - } catch (InstanceNotFoundException e) { - throw e; } catch (GBeanNotFoundException e) { - throw new InstanceNotFoundException("No instance found: " + name); + throw e; + } catch (InternalKernelException e) { + throw e; + } catch (NoSuchOperationException e) { + throw new InternalKernelException("GBean is not state manageable: " + name.getCanonicalName(), e); } catch (Exception e) { - throw new InvalidConfigException("Invalid GBean configuration for " + name, e); + throw new InternalKernelException("Invalid GBean configuration for " + name, e); } } - public void unloadGBean(ObjectName name) throws InstanceNotFoundException { + public void unloadGBean(ObjectName name) throws GBeanNotFoundException, InternalKernelException { try { mbServer.unregisterMBean(name); } catch (InstanceNotFoundException e) { - throw e; - } catch (JMException e) { - throw (IllegalStateException) new IllegalStateException("Error unloading GBean " + name).initCause(unwrapJMException(e)); + throw new GBeanNotFoundException(name.getCanonicalName()); + } catch (Exception e) { + throw new InternalKernelException("Error unloading GBean " + name, unwrapJMException(e)); } } - public Set listGBeans(ObjectName query) { - return mbServer.queryNames(query, null); + public Set listGBeans(ObjectName pattern) { + try { + return mbServer.queryNames(pattern, null); + } catch (RuntimeException e) { + throw new InternalKernelException("Error while applying pattern " + pattern, e); + } } public Set listGBeans(Set patterns) { @@ -473,45 +497,42 @@ return getConfigurationManager().listConfigurations(storeName); } - public ObjectName startConfiguration(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException { + public ObjectName startConfiguration(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException, InternalKernelException { ObjectName configName = getConfigurationManager().load(configID); try { startRecursiveGBean(configName); - } catch (InstanceNotFoundException e) { + } catch (GBeanNotFoundException e) { // should not happen as we just loaded it throw new InvalidConfigException(e); } return configName; - } - public void stopConfiguration(URI configID) throws NoSuchConfigException { + public void stopConfiguration(URI configID) throws NoSuchConfigException, InternalKernelException { ConfigurationManager configurationManager = getConfigurationManager(); try { ObjectName configName = Configuration.getConfigurationObjectName(configID); stopGBean(configName); } catch (MalformedObjectNameException e) { throw new NoSuchConfigException(e); - } catch (InstanceNotFoundException e) { + } catch (GBeanNotFoundException e) { throw new NoSuchConfigException(e); - } catch (InvalidConfigException e) { - throw (IllegalStateException) new IllegalStateException().initCause(e); } configurationManager.unload(configID); } - public int getConfigurationState(URI configID) throws NoSuchConfigException { + public int getConfigurationState(URI configID) throws NoSuchConfigException, InternalKernelException { try { ObjectName configName = Configuration.getConfigurationObjectName(configID); return ((Integer)getAttribute(configName, "state")).intValue(); } catch (MalformedObjectNameException e) { throw new NoSuchConfigException(e); - } catch (InstanceNotFoundException e) { + } catch (GBeanNotFoundException e) { throw new NoSuchConfigException(e); - } catch (InvalidConfigException e) { - throw (IllegalStateException) new IllegalStateException().initCause(e); + } catch (InternalKernelException e) { + throw e; } catch (Exception e) { - throw new NoSuchConfigException(e); + throw new InternalKernelException(e); } } @@ -648,8 +669,14 @@ return running; } - public ClassLoader getClassLoaderFor(ObjectName objectName) throws InstanceNotFoundException { - return mbServer.getClassLoaderFor(objectName); + public ClassLoader getClassLoaderFor(ObjectName name) throws GBeanNotFoundException { + try { + return mbServer.getClassLoaderFor(name); + } catch (InstanceNotFoundException e) { + throw new GBeanNotFoundException(name.getCanonicalName()); + } catch (RuntimeException e) { + throw new InternalKernelException("Error while attemping to get class loader for " + name.getCanonicalName(), e); + } } private static void processQueue() { Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java?view=diff&rev=109251&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java&r1=109250&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java (original) +++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/KernelMBean.java Tue Nov 30 14:56:24 2004 @@ -19,16 +19,15 @@ import java.io.IOException; import java.net.URI; +import java.util.Date; import java.util.List; import java.util.Set; -import java.util.Date; -import javax.management.InstanceAlreadyExistsException; -import javax.management.InstanceNotFoundException; import javax.management.MBeanServer; import javax.management.ObjectName; -import org.apache.geronimo.gbean.jmx.GBeanMBean; import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanData; +import org.apache.geronimo.gbean.jmx.GBeanMBean; import org.apache.geronimo.kernel.config.ConfigurationManager; import org.apache.geronimo.kernel.config.InvalidConfigException; import org.apache.geronimo.kernel.config.NoSuchConfigException; @@ -62,45 +61,61 @@ * Load a specific GBean into this kernel. * This is intended for applications that are embedding the kernel. * + * @param gbeanData the GBean to load + * @param classLoader the class loader to use to load the gbean + * @throws GBeanAlreadyExistsException if the name is already used + * @throws InternalKernelException if there is a problem during registration + */ + public void loadGBean(GBeanData gbeanData, ClassLoader classLoader) throws GBeanAlreadyExistsException, InternalKernelException; + + /** + * Load a specific GBean into this kernel. + * This is intended for applications that are embedding the kernel. + * * @param name the name to register the GBean under * @param gbean the GBean to register - * @throws InstanceAlreadyExistsException if the name is already used - * @throws InvalidConfigException if there is a problem during registration + * @throws GBeanAlreadyExistsException if the name is already used + * @throws InternalKernelException if there is a problem during registration + * @deprecated use loadGBean(GBeanData gbeanData, ClassLoader classLoader) */ - void loadGBean(ObjectName name, GBeanMBean gbean) throws InstanceAlreadyExistsException, InvalidConfigException; + void loadGBean(ObjectName name, GBeanMBean gbean) throws GBeanAlreadyExistsException, InternalKernelException; /** * Start a specific GBean. * * @param name the GBean to start - * @throws InstanceNotFoundException if the GBean could not be found + * @throws GBeanNotFoundException if the GBean could not be found + * @throws InternalKernelException if there GBean is not state manageable or if there is a general error */ - void startGBean(ObjectName name) throws InstanceNotFoundException, InvalidConfigException; + void startGBean(ObjectName name) throws GBeanNotFoundException, InternalKernelException; /** * Start a specific GBean and its children. * * @param name the GBean to start - * @throws InstanceNotFoundException if the GBean could not be found + * @throws GBeanNotFoundException if the GBean could not be found + * @throws InternalKernelException if there GBean is not state manageable or if there is a general error */ - void startRecursiveGBean(ObjectName name) throws InstanceNotFoundException, InvalidConfigException; + void startRecursiveGBean(ObjectName name) throws GBeanNotFoundException, InternalKernelException; /** * Stop a specific GBean. * * @param name the GBean to stop - * @throws InstanceNotFoundException if the GBean could not be found + * @throws GBeanNotFoundException if the GBean could not be found + * @throws InternalKernelException if there GBean is not state manageable or if there is a general error */ - void stopGBean(ObjectName name) throws InstanceNotFoundException, InvalidConfigException; + void stopGBean(ObjectName name) throws GBeanNotFoundException, InternalKernelException; /** * Unload a specific GBean. * This is intended for applications that are embedding the kernel. * * @param name the name of the GBean to unregister - * @throws InstanceNotFoundException if the GBean could not be found + * @throws GBeanNotFoundException if the GBean could not be found + * @throws InternalKernelException if there GBean is a problem while unloading the GBean */ - void unloadGBean(ObjectName name) throws InstanceNotFoundException; + void unloadGBean(ObjectName name) throws GBeanNotFoundException; boolean isRunning(); @@ -140,16 +155,25 @@ * Return the GBean info for a gbean instance. * @param name the name of the gbean whose info should be returned * @return the info for that instance - * @throws InstanceNotFoundException if there is no instance with the supplied name + * @throws GBeanNotFoundException if there is no instance with the supplied name */ - GBeanInfo getGBeanInfo(ObjectName name) throws InstanceNotFoundException; + GBeanInfo getGBeanInfo(ObjectName name) throws GBeanNotFoundException; /** - * Return the names of GBeans that match the query. - * @param query the query to be performed - * @return a Set of the names of online GBeans that match the query + * Return the names of GBeans that match the pattern. + * @param pattern the name pattern to match + * @return a Set of the names of online GBeans that match the pattern + * @throws InternalKernelException if a problem occures while searching */ - Set listGBeans(ObjectName query); + Set listGBeans(ObjectName pattern) throws InternalKernelException; + + /** + * Return all of the names of GBeans that match the set of patterns. + * @param patterns a set of name patterns to match + * @return a Set of the names of online GBeans that match the patterns + * @throws InternalKernelException if a problem occures while searching + */ + Set listGBeans(Set patterns) throws InternalKernelException; void registerShutdownHook(Runnable hook); @@ -157,5 +181,19 @@ void shutdown(); - ClassLoader getClassLoaderFor(ObjectName objectName) throws InstanceNotFoundException; + /** + * Gets the class loader use for a GBean + * @param name name of the GBean + * @return the class loader used to create the GBean + * @throws GBeanNotFoundException if there is no instance with the supplied name + * @throws InternalKernelException if there was a problem getting the class loader + */ + ClassLoader getClassLoaderFor(ObjectName name) throws GBeanNotFoundException, InternalKernelException; + + /** + * Gets the gbean data for the gbean held by this gbean mbean. + * @return the gbean data + * @throws GBeanNotFoundException if no such gbean exists with the specified name + */ + GBeanData getGBeanData(ObjectName name) throws GBeanNotFoundException, InternalKernelException; } Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?view=diff&rev=109251&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java&r1=109250&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java (original) +++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java Tue Nov 30 14:56:24 2004 @@ -37,7 +37,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import javax.management.JMRuntimeException; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; @@ -202,17 +201,7 @@ GBeanData gbeanData = (GBeanData) i.next(); ObjectName name = gbeanData.getName(); log.trace("Registering GBean " + name); - try { - kernel.loadGBean(gbeanData, configurationClassLoader); - } catch (JMRuntimeException e) { - Throwable cause = e.getCause(); - if (cause instanceof Exception) { - throw (Exception) cause; - } else if (cause instanceof Error) { - throw (Error) cause; - } - throw e; - } + kernel.loadGBean(gbeanData, configurationClassLoader); objectNames.add(name); kernel.getDependencyManager().addDependency(name, objectName); } @@ -397,9 +386,16 @@ for (Iterator i = gbeans.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); ObjectName objectName = (ObjectName) entry.getKey(); - GBeanMBean gbean = (GBeanMBean) entry.getValue(); + + // value may be either a gbeanMBean or a gbeanData + GBeanData gbeanData; + if (entry.getValue() instanceof GBeanMBean) { + GBeanMBean gbeanMBean = (GBeanMBean) entry.getValue(); + gbeanData = gbeanMBean.getGBeanData(); + } else { + gbeanData = (GBeanData) entry.getValue(); + } try { - GBeanData gbeanData = gbean.getGBeanData(); // todo we must explicitly set the bean name here from the gbean key because the gbean mbean may // not have been brought online, so the object namve in the gbean mbean will be null gbeanData.setName(objectName); Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?view=diff&rev=109251&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java&r1=109250&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original) +++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Tue Nov 30 14:56:24 2004 @@ -49,21 +49,21 @@ ObjectName load(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException; + /** + * @deprecated use load(GBeanData config, URL rootURL, ClassLoader classLoader) + */ ObjectName load(GBeanMBean config, URL rootURL) throws InvalidConfigException; - void load(GBeanData config, URL rootURL, ClassLoader classLoader) throws InvalidConfigException; - /** * Load the supplied Configuration into the Kernel and override the default JMX name. * This method should be used with discretion as it is possible to create * Configurations that cannot be located by management or monitoring tools. * - * @param config the GBeanMBean representing the Configuration + * @param config the GBeanData representing the Configuration * @param rootURL the URL to be used to resolve relative paths in the configuration - * @param configName the JMX ObjectName to register the Configuration under * @throws org.apache.geronimo.kernel.config.InvalidConfigException if the Configuration is not valid */ - void load(GBeanMBean config, URL rootURL, ObjectName configName) throws InvalidConfigException; + ObjectName load(GBeanData config, URL rootURL, ClassLoader classLoader) throws InvalidConfigException; List loadRecursive(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException; Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java?view=diff&rev=109251&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java&r1=109250&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java (original) +++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java Tue Nov 30 14:56:24 2004 @@ -26,18 +26,18 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; - -import javax.management.InstanceNotFoundException; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.geronimo.gbean.GBeanData; import org.apache.geronimo.gbean.GBeanInfo; import org.apache.geronimo.gbean.GBeanInfoBuilder; import org.apache.geronimo.gbean.GBeanLifecycle; -import org.apache.geronimo.gbean.GBeanData; import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.kernel.GBeanNotFoundException; +import org.apache.geronimo.kernel.InternalKernelException; import org.apache.geronimo.kernel.Kernel; import org.apache.geronimo.kernel.jmx.JMXUtil; import org.apache.geronimo.kernel.management.State; @@ -130,6 +130,9 @@ throw new NoSuchConfigException("No configuration with id: " + configID); } + /** + * @deprecated use load(GBeanData config, URL rootURL, ClassLoader classLoader) + */ public ObjectName load(GBeanMBean config, URL rootURL) throws InvalidConfigException { URI configID; try { @@ -137,26 +140,16 @@ } catch (Exception e) { throw new InvalidConfigException("Cannot get config ID", e); } + ObjectName configName; try { configName = Configuration.getConfigurationObjectName(configID); } catch (MalformedObjectNameException e) { throw new InvalidConfigException("Cannot convert ID to ObjectName: ", e); } - load(config, rootURL, configName); - return configName; - } - - public void load(GBeanData config, URL rootURL, ClassLoader classLoader) throws InvalidConfigException { - GBeanMBean mbean = new GBeanMBean(config, classLoader); - load(mbean, rootURL, config.getName()); - } - public void load(GBeanMBean config, URL rootURL, ObjectName configName) throws InvalidConfigException { try { kernel.loadGBean(configName, config); - } catch (InvalidConfigException e) { - throw e; } catch (Exception e) { throw new InvalidConfigException("Unable to register configuration", e); } @@ -172,6 +165,39 @@ throw new InvalidConfigException("Cannot set baseURL", e); } log.info("Loaded Configuration " + configName); + + return configName; + } + + public ObjectName load(GBeanData config, URL rootURL, ClassLoader classLoader) throws InvalidConfigException { + ObjectName name; + try { + URI configID = (URI) config.getAttribute("ID"); + name = Configuration.getConfigurationObjectName(configID); + } catch (MalformedObjectNameException e) { + throw new InvalidConfigException("Cannot convert ID to ObjectName: ", e); + } + config.setName(name); + + try { + kernel.loadGBean(config, classLoader); + } catch (Exception e) { + throw new InvalidConfigException("Unable to register configuration", e); + } + + try { + kernel.setAttribute(name, "baseURL", rootURL); + } catch (Exception e) { + try { + kernel.unloadGBean(name); + } catch (Exception ignored) { + // ignore + } + throw new InvalidConfigException("Cannot set baseURL", e); + } + log.info("Loaded Configuration " + name); + + return name; } public List loadRecursive(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException { @@ -207,7 +233,7 @@ public void unload(ObjectName configName) throws NoSuchConfigException { try { kernel.unloadGBean(configName); - } catch (InstanceNotFoundException e) { + } catch (GBeanNotFoundException e) { throw new NoSuchConfigException("No config registered: " + configName, e); } log.info("Unloaded Configuration " + configName); @@ -233,14 +259,14 @@ if (kernel.isLoaded(configName)) { try { kernel.stopGBean(configName); - } catch (InstanceNotFoundException e) { + } catch (GBeanNotFoundException e) { // ignore - } catch (InvalidConfigException e) { + } catch (InternalKernelException e) { log.warn("Could not stop configuration: " + configName, e); } try { kernel.unloadGBean(configName); - } catch (InstanceNotFoundException e) { + } catch (GBeanNotFoundException e) { // ignore } } Modified: geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java?view=diff&rev=109251&p1=geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java&r1=109250&p2=geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java (original) +++ geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java Tue Nov 30 14:56:24 2004 @@ -21,13 +21,10 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import javax.management.Attribute; -import javax.management.InstanceNotFoundException; -import javax.management.MBeanServer; import javax.management.ObjectName; import junit.framework.TestCase; -import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.gbean.GBeanData; import org.apache.geronimo.kernel.config.Configuration; import org.apache.geronimo.kernel.config.ConfigurationManager; import org.apache.geronimo.kernel.management.State; @@ -38,78 +35,70 @@ public class ConfigTest extends TestCase { private ObjectName gbeanName1; private Kernel kernel; - private MBeanServer mbServer; private byte[] state; private ObjectName gbeanName2; - public void testOfflineConfig() throws Exception { - GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO); - config.setAttribute("ID", new URI("test")); - config.setReferencePatterns("Parent", null); - } - public void testOnlineConfig() throws Exception { - GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO); + GBeanData config = new GBeanData(Configuration.GBEAN_INFO); config.setAttribute("ID", new URI("test")); config.setReferencePatterns("Parent", null); config.setAttribute("classPath", Collections.EMPTY_LIST); config.setAttribute("gBeanState", state); config.setAttribute("dependencies", Collections.EMPTY_LIST); ConfigurationManager configurationManager = kernel.getConfigurationManager(); - ObjectName configName = configurationManager.load(config, null); - mbServer.invoke(configName, "startRecursive", null, null); + ObjectName configName = configurationManager.load(config, null, getClass().getClassLoader()); + kernel.invoke(configName, "startRecursive", null, null); - assertEquals(new Integer(State.RUNNING_INDEX), mbServer.getAttribute(configName, "state")); - assertNotNull(mbServer.getAttribute(configName, "configurationClassLoader")); + assertEquals(new Integer(State.RUNNING_INDEX), kernel.getAttribute(configName, "state")); + assertNotNull(kernel.getAttribute(configName, "configurationClassLoader")); - assertEquals(new Integer(State.RUNNING_INDEX), mbServer.getAttribute(gbeanName1, "state")); - Object state = mbServer.getAttribute(gbeanName2, "state"); + assertEquals(new Integer(State.RUNNING_INDEX), kernel.getAttribute(gbeanName1, "state")); + Object state = kernel.getAttribute(gbeanName2, "state"); assertEquals(new Integer(State.RUNNING_INDEX), state); - assertEquals(new Integer(1), mbServer.getAttribute(gbeanName1, "finalInt")); - assertEquals("1234", mbServer.getAttribute(gbeanName1, "value")); - assertEquals(new Integer(3), mbServer.getAttribute(gbeanName2, "finalInt")); + assertEquals(new Integer(1), kernel.getAttribute(gbeanName1, "finalInt")); + assertEquals("1234", kernel.getAttribute(gbeanName1, "value")); + assertEquals(new Integer(3), kernel.getAttribute(gbeanName2, "finalInt")); - mbServer.setAttribute(gbeanName2, new Attribute("mutableInt", new Integer(44))); - assertEquals(new Integer(44), mbServer.getAttribute(gbeanName2, "mutableInt")); + kernel.setAttribute(gbeanName2, "mutableInt", new Integer(44)); + assertEquals(new Integer(44), kernel.getAttribute(gbeanName2, "mutableInt")); - mbServer.invoke(gbeanName2, "doSetMutableInt", new Object[]{new Integer(55)}, new String[]{"int"}); - assertEquals(new Integer(55), mbServer.getAttribute(gbeanName2, "mutableInt")); + kernel.invoke(gbeanName2, "doSetMutableInt", new Object[]{new Integer(55)}, new String[]{"int"}); + assertEquals(new Integer(55), kernel.getAttribute(gbeanName2, "mutableInt")); - assertEquals("no endpoint", mbServer.invoke(gbeanName1, "checkEndpoint", null, null)); - assertEquals("endpointCheck", mbServer.invoke(gbeanName2, "checkEndpoint", null, null)); + assertEquals("no endpoint", kernel.invoke(gbeanName1, "checkEndpoint", null, null)); + assertEquals("endpointCheck", kernel.invoke(gbeanName2, "checkEndpoint", null, null)); - assertEquals(new Integer(0), mbServer.invoke(gbeanName1, "checkEndpointCollection", null, null)); - assertEquals(new Integer(1), mbServer.invoke(gbeanName2, "checkEndpointCollection", null, null)); + assertEquals(new Integer(0), kernel.invoke(gbeanName1, "checkEndpointCollection", null, null)); + assertEquals(new Integer(1), kernel.invoke(gbeanName2, "checkEndpointCollection", null, null)); - mbServer.setAttribute(gbeanName2, new Attribute("endpointMutableInt", new Integer(99))); - assertEquals(new Integer(99), mbServer.getAttribute(gbeanName2, "endpointMutableInt")); - assertEquals(new Integer(99), mbServer.getAttribute(gbeanName1, "mutableInt")); + kernel.setAttribute(gbeanName2, "endpointMutableInt", new Integer(99)); + assertEquals(new Integer(99), kernel.getAttribute(gbeanName2, "endpointMutableInt")); + assertEquals(new Integer(99), kernel.getAttribute(gbeanName1, "mutableInt")); - mbServer.invoke(configName, "stop", null, null); + kernel.invoke(configName, "stop", null, null); try { - mbServer.getAttribute(gbeanName1, "value"); + kernel.getAttribute(gbeanName1, "value"); fail(); - } catch (InstanceNotFoundException e) { + } catch (GBeanNotFoundException e) { // ok } - assertEquals(new Integer(State.STOPPED.toInt()), mbServer.getAttribute(configName, "state")); + assertEquals(new Integer(State.STOPPED.toInt()), kernel.getAttribute(configName, "state")); configurationManager.unload(configName); - assertFalse(mbServer.isRegistered(configName)); + assertFalse(kernel.isLoaded(configName)); } protected void setUp() throws Exception { - kernel = new Kernel("test.kernel", "geronimo"); + kernel = new Kernel("test"); kernel.boot(); - mbServer = kernel.getMBeanServer(); - gbeanName1 = new ObjectName("geronimo.test:name=MyMockGMBean1"); - GBeanMBean mockBean1 = new GBeanMBean(MockGBean.getGBeanInfo()); + GBeanData mockBean1 = new GBeanData(gbeanName1, MockGBean.getGBeanInfo()); mockBean1.setAttribute("value", "1234"); mockBean1.setAttribute("name", "child"); mockBean1.setAttribute("finalInt", new Integer(1)); + gbeanName2 = new ObjectName("geronimo.test:name=MyMockGMBean2"); - GBeanMBean mockBean2 = new GBeanMBean(MockGBean.getGBeanInfo()); + GBeanData mockBean2 = new GBeanData(gbeanName2, MockGBean.getGBeanInfo()); mockBean2.setAttribute("value", "5678"); mockBean2.setAttribute("name", "Parent"); mockBean2.setAttribute("finalInt", new Integer(3)); @@ -123,7 +112,6 @@ } protected void tearDown() throws Exception { - mbServer = null; kernel.shutdown(); } } Modified: geronimo/trunk/modules/mail/src/test/org/apache/geronimo/mail/MailGBeanTest.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/mail/src/test/org/apache/geronimo/mail/MailGBeanTest.java?view=diff&rev=109251&p1=geronimo/trunk/modules/mail/src/test/org/apache/geronimo/mail/MailGBeanTest.java&r1=109250&p2=geronimo/trunk/modules/mail/src/test/org/apache/geronimo/mail/MailGBeanTest.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/mail/src/test/org/apache/geronimo/mail/MailGBeanTest.java (original) +++ geronimo/trunk/modules/mail/src/test/org/apache/geronimo/mail/MailGBeanTest.java Tue Nov 30 14:56:24 2004 @@ -16,13 +16,11 @@ */ package org.apache.geronimo.mail; +import java.util.Properties; import javax.mail.Session; -import javax.mail.Store; import javax.management.ObjectName; -import java.util.Properties; import junit.framework.TestCase; - import org.apache.geronimo.gbean.jmx.GBeanMBean; import org.apache.geronimo.kernel.Kernel; Modified: geronimo/trunk/modules/spring/src/java/org/apache/geronimo/spring/SpringGBean.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/spring/src/java/org/apache/geronimo/spring/SpringGBean.java?view=diff&rev=109251&p1=geronimo/trunk/modules/spring/src/java/org/apache/geronimo/spring/SpringGBean.java&r1=109250&p2=geronimo/trunk/modules/spring/src/java/org/apache/geronimo/spring/SpringGBean.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/spring/src/java/org/apache/geronimo/spring/SpringGBean.java (original) +++ geronimo/trunk/modules/spring/src/java/org/apache/geronimo/spring/SpringGBean.java Tue Nov 30 14:56:24 2004 @@ -17,25 +17,22 @@ package org.apache.geronimo.spring; +import java.util.Hashtable; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.geronimo.gbean.GBeanLifecycle; import org.apache.geronimo.gbean.WaitingException; import org.apache.geronimo.gbean.jmx.GBeanMBean; import org.apache.geronimo.kernel.Kernel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.support.BeanDefinitionValidationException; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; - -import javax.management.ObjectName; -import javax.management.MalformedObjectNameException; -import java.util.Map; -import java.util.HashMap; -import java.util.Properties; -import java.util.Hashtable; /** * A GBean for creating graphs of Spring POJOs and auto-deploying them inside Geronimo as GBeans Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java?view=diff&rev=109251&p1=geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java&r1=109250&p2=geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java&r2=109251 ============================================================================== --- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java (original) +++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java Tue Nov 30 14:56:24 2004 @@ -22,14 +22,14 @@ import java.util.Iterator; import java.util.List; import javax.management.ObjectName; -import javax.management.InstanceNotFoundException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.geronimo.gbean.GBeanData; +import org.apache.geronimo.kernel.GBeanNotFoundException; import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.kernel.InternalKernelException; import org.apache.geronimo.kernel.config.ConfigurationManager; -import org.apache.geronimo.kernel.config.InvalidConfigException; import org.apache.geronimo.kernel.log.GeronimoLogging; import org.apache.geronimo.system.url.GeronimoURLFactory; @@ -95,7 +95,7 @@ protected void startKernel(List configurations) throws Exception { // boot the kernel - kernel = new Kernel("geronimo.kernel", "geronimo"); + kernel = new Kernel("geronimo"); kernel.boot(); // load and start the configuration in this jar @@ -126,7 +126,7 @@ return kernel; } - protected void stopKernel() throws InstanceNotFoundException, InvalidConfigException { + protected void stopKernel() throws GBeanNotFoundException, InternalKernelException { // stop this configuration kernel.stopGBean(config.getName());