geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r383682 [3/5] - in /geronimo/branches/1.1/modules: connector/src/test/org/apache/geronimo/connector/ connector/src/test/org/apache/geronimo/connector/outbound/ deployment/src/java/org/apache/geronimo/deployment/ j2ee/src/java/org/apache/ger...
Date Mon, 06 Mar 2006 21:44:37 GMT
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java Mon Mar  6 13:44:29 2006
@@ -33,6 +33,8 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GAttributeInfo;
 import org.apache.geronimo.gbean.GOperationInfo;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.runtime.GBeanInstance;
 import org.apache.geronimo.gbean.runtime.RawInvoker;
 import org.apache.geronimo.kernel.Kernel;
@@ -53,29 +55,35 @@
     /**
      * The object name to which we are connected.
      */
-    private final ObjectName objectName;
+//    private final ObjectName objectName;
+
+    private final AbstractName abstractName;
 
     /**
      * GBeanInvokers keyed on the proxy interface method index
      */
     private ProxyInvoker[] gbeanInvokers;
 
-    public ProxyMethodInterceptor(Class proxyType, Kernel kernel, ObjectName objectName) {
+    public ProxyMethodInterceptor(Class proxyType, Kernel kernel, AbstractName abstractName) {
         assert proxyType != null;
         assert kernel != null;
-        assert objectName != null;
+        assert abstractName != null;
 
         this.proxyType = proxyType;
-        this.objectName = objectName;
-        gbeanInvokers = createGBeanInvokers(kernel, objectName);
+        this.abstractName = abstractName;
+        gbeanInvokers = createGBeanInvokers(kernel, abstractName);
     }
 
     public synchronized void destroy() {
         gbeanInvokers = null;
     }
 
-    public ObjectName getObjectName() {
-        return objectName;
+//    public ObjectName getObjectName() {
+//        return objectName;
+//    }
+
+    public AbstractName getAbstractName() {
+        return abstractName;
     }
 
     public final Object intercept(final Object object, final Method method, final Object[] args, final MethodProxy proxy) throws Throwable {
@@ -90,19 +98,19 @@
         }
 
         if (gbeanInvoker == null) {
-            throw new UnsupportedOperationException("No implementation method: objectName=" + objectName + ", method=" + method);
+            throw new UnsupportedOperationException("No implementation method: objectName=" + abstractName + ", method=" + method);
         }
 
-        return gbeanInvoker.invoke(objectName, args);
+        return gbeanInvoker.invoke(abstractName, args);
     }
 
-    private ProxyInvoker[] createGBeanInvokers(Kernel kernel, ObjectName objectName) {
+    private ProxyInvoker[] createGBeanInvokers(Kernel kernel, AbstractName abstractName) {
         ProxyInvoker[] invokers;
         try {
-            RawInvoker rawInvoker = (RawInvoker) kernel.getAttribute(objectName, GBeanInstance.RAW_INVOKER);
+            RawInvoker rawInvoker = (RawInvoker) kernel.getAttribute(abstractName, GBeanInstance.RAW_INVOKER);
             invokers = createRawGBeanInvokers(rawInvoker, proxyType);
         } catch (Exception e) {
-            invokers = createKernelGBeanInvokers(kernel, objectName, proxyType);
+            invokers = createKernelGBeanInvokers(kernel, abstractName, proxyType);
         }
 
         // handle equals, hashCode and toString directly here
@@ -117,7 +125,7 @@
                 invokers[getSuperIndex(proxyType, proxyType.getMethod("startRecursive", null))] = new StartRecursiveInvoke(kernel);
                 invokers[getSuperIndex(proxyType, proxyType.getMethod("stop", null))] = new StopInvoke(kernel);
                 invokers[getSuperIndex(proxyType, proxyType.getMethod("getStartTime", null))] = new GetStartTimeInvoke(kernel);
-                invokers[getSuperIndex(proxyType, proxyType.getMethod("getObjectName", null))] = new GetObjectNameInvoke();
+                invokers[getSuperIndex(proxyType, proxyType.getMethod("getObjectName", null))] = new GetObjectNameInvoke(kernel);
             }
         } catch (Exception e) {
             // this can not happen... all classes must implement equals, hashCode and toString
@@ -190,12 +198,12 @@
         return null;
     }
 
-    private ProxyInvoker[] createKernelGBeanInvokers(Kernel kernel, ObjectName objectName, Class proxyType) {
+    private ProxyInvoker[] createKernelGBeanInvokers(Kernel kernel, AbstractName abstractName, Class proxyType) {
         GBeanInfo info;
         try {
-            info = kernel.getGBeanInfo(objectName);
+            info = kernel.getGBeanInfo(abstractName);
         } catch (Exception e) {
-            throw new IllegalArgumentException("Could not get GBeanInfo for target object: " + objectName);
+            throw new IllegalArgumentException("Could not get GBeanInfo for target object: " + abstractName);
         }
 
         // build attributeName->attributeInfo map
@@ -287,8 +295,8 @@
     }
 
     static final class HashCodeInvoke implements ProxyInvoker {
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return new Integer(objectName.hashCode());
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return new Integer(abstractName.hashCode());
         }
     }
 
@@ -299,9 +307,9 @@
             this.proxyManager = proxyManager;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
             ObjectName proxyTarget = proxyManager.getProxyTarget(arguments[0]);
-            return Boolean.valueOf(objectName.equals(proxyTarget));
+            return Boolean.valueOf(abstractName.equals(proxyTarget));
         }
     }
 
@@ -312,8 +320,8 @@
             this.interfaceName = "[" + interfaceName + ": ";
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return interfaceName + objectName + "]";
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return interfaceName + abstractName + "]";
         }
     }
 
@@ -324,8 +332,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return new Integer(kernel.getGBeanState(objectName));
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return new Integer(kernel.getGBeanState(abstractName));
         }
     }
 
@@ -336,8 +344,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return State.fromInt(kernel.getGBeanState(objectName));
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return State.fromInt(kernel.getGBeanState(abstractName));
         }
     }
 
@@ -348,8 +356,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            kernel.startGBean(objectName);
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            kernel.startGBean(abstractName);
             return null;
         }
     }
@@ -361,8 +369,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            kernel.startRecursiveGBean(objectName);
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            kernel.startRecursiveGBean(abstractName);
             return null;
         }
     }
@@ -374,8 +382,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return new Long(kernel.getGBeanStartTime(objectName));
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return new Long(kernel.getGBeanStartTime(abstractName));
         }
     }
 
@@ -386,15 +394,22 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            kernel.stopGBean(objectName);
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            kernel.stopGBean(abstractName);
             return null;
         }
     }
 
     static final class GetObjectNameInvoke implements ProxyInvoker {
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return objectName.getCanonicalName();
+        private Kernel kernel;
+
+        public GetObjectNameInvoke(Kernel kernel) {
+            this.kernel = kernel;
+        }
+
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            GBeanData gBeanData = kernel.getGBeanData(abstractName);
+            return gBeanData.getName().getCanonicalName();
         }
     }
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawGetAttributeInvoker.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawGetAttributeInvoker.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawGetAttributeInvoker.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawGetAttributeInvoker.java Mon Mar  6 13:44:29 2006
@@ -16,9 +16,8 @@
  */
 package org.apache.geronimo.kernel.basic;
 
-import javax.management.ObjectName;
-
 import org.apache.geronimo.gbean.runtime.RawInvoker;
+import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * @version $Rev$ $Date$
@@ -32,7 +31,7 @@
         this.methodIndex = methodIndex;
     }
 
-    public Object invoke(final ObjectName objectName, final Object[] arguments) throws Throwable {
+    public Object invoke(final AbstractName abstractName, final Object[] arguments) throws Throwable {
         return rawInvoker.getAttribute(methodIndex);
     }
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawOperationInvoker.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawOperationInvoker.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawOperationInvoker.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawOperationInvoker.java Mon Mar  6 13:44:29 2006
@@ -16,9 +16,8 @@
  */
 package org.apache.geronimo.kernel.basic;
 
-import javax.management.ObjectName;
-
 import org.apache.geronimo.gbean.runtime.RawInvoker;
+import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * @version $Rev$ $Date$
@@ -32,7 +31,7 @@
         this.methodIndex = methodIndex;
     }
 
