You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2005/05/08 21:35:28 UTC

svn commit: r169154 [6/6] - in /geronimo/trunk: applications/jmxdebug/src/java/org/apache/geronimo/jmxdebug/web/beanlib/ applications/jmxdebug/src/webapp/WEB-INF/ assemblies/j2ee-server/ etc/ modules/assembly/ modules/assembly/src/plan/ modules/axis-builder/ modules/axis/ modules/classloader-server/ modules/classloader-server/src/test/org/apache/geronimo/classloaderserver/http/ modules/client-builder/ modules/client-builder/src/java/org/apache/geronimo/client/builder/ modules/client-builder/src/test/org/apache/geronimo/client/builder/ modules/client/ modules/connector-builder/ modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ modules/connector/ modules/connector/src/java/org/apache/geronimo/connector/ modules/connector/src/java/org/apache/geronimo/connector/outbound/ modules/connector/src/test/org/apache/geronimo/connector/ modules/connector/src/test/org/apache/geronimo/connector/outbound/ modules/deploy-tool/src/java/org/apache/geronimo/deployment/ modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/jmx/ modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/ modules/deployment/ modules/deployment/src/java/org/apache/geronimo/deployment/ modules/deployment/src/java/org/apache/geronimo/deployment/util/ modules/interop/ modules/interop/src/test/org/apache/geronimo/interop/ modules/j2ee-builder/ modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/ modules/j2ee/ modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/ modules/j2ee/src/test/org/apache/geronimo/j2ee/management/ modules/jetty-builder/ modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/ modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/ modules/jetty/ modules/jetty/src/test/org/apache/geronimo/jetty/ modules/jmx-remoting/src/java/org/apache/geronimo/jmxremoting/ modules/kernel/ modules/kernel/src/java/org/apache/geronimo/gbean/jmx/ modules/kernel/src/java/org/apache/geronimo/gbean/runtime/ modules/kernel/src/java/org/apache/geronimo/kernel/ modules/kernel/src/java/org/apache/geronimo/kernel/basic/ modules/kernel/src/java/org/apache/geronimo/kernel/config/ modules/kernel/src/java/org/apache/geronimo/kernel/jmx/ modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/ modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ modules/kernel/src/java/org/apache/geronimo/kernel/registry/ modules/kernel/src/test/org/apache/geronimo/gbean/ modules/kernel/src/test/org/apache/geronimo/gbean/runtime/ modules/kernel/src/test/org/apache/geronimo/kernel/ modules/mail/ modules/mail/src/java/org/apache/geronimo/mail/ modules/mail/src/test/org/apache/geronimo/mail/ modules/naming/src/java/org/apache/geronimo/naming/reference/ modules/naming/src/test/org/apache/geronimo/naming/java/ modules/security/ modules/security/src/java/org/apache/geronimo/security/jaas/ modules/security/src/java/org/apache/geronimo/security/realm/ modules/security/src/java/org/apache/geronimo/security/realm/providers/ modules/security/src/test/org/apache/geronimo/security/ modules/security/src/test/org/apache/geronimo/security/jaas/ modules/security/src/test/org/apache/geronimo/security/remoting/jmx/ modules/service-builder/ modules/service-builder/src/java/org/apache/geronimo/deployment/service/ modules/spring-builder/ modules/spring-builder/src/java/org/apache/geronimo/spring/deployment/ modules/spring/ modules/spring/src/java/org/apache/geronimo/spring/ modules/system/ modules/system/src/java/org/apache/geronimo/system/configuration/ modules/system/src/java/org/apache/geronimo/system/jmx/ modules/system/src/java/org/apache/geronimo/system/main/ modules/system/src/test/org/apache/geronimo/system/configuration/ modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/ modules/tomcat-builder/ modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/ modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/ modules/tomcat/ modules/tomcat/src/plan/ modules/tomcat/src/test/org/apache/geronimo/tomcat/ modules/webservices/ plugins/geronimo-packaging-plugin/ plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ plugins/maven-geronimo-plugin/ plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/

