geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r383682 [1/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
Author: djencks
Date: Mon Mar  6 13:44:29 2006
New Revision: 383682

URL: http://svn.apache.org/viewcvs?rev=383682&view=rev
Log:
Initial work on making version optional on gbean references.  This breaks build around security-builder.  This has plenty of known problems.

Added:
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java
Modified:
    geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
    geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
    geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java
    geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/Abstract77Test.java
    geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/DomainTest.java
    geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/JVMTest.java
    geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/ServerTest.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/AbstractGBeanReference.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanCollectionReference.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanDependency.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstanceState.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanSingleReference.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/ProxyCollection.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/DependencyManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/GBeanNotFoundException.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/KernelGBean.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicDependencyManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicKernel.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicRegistry.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/KernelGetAttributeInvoker.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/KernelOperationInvoker.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/KernelSetAttributeInvoker.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/LifecycleMonitorFlyweight.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyInvoker.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawGetAttributeInvoker.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawOperationInvoker.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/RawSetAttributeInvoker.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXUtil.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/KernelDelegate.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleAdapter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleListener.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/lifecycle/LifecycleMonitor.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyFactory.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/proxy/ProxyManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanAttributeTest.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/GBeanTest.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
    geronimo/branches/1.1/modules/security/src/test/org/apache/geronimo/security/AbstractTest.java
    geronimo/branches/1.1/modules/security/src/test/org/apache/geronimo/security/jaas/ConfigurationEntryTest.java
    geronimo/branches/1.1/modules/security/src/test/org/apache/geronimo/security/jaas/LoginKerberosNonGeronimoTest.java
    geronimo/branches/1.1/modules/security/src/test/org/apache/geronimo/security/jaas/LoginKerberosTest.java
    geronimo/branches/1.1/modules/security/src/test/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java
    geronimo/branches/1.1/modules/security/src/test/org/apache/geronimo/security/jaas/LoginSQLTest.java
    geronimo/branches/1.1/modules/security/src/test/org/apache/geronimo/security/jaas/TimeoutTest.java
    geronimo/branches/1.1/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java
    geronimo/branches/1.1/modules/security/src/test/org/apache/geronimo/security/remoting/jmx/RemoteLoginTest.java
    geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
    geronimo/branches/1.1/modules/service-builder/src/test-resources/services/plan1.xml
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/FileConfigurationList.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanGBeanBridge.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java
    geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java

Modified: geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java (original)
+++ geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java Mon Mar  6 13:44:29 2006
@@ -21,17 +21,23 @@
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.util.Map;
+import java.util.HashMap;
 import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.connector.mock.MockAdminObject;
 import org.apache.geronimo.connector.mock.MockAdminObjectImpl;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.AbstractName;
 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.repository.Artifact;
 
 /**
  * @version $Rev$ $Date$
@@ -39,7 +45,7 @@
 public class AdminObjectWrapperTest extends TestCase {
 
     private Kernel kernel;
-    private ObjectName selfName;
+    private AbstractName selfName;
     private static final String TARGET_NAME = "testAOName";
 
     public void testProxy() throws Exception {
@@ -105,14 +111,25 @@
         J2eeContext j2eeContext = new J2eeContextImpl("test.domain", "geronimo.server", "testapp", NameFactory.RESOURCE_ADAPTER_MODULE, "testmodule", TARGET_NAME, NameFactory.JMS_RESOURCE);
         kernel = KernelFactory.newInstance().createKernel(j2eeContext.getJ2eeDomainName());
         kernel.boot();
-        selfName = NameFactory.getComponentName(null, null, null, NameFactory.JCA_RESOURCE, null, null, null, j2eeContext);
 
-        GBeanData aow = new GBeanData(selfName, AdminObjectWrapperGBean.getGBeanInfo());
+        GBeanData aow = buildGBeanData("name", TARGET_NAME, AdminObjectWrapperGBean.getGBeanInfo(), NameFactory.JCA_RESOURCE, j2eeContext);
+        selfName = aow.getAbstractName();
         aow.setAttribute("adminObjectInterface", MockAdminObject.class.getName());
         aow.setAttribute("adminObjectClass", MockAdminObjectImpl.class.getName());
         kernel.loadGBean(aow, this.getClass().getClassLoader());
 
         kernel.startGBean(selfName);
+    }
+
+    private GBeanData buildGBeanData(String key, String value, GBeanInfo info, String type, J2eeContext j2eeContext) throws MalformedObjectNameException {
+        AbstractName abstractName = buildAbstractName(key, value, info, type, j2eeContext);
+        return new GBeanData(abstractName, info);
+    }
+
+    private AbstractName buildAbstractName(String key, String value, GBeanInfo info, String type, J2eeContext j2eeContext) throws MalformedObjectNameException {
+        Map names = new HashMap();
+        names.put(key, value);
+        return new AbstractName(new Artifact("test", "foo", "1", "car"), names, info.getInterfaces(), NameFactory.getComponentName(null, null, null, type, null, null, value, j2eeContext));
     }
 
     protected void tearDown() throws Exception {

Modified: geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java (original)
+++ geronimo/branches/1.1/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java Mon Mar  6 13:44:29 2006
@@ -22,8 +22,9 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
-import java.util.Collections;
-import javax.management.ObjectName;
+import java.util.Map;
+import java.util.HashMap;
+import javax.management.MalformedObjectNameException;
 import javax.resource.cci.Connection;
 import javax.resource.cci.ConnectionFactory;
 
@@ -38,11 +39,14 @@
 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.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
+import org.apache.geronimo.kernel.repository.Artifact;
 
 /**
  * @version $Rev$ $Date$
@@ -50,9 +54,9 @@
 public class ManagedConnectionFactoryWrapperTest extends TestCase {
 
     private Kernel kernel;
-    private ObjectName managedConnectionFactoryName;
-    private ObjectName ctcName;
-    private ObjectName cmfName;
+    private AbstractName managedConnectionFactoryName;
+    private AbstractName ctcName;
+    private AbstractName cmfName;
     private static final String KERNEL_NAME = "testKernel";
     private static final String TARGET_NAME = "testCFName";
 
@@ -107,21 +111,22 @@
         kernel = KernelFactory.newInstance().createKernel(KERNEL_NAME);
         kernel.boot();
         ClassLoader cl = MockConnectionTrackingCoordinator.class.getClassLoader();
-        ctcName = ObjectName.getInstance("test:role=ConnectionTrackingCoordinator");
-        GBeanData ctc = new GBeanData(ctcName, MockConnectionTrackingCoordinator.getGBeanInfo());
+        J2eeContext j2eeContext = new J2eeContextImpl("test.domain", "geronimo", "testapplication", "noModuleType", "testmodule", TARGET_NAME, NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
+
+        GBeanData ctc = buildGBeanData("name", "ConnectionTrackingCoordinator", MockConnectionTrackingCoordinator.getGBeanInfo(), "ConnectionTrackingCoordinator", j2eeContext);
+        ctcName = ctc.getAbstractName();
         kernel.loadGBean(ctc, cl);
 
-        cmfName = ObjectName.getInstance("test:role=ConnectionManagerContainer");
-        GBeanData cmf = new GBeanData(cmfName, GenericConnectionManagerGBean.getGBeanInfo());
+        GBeanData cmf = buildGBeanData("name", "ConnectionManagerContainer", GenericConnectionManagerGBean.getGBeanInfo(), "ConnectionManagerContainer", j2eeContext);
+        cmfName = cmf.getAbstractName();
         cmf.setAttribute("transactionSupport", NoTransactions.INSTANCE);
         cmf.setAttribute("pooling", new NoPool());
-        cmf.setReferencePatterns("ConnectionTracker", Collections.singleton(ctcName));
+        cmf.setReferencePattern("ConnectionTracker", new AbstractNameQuery(ctcName));
         kernel.loadGBean(cmf, cl);
 
-        J2eeContext j2eeContext = new J2eeContextImpl("test.domain", "geronimo", "testapplication", "noModuleType", "testmodule", TARGET_NAME, NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
-        managedConnectionFactoryName = NameFactory.getComponentName(null, null, null, NameFactory.JCA_RESOURCE, null, null, null, j2eeContext);
 
-        GBeanData mcfw = new GBeanData(managedConnectionFactoryName, ManagedConnectionFactoryWrapperGBean.getGBeanInfo());
+        GBeanData mcfw = buildGBeanData("name", TARGET_NAME, ManagedConnectionFactoryWrapperGBean.getGBeanInfo(), NameFactory.JCA_RESOURCE, j2eeContext);
+        managedConnectionFactoryName = mcfw.getAbstractName();
         mcfw.setAttribute("managedConnectionFactoryClass", MockManagedConnectionFactory.class.getName());
         mcfw.setAttribute("connectionFactoryInterface", ConnectionFactory.class.getName());
         mcfw.setAttribute("implementedInterfaces", new String[] {Serializable.class.getName(), ConnectionFactoryExtension.class.getName()});
@@ -129,7 +134,7 @@
         mcfw.setAttribute("connectionInterface", Connection.class.getName());
         mcfw.setAttribute("connectionImplClass", MockConnection.class.getName());
         //"ResourceAdapterWrapper",
-        mcfw.setReferencePatterns("ConnectionManagerContainer", Collections.singleton(cmfName));
+        mcfw.setReferencePattern("ConnectionManagerContainer", new AbstractNameQuery(cmfName));
         //"ManagedConnectionFactoryListener",
         kernel.loadGBean(mcfw, cl);
 
@@ -137,6 +142,17 @@
         kernel.startGBean(cmfName);
         kernel.startGBean(managedConnectionFactoryName);
     }
+    private GBeanData buildGBeanData(String key, String value, GBeanInfo info, String type, J2eeContext j2eeContext) throws MalformedObjectNameException {
+        AbstractName abstractName = buildAbstractName(key, value, info, type, j2eeContext);
+        return new GBeanData(abstractName, info);
+    }
+
+    private AbstractName buildAbstractName(String key, String value, GBeanInfo info, String type, J2eeContext j2eeContext) throws MalformedObjectNameException {
+        Map names = new HashMap();
+        names.put(key, value);
+        return new AbstractName(new Artifact("test", "foo", "1", "car"), names, info.getInterfaces(), NameFactory.getComponentName(null, null, null, type, null, null, value, j2eeContext));
+    }
+
 
     protected void tearDown() throws Exception {
         kernel.stopGBean(managedConnectionFactoryName);
@@ -145,11 +161,11 @@
 
     public static class MockConnectionTrackingCoordinator implements ConnectionTracker {
         public void handleObtained(ConnectionTrackingInterceptor connectionTrackingInterceptor,
-                ConnectionInfo connectionInfo) {
+                                   ConnectionInfo connectionInfo) {
         }
 
         public void handleReleased(ConnectionTrackingInterceptor connectionTrackingInterceptor,
-                ConnectionInfo connectionInfo) {
+                                   ConnectionInfo connectionInfo) {
         }
 
         public void setEnvironment(ConnectionInfo connectionInfo, String key) {

Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java Mon Mar  6 13:44:29 2006
@@ -24,6 +24,8 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.Configuration;
@@ -106,7 +108,7 @@
         } finally {
             if (tmpDir != null) {
                 if (!DeploymentUtil.recursiveDelete(tmpDir)) {
-                    pendingDeletionIndex.setProperty(tmpDir.getName(), new String("delete"));
+                    pendingDeletionIndex.setProperty(tmpDir.getName(), "delete");
                 }
             }
         }
@@ -124,18 +126,18 @@
      */
     public String getRemoteDeployUploadURL() {
         // Get the token GBean from the remote deployment configuration
-        Set set = kernel.listGBeans(new GBeanQuery(null, "org.apache.geronimo.deployment.remote.RemoteDeployToken"));
+        Set set = kernel.listGBeans(new AbstractNameQuery("org.apache.geronimo.deployment.remote.RemoteDeployToken"));
         if(set.size() == 0) {
             return null;
         }
-        ObjectName token = (ObjectName) set.iterator().next();
+        AbstractName token = (AbstractName) set.iterator().next();
         // Identify the parent configuration for that GBean
         set = kernel.getDependencyManager().getParents(token);
         ObjectName config = null;
         for (Iterator it = set.iterator(); it.hasNext();) {
-            ObjectName name = (ObjectName) it.next();
-            if(Configuration.isConfigurationObjectName(name)) {
-                config = name;
+            AbstractName name = (AbstractName) it.next();
+            if(Configuration.isConfigurationObjectName(name.getObjectName())) {
+                config = name.getObjectName();
                 break;
             }
         }
@@ -145,12 +147,12 @@
         }
         // Generate the URL based on the remote deployment configuration
         Hashtable hash = new Hashtable();
-        hash.put("J2EEApplication", token.getKeyProperty("J2EEApplication"));
-        hash.put("J2EEServer", token.getKeyProperty("J2EEServer"));
+        hash.put("J2EEApplication", token.getObjectName().getKeyProperty("J2EEApplication"));
+        hash.put("J2EEServer", token.getObjectName().getKeyProperty("J2EEServer"));
         hash.put("j2eeType", "WebModule");
         try {
             hash.put("name", Configuration.getConfigurationID(config).toString());
-            ObjectName module = new ObjectName(token.getDomain(), hash);
+            ObjectName module = new ObjectName(token.getObjectName().getDomain(), hash);
 
             String containerName = (String) kernel.getAttribute(module, "containerName");
             String contextPath = (String) kernel.getAttribute(module, "contextPath");
@@ -183,7 +185,7 @@
                         String url = (String) kernel.getAttribute(cncName, "connectUrl");
                         map.put(protocol, url);
                     }
-                    String urlPrefix = null;
+                    String urlPrefix;
                     if((urlPrefix = (String) map.get("HTTP")) == null) {
                         urlPrefix = (String) map.get("HTTPS");
                     }
@@ -324,7 +326,7 @@
     private void cleanupConfigurationDirs(ConfigurationData configurationData) {
         File configurationDir = configurationData.getConfigurationDir();
         if (!DeploymentUtil.recursiveDelete(configurationDir)) {
-            pendingDeletionIndex.setProperty(configurationDir.getName(), new String("delete"));
+            pendingDeletionIndex.setProperty(configurationDir.getName(), "delete");
             log.debug("Queued deployment directory to be reaped " + configurationDir);
         }
         for (Iterator iterator = configurationData.getChildConfigurations().iterator(); iterator.hasNext();) {

Modified: geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java (original)
+++ geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java Mon Mar  6 13:44:29 2006
@@ -31,6 +31,8 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.Log;
 
@@ -81,20 +83,37 @@
      * @return the Configuration the bean is in, or null if it is not in a Configuration
      */
     public synchronized static ObjectName getConfiguration(Kernel kernel, ObjectName objectName) {
+        try {
+            GBeanData data = kernel.getGBeanData(objectName);
+            AbstractName abstractName = data.getAbstractName();
+            AbstractName result = getConfiguration(kernel, abstractName);
+            if (result == null) {
+                return null;
+            }
+            return result.getObjectName();
+        } catch (GBeanNotFoundException e) {
+            log.warn("gbean not found" + objectName);
+            return null;
+        }
+    }
+
+    public synchronized static AbstractName getConfiguration(Kernel kernel, AbstractName abstractName) {
         DependencyManager mgr = kernel.getDependencyManager();
-        Set parents = mgr.getParents(objectName);
+        Set parents = mgr.getParents(abstractName);
         if(parents == null || parents.isEmpty()) {
-            log.warn("No parents found for "+objectName);
+            log.warn("No parents found for "+abstractName);
             return null;
         }
         for (Iterator it = parents.iterator(); it.hasNext();) {
-            ObjectName name = (ObjectName) it.next();
+            AbstractName name = (AbstractName) it.next();
             try {
                 GBeanInfo info = kernel.getGBeanInfo(name);
                 if(info.getClassName().equals(Configuration.class.getName())) {
                     return name;
                 }
-            } catch (GBeanNotFoundException e) {} // should never happen
+            } catch (GBeanNotFoundException e) {
+                // should never happen
+            }
         }
         log.warn("No Configuration parent found");
         return null;

Modified: geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/Abstract77Test.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/Abstract77Test.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/Abstract77Test.java (original)
+++ geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/Abstract77Test.java Mon Mar  6 13:44:29 2006
@@ -20,15 +20,20 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.Hashtable;
 import javax.management.ObjectName;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.management.impl.J2EEDomainImpl;
 import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
 import org.apache.geronimo.j2ee.management.impl.JVMImpl;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 import org.apache.log4j.Logger;
@@ -40,15 +45,30 @@
  * @version $Rev$ $Date$
  */
 public abstract class Abstract77Test extends TestCase {
-    protected static final ObjectName SERVER_INFO_NAME = JMXUtil.getObjectName("geronimo.system:role=ServerInfo");
+    protected static final GBeanData SERVER_INFO_DATA = buildGBeanData(new String[] {"role"}, new String[] {"ServerInfo"}, BasicServerInfo.getGBeanInfo());
 
     protected static final String DOMAIN = "geronimo.test";
-    protected static final ObjectName DOMAIN_NAME = JMXUtil.getObjectName(DOMAIN + ":j2eeType=J2EEDomain,name=" + DOMAIN);
-    protected static final ObjectName SERVER_NAME = JMXUtil.getObjectName(DOMAIN + ":j2eeType=J2EEServer,name=Test");
-    protected static final ObjectName JVM_NAME = JMXUtil.getObjectName(DOMAIN + ":j2eeType=JVM,J2EEServer=Test,name=JVM");
+    protected static final GBeanData DOMAIN_DATA = buildGBeanData(new String[] {"j2eeType", "name"}, new String[] {"J2EEDomain", DOMAIN}, J2EEDomainImpl.GBEAN_INFO);
+    protected static final GBeanData SERVER_DATA = buildGBeanData(new String[] {"j2eeType", "name"}, new String[] {"J2EEServer", "test"}, J2EEServerImpl.GBEAN_INFO);
+    protected static final GBeanData JVM_DATA = buildGBeanData(new String[] {"j2eeType", "J2EEServer", "name"}, new String[] {"JVM", "test", "JVM"}, JVMImpl.GBEAN_INFO);
 
     protected Kernel kernel;
 
+    private static GBeanData buildGBeanData(String[] key, String[] value, GBeanInfo info) {
+        AbstractName abstractName = buildAbstractName(key, value, info);
+        return new GBeanData(abstractName, info);
+    }
+
+    private static AbstractName buildAbstractName(String[] key, String value[], GBeanInfo info) {
+        Hashtable names = new Hashtable();
+        for (int i = 0; i < key.length; i++) {
+            String k = key[i];
+            String v = value[i];
+            names.put(k, v);
+        }
+        return new AbstractName(new Artifact("test", "foo", "1", "car"), names, info.getInterfaces(), JMXUtil.getObjectName(DOMAIN, names));
+    }
+
     protected void setUp() throws Exception {
         Logger.getRootLogger().setLevel(Level.WARN);
         Logger.getRootLogger().addAppender(new ConsoleAppender(new PatternLayout("%p [%t] %m %n")));
@@ -57,36 +77,32 @@
         kernel.boot();
 
         ClassLoader classLoader = getClass().getClassLoader();
-        GBeanData gbean;
-        gbean = new GBeanData(SERVER_INFO_NAME, BasicServerInfo.getGBeanInfo());
-        gbean.setAttribute("baseDirectory", System.getProperty("java.io.tmpdir"));
-        kernel.loadGBean(gbean, classLoader);
-
-        gbean = new GBeanData(DOMAIN_NAME, J2EEDomainImpl.GBEAN_INFO);
-        kernel.loadGBean(gbean, classLoader);
-
-        gbean = new GBeanData(SERVER_NAME, J2EEServerImpl.GBEAN_INFO);
-        gbean.setReferencePatterns("ServerInfo", Collections.singleton(SERVER_INFO_NAME));
-        kernel.loadGBean(gbean, classLoader);
-
-
-        kernel.loadGBean(new GBeanData(JVM_NAME, JVMImpl.GBEAN_INFO), classLoader);
-        kernel.startGBean(SERVER_INFO_NAME);
-        kernel.startGBean(DOMAIN_NAME);
-        kernel.startGBean(SERVER_NAME);
-        kernel.startGBean(JVM_NAME);
+        SERVER_INFO_DATA.setAttribute("baseDirectory", System.getProperty("java.io.tmpdir"));
+        kernel.loadGBean(SERVER_INFO_DATA, classLoader);
+
+        kernel.loadGBean(DOMAIN_DATA, classLoader);
+
+        SERVER_DATA.setReferencePatterns("ServerInfo", Collections.singleton(new AbstractNameQuery(SERVER_INFO_DATA.getAbstractName())));
+        kernel.loadGBean(SERVER_DATA, classLoader);
+
+
+        kernel.loadGBean(JVM_DATA, classLoader);
+        kernel.startGBean(SERVER_INFO_DATA.getAbstractName());
+        kernel.startGBean(DOMAIN_DATA.getAbstractName());
+        kernel.startGBean(SERVER_DATA.getAbstractName());
+        kernel.startGBean(JVM_DATA.getAbstractName());
     }
 
     protected void tearDown() throws Exception {
         super.tearDown();
-        kernel.stopGBean(JVM_NAME);
-        kernel.stopGBean(SERVER_NAME);
-        kernel.stopGBean(DOMAIN_NAME);
-        kernel.stopGBean(SERVER_INFO_NAME);
-        kernel.unloadGBean(JVM_NAME);
-        kernel.unloadGBean(SERVER_NAME);
-        kernel.unloadGBean(DOMAIN_NAME);
-        kernel.unloadGBean(SERVER_INFO_NAME);
+        kernel.stopGBean(JVM_DATA.getAbstractName());
+        kernel.stopGBean(SERVER_DATA.getAbstractName());
+        kernel.stopGBean(DOMAIN_DATA.getAbstractName());
+        kernel.stopGBean(SERVER_INFO_DATA.getAbstractName());
+        kernel.unloadGBean(JVM_DATA.getAbstractName());
+        kernel.unloadGBean(SERVER_DATA.getAbstractName());
+        kernel.unloadGBean(DOMAIN_DATA.getAbstractName());
+        kernel.unloadGBean(SERVER_INFO_DATA.getAbstractName());
         kernel.shutdown();
         kernel = null;
     }

Modified: geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/DomainTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/DomainTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/DomainTest.java (original)
+++ geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/DomainTest.java Mon Mar  6 13:44:29 2006
@@ -25,18 +25,18 @@
     private J2EEDomain domain;
 
     public void testStandardInterface() throws Exception {
-        assertEquals(DOMAIN_NAME.toString(), domain.getObjectName());
-        assertObjectNamesEqual(new String[]{SERVER_NAME.toString()}, domain.getServers());
+        assertEquals(DOMAIN_DATA.getName().toString(), domain.getObjectName());
+        assertObjectNamesEqual(new String[]{SERVER_DATA.getName().toString()}, domain.getServers());
     }
 
     public void testStandardAttributes() throws Exception {
-        assertEquals(DOMAIN_NAME.toString(), kernel.getAttribute(DOMAIN_NAME, "objectName"));
-        assertObjectNamesEqual(new String[]{SERVER_NAME.toString()}, (String[]) kernel.getAttribute(DOMAIN_NAME, "servers"));
+        assertEquals(DOMAIN_DATA.getName().toString(), kernel.getAttribute(DOMAIN_DATA.getAbstractName(), "objectName"));
+        assertObjectNamesEqual(new String[]{SERVER_DATA.getName().toString()}, (String[]) kernel.getAttribute(DOMAIN_DATA.getAbstractName(), "servers"));
     }
 
     protected void setUp() throws Exception {
         super.setUp();
-        domain = (J2EEDomain) kernel.getProxyManager().createProxy(DOMAIN_NAME, J2EEDomain.class);
+        domain = (J2EEDomain) kernel.getProxyManager().createProxy(DOMAIN_DATA.getAbstractName(), J2EEDomain.class);
     }
 
     protected void tearDown() throws Exception {

Modified: geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/JVMTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/JVMTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/JVMTest.java (original)
+++ geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/JVMTest.java Mon Mar  6 13:44:29 2006
@@ -31,17 +31,17 @@
     private Runtime runtime;
 
     public void testStandardInterface() {
-        assertEquals(JVM_NAME.getCanonicalName(), jvm.getObjectName());
+        assertEquals(JVM_DATA.getName().getCanonicalName(), jvm.getObjectName());
         assertEquals(System.getProperty("java.version"), jvm.getJavaVersion());
         assertEquals(System.getProperty("java.vendor"), jvm.getJavaVendor());
         assertEquals(node, jvm.getNode());
     }
 
     public void testStandardAttributes() throws Exception {
-        assertEquals(JVM_NAME.getCanonicalName(), kernel.getAttribute(JVM_NAME, "objectName"));
-        assertEquals(System.getProperty("java.version"), kernel.getAttribute(JVM_NAME, "javaVersion"));
-        assertEquals(System.getProperty("java.vendor"), kernel.getAttribute(JVM_NAME, "javaVendor"));
-        assertEquals(node, kernel.getAttribute(JVM_NAME, "node"));
+        assertEquals(JVM_DATA.getName().getCanonicalName(), kernel.getAttribute(JVM_DATA.getName(), "objectName"));
+        assertEquals(System.getProperty("java.version"), kernel.getAttribute(JVM_DATA.getName(), "javaVersion"));
+        assertEquals(System.getProperty("java.vendor"), kernel.getAttribute(JVM_DATA.getName(), "javaVendor"));
+        assertEquals(node, kernel.getAttribute(JVM_DATA.getName(), "node"));
     }
 
     public void testGeronimoInterface() {
@@ -50,12 +50,12 @@
     }
 
     public void testGeronimoAttributes() throws Exception {
-        assertEquals(new Integer(runtime.availableProcessors()), kernel.getAttribute(JVM_NAME, "availableProcessors"));
+        assertEquals(new Integer(runtime.availableProcessors()), kernel.getAttribute(JVM_DATA.getName(), "availableProcessors"));
     }
 
     public void testStatistics() throws Exception {
-        assertEquals(Boolean.TRUE, kernel.getAttribute(JVM_NAME, "statisticsProvider"));
-        JVMStats stats = (JVMStats) kernel.getAttribute(JVM_NAME, "stats");
+        assertEquals(Boolean.TRUE, kernel.getAttribute(JVM_DATA.getName(), "statisticsProvider"));
+        JVMStats stats = (JVMStats) kernel.getAttribute(JVM_DATA.getName(), "stats");
         assertNotNull(stats.getHeapSize());
         assertTrue(stats.getHeapSize().getCurrent() > 0);
         assertNotNull(stats.getHeapSize().getDescription());
@@ -78,8 +78,8 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        jvm = (JVM) kernel.getProxyManager().createProxy(JVM_NAME, JVM.class);
-        jvmEx = (org.apache.geronimo.management.geronimo.JVM) kernel.getProxyManager().createProxy(JVM_NAME, org.apache.geronimo.management.geronimo.JVM.class);
+        jvm = (JVM) kernel.getProxyManager().createProxy(JVM_DATA.getName(), JVM.class);
+        jvmEx = (org.apache.geronimo.management.geronimo.JVM) kernel.getProxyManager().createProxy(JVM_DATA.getName(), org.apache.geronimo.management.geronimo.JVM.class);
         node = InetAddress.getLocalHost().toString();
         runtime = Runtime.getRuntime();
     }

Modified: geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/ServerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/ServerTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/ServerTest.java (original)
+++ geronimo/branches/1.1/modules/j2ee/src/test/org/apache/geronimo/j2ee/management/ServerTest.java Mon Mar  6 13:44:29 2006
@@ -28,27 +28,27 @@
     private String version;
 
     public void testStandardInterface() throws Exception {
-        assertEquals(SERVER_NAME.toString(), server.getObjectName());
+        assertEquals(SERVER_DATA.getName().toString(), server.getObjectName());
         assertEquals(0, server.getDeployedObjects().length);
         assertEquals(0, server.getResources().length);
-        assertObjectNamesEqual(new String[]{JVM_NAME.toString()}, server.getJavaVMs());
+        assertObjectNamesEqual(new String[]{JVM_DATA.getName().toString()}, server.getJavaVMs());
         assertEquals("The Apache Software Foundation", server.getServerVendor());
         assertEquals(version, server.getServerVersion());
     }
 
     public void testStandardAttributes() throws Exception {
-        assertEquals(SERVER_NAME.toString(), kernel.getAttribute(SERVER_NAME, "objectName"));
-        assertEquals(0, ((String[]) kernel.getAttribute(SERVER_NAME, "deployedObjects")).length);
-        assertEquals(0, ((String[]) kernel.getAttribute(SERVER_NAME, "resources")).length);
-        assertObjectNamesEqual(new String[]{JVM_NAME.toString()}, (String[]) kernel.getAttribute(SERVER_NAME, "javaVMs"));
-        assertEquals("The Apache Software Foundation", kernel.getAttribute(SERVER_NAME, "serverVendor"));
-        assertEquals(version, kernel.getAttribute(SERVER_NAME, "serverVersion"));
+        assertEquals(SERVER_DATA.getName().toString(), kernel.getAttribute(SERVER_DATA.getName(), "objectName"));
+        assertEquals(0, ((String[]) kernel.getAttribute(SERVER_DATA.getName(), "deployedObjects")).length);
+        assertEquals(0, ((String[]) kernel.getAttribute(SERVER_DATA.getName(), "resources")).length);
+        assertObjectNamesEqual(new String[]{JVM_DATA.getName().toString()}, (String[]) kernel.getAttribute(SERVER_DATA.getName(), "javaVMs"));
+        assertEquals("The Apache Software Foundation", kernel.getAttribute(SERVER_DATA.getName(), "serverVendor"));
+        assertEquals(version, kernel.getAttribute(SERVER_DATA.getName(), "serverVersion"));
     }
 
     protected void setUp() throws Exception {
         super.setUp();
-        server = (J2EEServer) kernel.getProxyManager().createProxy(SERVER_NAME, J2EEServer.class);
-        version = (String) kernel.getAttribute(SERVER_INFO_NAME, "version");
+        server = (J2EEServer) kernel.getProxyManager().createProxy(SERVER_DATA.getName(), J2EEServer.class);
+        version = (String) kernel.getAttribute(SERVER_INFO_DATA.getName(), "version");
     }
 
     protected void tearDown() throws Exception {

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java?rev=383682&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java Mon Mar  6 13:44:29 2006
@@ -0,0 +1,103 @@
+/**
+ *
+ * Copyright 2006 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.gbean;
+
+import org.apache.geronimo.kernel.repository.Artifact;
+
+import javax.management.ObjectName;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class AbstractName implements Serializable {
+
+    private final Artifact artifact;
+    private final Map name;
+    private final Set interfaceTypes;
+
+    private final ObjectName objectName;
+
+    public AbstractName(Artifact artifact, Map name, String interfaceType, ObjectName objectName) {
+        this.artifact = artifact;
+        this.name = name;
+        this.interfaceTypes = Collections.singleton(interfaceType);
+        this.objectName = objectName;
+    }
+
+    public AbstractName(Artifact artifact, Map name, Set interfaceTypes, ObjectName objectName) {
+        this.artifact = artifact;
+        this.name = name;
+        this.interfaceTypes = interfaceTypes;
+        this.objectName = objectName;
+    }
+
+    public Artifact getArtifact() {
+        return artifact;
+    }
+
+    public Map getName() {
+        return name;
+    }
+
+    public Set getInterfaceTypes() {
+        return interfaceTypes;
+    }
+
+    public ObjectName getObjectName() {
+        return objectName;
+    }
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+            buf.append("artifact=").append(artifact);
+        for (Iterator iterator = interfaceTypes.iterator(); iterator.hasNext();) {
+            String interfaceType = (String) iterator.next();
+            buf.append(",interface=").append(interfaceType);
+        }
+        for (Iterator iterator = name.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            buf.append(",").append(entry.getKey()).append("=").append(entry.getValue());
+        }
+        return buf.toString();
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final AbstractName that = (AbstractName) o;
+
+        if (artifact != null ? !artifact.equals(that.artifact) : that.artifact != null) return false;
+        if (name != null ? !name.equals(that.name) : that.name != null) return false;
+
+        return true;
+    }
+
+    public int hashCode() {
+        int result;
+        result = (artifact != null ? artifact.hashCode() : 0);
+        result = 29 * result + (name != null ? name.hashCode() : 0);
+        return result;
+    }
+
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java?rev=383682&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java Mon Mar  6 13:44:29 2006
@@ -0,0 +1,169 @@
+/**
+ *
+ * Copyright 2006 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.gbean;
+
+import org.apache.geronimo.kernel.repository.Artifact;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class AbstractNameQuery implements Serializable {
+
+    private final List artifacts;
+    private final Map name;
+    private final Set interfaceTypes;
+
+    public AbstractNameQuery(AbstractName abstractName) {
+        this.artifacts = Collections.singletonList(abstractName.getArtifact());
+        this.name = abstractName.getName();
+        this.interfaceTypes = abstractName.getInterfaceTypes();
+    }
+
+    public AbstractNameQuery(Artifact artifact, Map name, String interfaceType) {
+        this.artifacts = Collections.singletonList(artifact);
+        this.name = name;
+        this.interfaceTypes = Collections.singleton(interfaceType);
+    }
+
+    public AbstractNameQuery(String interfaceType) {
+        this.artifacts = Collections.EMPTY_LIST;
+        this.name = Collections.EMPTY_MAP;
+        this.interfaceTypes = Collections.singleton(interfaceType);
+    }
+
+    public AbstractNameQuery(List artifacts, Map name, Set interfaceTypes) {
+        this.artifacts = artifacts;
+        this.name = name;
+        this.interfaceTypes = interfaceTypes;
+    }
+
+    public AbstractNameQuery(Artifact artifact, Map name, Set interfaceTypes) {
+        this.artifacts = Collections.singletonList(artifact);
+        this.name = name;
+        this.interfaceTypes = interfaceTypes;
+    }
+
+    public List getArtifacts() {
+        return artifacts;
+    }
+
+    public Map getName() {
+        return name;
+    }
+
+    public Set getInterfaceTypes() {
+        return interfaceTypes;
+    }
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        String separator = "";
+        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
+            Artifact artifact = (Artifact) iterator.next();
+            buf.append(separator).append("artifact=").append(artifact);
+            separator = ",";
+        }
+        for (Iterator iterator = interfaceTypes.iterator(); iterator.hasNext();) {
+            String interfaceType = (String) iterator.next();
+            buf.append(",interface=").append(interfaceType);
+        }
+        for (Iterator iterator = name.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            buf.append(",").append(entry.getKey()).append("=").append(entry.getValue());
+        }
+        return buf.toString();
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final AbstractNameQuery that = (AbstractNameQuery) o;
+
+        if (artifacts != null ? !artifacts.equals(that.artifacts) : that.artifacts != null) return false;
+        if (interfaceTypes != null ? !interfaceTypes.equals(that.interfaceTypes) : that.interfaceTypes != null)
+            return false;
+        return !(name != null ? !name.equals(that.name) : that.name != null);
+
+    }
+
+    public int hashCode() {
+        int result;
+        result = (artifacts != null ? artifacts.hashCode() : 0);
+        result = 29 * result + (name != null ? name.hashCode() : 0);
+        result = 29 * result + (interfaceTypes != null ? interfaceTypes.hashCode() : 0);
+        return result;
+    }
+
+    /**
+     * determine if the supplied info is more specific and matches our patterns.  In this method
+     * "this" is the query, the info parameter is the test specific info.
+     * @param info
+     * @return if the specific info supplied matches our patterns.
+     */
+    public boolean matches(AbstractNameQuery info) {
+        List artifacts = info.getArtifacts();
+        if (artifacts.size() != 1) {
+            throw new IllegalArgumentException("source info must have only one artifact");
+        }
+        if (!info.getName().entrySet().containsAll(name.entrySet())) {
+            return false;
+        }
+        if (!info.getInterfaceTypes().containsAll(interfaceTypes)) {
+            return false;
+        }
+        if (getArtifacts().isEmpty()) {
+            return true;
+        }
+        Artifact otherArtifact = (Artifact) artifacts.iterator().next();
+        for (Iterator iterator = getArtifacts().iterator(); iterator.hasNext();) {
+            Artifact artifact = (Artifact) iterator.next();
+            if (artifact.matches(otherArtifact)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean matches(AbstractName info) {
+        if (!info.getName().entrySet().containsAll(name.entrySet())) {
+            return false;
+        }
+        if (!info.getInterfaceTypes().containsAll(interfaceTypes)) {
+            return false;
+        }
+        if (getArtifacts().isEmpty()) {
+            return true;
+        }
+        Artifact otherArtifact = info.getArtifact();
+        for (Iterator iterator = getArtifacts().iterator(); iterator.hasNext();) {
+            Artifact artifact = (Artifact) iterator.next();
+            if (artifact.matches(otherArtifact)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java Mon Mar  6 13:44:29 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.gbean;
 
+import org.apache.geronimo.kernel.repository.Artifact;
+
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -36,11 +38,13 @@
 public class GBeanData implements Externalizable {
     private Map nameMap;
     private Set omit;
+    //TODO remove
     private ObjectName name;
     private GBeanInfo gbeanInfo;
     private final Map attributes;
     private final Map references;
     private final Set dependencies;
+    private AbstractName abstractName;
 
     public GBeanData() {
         nameMap = new HashMap();
@@ -61,6 +65,14 @@
         this.gbeanInfo = gbeanInfo;
     }
 
+    public GBeanData(AbstractName abstractName, GBeanInfo gbeanInfo) {
+        this();
+        this.abstractName = abstractName;
+        this.nameMap = abstractName.getName();
+        this.omit = new HashSet();
+        this.gbeanInfo = gbeanInfo;
+    }
+
     public GBeanData(Map nameMap, Set omitMap, GBeanInfo gbeanInfo) {
         this();
         this.nameMap.putAll(nameMap);
@@ -78,22 +90,30 @@
         attributes = new HashMap(gbeanData.attributes);
         references = new HashMap(gbeanData.references);
         dependencies = new HashSet(gbeanData.dependencies);
+        abstractName = gbeanData.abstractName;
     }
 
     public ObjectName getName() {
-        return name;
+        //TODO remove the name attribute
+        return abstractName == null? name: abstractName.getObjectName();
     }
 
+    //TODO remove
     public void setName(ObjectName name) {
         this.name = name;
     }
 
-    public void initializeName(ObjectName base) throws MalformedObjectNameException {
+    public void initializeName(Artifact configName, ObjectName base) throws MalformedObjectNameException {
         String domain = base.getDomain();
         Hashtable keys = base.getKeyPropertyList();
         keys.keySet().removeAll(omit);
         keys.putAll(nameMap);
-        name = new ObjectName(domain, keys);
+        ObjectName objectName = new ObjectName(domain, keys);
+        abstractName = new AbstractName(configName, nameMap, gbeanInfo.getInterfaces(), objectName);
+    }
+
+    public AbstractName getAbstractName() {
+        return abstractName;
     }
 
     public void setNameMap(Map nameMap) {
@@ -101,6 +121,10 @@
         this.nameMap.putAll(nameMap);
     }
 
+    public Map getNameMap() {
+        return nameMap;
+    }
+
     public void setOmit(Set omit) {
         this.omit.clear();
         this.omit.addAll(omit);
@@ -142,7 +166,7 @@
         return (Set) references.get(name);
     }
 
-    public void setReferencePattern(String name, ObjectName pattern) {
+    public void setReferencePattern(String name, AbstractNameQuery pattern) {
         setReferencePatterns(name, Collections.singleton(pattern));
     }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/AbstractGBeanReference.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/AbstractGBeanReference.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/AbstractGBeanReference.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/AbstractGBeanReference.java Mon Mar  6 13:44:29 2006
@@ -16,14 +16,7 @@
  */
 package org.apache.geronimo.gbean.runtime;
 
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import javax.management.ObjectName;
-
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GReferenceInfo;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
 import org.apache.geronimo.kernel.ClassLoading;
@@ -33,6 +26,13 @@
 import org.apache.geronimo.kernel.lifecycle.LifecycleListener;
 import org.apache.geronimo.kernel.management.State;
 
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
 /**
  * @version $Rev$ $Date$
  */
@@ -141,9 +141,9 @@
 
     protected abstract LifecycleListener createLifecycleListener();
 
-    protected abstract void targetAdded(ObjectName target);
+    protected abstract void targetAdded(AbstractName target);
 
-    protected abstract void targetRemoved(ObjectName target);
+    protected abstract void targetRemoved(AbstractName target);
 
     protected final Kernel getKernel() {
         return kernel;
@@ -208,7 +208,7 @@
     public final synchronized void online() {
         Set gbeans = kernel.listGBeans(patterns);
         for (Iterator objectNameIterator = gbeans.iterator(); objectNameIterator.hasNext();) {
-            ObjectName target = (ObjectName) objectNameIterator.next();
+            AbstractName target = (AbstractName) objectNameIterator.next();
             if (!targets.contains(target)) {
 
                 // if the bean is running add it to the runningTargets list
@@ -236,17 +236,17 @@
         return targets;
     }
 
-    protected final void addTarget(ObjectName objectName) {
-        if (!targets.contains(objectName)) {
-            targets.add(objectName);
-            targetAdded(objectName);
+    protected final void addTarget(AbstractName abstractName) {
+        if (!targets.contains(abstractName)) {
+            targets.add(abstractName);
+            targetAdded(abstractName);
         }
     }
 
-    protected final void removeTarget(ObjectName objectName) {
-        boolean wasTarget = targets.remove(objectName);
+    protected final void removeTarget(AbstractName abstractName) {
+        boolean wasTarget = targets.remove(abstractName);
         if (wasTarget) {
-            targetRemoved(objectName);
+            targetRemoved(abstractName);
         }
     }
 
@@ -260,12 +260,12 @@
     /**
      * Is the component in the Running state
      *
-     * @param objectName name of the component to check
+     * @param abstractName name of the component to check
      * @return true if the component is running; false otherwise
      */
-    private boolean isRunning(Kernel kernel, ObjectName objectName) {
+    private boolean isRunning(Kernel kernel, AbstractName abstractName) {
         try {
-            final int state = kernel.getGBeanState(objectName);
+            final int state = kernel.getGBeanState(abstractName);
             return state == State.RUNNING_INDEX;
         } catch (GBeanNotFoundException e) {
             // mbean is no longer registerd

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanCollectionReference.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanCollectionReference.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanCollectionReference.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanCollectionReference.java Mon Mar  6 13:44:29 2006
@@ -17,10 +17,9 @@
 
 package org.apache.geronimo.gbean.runtime;
 
-import javax.management.ObjectName;
-
 import org.apache.geronimo.gbean.GReferenceInfo;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.DependencyManager;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.lifecycle.LifecycleAdapter;
@@ -51,14 +50,14 @@
         }
     }
 
-    protected synchronized void targetAdded(ObjectName target) {
+    protected synchronized void targetAdded(AbstractName target) {
         ProxyCollection proxy = (ProxyCollection) getProxy();
         if (proxy != null) {
             proxy.addTarget(target);
         }
     }
 
-    protected synchronized void targetRemoved(ObjectName target) {
+    protected synchronized void targetRemoved(AbstractName target) {
         ProxyCollection proxy = (ProxyCollection) getProxy();
         if (proxy != null) {
             proxy.removeTarget(target);
@@ -67,24 +66,24 @@
 
     protected LifecycleListener createLifecycleListener() {
         return new LifecycleAdapter() {
-                    public void running(ObjectName objectName) {
-                        addTarget(objectName);
+                    public void running(AbstractName abstractName) {
+                        addTarget(abstractName);
                     }
 
-                    public void stopping(ObjectName objectName) {
-                        removeTarget(objectName);
+                    public void stopping(AbstractName abstractName) {
+                        removeTarget(abstractName);
                     }
 
-                    public void stopped(ObjectName objectName) {
-                        removeTarget(objectName);
+                    public void stopped(AbstractName abstractName) {
+                        removeTarget(abstractName);
                     }
 
-                    public void failed(ObjectName objectName) {
-                        removeTarget(objectName);
+                    public void failed(AbstractName abstractName) {
+                        removeTarget(abstractName);
                     }
 
-                    public void unloaded(ObjectName objectName) {
-                        removeTarget(objectName);
+                    public void unloaded(AbstractName abstractName) {
+                        removeTarget(abstractName);
                     }
                 };
     }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanDependency.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanDependency.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanDependency.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanDependency.java Mon Mar  6 13:44:29 2006
@@ -16,14 +16,10 @@
  */
 package org.apache.geronimo.gbean.runtime;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import javax.management.ObjectName;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
 import org.apache.geronimo.kernel.DependencyManager;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -32,6 +28,11 @@
 import org.apache.geronimo.kernel.lifecycle.LifecycleListener;
 import org.apache.geronimo.kernel.management.State;
 
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
 /**
  * @version $Rev$ $Date$
  */
@@ -71,7 +72,7 @@
      */
     private boolean isOnline = false;
 
-    public GBeanDependency(GBeanInstance gbeanInstance, ObjectName pattern, Kernel kernel, DependencyManager dependencyManager) throws InvalidConfigurationException {
+    public GBeanDependency(GBeanInstance gbeanInstance, AbstractNameQuery pattern, Kernel kernel, DependencyManager dependencyManager) throws InvalidConfigurationException {
         this.gbeanInstance = gbeanInstance;
         this.kernel = kernel;
         this.dependencyManager = dependencyManager;
@@ -89,7 +90,7 @@
     /**
      * The object to which the proxy is bound
      */
-    private ObjectName proxyTarget;
+    private AbstractName proxyTarget;
 
 
     public synchronized boolean start() {
@@ -98,27 +99,27 @@
             //
             // We must have exactally one running target
             //
-            ObjectName objectName = getGBeanInstance().getObjectNameObject();
+            AbstractName abstractName = getGBeanInstance().getAbstractName();
             Set targets = getTargets();
             if (targets.size() == 0) {
                 waitingForMe = true;
-                log.debug("Waiting to start " + objectName + " because no targets are running for the dependency matching the patternspatterns " + getPatternsText());
+                log.debug("Waiting to start " + abstractName + " because no targets are running for the dependency matching the patternspatterns " + getPatternsText());
                 return false;
             } else if (targets.size() > 1) {
                 waitingForMe = true;
-                log.debug("Waiting to start " + objectName + " because more then one targets are running for the dependency matching the patternspatterns " + getPatternsText());
+                log.debug("Waiting to start " + abstractName + " because more then one targets are running for the dependency matching the patternspatterns " + getPatternsText());
                 return false;
             }
             waitingForMe = false;
 
             // stop all gbeans that would match our patterns from starting
             DependencyManager dependencyManager = getDependencyManager();
-            dependencyManager.addStartHolds(objectName, getPatterns());
+            dependencyManager.addStartHolds(abstractName, getPatterns());
 
             // add a dependency on our target and create the proxy
-            ObjectName target = (ObjectName) targets.iterator().next();
+            AbstractName target = (AbstractName) targets.iterator().next();
             proxyTarget = target;
-            dependencyManager.addDependency(objectName, target);
+            dependencyManager.addDependency(abstractName, target);
         }
 
         return true;
@@ -128,28 +129,28 @@
         StringBuffer buf = new StringBuffer();
         Set patterns = getPatterns();
         for (Iterator iterator = patterns.iterator(); iterator.hasNext();) {
-            ObjectName objectName = (ObjectName) iterator.next();
-            buf.append(objectName.getCanonicalName()).append(" ");
+            AbstractNameQuery objectName = (AbstractNameQuery) iterator.next();
+            buf.append(objectName).append(" ");
         }
         return buf.toString();
     }
 
     public synchronized void stop() {
         waitingForMe = false;
-        ObjectName objectName = getGBeanInstance().getObjectNameObject();
+        AbstractName abstractName = getGBeanInstance().getAbstractName();
         Set patterns = getPatterns();
         DependencyManager dependencyManager = getDependencyManager();
         if (!patterns.isEmpty()) {
-            dependencyManager.removeStartHolds(objectName, patterns);
+            dependencyManager.removeStartHolds(abstractName, patterns);
         }
 
         if (proxyTarget != null) {
-            dependencyManager.removeDependency(objectName, proxyTarget);
+            dependencyManager.removeDependency(abstractName, proxyTarget);
             proxyTarget = null;
         }
     }
 
-    protected synchronized void targetAdded(ObjectName target) {
+    protected synchronized void targetAdded(AbstractName target) {
         // if we are running, and we now have two valid targets, which is an illegal state so we need to fail
         GBeanInstance gbeanInstance = getGBeanInstance();
         if (gbeanInstance.getStateInstance() == State.RUNNING) {
@@ -166,7 +167,7 @@
         }
     }
 
-    protected synchronized void targetRemoved(ObjectName target) {
+    protected synchronized void targetRemoved(AbstractName target) {
         GBeanInstance gbeanInstance = getGBeanInstance();
         if (gbeanInstance.getStateInstance() == State.RUNNING) {
             // we no longer have a valid target, which is an illegal state so we need to fail
@@ -196,20 +197,20 @@
 
     protected LifecycleListener createLifecycleListener() {
         return new LifecycleAdapter() {
-                    public void running(ObjectName objectName) {
-                        addTarget(objectName);
+                    public void running(AbstractName abstractName) {
+                        addTarget(abstractName);
                     }
 
-                    public void stopped(ObjectName objectName) {
-                        removeTarget(objectName);
+                    public void stopped(AbstractName abstractName) {
+                        removeTarget(abstractName);
                     }
 
-                    public void failed(ObjectName objectName) {
-                        removeTarget(objectName);
+                    public void failed(AbstractName abstractName) {
+                        removeTarget(abstractName);
                     }
 
-                    public void unloaded(ObjectName objectName) {
-                        removeTarget(objectName);
+                    public void unloaded(AbstractName abstractName) {
+                        removeTarget(abstractName);
                     }
                 };
     }
@@ -253,7 +254,7 @@
     public final synchronized void online() {
         Set gbeans = kernel.listGBeans(patterns);
         for (Iterator objectNameIterator = gbeans.iterator(); objectNameIterator.hasNext();) {
-            ObjectName target = (ObjectName) objectNameIterator.next();
+            AbstractName target = (AbstractName) objectNameIterator.next();
             if (!targets.contains(target)) {
 
                 // if the bean is running add it to the runningTargets list
@@ -281,17 +282,17 @@
         return targets;
     }
 
-    protected final void addTarget(ObjectName objectName) {
-        if (!targets.contains(objectName)) {
-            targets.add(objectName);
-            targetAdded(objectName);
+    protected final void addTarget(AbstractName abstractName) {
+        if (!targets.contains(abstractName)) {
+            targets.add(abstractName);
+            targetAdded(abstractName);
         }
     }
 
-    protected final void removeTarget(ObjectName objectName) {
-        boolean wasTarget = targets.remove(objectName);
+    protected final void removeTarget(AbstractName abstractName) {
+        boolean wasTarget = targets.remove(abstractName);
         if (wasTarget) {
-            targetRemoved(objectName);
+            targetRemoved(abstractName);
         }
     }
 
@@ -302,7 +303,7 @@
      * @param objectName name of the component to check
      * @return true if the component is running; false otherwise
      */
-    private boolean isRunning(Kernel kernel, ObjectName objectName) {
+    private boolean isRunning(Kernel kernel, AbstractName objectName) {
         try {
             final int state = kernel.getGBeanState(objectName);
             return state == State.RUNNING_INDEX;

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java Mon Mar  6 13:44:29 2006
@@ -70,9 +70,9 @@
     private ManageableAttributeStore manageableStore;
 
     /**
-     * The unique name of this service.
+     * the abstract name of this service
      */
-    private final ObjectName objectName;
+    private final AbstractName abstractName;
 
     /**
      * This handles all state transiitions for this instance.
@@ -195,10 +195,10 @@
      * mismatched attribute types or the intial data cannot be set
      */
     public GBeanInstance(GBeanData gbeanData, Kernel kernel, DependencyManager dependencyManager, LifecycleBroadcaster lifecycleBroadcaster, ClassLoader classLoader) throws InvalidConfigurationException {
-        this.objectName = gbeanData.getName();
+        this.abstractName = gbeanData.getAbstractName();
         this.kernel = kernel;
         this.lifecycleBroadcaster = lifecycleBroadcaster;
-        this.gbeanInstanceState = new GBeanInstanceState(objectName, kernel, dependencyManager, this, lifecycleBroadcaster);
+        this.gbeanInstanceState = new GBeanInstanceState(abstractName, kernel, dependencyManager, this, lifecycleBroadcaster);
         this.classLoader = classLoader;
 
         GBeanInfo gbeanInfo = gbeanData.getGBeanInfo();
@@ -247,7 +247,7 @@
         dependencies = new GBeanDependency[gbeanData.getDependencies().size()];
         int j = 0;
         for (Iterator iterator = gbeanData.getDependencies().iterator(); iterator.hasNext();) {
-            ObjectName dependencyName = (ObjectName) iterator.next();
+            AbstractNameQuery dependencyName = (AbstractNameQuery) iterator.next();
             GBeanDependency dependency = new GBeanDependency(this, dependencyName, kernel, dependencyManager);
             dependencies[j++] = dependency;
         }
@@ -296,7 +296,7 @@
             Constructor[] constructors = type.getConstructors();
             for (int i = 0; i < constructors.length; i++) {
                 Constructor testConstructor = constructors[i];
-                buf.append("constructor types: " + testConstructor.getParameterTypes() + "\n");
+                buf.append("constructor types: ").append(testConstructor.getParameterTypes()).append("\n");
                 if (testConstructor.getParameterTypes().length == parameterTypes.length) {
                     Class[] testParameterTypes = testConstructor.getParameterTypes();
                     for (int k = 0; k < testParameterTypes.length; k++) {
@@ -349,7 +349,7 @@
                 getReferenceByName(referenceName).setPatterns(referencePattern);
             }
         } catch (Exception e) {
-            throw new InvalidConfigurationException("Could not inject configuration data into the GBean " + objectName, e);
+            throw new InvalidConfigurationException("Could not inject configuration data into the GBean " + abstractName, e);
         }
 
         for (int i = 0; i < references.length; i++) {
@@ -365,7 +365,7 @@
         synchronized (this) {
             if (dead) {
                 // someone beat us to the punch... this instance should have never been found in the first place
-                throw new GBeanNotFoundException(objectName);
+                throw new GBeanNotFoundException(abstractName);
             }
             dead = true;
         }
@@ -373,7 +373,7 @@
         // if the bean is already stopped or failed, this will do nothing; otherwise it will shutdown the bean
         int state = getState();
         if (state != State.STOPPED_INDEX && state != State.FAILED_INDEX) {
-            log.error("GBeanInstance should already be stopped before die() is called: objectName=" + objectName + " state=" + State.fromInt(state));
+            log.error("GBeanInstance should already be stopped before die() is called: abstractName=" + abstractName + " state=" + State.fromInt(state));
         }
 
         gbeanInstanceState.fail();
@@ -436,11 +436,15 @@
     }
 
     public final String getObjectName() {
-        return objectName.getCanonicalName();
+        return abstractName.getObjectName().getCanonicalName();
     }
 
     public final ObjectName getObjectNameObject() {
-        return objectName;
+        return abstractName.getObjectName();
+    }
+
+    public final AbstractName getAbstractName() {
+        return abstractName;
     }
 
     /**
@@ -511,10 +515,10 @@
     public final void start() {
         synchronized (this) {
             if (dead) {
-                throw new IllegalStateException("A dead GBean can not be started: objectName=" + objectName);
+                throw new IllegalStateException("A dead GBean can not be started: abstractName=" + abstractName);
             }
             if (!enabled) {
-                throw new IllegalStateException("A disabled GBean can not be started: objectName=" + objectName);
+                throw new IllegalStateException("A disabled GBean can not be started: abstractName=" + abstractName);
             }
         }
         gbeanInstanceState.start();
@@ -528,10 +532,10 @@
     public final void startRecursive() {
         synchronized (this) {
             if (dead) {
-                throw new IllegalStateException("A dead GBean can not be started: objectName=" + objectName);
+                throw new IllegalStateException("A dead GBean can not be started: abstractName=" + abstractName);
             }
             if (!enabled) {
-                throw new IllegalStateException("A disabled GBean can not be started: objectName=" + objectName);
+                throw new IllegalStateException("A disabled GBean can not be started: abstractName=" + abstractName);
             }
         }
         gbeanInstanceState.startRecursive();
@@ -559,7 +563,7 @@
      * @return the gbean data
      */
     public GBeanData getGBeanData() {
-        GBeanData gbeanData = new GBeanData(objectName, gbeanInfo);
+        GBeanData gbeanData = new GBeanData(abstractName, gbeanInfo);
 
         // copy target into local variables from within a synchronized block to gaurentee a consistent read
         int state;
@@ -597,6 +601,7 @@
             Set patterns = reference.getPatterns();
             gbeanData.setReferencePatterns(name, patterns);
         }
+        //TODO copy the dependencies??
         return gbeanData;
     }
 
@@ -748,7 +753,7 @@
                                                                                               ManageableAttributeStore.class);
         }
         String configName = null;
-        Set set = kernel.getDependencyManager().getParents(objectName);
+        Set set = kernel.getDependencyManager().getParents(abstractName);
         for (Iterator iterator = set.iterator(); iterator.hasNext();) {
             ObjectName name = (ObjectName) iterator.next();
             if(Configuration.isConfigurationObjectName(name)) {
@@ -757,16 +762,16 @@
             }
         }
         if(configName != null) {
-            manageableStore.setValue(configName, objectName, attribute.getAttributeInfo(), value);
+            manageableStore.setValue(configName, abstractName.getObjectName(), attribute.getAttributeInfo(), value);
         } else {
-            log.error("Unable to identify Configuration for GBean "+objectName+".  Manageable attribute "+attribute.getName()+" was not updated in persistent store.");
+            log.error("Unable to identify Configuration for GBean "+abstractName.getObjectName()+".  Manageable attribute "+attribute.getName()+" was not updated in persistent store.");
         }
     }
 
     private GBeanAttribute getAttributeByName(String name) throws NoSuchAttributeException {
         Integer index = (Integer) attributeIndex.get(name);
         if (index == null) {
-            throw new NoSuchAttributeException("Unknown attribute " + name + " in gbean " + objectName);
+            throw new NoSuchAttributeException("Unknown attribute " + name + " in gbean " + abstractName.getObjectName());
         }
         GBeanAttribute attribute = attributes[index.intValue()];
         return attribute;
@@ -795,7 +800,7 @@
         }
 
         if (state == DESTROYED && !operation.isFramework()) {
-            throw new IllegalStateException("Operations can only be invoke while the GBean instance is running: " + objectName);
+            throw new IllegalStateException("Operations can only be invoke while the GBean instance is running: " + abstractName.getObjectName());
         }
         return operation.invoke(instance, arguments);
     }
@@ -830,7 +835,7 @@
         }
 
         if (state == DESTROYED && !operation.isFramework()) {
-            throw new IllegalStateException("Operations can only be invoke while the GBean is running: " + objectName);
+            throw new IllegalStateException("Operations can only be invoke while the GBean is running: " + abstractName);
         }
         return operation.invoke(instance, arguments);
     }
@@ -908,7 +913,7 @@
                 }
                 throw e;
             } catch (IllegalArgumentException e) {
-                log.warn("Constructor mismatch for " + objectName, e);
+                log.warn("Constructor mismatch for " + abstractName.getObjectName(), e);
                 throw e;
             }
 
@@ -954,7 +959,7 @@
                 try {
                     ((GBeanLifecycle) instance).doFail();
                 } catch (Throwable ignored) {
-                    log.error("Problem in doFail of " + objectName, ignored);
+                    log.error("Problem in doFail of " + abstractName.getObjectName(), ignored);
                 }
             }
 
@@ -1078,13 +1083,13 @@
                     try {
                         ((GBeanLifecycle) instance).doStop();
                     } catch (Throwable ignored) {
-                        log.error("Problem in doStop of " + objectName, ignored);
+                        log.error("Problem in doStop of " + abstractName.getObjectName(), ignored);
                     }
                 } else {
                     try {
                         ((GBeanLifecycle) instance).doFail();
                     } catch (Throwable ignored) {
-                        log.error("Problem in doFail of " + objectName, ignored);
+                        log.error("Problem in doFail of " + abstractName.getObjectName(), ignored);
                     }
                 }
             }
@@ -1174,14 +1179,14 @@
     public boolean equals(Object obj) {
         if (obj == this) return true;
         if (obj instanceof GBeanInstance == false) return false;
-        return objectName.equals(((GBeanInstance)obj).objectName);
+        return abstractName.equals(((GBeanInstance)obj).abstractName);
     }
 
     public int hashCode() {
-        return objectName.hashCode();
+        return abstractName.hashCode();
     }
 
     public String toString() {
-        return objectName.toString();
+        return abstractName.toString();
     }
 }



Mime
View raw message