-    public Object invoke(final ObjectName objectName, final Object[] arguments) throws Throwable {
+    public Object invoke(final AbstractName abstractName, final Object[] arguments) throws Throwable {
         return rawInvoker.invoke(methodIndex, arguments);
     }
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawSetAttributeInvoker.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawSetAttributeInvoker.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawSetAttributeInvoker.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawSetAttributeInvoker.java Mon Mar  6 13:44:29 2006
@@ -16,9 +16,8 @@
  */
 package org.apache.geronimo.kernel.basic;
 
-import javax.management.ObjectName;
-
 import org.apache.geronimo.gbean.runtime.RawInvoker;
+import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * @version $Rev$ $Date$
@@ -32,7 +31,7 @@
         this.methodIndex = methodIndex;
     }
 
-    public Object invoke(final ObjectName objectName, final Object[] arguments) throws Throwable {
+    public Object invoke(final AbstractName abstractName, final Object[] arguments) throws Throwable {
         rawInvoker.setAttribute(methodIndex, arguments[0]);
         return null;
     }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java Mon Mar  6 13:44:29 2006
@@ -23,6 +23,8 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.DependencyManager;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -94,6 +96,7 @@
  */
 public class Configuration implements GBeanLifecycle, ConfigurationParent {
     private static final Log log = LogFactory.getLog(Configuration.class);
+    public static final Object JSR77_BASE_NAME_PROPERTY = "org.apache.geronimo.name.javax.management.j2ee.BaseName";
 
     /**
      * @deprecated Use artifact version of this method
@@ -110,6 +113,10 @@
         }
     }
 
+    public static AbstractName getConfigurationAbstractName(Artifact configId) throws InvalidConfigException {
+        return new AbstractName(configId, Collections.EMPTY_MAP, Configuration.class.getName(), getConfigurationObjectName(configId));
+    }
+
     public static boolean isConfigurationObjectName(ObjectName name) {
         return name.getDomain().equals("geronimo.config") && name.getKeyPropertyList().size() == 1 && name.getKeyProperty("name") != null;
     }
@@ -139,7 +146,7 @@
      * The registered objectName for this configuraion.
      */
     private final ObjectName objectName;
-
+    private final AbstractName abstractName;
     /**
      * Defines the environment requred for this configuration.
      */
@@ -184,6 +191,7 @@
         configurationStore = null;
         id = null;
         objectName = null;
+        abstractName = null;
         moduleType = null;
         parents = null;
         configurationClassLoader = null;
@@ -216,6 +224,7 @@
                     ", but actual objectName is " +
                     "<" + this.objectName.getCanonicalName() + ">");
         }
+        abstractName = getConfigurationAbstractName(id);
 
         this.configurationStore = configurationStore;
 
@@ -266,11 +275,13 @@
 
                 ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), configurationClassLoader);
                 try {
+                    ObjectName baseName = getBaseName();
                     while (true) {
                         GBeanData gbeanData = new GBeanData();
                         gbeanData.readExternal(ois);
+                        gbeanData.initializeName(id, baseName);
 
-                        gbeans.put(gbeanData.getName(), gbeanData);
+                        gbeans.put(gbeanData.getNameMap(), gbeanData);
                     }
                 } catch (EOFException e) {
                     // ok
@@ -379,6 +390,15 @@
         return objectName.getCanonicalName();
     }
 
+    public AbstractName getAbstractName() {
+        return abstractName;
+    }
+
+    public ObjectName getBaseName() {
+        String baseNameString = (String) environment.getProperties().get(JSR77_BASE_NAME_PROPERTY);
+        return JMXUtil.getObjectName(baseNameString);
+    }
+
     /**
      * Gets the parent configurations of this configuration.
      * @return the parents of this configuration
@@ -429,6 +449,10 @@
      * @return true if this configuration contains the specified GBean; false otherwise
      */
     public synchronized boolean containsGBean(ObjectName gbean) {
+        //TODO does not work
+        if (true) {
+            throw new IllegalArgumentException("does not work");
+        }
         return gbeans.containsKey(gbean);
     }
 
@@ -440,7 +464,7 @@
             log.trace("Registering GBean " + beanData.getName());
 
             // add a dependency on this configuration
-            beanData.getDependencies().add(objectName);
+            beanData.getDependencies().add(new AbstractNameQuery(abstractName));
 
             // register the bean with the kernel
             kernel.loadGBean(beanData, configurationClassLoader);
@@ -457,10 +481,11 @@
             Thread.currentThread().setContextClassLoader(oldCl);
         }
 