Added: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanGBeanBridge.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanGBeanBridge.java?rev=169154&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanGBeanBridge.java (added)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanGBeanBridge.java Sun May  8 12:35:23 2005
@@ -0,0 +1,259 @@
+/**
+ *
+ * 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.system.jmx;
+
+import java.util.Iterator;
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.DynamicMBean;
+import javax.management.JMException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanNotificationInfo;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GOperationSignature;
+import org.apache.geronimo.kernel.NoSuchAttributeException;
+import org.apache.geronimo.kernel.NoSuchOperationException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.lifecycle.LifecycleListener;
+import org.apache.geronimo.kernel.management.NotificationType;
+
+/**
+ * @version $Rev: 109772 $ $Date: 2004-12-03 21:06:02 -0800 (Fri, 03 Dec 2004) $
+ */
+public final class MBeanGBeanBridge implements MBeanRegistration, DynamicMBean, NotificationEmitter {
+    private static final Log log = LogFactory.getLog(MBeanGBeanBridge.class);
+
+    /**
+     * The kernel
+     */
+    private final Kernel kernel;
+
+    /**
+     * The unique name of this service.
+     */
+    private final ObjectName objectName;
+
+    /**
+     * The mbean info
+     */
+    private final MBeanInfo mbeanInfo;
+
+    /**
+     * The broadcaster for notifications
+     */
+    private final NotificationBroadcasterSupport notificationBroadcaster = new NotificationBroadcasterSupport();
+    private final LifecycleBridge lifecycleBridge;
+
+    public MBeanGBeanBridge(Kernel kernel, ObjectName objectName, MBeanInfo mbeanInfo) {
+        this.kernel = kernel;
+        this.objectName = objectName;
+        this.mbeanInfo = mbeanInfo;
+        lifecycleBridge = new LifecycleBridge(objectName, notificationBroadcaster);
+    }
+
+    public ObjectName getObjectName() {
+        return objectName;
+    }
+
+    public ObjectName preRegister(MBeanServer mBeanServer, ObjectName objectName) throws Exception {
+        return objectName;
+    }
+
+    public void postRegister(Boolean registrationDone) {
+        if (Boolean.TRUE.equals(registrationDone)) {
+            // fire the loaded event from the gbeanMBean.. it was already fired from the GBeanInstance when it was created
+            kernel.getLifecycleMonitor().addLifecycleListener(lifecycleBridge, objectName);
+            lifecycleBridge.loaded(objectName);
+        }
+    }
+
+    public void preDeregister() {
+        kernel.getLifecycleMonitor().removeLifecycleListener(lifecycleBridge);
+        lifecycleBridge.unloaded(objectName);
+    }
+
+    public void postDeregister() {
+    }
+
+    public MBeanInfo getMBeanInfo() {
+        return mbeanInfo;
+    }
+
+    public Object getAttribute(String attributeName) throws ReflectionException, AttributeNotFoundException {
+        try {
+            return kernel.getAttribute(objectName, attributeName);
+        } catch (NoSuchAttributeException e) {
+            throw new AttributeNotFoundException(attributeName);
+        } catch (Exception e) {
+            throw new ReflectionException(e);
+        }
+    }
+
+    public void setAttribute(Attribute attribute) throws ReflectionException, AttributeNotFoundException {
+        String attributeName = attribute.getName();
+        Object attributeValue = attribute.getValue();
+        try {
+            kernel.setAttribute(objectName, attributeName, attributeValue);
+        } catch (NoSuchAttributeException e) {
+            throw new AttributeNotFoundException(attributeName);
+        } catch (Exception e) {
+            throw new ReflectionException(e);
+        }
+    }
+
+    public AttributeList getAttributes(String[] attributes) {
+        AttributeList results = new AttributeList(attributes.length);
+        for (int i = 0; i < attributes.length; i++) {
+            String name = attributes[i];
+            try {
+                Object value = getAttribute(name);
+                results.add(new Attribute(name, value));
+            } catch (JMException e) {
+                log.warn("Exception while getting attribute " + name, e);
+            }
+        }
+        return results;
+    }
+
+    public AttributeList setAttributes(AttributeList attributes) {
+        AttributeList results = new AttributeList(attributes.size());
+        for (Iterator iterator = attributes.iterator(); iterator.hasNext();) {
+            Attribute attribute = (Attribute) iterator.next();
+            try {
+                setAttribute(attribute);
+                results.add(attribute);
+            } catch (JMException e) {
+                log.warn("Exception while setting attribute " + attribute.getName(), e);
+            }
+        }
+        return results;
+    }
+
+    public Object invoke(String operationName, Object[] arguments, String[] types) throws ReflectionException {
+        try {
+            return kernel.invoke(objectName, operationName, arguments, types);
+        } catch (NoSuchOperationException e) {
+            throw new ReflectionException(new NoSuchMethodException(new GOperationSignature(operationName, types).toString()));
+        } catch (Exception e) {
+            throw new ReflectionException(e);
+        }
+    }
+
+    public MBeanNotificationInfo[] getNotificationInfo() {
+        return new MBeanNotificationInfo[]{
+            new MBeanNotificationInfo(NotificationType.TYPES, "javax.management.Notification", "J2EE Notifications")
+        };
+    }
+
+    public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) {
+        notificationBroadcaster.addNotificationListener(listener, filter, handback);
+    }
+
+    public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException {
+        notificationBroadcaster.removeNotificationListener(listener);
+    }
+
+    public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException {
+        notificationBroadcaster.removeNotificationListener(listener, filter, handback);
+    }
+
+    public String toString() {
+        return objectName.toString();
+    }
+
+    private static class LifecycleBridge implements LifecycleListener {
+        /**
+         * Sequence number used for notifications
+         */
+        private long sequence;
+
+        /**
+         * Name of the MBeanGBean
+         */
+        private final ObjectName mbeanGBeanName;
+
+        /**
+         * The notification broadcaster to use
+         */
+        private final NotificationBroadcasterSupport notificationBroadcaster;
+
+        public LifecycleBridge(ObjectName mbeanGBeanName, NotificationBroadcasterSupport notificationBroadcaster) {
+            this.mbeanGBeanName = mbeanGBeanName;
+            this.notificationBroadcaster = notificationBroadcaster;
+        }
+
+        public void loaded(ObjectName objectName) {
+            if (mbeanGBeanName.equals(objectName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.OBJECT_CREATED, objectName, nextSequence()));
+            }
+        }
+
+        public void starting(ObjectName objectName) {
+            if (mbeanGBeanName.equals(objectName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_STARTING, objectName, nextSequence()));
+            }
+        }
+
+        public void running(ObjectName objectName) {
+            if (mbeanGBeanName.equals(objectName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_RUNNING, objectName, nextSequence()));
+            }
+        }
+
+        public void stopping(ObjectName objectName) {
+            if (mbeanGBeanName.equals(objectName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_STOPPING, objectName, nextSequence()));
+            }
+        }
+
+        public void stopped(ObjectName objectName) {
+            if (mbeanGBeanName.equals(objectName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_STOPPED, objectName, nextSequence()));
+            }
+        }
+
+        public void failed(ObjectName objectName) {
+            if (mbeanGBeanName.equals(objectName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_FAILED, objectName, nextSequence()));
+            }
+        }
+
+        public void unloaded(ObjectName objectName) {
+            if (mbeanGBeanName.equals(objectName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.OBJECT_DELETED, objectName, nextSequence()));
+            }
+        }
+
+        public synchronized long nextSequence() {
+            return sequence++;
+        }
+    }
+}