-        gbeans.put(beanData.getName(), beanData);
+        gbeans.put(beanData.getNameMap(), beanData);
     }
 
     public synchronized void removeGBean(ObjectName name) throws GBeanNotFoundException {
+        //TODO does not work
         if (!gbeans.containsKey(name)) {
             throw new GBeanNotFoundException(name);
         }
@@ -483,11 +508,11 @@
         Set parentNames = new HashSet();
         for (Iterator iterator = parents.iterator(); iterator.hasNext();) {
             Configuration configuration = (Configuration) iterator.next();
-            ObjectName parentName = getConfigurationObjectName(configuration.getId());
+            AbstractName parentName = getConfigurationAbstractName(configuration.getId());
             parentNames.add(parentName);
         }
         DependencyManager dependencyManager = this.kernel.getDependencyManager();
-        dependencyManager.addDependencies(this.objectName, parentNames);
+        dependencyManager.addDependencies(abstractName, parentNames);
 
         // declare the artifacts as loaded
         LinkedHashSet artifacts = new LinkedHashSet();
@@ -513,8 +538,9 @@
 
     private void shutdown() {
         // unregister all GBeans
-        for (Iterator i = gbeans.keySet().iterator(); i.hasNext();) {
-            ObjectName name = (ObjectName) i.next();
+        for (Iterator i = gbeans.values().iterator(); i.hasNext();) {
+            GBeanData gbeanData = (GBeanData) i.next();
+            AbstractName name = gbeanData.getAbstractName();
             try {
                 if (kernel.isLoaded(name)) {
                     log.trace("Unregistering GBean " + name);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java Mon Mar  6 13:44:29 2006
@@ -19,41 +19,43 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GAttributeInfo;
 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.GAttributeInfo;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
+import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
-import org.apache.geronimo.kernel.repository.MissingDependencyException;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
 
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.LinkedHashSet;
-import java.util.Map;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.LinkedList;
-import java.net.URL;
-import java.net.URI;
-import java.net.MalformedURLException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * The standard non-editable ConfigurationManager implementation.  That is,
@@ -184,7 +186,7 @@
                 Map.Entry entry = (Map.Entry) iterator.next();
                 Artifact configurationId = (Artifact) entry.getKey();
                 GBeanData configurationData = (GBeanData) entry.getValue();
-                ObjectName configurationName = Configuration.getConfigurationObjectName(configurationId);
+                AbstractName configurationName = Configuration.getConfigurationAbstractName(configurationId);
 
                 // load the configuation
                 try {
@@ -334,14 +336,14 @@
         LinkedHashSet importNames = new LinkedHashSet();
         for (Iterator iterator = imports.iterator(); iterator.hasNext();) {
             Artifact artifact = (Artifact) iterator.next();
-            ObjectName importName = Configuration.getConfigurationObjectName(artifact);
-            importNames.add(importName);
+            AbstractName importName = Configuration.getConfigurationAbstractName(artifact);
+            importNames.add(new AbstractNameQuery(importName));
         }
         LinkedHashSet referenceNames = new LinkedHashSet();
         for (Iterator iterator = references.iterator(); iterator.hasNext();) {
             Artifact artifact = (Artifact) iterator.next();
-            ObjectName referenceName = Configuration.getConfigurationObjectName(artifact);
-            referenceNames.add(referenceName);
+            AbstractName referenceName = Configuration.getConfigurationAbstractName(artifact);
+            referenceNames.add(new AbstractNameQuery(referenceName));
         }
 
         // add dependencies on the imports and references
@@ -386,6 +388,7 @@
         }
 
         // register all the GBeans
+        AbstractNameQuery configurationReferencePattern = new AbstractNameQuery(Configuration.getConfigurationAbstractName(configuration.getId()));
         ConfigurationStore configurationStore = configuration.getConfigurationStore();
         for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
             GBeanData gbeanData = (GBeanData) iterator.next();
@@ -402,7 +405,7 @@
             }
 
             // add a dependency from the gbean to the configuration
-            gbeanData.getDependencies().add(Configuration.getConfigurationObjectName(getConfigurationId(configuration)));
+            gbeanData.getDependencies().add(configurationReferencePattern);
 
             log.trace("Registering GBean " + gbeanData.getName());
 
@@ -440,18 +443,20 @@
         try {
             // start the gbeans
             Map gbeans = configuration.getGBeans();
-            for (Iterator iterator = gbeans.keySet().iterator(); iterator.hasNext();) {
-                ObjectName gbeanName = (ObjectName) iterator.next();
+            for (Iterator iterator = gbeans.values().iterator(); iterator.hasNext();) {
+                GBeanData gbeanData = (GBeanData) iterator.next();
+                AbstractName gbeanName = gbeanData.getAbstractName();
                 if (kernel.isGBeanEnabled(gbeanName)) {
                     kernel.startRecursiveGBean(gbeanName);
                 }
             }
 
             // assure all of the gbeans are started
-//            for (Iterator iterator = gbeans.keySet().iterator(); iterator.hasNext();) {
-//                ObjectName gbeanName = (ObjectName) iterator.next();
+//            for (Iterator iterator = gbeans.values().iterator(); iterator.hasNext();) {
+//                GBeanData gbeanData = (GBeanData) iterator.next();
+//                AbstractName gbeanName = gbeanData.getAbstractName();
 //                if (State.RUNNING_INDEX != kernel.getGBeanState(gbeanName)) {
-//                    throw new InvalidConfigurationException("Configuration " + getConfigurationId(configuration) + " failed to start because gbean " + gbeanName + " did not start");
+//                    throw new InvalidConfigurationException("Configuration " + configuration.getId() + " failed to start because gbean " + gbeanName + " did not start");
 //                }
 //            }
         } catch (GBeanNotFoundException e) {
@@ -483,12 +488,12 @@
 
     private void stop(Configuration configuration) throws InvalidConfigException {
         try {
-            Collection gbeans = configuration.getGBeans().keySet();
+            Collection gbeans = configuration.getGBeans().values();
 
             // stop the gbeans
             for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
-                // todo should try to stop all beans
-                ObjectName gbeanName = (ObjectName) iterator.next();
+                GBeanData gbeanData = (GBeanData) iterator.next();
+                AbstractName gbeanName = gbeanData.getAbstractName();
                 kernel.stopGBean(gbeanName);
             }
         } catch (Exception e) {
@@ -519,9 +524,9 @@
     }
 
     private void unload(Artifact configurationId) throws NoSuchConfigException {
-        ObjectName configName;
+        AbstractName configName;
         try {
-            configName = Configuration.getConfigurationObjectName(configurationId);
+            configName = Configuration.getConfigurationAbstractName(configurationId);
         } catch (InvalidConfigException e) {
             throw new NoSuchConfigException("Could not construct configuration object name", e);
         }
@@ -532,8 +537,9 @@
 
                     // unload the gbeans
                     // todo move this to stopConfiguration
-                    for (Iterator iterator = gbeans.keySet().iterator(); iterator.hasNext();) {
-                        ObjectName gbeanName = (ObjectName) iterator.next();
+                    for (Iterator iterator = gbeans.values().iterator(); iterator.hasNext();) {
+                        GBeanData gbeanData = (GBeanData) iterator.next();
+                        AbstractName gbeanName = gbeanData.getAbstractName();
                         kernel.unloadGBean(gbeanName);
                     }
                 } catch (Exception e) {

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java Mon Mar  6 13:44:29 2006
@@ -30,11 +30,14 @@
 
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Repository;
 
 /**
  * @version $Rev$ $Date$
@@ -117,8 +120,8 @@
     // user should be using ConfigurationManager to do this work
     static GBeanData toConfigurationGBeanData(ConfigurationData configurationData, ConfigurationStore configurationStore) throws InvalidConfigException, MalformedObjectNameException {
         Artifact id = configurationData.getId();
-        ObjectName objectName = Configuration.getConfigurationObjectName(id);
-        GBeanData gbeanData = new GBeanData(objectName, Configuration.GBEAN_INFO);
+        AbstractName abstractName = Configuration.getConfigurationAbstractName(id);
+        GBeanData gbeanData = new GBeanData(abstractName, Configuration.GBEAN_INFO);
         gbeanData.setAttribute("type", configurationData.getModuleType());
         Environment environment = configurationData.getEnvironment();
         gbeanData.setAttribute("environment", environment);
@@ -127,7 +130,7 @@
         if (configurationStore != null) {
             gbeanData.setAttribute("configurationStore", configurationStore);
         }
-        gbeanData.setReferencePattern("Repositories", new ObjectName("*:j2eeType=Repository,*"));
+        gbeanData.setReferencePattern("Repositories", new AbstractNameQuery(Repository.class.getName()));
         return gbeanData;
     }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyManager.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyManager.java Mon Mar  6 13:44:29 2006
@@ -16,12 +16,11 @@
  */
 package org.apache.geronimo.kernel.jmx;
 
-import javax.management.ObjectName;
-
 import net.sf.cglib.proxy.Callback;
 import net.sf.cglib.proxy.MethodInterceptor;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.basic.BasicProxyManager;
+import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * Pretty much the same as the BasicProxyManager, but it has a different way
@@ -34,7 +33,7 @@
         super(kernel);
     }
 
-    protected Callback getMethodInterceptor(Class proxyType, Kernel kernel, ObjectName target) {
+    protected Callback getMethodInterceptor(Class proxyType, Kernel kernel, AbstractName target) {
         return new JMXProxyMethodInterceptor(proxyType, kernel, target);
     }
 
@@ -42,8 +41,8 @@
          ((JMXProxyMethodInterceptor)methodInterceptor).destroy();
     }
 
-    protected ObjectName getObjectName(MethodInterceptor methodInterceptor) {
-        return ((JMXProxyMethodInterceptor)methodInterceptor).getObjectName();
+    protected AbstractName getAbstractName(MethodInterceptor methodInterceptor) {
+        return ((JMXProxyMethodInterceptor)methodInterceptor).getAbstractName();
     }
 
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java Mon Mar  6 13:44:29 2006
@@ -34,6 +34,7 @@
 import org.apache.geronimo.kernel.proxy.DeadProxyException;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
+import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * @version $Rev$ $Date$
@@ -47,20 +48,20 @@
     /**
      * The object name to which we are connected.
      */
-    private final ObjectName objectName;
+    private final AbstractName objectName;
 
     /**
      * GBeanInvokers keyed on the proxy interface method index
      */
     private ProxyInvoker[] gbeanInvokers;
 
-    public JMXProxyMethodInterceptor(Class proxyType, Kernel kernel, ObjectName objectName) {
+    public JMXProxyMethodInterceptor(Class proxyType, Kernel kernel, AbstractName targetName) {
         assert proxyType != null;
         assert kernel != null;
-        assert objectName != null;
+        assert targetName != null;
 
         this.proxyType = proxyType;
-        this.objectName = objectName;
+        this.objectName = targetName;
         gbeanInvokers = createGBeanInvokers(kernel);
     }
 
@@ -68,7 +69,7 @@
         gbeanInvokers = null;
     }
 
-    public ObjectName getObjectName() {
+    public AbstractName getAbstractName() {
         return objectName;
     }
 
@@ -172,8 +173,8 @@
     }
 
     static final class HashCodeInvoke implements ProxyInvoker {
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return new Integer(objectName.hashCode());
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return new Integer(abstractName.hashCode());
         }
     }
 
@@ -184,9 +185,9 @@
             this.proxyManager = proxyManager;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
             ObjectName proxyTarget = proxyManager.getProxyTarget(arguments[0]);
-            return Boolean.valueOf(objectName.equals(proxyTarget));
+            return Boolean.valueOf(abstractName.equals(proxyTarget));
         }
     }
 
@@ -197,8 +198,8 @@
             this.interfaceName = "[" + interfaceName + ": ";
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return interfaceName + objectName + "]";
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return interfaceName + abstractName + "]";
         }
     }
 
@@ -209,8 +210,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return new Integer(kernel.getGBeanState(objectName));
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return new Integer(kernel.getGBeanState(abstractName));
         }
     }
 
@@ -221,8 +222,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return State.fromInt(kernel.getGBeanState(objectName));
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return State.fromInt(kernel.getGBeanState(abstractName));
         }
     }
 
@@ -233,8 +234,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            kernel.startGBean(objectName);
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            kernel.startGBean(abstractName);
             return null;
         }
     }
@@ -246,8 +247,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            kernel.startRecursiveGBean(objectName);
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            kernel.startRecursiveGBean(abstractName);
             return null;
         }
     }
@@ -259,8 +260,8 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return new Long(kernel.getGBeanStartTime(objectName));
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return new Long(kernel.getGBeanStartTime(abstractName));
         }
     }
 
@@ -271,15 +272,15 @@
             this.kernel = kernel;
         }
 
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            kernel.stopGBean(objectName);
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            kernel.stopGBean(abstractName);
             return null;
         }
     }
 
     static final class GetObjectNameInvoke implements ProxyInvoker {
-        public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
-            return objectName.getCanonicalName();
+        public Object invoke(AbstractName abstractName, Object[] arguments) throws Throwable {
+            return abstractName.getObjectName().getCanonicalName();
         }
     }
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXUtil.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXUtil.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXUtil.java Mon Mar  6 13:44:29 2006
@@ -20,6 +20,7 @@
 import java.util.Set;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Hashtable;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.management.MBeanInfo;
@@ -56,6 +57,14 @@
             return new ObjectName(name);
         } catch (MalformedObjectNameException e) {
             throw new IllegalArgumentException("Malformed ObjectName: " + name);
+        }
+    }
+
+   public static ObjectName getObjectName(String domain, Hashtable keys) throws IllegalArgumentException {
+        try {
+            return new ObjectName(domain, keys);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalArgumentException("Malformed ObjectName: " + domain + ":" + keys);
         }
     }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/KernelDelegate.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/KernelDelegate.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/KernelDelegate.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/KernelDelegate.java Mon Mar  6 13:44:29 2006
@@ -28,11 +28,15 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.DependencyManager;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.NoSuchAttributeException;
+import org.apache.geronimo.kernel.NoSuchOperationException;
 import org.apache.geronimo.kernel.lifecycle.LifecycleMonitor;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 
@@ -80,6 +84,18 @@
         }
     }
 