Added: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java?rev=169154&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java (added)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java Sun May  8 12:35:23 2005
@@ -0,0 +1,192 @@
+/**
+ *
+ * Copyright 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.system.jmx;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.JMException;
+import javax.management.JMRuntimeException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+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.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.kernel.lifecycle.LifecycleAdapter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MBeanServerKernelBridge implements GBeanLifecycle {
+    private static final Log log = LogFactory.getLog(MBeanServerKernelBridge.class);
+    private final HashMap registry = new HashMap();
+    private final Kernel kernel;
+    private final MBeanServer mbeanServer;
+    private static final ObjectName ALL = JMXUtil.getObjectName("*:*");
+
+    public MBeanServerKernelBridge(Kernel kernel, String mbeanServerId) throws MBeanServerNotFound {
+        this.kernel = kernel;
+        ArrayList servers = MBeanServerFactory.findMBeanServer(mbeanServerId);
+        if (servers.size() == 0) {
+            throw new MBeanServerNotFound("No MBeanServers were found with the agent id " + mbeanServerId);
+        } else if (servers.size() > 1) {
+            throw new MBeanServerNotFound(servers.size() + " MBeanServers were found with the agent id " + mbeanServerId);
+        }
+        mbeanServer = (MBeanServer) servers.get(0);
+
+    }
+
+    public void doStart() {
+        kernel.getLifecycleMonitor().addLifecycleListener(new GBeanRegistrationListener(), ALL);
+
+        HashMap beans = new HashMap();
+        synchronized (this) {
+            Set allNames = kernel.listGBeans(ALL);
+            for (Iterator iterator = allNames.iterator(); iterator.hasNext();) {
+                ObjectName objectName = (ObjectName) iterator.next();
+                if (registry.containsKey(objectName)) {
+                    // instance already registered
+                    continue;
+                }
+                MBeanInfo mbeanInfo = null;
+                try {
+                    mbeanInfo = JMXUtil.toMBeanInfo(kernel.getGBeanInfo(objectName));
+                } catch (GBeanNotFoundException e) {
+                    // ignore - gbean already unregistered
+                    continue;
+                }
+                MBeanGBeanBridge mbeanGBeanBridge = new MBeanGBeanBridge(kernel, objectName, mbeanInfo);
+                registry.put(objectName, mbeanGBeanBridge);
+                beans.put(objectName, mbeanGBeanBridge);
+            }
+        }
+        for (Iterator iterator = beans.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            ObjectName objectName = (ObjectName) entry.getKey();
+            MBeanGBeanBridge bridge = (MBeanGBeanBridge) entry.getValue();
+            try {
+                mbeanServer.registerMBean(bridge, objectName);
+            } catch (InstanceAlreadyExistsException e) {
+                // ignore - gbean already has an mbean shadow object
+            } catch (Exception e) {
+                log.info("Unable to register MBean shadow object for GBean", unwrapJMException(e));
+            }
+        }
+    }
+
+    public void doFail() {
+        doStop();
+    }
+
+    public void doStop() {
+        // unregister all of our GBeans from the MBeanServer
+        Map beans;
+        synchronized (this) {
+            beans = new HashMap(registry);
+            registry.clear();
+        }
+        for (Iterator i = beans.keySet().iterator(); i.hasNext();) {
+            ObjectName objectName = (ObjectName) i.next();
+            try {
+                mbeanServer.unregisterMBean(objectName);
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+    }
+
+    private void register(ObjectName objectName) {
+        try {
+            MBeanGBeanBridge mbeanGBeanBridge = null;
+            synchronized (this) {
+                if (registry.containsKey(objectName)) {
+                    return;
+                }
+                MBeanInfo mbeanInfo = JMXUtil.toMBeanInfo(kernel.getGBeanInfo(objectName));
+                mbeanGBeanBridge = new MBeanGBeanBridge(kernel, objectName, mbeanInfo);
+                registry.put(objectName, mbeanGBeanBridge);
+            }
+            mbeanServer.registerMBean(mbeanGBeanBridge, objectName);
+        } catch (GBeanNotFoundException e) {
+            // ignore - gbean already unregistered
+        } catch (InstanceAlreadyExistsException e) {
+            // ignore - gbean already has an mbean shadow object
+        } catch (Exception e) {
+            log.info("Unable to register MBean shadow object for GBean", unwrapJMException(e));
+        }
+    }
+
+    private void unregister(ObjectName objectName) {
+        synchronized (this) {
+            if (registry.remove(objectName) == null) {
+                return;
+            }
+        }
+
+        try {
+            mbeanServer.unregisterMBean(objectName);
+        } catch (InstanceNotFoundException e) {
+            // ignore - something else may have unregistered us
+            // if there truely is no GBean then we will catch it below whwn we call the superclass
+        } catch (Exception e) {
+            log.info("Unable to unregister MBean shadow object for GBean", unwrapJMException(e));
+        }
+    }
+
+    private Throwable unwrapJMException(Throwable cause) {
+        while ((cause instanceof JMException || cause instanceof JMRuntimeException) && cause.getCause() != null) {
+            cause = cause.getCause();
+        }
+        return cause;
+    }
+
+    private class GBeanRegistrationListener extends LifecycleAdapter {
+        public void loaded(ObjectName objectName) {
+            register(objectName);
+        }
+
+        public void unloaded(ObjectName objectName) {
+            unregister(objectName);
+        }
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(MBeanServerKernelBridge.class);
+        infoFactory.addAttribute("kernel", Kernel.class, false);
+        infoFactory.addAttribute("mbeanServerId", String.class, true);
+        infoFactory.setConstructor(new String[]{"kernel", "mbeanServerId"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Added: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerNotFound.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerNotFound.java?rev=169154&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerNotFound.java (added)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerNotFound.java Sun May  8 12:35:23 2005
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005 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.system.jmx;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MBeanServerNotFound extends Exception {
+    public MBeanServerNotFound() {
+    }
+
+    public MBeanServerNotFound(String message) {
+        super(message);
+    }
+
+    public MBeanServerNotFound(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public MBeanServerNotFound(Throwable cause) {
+        super(cause);
+    }
+}

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?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- 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 Sun May  8 12:35:23 2005
@@ -27,9 +27,12 @@
 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.KernelFactory;
+import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.log.GeronimoLogging;
 import org.apache.geronimo.system.url.GeronimoURLFactory;
 
@@ -74,7 +77,7 @@
     }
 
     private Kernel kernel;
-    private GBeanData config;
+    private GBeanData configuration;
 
     public void invokeMainGBean(List configurations, ObjectName mainGBean, String mainMethod, String[] args) throws Exception {
         startKernel(configurations);
@@ -94,24 +97,30 @@
     }
 
     protected void startKernel(List configurations) throws Exception {
-        // boot the kernel
-        kernel = new Kernel("geronimo");
-        kernel.boot();
-
         // load and start the configuration in this jar
-        ConfigurationManager configurationManager = kernel.getConfigurationManager();
-        config = new GBeanData();
+        configuration = new GBeanData();
         ClassLoader classLoader = CommandLine.class.getClassLoader();
         ObjectInputStream ois = new ObjectInputStream(classLoader.getResourceAsStream("META-INF/config.ser"));
         try {
-            config.readExternal(ois);
+            configuration.readExternal(ois);
         } finally {
             ois.close();
         }
-        configurationManager.load(config, classLoader.getResource("/"), classLoader);
-        kernel.startRecursiveGBean(config.getName());
+        URI configurationId = (URI) configuration.getAttribute("id");
+        ObjectName configName = Configuration.getConfigurationObjectName(configurationId);
+        configuration.setName(configName);
+
+        // boot the kernel
+        kernel = KernelFactory.newInstance().createKernel("geronimo");
+        kernel.boot();
+
+        // load this configuration into the kernel
+        kernel.loadGBean(configuration, classLoader);
+        kernel.setAttribute(configName, "baseURL", classLoader.getResource("/"));
+        kernel.startRecursiveGBean(configName);
 
         // load and start the configurations
+        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
         for (Iterator i = configurations.iterator(); i.hasNext();) {
             URI configID = (URI) i.next();
             List list = configurationManager.loadRecursive(configID);
@@ -128,7 +137,7 @@
 
     protected void stopKernel() throws GBeanNotFoundException, InternalKernelException {
         // stop this configuration
-        kernel.stopGBean(config.getName());
+        kernel.stopGBean(configuration.getName());
 
         // shutdown the kernel
         kernel.shutdown();

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java Sun May  8 12:35:23 2005
@@ -17,30 +17,34 @@
 
 package org.apache.geronimo.system.main;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.ObjectInputStream;
-import java.io.File;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
-import javax.management.ObjectName;
+import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
+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.kernel.Kernel;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.jmx.JMXUtil;
-import org.apache.geronimo.kernel.jmx.JMXGBeanRegistry;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.log.GeronimoLogging;
-import org.apache.geronimo.system.url.GeronimoURLFactory;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.system.jmx.MBeanServerKernelBridge;
 import org.apache.geronimo.system.serverinfo.DirectoryUtils;
+import org.apache.geronimo.system.url.GeronimoURLFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -131,9 +135,16 @@
             } finally {
                 ois.close();
             }
+            URI configurationId = (URI) configuration.getAttribute("id");
+            ObjectName configName = Configuration.getConfigurationObjectName(configurationId);
+            configuration.setName(configName);
+
+            // create a mbean server
+            MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer("geronimo");
+            String mbeanServerId = (String) mbeanServer.getAttribute(new ObjectName("JMImplementation:type=MBeanServerDelegate"), "MBeanServerId");
 
-            // build a jms kernel
-            final Kernel kernel = new Kernel("geronimo", new JMXGBeanRegistry(MBeanServerFactory.createMBeanServer("geronimo")));
+            // create the kernel
+            final Kernel kernel = KernelFactory.newInstance().createKernel("geronimo");
 
             // boot the kernel
             try {
@@ -144,9 +155,11 @@
                 throw new AssertionError();
             }
 
+            // load this configuration into the kernel
+            kernel.loadGBean(configuration, classLoader);
+            kernel.setAttribute(configName, "baseURL", classLoader.getResource("/"));
+
             // add our shutdown hook
-            ConfigurationManager configurationManager = kernel.getConfigurationManager();
-            configurationManager.load(configuration, classLoader.getResource("/"), classLoader);
             Runtime.getRuntime().addShutdownHook(new Thread("Shutdown Thread") {
                 public void run() {
                     log.info("Server shutdown begun");
@@ -155,6 +168,13 @@
                 }
             });
 
+            // add the jmx bridge
+            ObjectName mbeanServerKernelBridgeName = new ObjectName("geronimo.boot:role=MBeanServerKernelBridge"); 
+            GBeanData mbeanServerKernelBridge = new GBeanData(mbeanServerKernelBridgeName, MBeanServerKernelBridge.GBEAN_INFO);
+            mbeanServerKernelBridge.setAttribute("mbeanServerId", mbeanServerId);
+            kernel.loadGBean(mbeanServerKernelBridge, classLoader);
+            kernel.startGBean(mbeanServerKernelBridgeName);
+
             // start this configuration
             kernel.startRecursiveGBean(configuration.getName());
 
@@ -177,6 +197,7 @@
 
             // load the rest of the configurations
             try {
+                ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
                 for (Iterator i = configs.iterator(); i.hasNext();) {
                     URI configID = (URI) i.next();
                     List list = configurationManager.loadRecursive(configID);
@@ -209,9 +230,9 @@
             for (Iterator iterator = allGBeans.iterator(); iterator.hasNext();) {
                 ObjectName objectName = (ObjectName) iterator.next();
                 try {
-                    Integer state = (Integer) kernel.getAttribute(objectName, "state");
-                    if (state.intValue() != State.RUNNING_INDEX) {
-                        log.info("GBean " + objectName + " is not running. Current state: " + State.fromInteger(state).getName());
+                    int state = kernel.getGBeanState(objectName);
+                    if (state != State.RUNNING_INDEX) {
+                        log.info("GBean " + objectName + " is not running. Current state: " + State.fromInt(state).getName());
                     }
                 } catch (GBeanNotFoundException e) {
                     log.info("Alleged GBean " + objectName + " is not a GBean");

Modified: geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java (original)
+++ geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java Sun May  8 12:35:23 2005
@@ -25,11 +25,14 @@
 import java.net.URL;
 import java.util.jar.JarOutputStream;
 import java.util.zip.ZipEntry;
+import java.util.Collections;
 import javax.management.ObjectName;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.management.State;
@@ -49,15 +52,11 @@
     private ObjectName gbeanName1;
     private ObjectName gbeanName2;
     private ObjectName storeName;
+    private ConfigurationManager configurationManager;
 
     public void testInstall() throws Exception {
         kernel.invoke(storeName, "install", new Object[] {source}, new String[] {"java.net.URL"});
         assertTrue(new File(root, "1/META-INF/config.ser").exists());
-        assertEquals(new File(root, "1").toURL(),
-            kernel.invoke(storeName, "getBaseURL", new Object[] {uri}, new String[] {"java.net.URI"}));
-
-        GBeanData config = (GBeanData) kernel.invoke(storeName, "getConfiguration", new Object[] {uri}, new String[] {"java.net.URI"});
-        assertEquals(uri, config.getAttribute("ID"));
     }
 
     public void testReInstall() throws Exception {
@@ -79,16 +78,15 @@
         kernel.invoke(storeName, "install", new Object[] {source}, new String[] {"java.net.URL"});
 
         // load and start the config
-        ConfigurationManager configurationManager = kernel.getConfigurationManager();
         ObjectName configName = configurationManager.load(uri);
-        kernel.invoke(configName, "startRecursive", null, null);
+        kernel.startRecursiveGBean(configName);
 
         // make sure the config and the enabled gbean are running
-        assertEquals(new Integer(State.RUNNING_INDEX), kernel.getAttribute(configName, "state"));
-        assertEquals(new Integer(State.RUNNING_INDEX), kernel.getAttribute(gbeanName1, "state"));
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(configName));
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbeanName1));
 
         // make sure the config and the disabled gbean are NOT running
-        assertEquals(new Integer(State.STOPPED_INDEX), kernel.getAttribute(gbeanName2, "state"));
+        assertEquals(State.STOPPED_INDEX, kernel.getGBeanState(gbeanName2));
 
         // set the value
         kernel.setAttribute(gbeanName1, "value", "9900990099");
@@ -96,26 +94,26 @@
 
         // stop and unload the config
         kernel.stopGBean(configName);
-        configurationManager.unload(configName);
+        kernel.unloadGBean(configName);
 
         // assure it was unloaded
         assertFalse(kernel.isLoaded(configName));
 
         // now reload and restart the config
         configName = configurationManager.load(uri);
-        kernel.invoke(configName, "startRecursive", null, null);
+        kernel.startRecursiveGBean(configName);
 
         // make sure the value was reloaded correctly
         assertEquals("9900990099", kernel.getAttribute(gbeanName1, "value"));
 
         // stop and unload the config
         kernel.stopGBean(configName);
-        configurationManager.unload(configName);
+        kernel.unloadGBean(configName);
     }
 
     protected void setUp() throws Exception {
         try {
-            kernel = new Kernel("test.kernel");
+            kernel = KernelFactory.newInstance().createKernel("test.kernel");
             kernel.boot();
 
             gbeanName1 = new ObjectName("geronimo.test:name=MyMockGMBean1");
@@ -136,13 +134,19 @@
             storeName = new ObjectName("geronimo.test:j2eeType=ConfigurationStore,name=LocalConfigStore");
             GBeanData store = new GBeanData(storeName, LocalConfigStore.getGBeanInfo());
             store.setAttribute("root", root.toURI());
-
             kernel.loadGBean(store, getClass().getClassLoader());
             kernel.startGBean(storeName);
 
+            ObjectName configurationManagerName = new ObjectName(":j2eeType=ConfigurationManager,name=Basic");
+            GBeanData configurationManagerData = new GBeanData(configurationManagerName, ConfigurationManagerImpl.GBEAN_INFO);
+            configurationManagerData.setReferencePatterns("Stores", Collections.singleton(store.getName()));
+            kernel.loadGBean(configurationManagerData, getClass().getClassLoader());
+            kernel.startGBean(configurationManagerName);
+            configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);
+
             uri = new URI("test");
             GBeanData gbean = new GBeanData(Configuration.getConfigurationObjectName(uri), Configuration.GBEAN_INFO);
-            gbean.setAttribute("ID", uri);
+            gbean.setAttribute("id", uri);
             gbean.setAttribute("gBeanState", state);
 
 

Modified: geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java (original)
+++ geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java Sun May  8 12:35:23 2005
@@ -91,7 +91,7 @@
     }
 
     public String getId() {
-        return getAttributeValue("ID");
+        return getAttributeValue("id");
     }
 
     public String getAttributeValue(String attrName) {

Modified: geronimo/trunk/modules/tomcat-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/project.xml?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/project.xml (original)
+++ geronimo/trunk/modules/tomcat-builder/project.xml Sun May  8 12:35:23 2005
@@ -300,7 +300,7 @@
 
         <dependency>
             <groupId>cglib</groupId>
-            <artifactId>cglib-full</artifactId>
+            <artifactId>cglib-nodep</artifactId>
             <version>${cglib_version}</version>
             <url>http://cglib.sf.net/</url>
         </dependency>

Modified: geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Sun May  8 12:35:23 2005
@@ -36,7 +36,6 @@
 import java.util.Set;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
-
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.security.jacc.WebResourcePermission;
@@ -298,7 +297,7 @@
        // web application do not add anything to the shared context
    }
 
-   public String addGBeans(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
+   public void addGBeans(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
        J2eeContext earJ2eeContext = earContext.getJ2eeContext();
        J2eeContext moduleJ2eeContext = J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, NameFactory.WEB_MODULE, module.getName());
        WebModule webModule = (WebModule) module;
@@ -429,7 +428,6 @@
        } catch (Exception e) {
            throw new DeploymentException("Unable to initialize webapp GBean", e);
        }
-       return null;
    }
 
    private ClassLoader getWebClassLoader(EARContext earContext, WebModule webModule, ClassLoader cl, boolean contextPriorityClassLoader) throws DeploymentException {

Modified: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Sun May  8 12:35:23 2005
@@ -58,15 +58,18 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.registry.BasicGBeanRegistry;
 import org.apache.geronimo.security.SecurityServiceImpl;
 import org.apache.geronimo.security.jacc.ApplicationPolicyConfigurationManager;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
@@ -175,22 +178,18 @@
         kernel.loadGBean(configData, cl);
 
         kernel.startRecursiveGBean(configData.getName());
-        if (((Integer) kernel.getAttribute(configData.getName(), "state"))
-                .intValue() != State.RUNNING_INDEX) {
+        if (kernel.getGBeanState(configData.getName()) != State.RUNNING_INDEX) {
             fail("gbean not started: " + configData.getName());
         }
 
-        assertEquals(new Integer(State.RUNNING_INDEX),kernel.getAttribute(
-                                ObjectName.getInstance("test:J2EEApplication=null,J2EEServer=bar,j2eeType=WebModule,name=org/apache/geronimo/test"),
-                                "state"));        
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(ObjectName.getInstance("test:J2EEApplication=null,J2EEServer=bar,j2eeType=WebModule,name=org/apache/geronimo/test")));
 
         Set names = kernel.listGBeans(ObjectName.getInstance("test:J2EEApplication=null,J2EEServer=bar,*"));
         System.out.println("Object names: " + names);
         for (Iterator iterator = names.iterator(); iterator.hasNext();) {
             ObjectName objectName = (ObjectName) iterator.next();
-            System.out.println("STATE: " + kernel.getAttribute(objectName, "state") + " - " + objectName.getCanonicalName());
-            assertEquals(new Integer(State.RUNNING_INDEX), kernel.getAttribute(
-                    objectName, "state"));
+            System.out.println("STATE: " + kernel.getGBeanState(objectName) + " - " + objectName.getCanonicalName());
+            assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(objectName));
         }
 
         //If we got here with no errors, then Tomcat deployed the war and loaded the classes
@@ -336,7 +335,7 @@
         ctcName = new ObjectName(
                 "geronimo.server:role=ConnectionTrackingCoordinator");
 
-        kernel = new Kernel("foo", new BasicGBeanRegistry());
+        kernel = KernelFactory.newInstance().createKernel("foo");
         kernel.boot();
 
         GBeanData store = new GBeanData(JMXUtil
@@ -345,11 +344,15 @@
         kernel.loadGBean(store, this.getClass().getClassLoader());
         kernel.startGBean(store.getName());
 
-        GBeanData baseConfig = (GBeanData) kernel.invoke(store.getName(),
-                "getConfiguration", new Object[] { parentId },
-                new String[] { URI.class.getName() });
-        kernel.loadGBean(baseConfig, this.getClass().getClassLoader());
-        kernel.startGBean(baseConfig.getName());
+        ObjectName configurationManagerName = new ObjectName(":j2eeType=ConfigurationManager,name=Basic");
+        GBeanData configurationManagerData = new GBeanData(configurationManagerName, ConfigurationManagerImpl.GBEAN_INFO);
+        configurationManagerData.setReferencePatterns("Stores", Collections.singleton(store.getName()));
+        kernel.loadGBean(configurationManagerData, getClass().getClassLoader());
+        kernel.startGBean(configurationManagerName);
+        ConfigurationManager configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);
+
+        ObjectName baseConfigName = configurationManager.load(parentId);
+        kernel.startGBean(baseConfigName);
 
         serverInfoName = new ObjectName("geronimo.system:name=ServerInfo");
         serverInfoGBean = new GBeanData(serverInfoName, ServerInfo.GBEAN_INFO);
@@ -447,8 +450,7 @@
     private void start(GBeanData gbeanData) throws Exception {
         kernel.loadGBean(gbeanData, cl);
         kernel.startGBean(gbeanData.getName());
-        if (((Integer) kernel.getAttribute(gbeanData.getName(), "state"))
-                .intValue() != State.RUNNING_INDEX) {
+        if (kernel.getGBeanState(gbeanData.getName()) != State.RUNNING_INDEX) {
             fail("gbean not started: " + gbeanData.getName());
         }
     }
@@ -459,49 +461,50 @@
     }
 
     public static class MockConfigStore implements ConfigurationStore {
-        public URI install(URL source) throws IOException,
-                InvalidConfigException {
-            return null;
+        private final Kernel kernel;
+
+        public MockConfigStore(Kernel kernel) {
+            this.kernel = kernel;
         }
 
-        public URI install(File source) throws IOException,
-                InvalidConfigException {
+        public URI install(URL source) throws IOException, InvalidConfigException {
             return null;
         }
 
-        public void uninstall(URI configID) throws NoSuchConfigException,
-                IOException {
-
+        public void install(ConfigurationData configurationData, File source) throws IOException, InvalidConfigException {
         }
 
-        public boolean containsConfiguration(URI configID) {
-            return true;
+        public void uninstall(URI configID) throws NoSuchConfigException, IOException {
         }
 
-        public GBeanData getConfiguration(URI id) throws NoSuchConfigException,
-                IOException, InvalidConfigException {
-            GBeanData configData = null;
+        public ObjectName loadConfiguration(URI configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+            ObjectName configurationObjectName = null;
             try {
-                configData = new GBeanData(Configuration
-                        .getConfigurationObjectName(id),
-                        Configuration.GBEAN_INFO);
+                configurationObjectName = Configuration.getConfigurationObjectName(configId);
             } catch (MalformedObjectNameException e) {
                 throw new InvalidConfigException(e);
             }
-            configData.setAttribute("ID", id);
+            GBeanData configData = new GBeanData(configurationObjectName, Configuration.GBEAN_INFO);
+            configData.setAttribute("id", configId);
             configData.setAttribute("domain", "test");
             configData.setAttribute("server", "bar");
             configData.setAttribute("gBeanState", NO_OBJECTS_OS);
-            return configData;
-        }
 
-        public void updateConfiguration(Configuration configuration)
-                throws NoSuchConfigException, Exception {
+            try {
+                kernel.loadGBean(configData, Configuration.class.getClassLoader());
+            } catch (Exception e) {
+                throw new InvalidConfigException("Unable to register configuration", e);
+            }
 
+            return configurationObjectName;
         }
 
-        public URL getBaseURL(URI id) throws NoSuchConfigException {
-            return null;
+        public boolean containsConfiguration(URI configID) {
+            return true;
+        }
+
+        public void updateConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, Exception {
+
         }
 
         public String getObjectName() {
@@ -521,9 +524,10 @@
         private static final byte[] NO_OBJECTS_OS;
 
         static {
-            GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(
-                    MockConfigStore.class, NameFactory.CONFIGURATION_STORE);
+            GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(MockConfigStore.class, NameFactory.CONFIGURATION_STORE);
             infoBuilder.addInterface(ConfigurationStore.class);
+            infoBuilder.addAttribute("kernel", Kernel.class, false);
+            infoBuilder.setConstructor(new String[] {"kernel"});
             GBEAN_INFO = infoBuilder.getBeanInfo();
 
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -535,6 +539,5 @@
                 throw new RuntimeException(e);
             }
         }
-    };
-
+    }
 }

Modified: geronimo/trunk/modules/tomcat/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/project.xml?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/project.xml (original)
+++ geronimo/trunk/modules/tomcat/project.xml Sun May  8 12:35:23 2005
@@ -44,7 +44,7 @@
         <!-- temporary solution until appropriate xmlbeans code is ready -->
         <dependency>
           <groupId>cglib</groupId>
-          <artifactId>cglib-full</artifactId>
+          <artifactId>cglib-nodep</artifactId>
           <version>${cglib_version}</version>
           <url>http://cglib.sf.net/</url>
         </dependency>

Modified: geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml (original)
+++ geronimo/trunk/modules/tomcat/src/plan/tomcat-plan.xml Sun May  8 12:35:23 2005
@@ -64,22 +64,22 @@
         <uri>tomcat/jars/servlets-invoker-${tomcat_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>commons-beanutils/jars/commons-beanutils-1.6.1.jar</uri>
+        <uri>commons-beanutils/jars/commons-beanutils-${commons_beanutils_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>commons-collections/jars/commons-collections-2.1.jar</uri>
+        <uri>commons-collections/jars/commons-collections-${commons_collections_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>commons-digester/jars/commons-digester-1.6.jar</uri>
+        <uri>commons-digester/jars/commons-digester-${commons_digester_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>commons-el/jars/commons-el-1.0.jar</uri>
+        <uri>commons-el/jars/commons-el-${commons_el_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>commons-modeler/jars/commons-modeler-1.1.jar</uri>
+        <uri>commons-modeler/jars/commons-modeler-${commons_modeler_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>regexp/jars/regexp-1.3.jar</uri>
+        <uri>regexp/jars/regexp-${regexp_version}.jar</uri>
     </dependency>
     <dependency>
         <uri>mx4j/jars/mx4j-${mx4j-version}.jar</uri>

Modified: geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java (original)
+++ geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java Sun May  8 12:35:23 2005
@@ -36,6 +36,7 @@
 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.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.security.SecurityServiceImpl;
@@ -258,7 +259,7 @@
     private void start(GBeanData gbeanData) throws Exception {
         kernel.loadGBean(gbeanData, cl);
         kernel.startGBean(gbeanData.getName());
-        if (((Integer) kernel.getAttribute(gbeanData.getName(), "state")).intValue() != State.RUNNING_INDEX) {
+        if (kernel.getGBeanState(gbeanData.getName()) != State.RUNNING_INDEX) {
             fail("gbean not started: " + gbeanData.getName());
         }
     }
@@ -283,7 +284,7 @@
 
         ctcName = new ObjectName("geronimo.test:role=ConnectionTrackingCoordinator");
 
-        kernel = new Kernel("test.kernel");
+        kernel = KernelFactory.newInstance().createKernel("test.kernel");
         kernel.boot();
 
         //ServerInfo

Modified: geronimo/trunk/modules/webservices/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/project.xml?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/modules/webservices/project.xml (original)
+++ geronimo/trunk/modules/webservices/project.xml Sun May  8 12:35:23 2005
@@ -85,7 +85,7 @@
 
         <dependency>
             <groupId>cglib</groupId>
-            <artifactId>cglib-full</artifactId>
+            <artifactId>cglib-nodep</artifactId>
             <version>${cglib_version}</version>
             <url>http://cglib.sf.net/</url>
         </dependency>

Modified: geronimo/trunk/plugins/geronimo-packaging-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-packaging-plugin/project.xml?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-packaging-plugin/project.xml (original)
+++ geronimo/trunk/plugins/geronimo-packaging-plugin/project.xml Sun May  8 12:35:23 2005
@@ -28,13 +28,13 @@
         <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-kernel</artifactId>
-            <version>159810</version>
+            <version>1.0-SNAPSHOT</version>
         </dependency>
 
         <dependency>
             <groupId>cglib</groupId>
-            <artifactId>cglib-full</artifactId>
-            <version>2.0.2</version>
+            <artifactId>cglib-nodep</artifactId>
+            <version>2.1</version>
         </dependency>
         <dependency>
             <groupId>mx4j</groupId>

Modified: geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java (original)
+++ geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java Sun May  8 12:35:23 2005
@@ -20,7 +20,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectInputStream;
-import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
 import java.util.List;
@@ -34,7 +33,9 @@
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.Kernel;
 
 /**
  * Implementation of ConfigurationStore that loads Configurations from a repository.
@@ -44,10 +45,12 @@
  * @version $Rev$ $Date$
  */
 public class MavenConfigStore implements ConfigurationStore {
+    private final Kernel kernel;
     private final ObjectName objectName;
     private final Repository repository;
 
-    public MavenConfigStore(String objectName, Repository repository) throws MalformedObjectNameException {
+    public MavenConfigStore(Kernel kernel, String objectName, Repository repository) throws MalformedObjectNameException {
+        this.kernel = kernel;
         this.objectName = new ObjectName(objectName);
         this.repository = repository;
     }
@@ -56,24 +59,54 @@
         return objectName.toString();
     }
 
-    public GBeanData getConfiguration(URI id) throws NoSuchConfigException, IOException, InvalidConfigException {
-        if (!repository.hasURI(id)) {
-            throw new NoSuchConfigException("Configuration not found: " + id);
+    public synchronized ObjectName loadConfiguration(URI configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+        if (!repository.hasURI(configId)) {
+            throw new NoSuchConfigException("Configuration not found: " + configId);
         }
 
-        URL stateURL = new URL(getBaseURL(id), "META-INF/config.ser");
-        InputStream jis = stateURL.openStream();
+        GBeanData config = new GBeanData();
+        URL baseURL = new URL("jar:" + repository.getURL(configId).toString() + "!/");
+        InputStream jis = null;
         try {
+            URL stateURL = new URL(baseURL, "META-INF/config.ser");
+            jis = stateURL.openStream();
             ObjectInputStream ois = new ObjectInputStream(jis);
-            GBeanData config = new GBeanData();
             config.readExternal(ois);
             config.setReferencePattern("ConfigurationStore", objectName);
-            return config;
         } catch (ClassNotFoundException e) {
-            throw new InvalidConfigException("Unable to load class from config: " + id, e);
+            throw new InvalidConfigException("Unable to load class from config: " + configId, e);
         } finally {
-            jis.close();
+            if (jis != null) {
+                jis.close();
+            }
+        }
+
+        ObjectName name;
+        try {
+            name = Configuration.getConfigurationObjectName(configId);
+        } catch (MalformedObjectNameException e) {
+            throw new InvalidConfigException("Cannot convert id to ObjectName: ", e);
+        }
+        config.setName(name);
+
+        try {
+            kernel.loadGBean(config, Configuration.class.getClassLoader());
+        } catch (Exception e) {
+            throw new InvalidConfigException("Unable to register configuration", e);
+        }
+
+        try {
+            kernel.setAttribute(name, "baseURL", baseURL);
+        } catch (Exception e) {
+            try {
+                kernel.unloadGBean(name);
+            } catch (Exception ignored) {
+                // ignore
+            }
+            throw new InvalidConfigException("Cannot set baseURL", e);
         }
+
+        return name;
     }
 
     public boolean containsConfiguration(URI configID) {
@@ -95,19 +128,11 @@
         }
     }
 
-    public URL getBaseURL(URI id) throws NoSuchConfigException {
-        try {
-            return new URL("jar:" + repository.getURL(id).toString() + "!/");
-        } catch (MalformedURLException e) {
-            throw new AssertionError();
-        }
-    }
-
     public URI install(URL source) throws IOException, InvalidConfigException {
         throw new UnsupportedOperationException();
     }
 
-    public URI install(File source) throws IOException, InvalidConfigException {
+    public void install(ConfigurationData configurationData, File source) throws IOException, InvalidConfigException {
         throw new UnsupportedOperationException();
     }
 
@@ -115,7 +140,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public void updateConfiguration(Configuration configuration) throws NoSuchConfigException, Exception {
+    public void updateConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, Exception {
         // we don't store persistent state
     }
 
@@ -133,9 +158,10 @@
     static {
         GBeanInfoBuilder builder = new GBeanInfoBuilder(MavenConfigStore.class);
         builder.addInterface(ConfigurationStore.class);
+        builder.addAttribute("kernel", Kernel.class, false);
         builder.addAttribute("objectName", String.class, false);
         builder.addReference("Repository", Repository.class);
-        builder.setConstructor(new String[]{"objectName", "Repository"});
+        builder.setConstructor(new String[]{"kernel", "objectName", "Repository"});
         GBEAN_INFO = builder.getBeanInfo();
     }
 }

Modified: geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java (original)
+++ geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java Sun May  8 12:35:23 2005
@@ -24,8 +24,11 @@
 import javax.management.ObjectName;
 
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
 
 /**
  * JellyBean that builds a Geronimo Configuration using the local Mavem
@@ -190,7 +193,7 @@
         Kernel kernel = createKernel();
 
         // start the Configuration we're going to use for this deployment
-        ConfigurationManager configMgr = kernel.getConfigurationManager();
+        ConfigurationManager configMgr = ConfigurationUtil.getConfigurationManager(kernel);
         if (!configMgr.isLoaded(deploymentConfig)) {
             List configs = configMgr.loadRecursive(deploymentConfig);
             for (int i = 0; i < configs.size(); i++) {
@@ -208,12 +211,12 @@
      * Create a Geronimo Kernel to contain the deployment configurations.
      */
     private Kernel createKernel() throws Exception {
-        Kernel kernel = Kernel.getKernel(KERNEL_NAME);
+        Kernel kernel = KernelRegistry.getKernel(KERNEL_NAME);
         if (kernel != null) {
             return kernel;
         }
 
-        kernel = new Kernel(KERNEL_NAME);
+        kernel = KernelFactory.newInstance().createKernel(KERNEL_NAME);
         kernel.boot();
 
         bootDeployerSystem(kernel);

Modified: geronimo/trunk/plugins/maven-geronimo-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/maven-geronimo-plugin/project.xml?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/plugins/maven-geronimo-plugin/project.xml (original)
+++ geronimo/trunk/plugins/maven-geronimo-plugin/project.xml Sun May  8 12:35:23 2005
@@ -106,8 +106,8 @@
 
         <dependency>
             <groupId>cglib</groupId>
-            <artifactId>cglib-full</artifactId>
-            <version>2.0.2</version>
+            <artifactId>cglib-nodep</artifactId>
+            <version>2.1</version>
             <url>http://cglib.sourceforge.net</url>
         </dependency>
 

Modified: geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java (original)
+++ geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java Sun May  8 12:35:23 2005
@@ -26,13 +26,15 @@
 import java.util.List;
 import java.util.StringTokenizer;
 import javax.management.ObjectName;
-import javax.management.MBeanServerFactory;
+import javax.management.MalformedObjectNameException;
 
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.registry.BasicGBeanRegistry;
-import org.apache.geronimo.kernel.jmx.JMXGBeanRegistry;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.log.GeronimoLogging;
 import org.apache.geronimo.system.url.GeronimoURLFactory;
 
@@ -97,7 +99,6 @@
         }
         File root = new File(getGeronimoHome());
         URL systemURL = new File(root, "bin/server.jar").toURL();
-//        System.out.println("systemURL = " + systemURL);
         URL configURL = new URL("jar:" + systemURL.toString() + "!/META-INF/config.ser");
         GBeanData configuration = new GBeanData();
         ObjectInputStream ois = new ObjectInputStream(configURL.openStream());
@@ -106,16 +107,20 @@
         } finally {
             ois.close();
         }
+        URI configurationId = (URI) configuration.getAttribute("id");
+        ObjectName configName = Configuration.getConfigurationObjectName(configurationId);
+        configuration.setName(configName);
 
         // build a basic kernel without a configuration-store, our configuration store is
-        Kernel kernel = new Kernel(getKernelName());
+        Kernel kernel = KernelFactory.newInstance().createKernel(getKernelName());
         kernel.boot();
 
-        ConfigurationManager configurationManager = kernel.getConfigurationManager();
-        ObjectName configName = configurationManager.load(configuration, systemURL, this.getClass().getClassLoader());
+        kernel.loadGBean(configuration, this.getClass().getClassLoader());
+        kernel.setAttribute(configName, "baseURL", systemURL);
         kernel.startRecursiveGBean(configName);
 
         // load the rest of the configuration listed on the command line
+        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
         for (Iterator i = configList.iterator(); i.hasNext();) {
             URI configID = (URI) i.next();
             List list = configurationManager.loadRecursive(configID);

Modified: geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopRemoteServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopRemoteServer.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopRemoteServer.java (original)
+++ geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopRemoteServer.java Sun May  8 12:35:23 2005
@@ -8,16 +8,15 @@
 import javax.management.remote.JMXServiceURL;
 
 import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.jmx.KernelMBean;
 import org.apache.geronimo.kernel.jmx.KernelDelegate;
+import org.apache.geronimo.kernel.Kernel;
 
 /**
  */
 public class StopRemoteServer extends AbstractModuleCommand {
 
     private MBeanServerConnection mbServerConnection;
-    private KernelMBean kernel;
+    private Kernel kernel;
 
     public void execute() throws Exception {
         String uri = getUri().substring(DeploymentFactoryImpl.URI_PREFIX.length());

Modified: geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopServer.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopServer.java (original)
+++ geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopServer.java Sun May  8 12:35:23 2005
@@ -17,6 +17,7 @@
 
 package org.apache.geronimo.deployment.mavenplugin;
 
+import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.kernel.Kernel;
 
 /**
@@ -34,7 +35,7 @@
     }
 
     public void execute() throws Exception {
-        Kernel kernel = Kernel.getKernel(getKernelName());
+        Kernel kernel = KernelRegistry.getKernel(getKernelName());
         kernel.shutdown();
     }
 

Modified: geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/WaitForStarted.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/WaitForStarted.java?rev=169154&r1=169153&r2=169154&view=diff
==============================================================================
--- geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/WaitForStarted.java (original)
+++ geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/WaitForStarted.java Sun May  8 12:35:23 2005
@@ -20,15 +20,18 @@
 import java.util.HashMap;
 import java.util.Map;
 import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
 
 import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
 import org.apache.geronimo.kernel.jmx.KernelDelegate;
-import org.apache.geronimo.kernel.jmx.KernelMBean;
 import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
 
 public class WaitForStarted extends AbstractModuleCommand {
 
@@ -36,7 +39,7 @@
     private int retryIntervalMilliseconds = 1000;
 
     private MBeanServerConnection mbServerConnection;
-    private KernelMBean kernel;
+    private Kernel kernel;
     private String id;
 
     public String getId() {
@@ -85,14 +88,16 @@
         } finally {
             Thread.currentThread().setContextClassLoader(oldcl);
         }
-        URI id = new URI(getId());
+        ObjectName configName = Configuration.getConfigurationObjectName(new URI(getId()));
         for (int tries = maxTries; tries > 0; tries--) {
             try {
-                int state = kernel.getConfigurationState(id);
+                int state = kernel.getGBeanState(configName);
                 if (state == State.RUNNING_INDEX) {
                     return;
                 }
-            } catch (NoSuchConfigException e) {
+            } catch (InternalKernelException e) {
+                //hasn't been loaded yet, keep trying
+            } catch (GBeanNotFoundException e) {
                 //hasn't been loaded yet, keep trying
             }
             Thread.sleep(retryIntervalMilliseconds);