+    public void startGBean(AbstractName name) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("startGBean", new Object[] {name}, new String[] {AbstractName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public void startRecursiveGBean(ObjectName name) throws GBeanNotFoundException {
         try {
             invokeKernel("startRecursiveGBean", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -92,6 +108,18 @@
         }
     }
 
+    public void startRecursiveGBean(AbstractName name) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("startRecursiveGBean", new Object[] {name}, new String[] {AbstractName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public void stopGBean(ObjectName name) throws GBeanNotFoundException {
         try {
             invokeKernel("stopGBean", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -104,6 +132,18 @@
         }
     }
 
+    public void stopGBean(AbstractName name) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("stopGBean", new Object[] {name}, new String[] {AbstractName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public void unloadGBean(ObjectName name) throws GBeanNotFoundException {
         try {
             invokeKernel("unloadGBean", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -116,6 +156,18 @@
         }
     }
 
+    public void unloadGBean(AbstractName name) throws GBeanNotFoundException, InternalKernelException, IllegalStateException {
+        try {
+            invokeKernel("unloadGBean", new Object[] {name}, new String[] {AbstractName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public int getGBeanState(ObjectName name) throws GBeanNotFoundException {
         try {
             return ((Integer) invokeKernel("getGBeanState", new Object[]{name}, new String[]{ObjectName.class.getName()})).intValue();
@@ -128,6 +180,18 @@
         }
     }
 
+    public int getGBeanState(AbstractName name) throws GBeanNotFoundException {
+        try {
+            return ((Integer) invokeKernel("getGBeanState", new Object[]{name}, new String[]{AbstractName.class.getName()})).intValue();
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public long getGBeanStartTime(ObjectName name) throws GBeanNotFoundException {
         try {
             return ((Long) invokeKernel("getGBeanStartTime", new Object[]{name}, new String[]{ObjectName.class.getName()})).longValue();
@@ -140,6 +204,18 @@
         }
     }
 
+    public long getGBeanStartTime(AbstractName name) throws GBeanNotFoundException {
+        try {
+            return ((Long) invokeKernel("getGBeanStartTime", new Object[]{name}, new String[]{AbstractName.class.getName()})).longValue();
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public boolean isGBeanEnabled(ObjectName name) throws GBeanNotFoundException {
         try {
             return ((Boolean) invokeKernel("isGBeanEnabled", new Object[] {name}, new String[] {ObjectName.class.getName()})).booleanValue();
@@ -152,6 +228,18 @@
         }
     }
 
+    public boolean isGBeanEnabled(AbstractName name) throws GBeanNotFoundException {
+        try {
+            return ((Boolean) invokeKernel("isGBeanEnabled", new Object[] {name}, new String[] {AbstractName.class.getName()})).booleanValue();
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public void setGBeanEnabled(ObjectName name, boolean enabled) throws GBeanNotFoundException {
         try {
             invokeKernel("setGBeanEnabled", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -164,22 +252,50 @@
         }
     }
 
+    public void setGBeanEnabled(AbstractName name, boolean enabled) throws GBeanNotFoundException {
+        try {
+            invokeKernel("setGBeanEnabled", new Object[] {name}, new String[] {ObjectName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public Object getAttribute(ObjectName objectName, String attributeName) throws Exception {
         return invokeKernel("getAttribute", new Object[]{objectName, attributeName}, new String[]{ObjectName.class.getName(), String.class.getName()});
     }
 
+    public Object getAttribute(AbstractName abstractName, String attributeName) throws GBeanNotFoundException, NoSuchAttributeException, Exception {
+        return invokeKernel("getAttribute", new Object[]{abstractName, attributeName}, new String[]{AbstractName.class.getName(), String.class.getName()});
+    }
+
     public void setAttribute(ObjectName objectName, String attributeName, Object attributeValue) throws Exception {
         invokeKernel("setAttribute", new Object[]{objectName, attributeName, attributeValue}, new String[]{ObjectName.class.getName(), String.class.getName(), Object.class.getName()});
     }
 
+    public void setAttribute(AbstractName abstractName, String attributeName, Object attributeValue) throws GBeanNotFoundException, NoSuchAttributeException, Exception {
+        invokeKernel("setAttribute", new Object[]{abstractName, attributeName, attributeValue}, new String[]{AbstractName.class.getName(), String.class.getName(), Object.class.getName()});
+    }
+
     public Object invoke(ObjectName objectName, String methodName) throws Exception {
         return invokeKernel("invoke", new Object[]{objectName, methodName}, new String[]{ObjectName.class.getName(), String.class.getName()});
     }
 
+    public Object invoke(AbstractName abstractName, String methodName) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception {
+        return invokeKernel("invoke", new Object[]{abstractName, methodName}, new String[]{AbstractName.class.getName(), String.class.getName()});
+    }
+
     public Object invoke(ObjectName objectName, String methodName, Object[] args, String[] types) throws Exception {
         return invokeKernel("invoke", new Object[]{objectName, methodName, args, types}, new String[]{ObjectName.class.getName(), String.class.getName(), Object[].class.getName(), String[].class.getName()});
     }
 
+    public Object invoke(AbstractName abstractName, String methodName, Object[] args, String[] types) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception {
+        return invokeKernel("invoke", new Object[]{abstractName, methodName, args, types}, new String[]{AbstractName.class.getName(), String.class.getName(), Object[].class.getName(), String[].class.getName()});
+    }
+
     public boolean isLoaded(ObjectName name) {
         try {
             return ((Boolean) invokeKernel("isLoaded", new Object[]{name}, new String[]{ObjectName.class.getName()})).booleanValue();
@@ -190,6 +306,16 @@
         }
     }
 
+    public boolean isLoaded(AbstractName name) {
+        try {
+            return ((Boolean) invokeKernel("isLoaded", new Object[]{name}, new String[]{AbstractName.class.getName()})).booleanValue();
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+     }
+
     public GBeanInfo getGBeanInfo(ObjectName name) throws GBeanNotFoundException {
         try {
             return (GBeanInfo) invokeKernel("getGBeanInfo", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -202,6 +328,18 @@
         }
     }
 
+    public GBeanInfo getGBeanInfo(AbstractName name) throws GBeanNotFoundException {
+        try {
+            return (GBeanInfo) invokeKernel("getGBeanInfo", new Object[] {name}, new String[] {AbstractName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public Set listGBeans(ObjectName pattern) {
         try {
             return (Set) invokeKernel("listGBeans", new Object[] {pattern}, new String[] {ObjectName.class.getName()});
@@ -286,12 +424,34 @@
         }
     }
 
+    public GBeanData getGBeanData(AbstractName name) throws GBeanNotFoundException, InternalKernelException {
+        try {
+            return (GBeanData) invokeKernel("getGBeanData", new Object[] {name}, new String[] {AbstractName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public ObjectName getObjectNameFor(Object service) {
         return proxyManager.getProxyTarget(service);
     }
 
     public boolean isRunning() {
         return ((Boolean) getKernelAttribute("running")).booleanValue();
+    }
+
+    public Set listGBeans(AbstractNameQuery query) {
+        try {
+            return (Set) invokeKernel("listGBeans", new Object[] {query}, new String[] {AbstractNameQuery.class.getName()});
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
     }
 
     /**

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleAdapter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleAdapter.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleAdapter.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleAdapter.java Mon Mar  6 13:44:29 2006
@@ -16,30 +16,30 @@
  */
 package org.apache.geronimo.kernel.lifecycle;
 
-import javax.management.ObjectName;
+import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * @version $Rev$ $Date$
  */
 public class LifecycleAdapter implements LifecycleListener {
-    public void loaded(ObjectName objectName) {
+    public void loaded(AbstractName abstractName) {
     }
 
-    public void starting(ObjectName objectName) {
+    public void starting(AbstractName abstractName) {
     }
 
-    public void running(ObjectName objectName) {
+    public void running(AbstractName abstractName) {
     }
 
-    public void stopping(ObjectName objectName) {
+    public void stopping(AbstractName abstractName) {
     }
 
-    public void stopped(ObjectName objectName) {
+    public void stopped(AbstractName abstractName) {
     }
 
-    public void failed(ObjectName objectName) {
+    public void failed(AbstractName abstractName) {
     }
 
-    public void unloaded(ObjectName objectName) {
+    public void unloaded(AbstractName abstractName) {
     }
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleListener.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleListener.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleListener.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleListener.java Mon Mar  6 13:44:29 2006
@@ -16,18 +16,19 @@
  */
 package org.apache.geronimo.kernel.lifecycle;
 
+import org.apache.geronimo.gbean.AbstractName;
+
 import java.util.EventListener;
-import javax.management.ObjectName;
 
 /**
  * @version $Rev$ $Date$
  */
 public interface LifecycleListener extends EventListener {
-    public void loaded(ObjectName objectName);
-    public void starting(ObjectName objectName);
-    public void running(ObjectName objectName);
-    public void stopping(ObjectName objectName);
-    public void stopped(ObjectName objectName);
-    public void failed(ObjectName objectName);
-    public void unloaded(ObjectName objectName);
+    public void loaded(AbstractName abstractName);
+    public void starting(AbstractName abstractName);
+    public void running(AbstractName abstractName);
+    public void stopping(AbstractName abstractName);
+    public void stopped(AbstractName abstractName);
+    public void failed(AbstractName abstractName);
+    public void unloaded(AbstractName abstractName);
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleMonitor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleMonitor.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleMonitor.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleMonitor.java Mon Mar  6 13:44:29 2006
@@ -16,14 +16,15 @@
  */
 package org.apache.geronimo.kernel.lifecycle;
 
+import org.apache.geronimo.gbean.AbstractNameQuery;
+
 import java.util.Set;
-import javax.management.ObjectName;
 
 /**
  * @version $Rev$ $Date$
  */
 public interface LifecycleMonitor {
-    void addLifecycleListener(LifecycleListener listener, ObjectName pattern);
+    void addLifecycleListener(LifecycleListener listener, AbstractNameQuery pattern);
 
     void addLifecycleListener(LifecycleListener listener, Set patterns);
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyFactory.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyFactory.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyFactory.java Mon Mar  6 13:44:29 2006
@@ -17,6 +17,8 @@
 
 package org.apache.geronimo.kernel.proxy;
 
+import org.apache.geronimo.gbean.AbstractName;
+
 import javax.management.ObjectName;
 
 
@@ -30,4 +32,5 @@
      * @return the proxy
      */
     Object createProxy(ObjectName target);
+    Object createProxy(AbstractName target);
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java Mon Mar  6 13:44:29 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.kernel.proxy;
 
+import org.apache.geronimo.gbean.AbstractName;
+
 import javax.management.ObjectName;
 import javax.management.MalformedObjectNameException;
 
@@ -62,6 +64,7 @@
      * @return the proxy, or null if the GBeanInfo declares no interfaces
      */
     public Object createProxy(ObjectName target, ClassLoader loader);
+    public Object createProxy(AbstractName target, ClassLoader loader);
 
     /**
      * Create proxies for the specified targets.  The proxies will implement
@@ -87,6 +90,7 @@
      * @return the proxy
      */
     public Object createProxy(ObjectName target, Class type);
+    public Object createProxy(AbstractName target, Class type);
 
     /**
      * Cleans up and resources associated with the proxy
@@ -103,6 +107,7 @@
 
     /**
      * Get the object name of the specified proxy
+     * TODO convert to abstractName
      * @param proxy the proxy to get the target object name from
      * @return the object name of the target
      */

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java Mon Mar  6 13:44:29 2006
@@ -35,7 +35,7 @@
     private final boolean resolved;
 
     public Artifact(String groupId, String artifactId, String version, String type) {
-        this(groupId, artifactId, new Version(version), type);
+        this(groupId, artifactId, version == null? null: new Version(version), type);
     }
 
     public Artifact(String groupId, String artifactId, Version version, String type) {
@@ -120,11 +120,8 @@
             return false;
         }
 
-        if (version != null ? !version.equals(artifact.version) : artifact.version != null) {
-            return false;
-        }
+        return !(version != null ? !version.equals(artifact.version) : artifact.version != null);
 
-        return true;
     }
 
     public int hashCode() {
@@ -149,4 +146,21 @@
         return groupId + "/" + artifactId + "/" + version + "/" + type;
     }
 
+    /**
+     * see if this artifact matches the other artifact (which is more specific than this one)
+     * @param otherArtifact the more specific artifact we are comparing with
+     * @return whether the other artifact is consistent with everything specified in this artifact.
+     */
+    public boolean matches(Artifact otherArtifact) {
+        if (groupId != null && !groupId.equals(otherArtifact.groupId)) {
+            return false;
+        }
+        if (artifactId != null && !artifactId.equals(otherArtifact.artifactId)) {
+            return false;
+        }
+        if (version != null && !version.equals(otherArtifact.version)) {
+            return false;
+        }
+        return (type == null || type.equals(otherArtifact.type));
+    }
 }

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanAttributeTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanAttributeTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanAttributeTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanAttributeTest.java Mon Mar  6 13:44:29 2006
@@ -17,15 +17,22 @@
 package org.apache.geronimo.gbean.runtime;
 
 import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.gbean.GAttributeInfo;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.MockDynamicGBean;
 import org.apache.geronimo.kernel.MockGBean;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+import java.util.Map;
+import java.util.HashMap;
 
 /**
  * @version $Rev$ $Date$
@@ -350,12 +357,12 @@
         kernel = KernelFactory.newInstance().createKernel("test");
         kernel.boot();
 
-        gbeanInstance = new GBeanInstance(new GBeanData(new ObjectName("test:MockGBean=normal"), MockGBean.getGBeanInfo()),
+        gbeanInstance = new GBeanInstance(new GBeanData(buildAbstractName("normal", MockGBean.getGBeanInfo()), MockGBean.getGBeanInfo()),
                 kernel,
                 kernel.getDependencyManager(),
                 new MyLifecycleBroadcaster(),
                 MockGBean.class.getClassLoader());
-        dynamicGBeanInstance = new GBeanInstance(new GBeanData(new ObjectName("test:MockGBean=dynamic"), MockDynamicGBean.getGBeanInfo()),
+        dynamicGBeanInstance = new GBeanInstance(new GBeanData(buildAbstractName("dynamic", MockDynamicGBean.getGBeanInfo()), MockDynamicGBean.getGBeanInfo()),
                 kernel,
                 kernel.getDependencyManager(),
                 new MyLifecycleBroadcaster(),
@@ -379,6 +386,12 @@
     protected void tearDown() throws Exception {
         kernel.shutdown();
         gbeanInstance = null;
+    }
+
+    private AbstractName buildAbstractName(String name, GBeanInfo info) throws MalformedObjectNameException {
+        Map names = new HashMap();
+        names.put("name", name);
+        return new AbstractName(new Artifact("test", "foo", "1", "car"), names, info.getInterfaces(), new ObjectName("test:MockGBean=" + name));
     }
 
     private static class MyLifecycleBroadcaster implements LifecycleBroadcaster {

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java Mon Mar  6 13:44:29 2006
@@ -17,15 +17,21 @@
 package org.apache.geronimo.gbean.runtime;
 
 import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.MockGBean;
-import org.apache.geronimo.kernel.MockDynamicGBean;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+
+import java.util.Map;
+import java.util.HashMap;
 
 /**
  * @version $Rev$ $Date$
@@ -33,12 +39,12 @@
 public class GBeanDependencyTest extends TestCase {
 
     private Kernel kernel;
-    
+
     public void testGBeanDependency() throws Exception {
-        ObjectName parentName = new ObjectName("test:MockGBean=parent");
+        AbstractName parentName = buildAbstractName("parent", MockGBean.getGBeanInfo());
         GBeanData gbeanDataParent = new GBeanData(parentName, MockGBean.getGBeanInfo());
-        GBeanData gbeanDataChild = new GBeanData(new ObjectName("test:MockGBean=child"), MockGBean.getGBeanInfo());
-        gbeanDataChild.getDependencies().add(parentName);
+        GBeanData gbeanDataChild = new GBeanData(buildAbstractName("child", MockGBean.getGBeanInfo()), MockGBean.getGBeanInfo());
+        gbeanDataChild.getDependencies().add(new AbstractNameQuery(parentName));
         kernel.loadGBean(gbeanDataChild, MockGBean.class.getClassLoader());
         kernel.startGBean(gbeanDataChild.getName());
         assertEquals(State.STARTING_INDEX, kernel.getGBeanState(gbeanDataChild.getName()));
@@ -48,6 +54,11 @@
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbeanDataChild.getName()));
     }
 
+    private AbstractName buildAbstractName(String name, GBeanInfo info) throws MalformedObjectNameException {
+        Map names = new HashMap();
+        names.put("name", name);
+        return new AbstractName(new Artifact("test", "foo", "1", "car"), names, info.getInterfaces(), new ObjectName("test:MockGBean=" + name));
+    }
     protected void setUp() throws Exception {
         kernel = KernelFactory.newInstance().createKernel("test");
         kernel.boot();

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java Mon Mar  6 13:44:29 2006
@@ -27,12 +27,17 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
 import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
@@ -46,6 +51,7 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 
 /**
@@ -53,10 +59,11 @@
  */
 public class ConfigTest extends TestCase {
     private Kernel kernel;
-    private ObjectName gbeanName1;
-    private ObjectName gbeanName2;
+    private AbstractName gbeanName1;
+    private AbstractName gbeanName2;
     private ConfigurationData configurationData;
     private ConfigurationManager configurationManager;
+    private final String BASE_NAME = "test:J2EEServer=geronimo";
 
     public void testConfigLifecycle() throws Exception {
 
@@ -173,22 +180,22 @@
         Configuration configuration = configurationManager.loadConfiguration(configurationData);
         assertNotNull(configuration.getConfigurationClassLoader());
 
-        ObjectName gbeanName3 = new ObjectName("geronimo.test:name=MyMockGMBean3");
+        GBeanData mockBean3 = buildGBeanData("name", "MyMockGMBean3", MockGBean.getGBeanInfo());
+        mockBean3.initializeName(configuration.getId(), JMXUtil.getObjectName(BASE_NAME));
         try {
-            kernel.getGBeanState(gbeanName3);
+            kernel.getGBeanState(mockBean3.getAbstractName());
             fail("Gbean should not be found yet");
         } catch (GBeanNotFoundException e) {
         }
-        GBeanData mockBean3 = new GBeanData(gbeanName3, MockGBean.getGBeanInfo());
         mockBean3.setAttribute("value", "1234");
         mockBean3.setAttribute("name", "child");
         mockBean3.setAttribute("finalInt", new Integer(1));
         configuration.addGBean(mockBean3, true);
 
-        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbeanName3));
-        assertEquals(new Integer(1), kernel.getAttribute(gbeanName3, "finalInt"));
-        assertEquals("1234", kernel.getAttribute(gbeanName3, "value"));
-        assertEquals("child", kernel.getAttribute(gbeanName3, "name"));
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(mockBean3.getAbstractName()));
+        assertEquals(new Integer(1), kernel.getAttribute(mockBean3.getAbstractName(), "finalInt"));
+        assertEquals("1234", kernel.getAttribute(mockBean3.getAbstractName(), "value"));
+        assertEquals("child", kernel.getAttribute(mockBean3.getAbstractName(), "name"));
     }
 
     protected void setUp() throws Exception {
@@ -196,50 +203,62 @@
         kernel = KernelFactory.newInstance().createKernel("test");
         kernel.boot();
 
-        ObjectName artifactManagerName = new ObjectName(":j2eeType=ArtifactManager");
-        GBeanData artifactManagerData = new GBeanData(artifactManagerName, DefaultArtifactManager.GBEAN_INFO);
+        GBeanData artifactManagerData = buildGBeanData("j2eeType", "ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
+        artifactManagerData.initializeName(new Artifact("test", "base", "1", "car"), JMXUtil.getObjectName("test:module=base"));
         kernel.loadGBean(artifactManagerData, getClass().getClassLoader());
-        kernel.startGBean(artifactManagerName);
-        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(artifactManagerName));
+        kernel.startGBean(artifactManagerData.getAbstractName());
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(artifactManagerData.getAbstractName()));
 
-        ObjectName artifactResolverName = new ObjectName(":j2eeType=ArtifactResolver");
-        GBeanData artifactResolverData = new GBeanData(artifactResolverName, DefaultArtifactResolver.GBEAN_INFO);
-        artifactResolverData.setReferencePattern("ArtifactManager", artifactManagerName);
+        GBeanData artifactResolverData = buildGBeanData("j2eeType", "ArtifactResolver", DefaultArtifactResolver.GBEAN_INFO);
+        artifactResolverData.initializeName(new Artifact("test", "base", "1", "car"), JMXUtil.getObjectName("test:module=base"));
+        artifactResolverData.setReferencePattern("ArtifactManager", new AbstractNameQuery(artifactManagerData.getAbstractName()));
         kernel.loadGBean(artifactResolverData, getClass().getClassLoader());
-        kernel.startGBean(artifactResolverName);
-        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(artifactResolverName));
+        kernel.startGBean(artifactResolverData.getAbstractName());
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(artifactResolverData.getAbstractName()));
+
+        GBeanData configurationManagerData = buildGBeanData("name", "BasicConfigurationManager", ConfigurationManagerImpl.GBEAN_INFO);
+        configurationManagerData.initializeName(new Artifact("test", "base", "1", "car"), JMXUtil.getObjectName("test:module=base"));
+        configurationManagerData.setReferencePattern("ArtifactManager", new AbstractNameQuery(artifactManagerData.getAbstractName()));
+        configurationManagerData.setReferencePattern("ArtifactResolver", new AbstractNameQuery(artifactResolverData.getAbstractName()));
 
-        ObjectName configurationManagerName = new ObjectName(":j2eeType=ConfigurationManager,name=Basic");
-        GBeanData configurationManagerData = new GBeanData(configurationManagerName, ConfigurationManagerImpl.GBEAN_INFO);
-        configurationManagerData.setReferencePattern("ArtifactManager", artifactManagerName);
-        configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolverName);
         kernel.loadGBean(configurationManagerData, getClass().getClassLoader());
-        kernel.startGBean(configurationManagerName);
+        kernel.startGBean(configurationManagerData.getAbstractName());
         configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
 
+        Environment environment = new Environment();
+        environment.setConfigId(new Artifact("geronimo", "test", "1", "car"));
+        Map properties = new HashMap();
+        properties.put(Configuration.JSR77_BASE_NAME_PROPERTY, BASE_NAME);
+        environment.setProperties(properties);
 
         ArrayList gbeans = new ArrayList();
 
-        gbeanName1 = new ObjectName("geronimo.test:name=MyMockGMBean1");
-        GBeanData mockBean1 = new GBeanData(gbeanName1, MockGBean.getGBeanInfo());
+        GBeanData mockBean1 = buildGBeanData("name", "MyMockGMBean1", MockGBean.getGBeanInfo());
+        mockBean1.initializeName(environment.getConfigId(), JMXUtil.getObjectName(BASE_NAME));
+        gbeanName1 = mockBean1.getAbstractName();
         mockBean1.setAttribute("value", "1234");
         mockBean1.setAttribute("name", "child");
         mockBean1.setAttribute("finalInt", new Integer(1));
         gbeans.add(mockBean1);
 
-        gbeanName2 = new ObjectName("geronimo.test:name=MyMockGMBean2");
-        GBeanData mockBean2 = new GBeanData(gbeanName2, MockGBean.getGBeanInfo());
+        GBeanData mockBean2 = buildGBeanData("name", "MyMockGMBean2", MockGBean.getGBeanInfo());
+        mockBean2.initializeName(environment.getConfigId(), JMXUtil.getObjectName(BASE_NAME));
+        gbeanName2 = mockBean2.getAbstractName();
         mockBean2.setAttribute("value", "5678");
         mockBean2.setAttribute("name", "Parent");
         mockBean2.setAttribute("finalInt", new Integer(3));
-        mockBean2.setReferencePatterns("MockEndpoint", Collections.singleton(gbeanName1));
-        mockBean2.setReferencePatterns("EndpointCollection", Collections.singleton(gbeanName1));
+        mockBean2.setReferencePatterns("MockEndpoint", Collections.singleton(new AbstractNameQuery(gbeanName1)));
+        mockBean2.setReferencePatterns("EndpointCollection", Collections.singleton(new AbstractNameQuery(gbeanName1)));
         gbeans.add(mockBean2);
 
-        Environment environment = new Environment();
-        environment.setConfigId(new Artifact("geronimo", "test", "1", "car"));
 
         configurationData = new ConfigurationData(ConfigurationModuleType.CAR, null, gbeans, null, environment, null);
+    }
+
+    private GBeanData buildGBeanData(String key, String value, GBeanInfo info) throws MalformedObjectNameException {
+        Map nameMap = new HashMap();
+        nameMap.put(key, value);
+        return new GBeanData(nameMap, Collections.EMPTY_SET, info);
     }
 
     protected void tearDown() throws Exception {

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java Mon Mar  6 13:44:29 2006
@@ -17,98 +17,100 @@
 
 package org.apache.geronimo.kernel;
 
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collections;
-import java.util.Set;
-import javax.management.ObjectName;
-
 import junit.framework.TestCase;
-
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.kernel.proxy.ProxyFactory;
-import org.apache.log4j.Logger;
+import org.apache.geronimo.kernel.proxy.ProxyManager;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 import org.apache.log4j.PatternLayout;
 
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * @version $Rev$ $Date$
  */
 public class GBeanTest extends TestCase {
-    private ObjectName name;
-    private ObjectName name2;
     private Kernel kernel;
 
     public void testListGBeans() throws Exception {
-        ObjectName name = new ObjectName(":name=test");
-        GBeanData gbean = new GBeanData(name, MockGBean.getGBeanInfo());
+        GBeanData gbean = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
         
         kernel.loadGBean(gbean, getClass().getClassLoader());
-        kernel.startGBean(name);
-        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(name));
+        kernel.startGBean(gbean.getAbstractName());
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean.getAbstractName()));
 
-        Set gbeans = kernel.listGBeans(name);
+        Set gbeans = kernel.listGBeans(new AbstractNameQuery(gbean.getAbstractName()));
         assertEquals(1, gbeans.size());
-        assertEquals(name, gbeans.iterator().next());
+        assertEquals(gbean.getAbstractName(), gbeans.iterator().next());
     }
 
     public void testLoad() throws Exception {
         ClassLoader cl = getClass().getClassLoader();
         ClassLoader myCl = new URLClassLoader(new URL[0], cl);
-        GBeanData gbean = new GBeanData(name, MockGBean.getGBeanInfo());
+        GBeanData gbean = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
         gbean.setAttribute("name", "Test");
         gbean.setAttribute("finalInt", new Integer(123));
         kernel.loadGBean(gbean, myCl);
-        kernel.startGBean(name);
-        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(name));
-        assertEquals("Hello", kernel.invoke(name, "doSomething", new Object[]{"Hello"}, new String[]{String.class.getName()}));
+        kernel.startGBean(gbean.getAbstractName());
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean.getAbstractName()));
+        assertEquals("Hello", kernel.invoke(gbean.getAbstractName(), "doSomething", new Object[]{"Hello"}, new String[]{String.class.getName()}));
 
-        assertEquals(name.getCanonicalName(), kernel.getAttribute(name, "objectName"));
-        assertEquals(name.getCanonicalName(), kernel.getAttribute(name, "actualObjectName"));
+        assertEquals(gbean.getAbstractName().getObjectName().getCanonicalName(), kernel.getAttribute(gbean.getAbstractName(), "objectName"));
+        assertEquals(gbean.getAbstractName().getObjectName().getCanonicalName(), kernel.getAttribute(gbean.getAbstractName(), "actualObjectName"));
 
-        assertSame(myCl, kernel.getAttribute(name, "actualClassLoader"));
+        assertSame(myCl, kernel.getAttribute(gbean.getAbstractName(), "actualClassLoader"));
 
         // the MockGBean implemmentation of getConfigurationClassLoader will throw an exception, but since the GBean architecture
         // handles this directly the implementation method will never be called
-        kernel.getAttribute(name, "classLoader");
+        kernel.getAttribute(gbean.getAbstractName(), "classLoader");
 
-        assertSame(kernel, kernel.getAttribute(name, "kernel"));
-        assertSame(kernel, kernel.getAttribute(name, "actualKernel"));
+        assertSame(kernel, kernel.getAttribute(gbean.getAbstractName(), "kernel"));
+        assertSame(kernel, kernel.getAttribute(gbean.getAbstractName(), "actualKernel"));
 
-        kernel.stopGBean(name);
-        kernel.unloadGBean(name);
+        kernel.stopGBean(gbean.getAbstractName());
+        kernel.unloadGBean(gbean.getAbstractName());
     }
 
     public void testEndpoint() throws Exception {
         ClassLoader cl = MockGBean.class.getClassLoader();
-        GBeanData gbean1 = new GBeanData(name, MockGBean.getGBeanInfo());
+        GBeanData gbean1 = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
         gbean1.setAttribute("finalInt", new Integer(123));
         kernel.loadGBean(gbean1, cl);
-        kernel.startGBean(name);
+        kernel.startGBean(gbean1.getAbstractName());
 
-        GBeanData gbean2 = new GBeanData(name2, MockGBean.getGBeanInfo());
+        GBeanData gbean2 = buildGBeanData("name", "test2", MockGBean.getGBeanInfo());
         gbean2.setAttribute("finalInt", new Integer(123));
-        gbean2.setReferencePatterns("MockEndpoint", Collections.singleton(name));
+        gbean2.setReferencePattern("MockEndpoint", new AbstractNameQuery(gbean1.getAbstractName()));
         kernel.loadGBean(gbean2, cl);
-        kernel.startGBean(name2);
+        kernel.startGBean(gbean2.getAbstractName());
 
-        assertEquals("endpointCheck", kernel.invoke(name2, "checkEndpoint", null, null));
+        assertEquals("endpointCheck", kernel.invoke(gbean2.getAbstractName(), "checkEndpoint", null, null));
     }
 
     public void testProxiesInterfaces() throws Exception {
         ClassLoader cl = getClass().getClassLoader();
         ClassLoader myCl = new URLClassLoader(new URL[0], cl);
-        GBeanData gbean = new GBeanData(name, MockGBean.getGBeanInfo());
+        GBeanData gbean = buildGBeanData("name", "test", MockGBean.getGBeanInfo());
         gbean.setAttribute("name", "Test");
         gbean.setAttribute("finalInt", new Integer(123));
         kernel.loadGBean(gbean, myCl);
-        kernel.startGBean(name);
+        kernel.startGBean(gbean.getAbstractName());
         ProxyManager mgr = kernel.getProxyManager();
 
-        Object test = mgr.createProxy(name, myCl);
+        Object test = mgr.createProxy(gbean.getAbstractName(), myCl);
         assertTrue(test instanceof MockEndpoint);
         assertTrue(test instanceof MockParentInterface1);
         assertTrue(test instanceof MockParentInterface2);
@@ -129,7 +131,7 @@
         ((MockChildInterface2)test).doNothing();
         assertEquals("Foo", ((MockChildInterface2)test).doSomething("Foo"));
 
-        test = mgr.createProxy(name, MockEndpoint.class);
+        test = mgr.createProxy(gbean.getAbstractName(), MockEndpoint.class);
         assertTrue(test instanceof MockEndpoint);
         assertFalse(test instanceof MockParentInterface1);
         assertFalse(test instanceof MockParentInterface2);
@@ -139,7 +141,7 @@
 
         ProxyFactory proxyFactory;
         proxyFactory = mgr.createProxyFactory(new Class[]{MockEndpoint.class, MockParentInterface2.class, MockChildInterface2.class}, myCl);
-        test = proxyFactory.createProxy(name);
+        test = proxyFactory.createProxy(gbean.getAbstractName());
         assertTrue(test instanceof MockEndpoint);
         assertTrue(test instanceof MockParentInterface1);
         assertTrue(test instanceof MockParentInterface2);
@@ -148,7 +150,7 @@
         assertFalse(test instanceof Comparable);
 
         proxyFactory = mgr.createProxyFactory(new Class[]{MockEndpoint.class, MockParentInterface1.class, MockChildInterface1.class}, myCl);
-        test = proxyFactory.createProxy(name);
+        test = proxyFactory.createProxy(gbean.getAbstractName());
         assertTrue(test instanceof MockEndpoint);
         assertTrue(test instanceof MockParentInterface1);
         assertFalse(test instanceof MockParentInterface2);
@@ -157,7 +159,7 @@
         assertFalse(test instanceof Comparable);
 
         proxyFactory = mgr.createProxyFactory(new Class[]{MockEndpoint.class, MockParentInterface1.class, MockChildInterface1.class, Comparable.class}, myCl);
-        test = proxyFactory.createProxy(name);
+        test = proxyFactory.createProxy(gbean.getAbstractName());
         assertTrue(test instanceof MockEndpoint);
         assertTrue(test instanceof MockParentInterface1);
         assertFalse(test instanceof MockParentInterface2);
@@ -165,7 +167,7 @@
         assertFalse(test instanceof MockChildInterface2);
 
         proxyFactory = mgr.createProxyFactory(new Class[]{MockParentInterface1.class, MockChildInterface1.class, Comparable.class}, myCl);
-        test = proxyFactory.createProxy(name);
+        test = proxyFactory.createProxy(gbean.getAbstractName());
         assertFalse(test instanceof MockEndpoint);
         assertTrue(test instanceof MockParentInterface1);
         assertFalse(test instanceof MockParentInterface2);
@@ -173,7 +175,7 @@
         assertFalse(test instanceof MockChildInterface2);
 
         proxyFactory = mgr.createProxyFactory(new Class[]{MockEndpoint.class, Comparable.class}, myCl);
-        test = proxyFactory.createProxy(name);
+        test = proxyFactory.createProxy(gbean.getAbstractName());
         assertTrue(test instanceof MockEndpoint);
         assertFalse(test instanceof MockParentInterface1);
         assertFalse(test instanceof MockParentInterface2);
@@ -181,7 +183,7 @@
         assertFalse(test instanceof MockChildInterface2);
 
         proxyFactory = mgr.createProxyFactory(new Class[]{Comparable.class}, myCl);
-        test = proxyFactory.createProxy(name);
+        test = proxyFactory.createProxy(gbean.getAbstractName());
 
         try {
             proxyFactory = mgr.createProxyFactory(null, myCl);
@@ -197,7 +199,7 @@
 
         try {
             // two classes
-            test = mgr.createProxyFactory(new Class[]{MockGBean.class, Object.class}, cl).createProxy(name);
+            test = mgr.createProxyFactory(new Class[]{MockGBean.class, Object.class}, cl).createProxy(gbean.getAbstractName());
             fail();
         } catch (IllegalArgumentException e) {
         }
@@ -206,8 +208,6 @@
     protected void setUp() throws Exception {
         Logger.getRootLogger().addAppender(new ConsoleAppender(new PatternLayout("%p [%t] %m %n")));
         Logger.getRootLogger().setLevel(Level.DEBUG);
-        name = new ObjectName("test:name=MyMockGBean");
-        name2 = new ObjectName("test:name=MyMockGBean2");
         kernel = KernelFactory.newInstance().createKernel("test");
         kernel.boot();
     }
@@ -215,4 +215,15 @@
     protected void tearDown() throws Exception {
         kernel.shutdown();
     }
+    private GBeanData buildGBeanData(String key, String value, GBeanInfo info) throws MalformedObjectNameException {
+        AbstractName abstractName = buildAbstractName(key, value, info);
+        return new GBeanData(abstractName, info);
+    }
+
+    private AbstractName buildAbstractName(String key, String value, GBeanInfo info) throws MalformedObjectNameException {
+        Map names = new HashMap();
+        names.put(key, value);
+        return new AbstractName(new Artifact("test", "foo", "1", "car"), names, info.getInterfaces(), new ObjectName("test:" + key + "=" + value));
+    }
+
 }



Mime
View raw message