geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r385372 [2/3] - in /geronimo/branches/1.1/modules: client-builder/src/java/org/apache/geronimo/client/builder/ client-builder/src/schema/ connector-builder/src/java/org/apache/geronimo/connector/deployment/ connector-builder/src/schema/ con...
Date Sun, 12 Mar 2006 21:44:53 GMT
Modified: geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java (original)
+++ geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java Sun Mar 12 13:44:50 2006
@@ -22,8 +22,10 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.j2ee.management.impl.Util;
 import org.apache.geronimo.jetty.connector.AJP13Connector;
 import org.apache.geronimo.jetty.connector.HTTPConnector;
 import org.apache.geronimo.jetty.connector.HTTPSConnector;
@@ -31,12 +33,10 @@
 import org.apache.geronimo.jetty.requestlog.JettyLogManager;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.EditableConfigurationManager;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.management.geronimo.WebManager;
-import org.apache.geronimo.system.serverinfo.ServerInfo;
 
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
@@ -45,6 +45,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.Collections;
 
 /**
  * Jetty implementation of WebManager.  Knows how to manipulate
@@ -69,22 +70,15 @@
      * the connector may well require further customization before being fully
      * functional (e.g. SSL settings for an HTTPS connector).
      */
-    public String addConnector(String containerObjectName, String uniqueName, String protocol, String host, int port) {
-        ObjectName container;
-        try {
-            container = ObjectName.getInstance(containerObjectName);
-        } catch (MalformedObjectNameException e) {
-            throw new IllegalArgumentException("Invalid web container ObjectName '"+containerObjectName+"'");
-        }
-        ObjectName name = getConnectorName(container, protocol, uniqueName);
+    public AbstractName addConnector(AbstractName containerName, String uniqueName, String protocol, String host, int port) {
+        AbstractName name = NameFactory.getChildName(containerName, NameFactory.GERONIMO_SERVICE, "JettyWebConnector-" + protocol + "-" + uniqueName, null);
         GBeanData connector;
         if (protocol.equals(PROTOCOL_HTTP)) {
             connector = new GBeanData(name, HTTPConnector.GBEAN_INFO);
         } else if (protocol.equals(PROTOCOL_HTTPS)) {
             connector = new GBeanData(name, HTTPSConnector.GBEAN_INFO);
-            GBeanQuery query = new GBeanQuery(null, ServerInfo.class.getName());
-            Set set = kernel.listGBeans(query);
-            connector.setReferencePattern("ServerInfo", (ObjectName) set.iterator().next());
+            AbstractNameQuery query = new AbstractNameQuery(null, Collections.singletonMap(NameFactory.J2EE_TYPE, "ServerInfo"));
+            connector.setReferencePattern("ServerInfo", query);
             //todo: default HTTPS settings
         } else if (protocol.equals(PROTOCOL_AJP)) {
             connector = new GBeanData(name, AJP13Connector.GBEAN_INFO);
@@ -95,13 +89,12 @@
         connector.setAttribute("port", new Integer(port));
         connector.setAttribute("minThreads", new Integer(10));
         connector.setAttribute("maxThreads", new Integer(50));
-        connector.setReferencePattern(JettyConnector.CONNECTOR_CONTAINER_REFERENCE, container);
+        connector.setReferencePattern(JettyConnector.CONNECTOR_CONTAINER_REFERENCE, containerName);
         EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
         if(mgr != null) {
             try {
-                ObjectName config = Util.getConfiguration(kernel, container);
-                mgr.addGBeanToConfiguration(Configuration.getConfigurationID(config), connector, false);
-                return name.getCanonicalName();
+                mgr.addGBeanToConfiguration(containerName.getArtifact(), connector, false);
+                return name;
             } catch (InvalidConfigException e) {
                 log.error("Unable to add GBean", e);
                 return null;
@@ -141,16 +134,11 @@
      * Removes a connector.  This shuts it down if necessary, and removes it
      * from the server environment.  It must be a connector that this container
      * is responsible for.
+     * @param connectorName
      */
-    public void removeConnector(String objectName) {
-        ObjectName name;
+    public void removeConnector(AbstractName connectorName) {
         try {
-            name = ObjectName.getInstance(objectName);
-        } catch (MalformedObjectNameException e) {
-            throw new IllegalArgumentException("Invalid object name '" + objectName + "': " + e.getMessage());
-        }
-        try {
-            GBeanInfo info = kernel.getGBeanInfo(name);
+            GBeanInfo info = kernel.getGBeanInfo(connectorName);
             boolean found = false;
             Set intfs = info.getInterfaces();
             for (Iterator it = intfs.iterator(); it.hasNext();) {
@@ -160,13 +148,12 @@
                 }
             }
             if (!found) {
-                throw new GBeanNotFoundException(name);
+                throw new GBeanNotFoundException(connectorName);
             }
-            ObjectName config = Util.getConfiguration(kernel, name);
             EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
             if(mgr != null) {
                 try {
-                    mgr.removeGBeanFromConfiguration(Configuration.getConfigurationID(config), name);
+                    mgr.removeGBeanFromConfiguration(connectorName.getArtifact(), connectorName);
                 } catch (InvalidConfigException e) {
                     log.error("Unable to add GBean", e);
                 } finally {
@@ -176,7 +163,7 @@
                 log.warn("The ConfigurationManager in the kernel does not allow editing");
             }
         } catch (GBeanNotFoundException e) {
-            log.warn("No such GBean '" + objectName + "'"); //todo: what if we want to remove a failed GBean?
+            log.warn("No such GBean '" + connectorName + "'"); //todo: what if we want to remove a failed GBean?
         } catch (Exception e) {
             log.error(e);
         }
@@ -243,7 +230,7 @@
             for (Iterator it = set.iterator(); it.hasNext();) {
                 ObjectName name = (ObjectName) it.next(); // a single Jetty connector
                 GBeanData data = kernel.getGBeanData(name);
-                Set refs = data.getReferencePatterns(JettyConnector.CONNECTOR_CONTAINER_REFERENCE);
+                ReferencePatterns refs = data.getReferencePatterns(JettyConnector.CONNECTOR_CONTAINER_REFERENCE);
                 for (Iterator refit = refs.iterator(); refit.hasNext();) {
                     ObjectName ref = (ObjectName) refit.next();
                     boolean match = false;
@@ -315,20 +302,6 @@
             return (String[]) results.toArray(new String[results.size()]);
         } catch (Exception e) {
             throw new IllegalArgumentException("Unable to look up connectors for Jetty container '"+containerObjectName+"': "+e);
-        }
-    }
-
-    private ObjectName getConnectorName(ObjectName container, String protocol, String uniqueName) {
-        Hashtable table = new Hashtable();
-        table.put(NameFactory.J2EE_APPLICATION, container.getKeyProperty(NameFactory.J2EE_APPLICATION));
-        table.put(NameFactory.J2EE_SERVER, container.getKeyProperty(NameFactory.J2EE_SERVER));
-        table.put(NameFactory.J2EE_MODULE, container.getKeyProperty(NameFactory.J2EE_MODULE));
-        table.put(NameFactory.J2EE_TYPE, container.getKeyProperty(NameFactory.J2EE_TYPE));
-        table.put(NameFactory.J2EE_NAME, "JettyWebConnector-" + protocol + "-" + uniqueName);
-        try {
-            return ObjectName.getInstance(container.getDomain(), table);
-        } catch (MalformedObjectNameException e) {
-            throw new IllegalStateException("Never should have failed: " + e.getMessage());
         }
     }
 

Modified: 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=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java Sun Mar 12 13:44:50 2006
@@ -38,6 +38,10 @@
 
     private final ObjectName objectName;
 
+    public AbstractName(Artifact artifact, Map name, ObjectName objectName) {
+        this(artifact, name, Collections.EMPTY_SET, objectName);
+    }
+
     public AbstractName(Artifact artifact, Map name, String interfaceType, ObjectName objectName) {
         this(artifact, name, Collections.singleton(interfaceType), objectName);
         assert interfaceType != null;

Modified: 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=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java Sun Mar 12 13:44:50 2006
@@ -41,6 +41,12 @@
         this.interfaceTypes = abstractName.getInterfaceTypes();
     }
 
+    public AbstractNameQuery(Artifact artifact, Map name) {
+        this.artifact = artifact;
+        this.name = name;
+        this.interfaceTypes = Collections.EMPTY_SET;
+    }
+
     public AbstractNameQuery(Artifact artifact, Map name, String interfaceType) {
         this.artifact = artifact;
         this.name = name;

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/GBeanNotFoundException.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/GBeanNotFoundException.java?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/GBeanNotFoundException.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/GBeanNotFoundException.java Sun Mar 12 13:44:50 2006
@@ -48,6 +48,10 @@
         super(message + ": " + patterns);
     }
 
+    public GBeanNotFoundException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
     public ObjectName getGBeanName() {
         return gBeanName;
     }

Modified: geronimo/branches/1.1/modules/management/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/project.xml?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/project.xml (original)
+++ geronimo/branches/1.1/modules/management/project.xml Sun Mar 12 13:44:50 2006
@@ -44,6 +44,11 @@
             <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
             <version>${geronimo_spec_j2ee_management_version}</version>
         </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${geronimo_version}</version>
+        </dependency>
     </dependencies>
 
     <build>

Modified: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/NetworkManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/NetworkManager.java?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/NetworkManager.java (original)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/NetworkManager.java Sun Mar 12 13:44:50 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.management.geronimo;
 
+import org.apache.geronimo.gbean.AbstractName;
+
 /**
  * Base management interface for a network technology with associated
  * containers and connectors.  Examples might be Web, EJB, JMS (all
@@ -41,8 +43,9 @@
      * Removes a connector.  This shuts it down if necessary, and removes it
      * from the server environment.  It must be a connector that uses this
      * network technology.
+     * @param connectorName
      */
-    public void removeConnector(String objectName);
+    public void removeConnector(AbstractName connectorName);
 
     /**
      * Gets the ObjectNames of any existing connectors for this network

Modified: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java (original)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java Sun Mar 12 13:44:50 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.management.geronimo;
 
+import org.apache.geronimo.gbean.AbstractName;
+
 /**
  * Specialization of NetworkManager for web containers.
  *
@@ -37,8 +39,7 @@
      * functional (e.g. SSL settings for a secure connector).  This may need
      * to be done before starting the resulting connector.
      *
-     * @param containerObjectName The ObjectName of the container that the
-     *                            connector should be added to
+     * @param containerName
      * @param uniqueName          A name fragment that's unique to this
      *                            connector
      * @param protocol            The protocol that the connector should use
@@ -48,7 +49,7 @@
      *
      * @return The ObjectName of the new connector.
      */
-    public String addConnector(String containerObjectName, String uniqueName, String protocol, String host, int port);
+    public AbstractName addConnector(AbstractName containerName, String uniqueName, String protocol, String host, int port);
 
     /**
      * Gets the ObjectName of the WebAccessLog implementation for a web

Modified: geronimo/branches/1.1/modules/naming-builder/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/maven.xml?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/naming-builder/maven.xml (original)
+++ geronimo/branches/1.1/modules/naming-builder/maven.xml Sun Mar 12 13:44:50 2006
@@ -24,7 +24,7 @@
 
     <preGoal name="java:compile">
         <xmlbeans:schema2java
-            maven.xmlbeans2.sourceschema="schema/geronimo-naming-1.0.xsd"/>
+            maven.xmlbeans2.sourceschema="schema/geronimo-naming-1.1.xsd"/>
         <mkdir dir="${basedir}/target/xmlbeans-classes"/>
         <mkdir dir="${basedir}/target/xmlbeans-classes/schemaorg_apache_xmlbeans"/>
         <copy todir="${basedir}/target/xmlbeans-classes/schemaorg_apache_xmlbeans">

Modified: geronimo/branches/1.1/modules/naming-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/project.xml?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/naming-builder/project.xml (original)
+++ geronimo/branches/1.1/modules/naming-builder/project.xml Sun Mar 12 13:44:50 2006
@@ -61,10 +61,18 @@
             <artifactId>stax-api</artifactId>
             <version>${stax_api_version}</version>
         </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-service-builder</artifactId>
+            <version>${pom.currentVersion}</version>
+            <properties>
+                <xmlbeans>true</xmlbeans>
+            </properties>
+        </dependency>
 
         <!-- Module Dependencies -->
 
-           <dependency>
+        <dependency>
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
             <version>${commons_logging_version}</version>
@@ -101,13 +109,13 @@
             <version>${pom.currentVersion}</version>
         </dependency>
 
-       <dependency>
+        <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-j2ee-builder</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>
 
-         <dependency>
+        <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
             <version>${geronimo_spec_j2ee_deployment_version}</version>
@@ -122,7 +130,7 @@
             </properties>
         </dependency>
 
-       <dependency>
+        <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-naming</artifactId>
             <version>${pom.currentVersion}</version>

Modified: geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java Sun Mar 12 13:44:50 2006
@@ -25,12 +25,10 @@
 import org.apache.geronimo.j2ee.deployment.NamingContext;
 import org.apache.geronimo.j2ee.deployment.RefContext;
 import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder;
-import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.ClassLoading;
-import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.naming.java.ComponentContextBuilder;
-import org.apache.geronimo.xbeans.geronimo.naming.GerCssType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerGbeanLocatorType;
@@ -38,6 +36,7 @@
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
+import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
 import org.apache.geronimo.xbeans.j2ee.EjbLocalRefType;
 import org.apache.geronimo.xbeans.j2ee.EjbRefType;
 import org.apache.geronimo.xbeans.j2ee.EnvEntryType;
@@ -51,9 +50,8 @@
 import org.apache.geronimo.xbeans.j2ee.ServiceRefType;
 import org.apache.geronimo.xbeans.j2ee.XsdQNameType;
 import org.apache.geronimo.xbeans.j2ee.XsdStringType;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
 import javax.naming.NamingException;
 import javax.naming.Reference;
 import javax.transaction.UserTransaction;
@@ -71,7 +69,7 @@
 import java.util.Set;
 
 /**
- * @version $Rev: 384667 $ $Date$
+ * @version $Rev:385232 $ $Date$
  */
 public class ENCConfigBuilder {
 
@@ -99,68 +97,20 @@
     }
 
 
-    public static ObjectName getGBeanId(String j2eeType, GerGbeanLocatorType gerGbeanLocator, J2eeContext j2eeContext, DeploymentContext context, Kernel kernel) throws DeploymentException {
-        ObjectName containerId = null;
+    public static AbstractNameQuery getGBeanId(String j2eeType, GerGbeanLocatorType gerGbeanLocator, DeploymentContext context) throws DeploymentException {
+        AbstractNameQuery abstractNameQuery;
         if (gerGbeanLocator.isSetGbeanLink()) {
             //exact match
             String linkName = gerGbeanLocator.getGbeanLink().trim();
-            ObjectName exact = null;
-            try {
-                exact = NameFactory.getComponentName(null, null, null, null, linkName, j2eeType, j2eeContext);
-            } catch (MalformedObjectNameException e) {
-                throw new DeploymentException("Could not construct gbean name", e);
-            }
-            if (context.listGBeans(exact).size() == 1) {
-                containerId = exact;
-            } else {
-                //TODO figure out some way to use the copy of this code in RefContext
-                ObjectName query = null;
-                try {
-                    query = NameFactory.getComponentNameQuery(null, null, null, linkName, j2eeType, j2eeContext);
-                } catch (MalformedObjectNameException e) {
-                    throw new DeploymentException("Could not construct query for gbean name", e);
-                }
-                Set localMatches = context.listGBeans(query);
-                if (localMatches.size() > 1) {
-                    throw new DeploymentException("More than one local match for gbean link, " + localMatches);
-                }
-                if (localMatches.size() == 1) {
-                    containerId = (ObjectName) localMatches.iterator().next();
-                }
-                if (containerId == null) {
-                    try {
-                        query = NameFactory.getComponentRestrictedQueryName(null, null, linkName, j2eeType, j2eeContext);
-                    } catch (MalformedObjectNameException e) {
-                        throw new DeploymentException("Could not construct query for gbean name", e);
-                    }
-                    Set matches = kernel.listGBeans(query);
-                    if (matches.size() != 1) {
-                        throw new DeploymentException("No or ambiguous match for gbean link: " + linkName + " using query " + query + ", matches: " + matches);
-                    }
-                    containerId = (ObjectName) matches.iterator().next();
-                }
-            }
-        } else if (gerGbeanLocator.isSetTargetName()) {
-            try {
-                containerId = ObjectName.getInstance(getStringValue(gerGbeanLocator.getTargetName()));
-            } catch (MalformedObjectNameException e) {
-                throw new DeploymentException("Could not construct object name from specified string", e);
-            }
+            abstractNameQuery = buildAbstractNameQuery(null, j2eeType, linkName);
+
         } else {
+            GerPatternType patternType = gerGbeanLocator.getPattern();
             //construct name from components
-            try {
-                containerId = NameFactory.getComponentName(getStringValue(gerGbeanLocator.getDomain()),
-                        getStringValue(gerGbeanLocator.getServer()),
-                        getStringValue(gerGbeanLocator.getApplication()),
-                        getStringValue(gerGbeanLocator.getModule()),
-                        getStringValue(gerGbeanLocator.getName()),
-                        j2eeType,
-                        j2eeContext);
-            } catch (MalformedObjectNameException e) {
-                throw new DeploymentException("could not construct object name for jms resource", e);
-            }
+            abstractNameQuery = buildAbstractNameQuery(patternType, j2eeType);
         }
-        return containerId;
+        //TODO check that the query is satisfied.
+        return abstractNameQuery;
     }
 
 
@@ -207,7 +157,7 @@
                     //TODO expose jsr-77 objects for these guys
                     builder.bind(name, new URL(gerResourceRef.getUrl()));
                 } catch (MalformedURLException e) {
-                    throw  new DeploymentException("Could not convert " + gerResourceRef.getUrl() + " to URL", e);
+                    throw new DeploymentException("Could not convert " + gerResourceRef.getUrl() + " to URL", e);
                 }
             } else {
                 //determine jsr-77 type from interface
@@ -222,9 +172,10 @@
                     j2eeType = NameFactory.JCA_MANAGED_CONNECTION_FACTORY;
                 }
                 try {
-                    String containerId = getResourceContainerId(name, j2eeType, moduleURI, gerResourceRef, earContext);
+                    AbstractNameQuery containerId = getResourceContainerId(name, j2eeType, moduleURI, gerResourceRef, earContext);
 
-                    ref = refContext.getConnectionFactoryRef(containerId, iface);
+                    //TODO configid not sure what knownParent is supposed to be
+                    ref = refContext.getConnectionFactoryRef(containerId, iface, earContext.getConfiguration(null));
                     builder.bind(name, ref);
                 } catch (UnresolvedReferenceException e) {
                     throw new DeploymentException("Unable to resolve resource reference '" + name + "' (" + (e.isMultiple() ? "found multiple matching resources" : "no matching resources found") + ")");
@@ -234,31 +185,18 @@
 
     }
 
-    private static String getResourceContainerId(String name, String type, URI moduleURI, GerResourceRefType gerResourceRef, EARContext context) throws DeploymentException {
-        String containerId = null;
+    private static AbstractNameQuery getResourceContainerId(String name, String type, URI moduleURI, GerResourceRefType gerResourceRef, EARContext context) throws DeploymentException {
+        AbstractNameQuery containerId;
+        String module = moduleURI == null? null: moduleURI.toString();
         RefContext refContext = context.getRefContext();
         if (gerResourceRef == null) {
-            //try to resolve ref based only matching resource-ref-name
-            //throws exception if it can't locate ref.
-            containerId = refContext.getConnectionFactoryContainerId(moduleURI, name, type, context);
+            containerId = buildAbstractNameQuery(module, type, name);
         } else if (gerResourceRef.isSetResourceLink()) {
-            containerId = refContext.getConnectionFactoryContainerId(moduleURI, gerResourceRef.getResourceLink().trim(), type, context);
-        } else if (gerResourceRef.isSetTargetName()) {
-            containerId = gerResourceRef.getTargetName().trim();
+            containerId = buildAbstractNameQuery(module, type, gerResourceRef.getResourceLink().trim());
         } else {
             //construct name from components
-            try {
-                containerId = NameFactory.getComponentName(getStringValue(gerResourceRef.getDomain()),
-                        getStringValue(gerResourceRef.getServer()),
-                        getStringValue(gerResourceRef.getApplication()),
-                        NameFactory.JCA_RESOURCE,
-                        getStringValue(gerResourceRef.getModule()),
-                        getStringValue(gerResourceRef.getName()),
-                        gerResourceRef.getType() == null ? type : gerResourceRef.getType().trim(),
-                        context.getModuleName()).getCanonicalName();
-            } catch (MalformedObjectNameException e) {
-                throw new DeploymentException("could not construct object name for resource", e);
-            }
+            GerPatternType patternType = gerResourceRef.getPattern();
+            containerId = buildAbstractNameQuery(patternType, type);
         }
         return containerId;
     }
@@ -280,8 +218,9 @@
             }
             GerResourceEnvRefType gerResourceEnvRef = (GerResourceEnvRefType) refMap.get(name);
             try {
-                String containerId = getAdminObjectContainerId(name, gerResourceEnvRef, earContext);
-                Reference ref = earContext.getRefContext().getAdminObjectRef(containerId, iface);
+                AbstractNameQuery containerId = getAdminObjectContainerId(name, gerResourceEnvRef, earContext);
+                //TODO not sure what knownParent is supposed to be
+                Reference ref = earContext.getRefContext().getAdminObjectRef(containerId, iface, earContext.getConfiguration(null));
 
                 builder.bind(name, ref);
             } catch (UnresolvedReferenceException e) {
@@ -290,47 +229,28 @@
         }
     }
 
-    private static String getAdminObjectContainerId(String name, GerResourceEnvRefType gerResourceEnvRef, EARContext context) throws DeploymentException {
-        String containerId = null;
+    private static AbstractNameQuery getAdminObjectContainerId(String name, GerResourceEnvRefType gerResourceEnvRef, EARContext context) throws DeploymentException {
+        AbstractNameQuery containerId;
         RefContext refContext = context.getRefContext();
-        URI moduleURI = URI.create("");
         if (gerResourceEnvRef == null) {
-            //try to resolve ref based only matching resource-ref-name
-            //throws exception if it can't locate ref.
-            containerId = refContext.getAdminObjectContainerId(moduleURI, name, context);
+            containerId = buildAbstractNameQuery(null, NameFactory.JCA_ADMIN_OBJECT, name);
         } else if (gerResourceEnvRef.isSetMessageDestinationLink()) {
-            containerId = refContext.getAdminObjectContainerId(moduleURI, gerResourceEnvRef.getMessageDestinationLink().trim(), context);
+            containerId = buildAbstractNameQuery(null, NameFactory.JCA_ADMIN_OBJECT, gerResourceEnvRef.getMessageDestinationLink().trim());
         } else if (gerResourceEnvRef.isSetAdminObjectLink()) {
+            String moduleURI = null;
             if (gerResourceEnvRef.isSetAdminObjectModule()) {
-                try {
-                    moduleURI = new URI(gerResourceEnvRef.getAdminObjectModule().trim());
-                } catch (URISyntaxException e) {
-                    throw new DeploymentException("Could not construct module URI", e);
-                }
+                    moduleURI = gerResourceEnvRef.getAdminObjectModule().trim();
             }
-            containerId = refContext.getAdminObjectContainerId(moduleURI, gerResourceEnvRef.getAdminObjectLink().trim(), context);
-        } else if (gerResourceEnvRef.isSetTargetName()) {
-            containerId = getStringValue(gerResourceEnvRef.getTargetName());
+            containerId = buildAbstractNameQuery(moduleURI, NameFactory.JCA_ADMIN_OBJECT, gerResourceEnvRef.getAdminObjectLink().trim());
         } else {
             //construct name from components
-            try {
-                containerId = NameFactory.getComponentName(getStringValue(gerResourceEnvRef.getDomain()),
-                        getStringValue(gerResourceEnvRef.getServer()),
-                        getStringValue(gerResourceEnvRef.getApplication()),
-                        NameFactory.JCA_RESOURCE,
-                        getStringValue(gerResourceEnvRef.getModule()),
-                        getStringValue(gerResourceEnvRef.getName()),
-                        NameFactory.JMS_RESOURCE,
-                        //gerResourceEnvRef.getType(),
-                        context.getModuleName()).getCanonicalName();
-            } catch (MalformedObjectNameException e) {
-                throw new DeploymentException("could not construct object name for jms resource", e);
-            }
+            GerPatternType patternType = gerResourceEnvRef.getPattern();
+            containerId = buildAbstractNameQuery(patternType, NameFactory.JCA_ADMIN_OBJECT);
         }
         return containerId;
     }
 
-    static void addMessageDestinationRefs(RefContext refContext, NamingContext namingContext, MessageDestinationRefType[] messageDestinationRefs, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
+    static void addMessageDestinationRefs(RefContext refContext, EARContext earContext, MessageDestinationRefType[] messageDestinationRefs, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
         for (int i = 0; i < messageDestinationRefs.length; i++) {
             MessageDestinationRefType messageDestinationRef = messageDestinationRefs[i];
             String name = getStringValue(messageDestinationRef.getMessageDestinationRefName());
@@ -342,17 +262,12 @@
             } catch (ClassNotFoundException e) {
                 throw new DeploymentException("could not load class " + type, e);
             }
-            URI moduleURI = URI.create("");
+            String moduleURI = null;
             GerMessageDestinationType destination = (GerMessageDestinationType) refContext.getMessageDestination(linkName);
             if (destination != null) {
                 if (destination.isSetAdminObjectLink()) {
                     if (destination.isSetAdminObjectModule()) {
-                        String module = destination.getAdminObjectModule().trim();
-                        try {
-                            moduleURI = new URI(module);
-                        } catch (URISyntaxException e) {
-                            throw new DeploymentException("Could not construct module URI", e);
-                        }
+                        moduleURI = destination.getAdminObjectModule().trim();
                     }
                     linkName = destination.getAdminObjectLink().trim();
                 }
@@ -366,8 +281,9 @@
 
             //try to resolve ref based only matching resource-ref-name
             //throws exception if it can't locate ref.
-            String containerId = refContext.getAdminObjectContainerId(moduleURI, linkName, namingContext);
-            Reference ref = refContext.getAdminObjectRef(containerId, iface);
+            AbstractNameQuery containerId = buildAbstractNameQuery(moduleURI, NameFactory.JCA_ADMIN_OBJECT, linkName);
+            //TODO configid not sure what knwonParent is suppsed to be
+            Reference ref = refContext.getAdminObjectRef(containerId, iface, earContext.getConfiguration(null));
             builder.bind(name, ref);
 
         }
@@ -375,7 +291,6 @@
     }
 
     static void addEJBRefs(NamingContext earContext, NamingContext ejbContext, RefContext refContext, URI moduleURI, EjbRefType[] ejbRefs, Map ejbRefMap, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
-        J2eeContext j2eeContext = ejbContext.getModuleName();
         for (int i = 0; i < ejbRefs.length; i++) {
             EjbRefType ejbRef = ejbRefs[i];
 
@@ -385,20 +300,21 @@
             try {
                 assureEJBObjectInterface(remote, cl);
             } catch (DeploymentException e) {
-                throw new DeploymentException("Error processing 'remote' element for EJB Reference '"+ejbRefName+"' for module '"+moduleURI+"': "+e.getMessage());
+                throw new DeploymentException("Error processing 'remote' element for EJB Reference '" + ejbRefName + "' for module '" + moduleURI + "': " + e.getMessage());
             }
 
             String home = getStringValue(ejbRef.getHome());
             try {
                 assureEJBHomeInterface(home, cl);
             } catch (DeploymentException e) {
-                throw new DeploymentException("Error processing 'home' element for EJB Reference '"+ejbRefName+"' for module '"+moduleURI+"': "+e.getMessage());
+                throw new DeploymentException("Error processing 'home' element for EJB Reference '" + ejbRefName + "' for module '" + moduleURI + "': " + e.getMessage());
             }
 
             Reference ejbReference;
             boolean isSession = "Session".equals(getStringValue(ejbRef.getEjbRefType()));
 
-            if (isSession && remote.equals("javax.management.j2ee.Management") && home.equals("javax.management.j2ee.ManagementHome")) {
+            if (isSession && remote.equals("javax.management.j2ee.Management") && home.equals("javax.management.j2ee.ManagementHome"))
+            {
                 String mejbName = refContext.getMEJBName();
                 ejbReference = refContext.getEJBRemoteRef(mejbName, isSession, home, remote);
             } else {
@@ -407,32 +323,22 @@
                 GerEjbRefType remoteRef = (GerEjbRefType) ejbRefMap.get(ejbRefName);
                 if (remoteRef != null && remoteRef.isSetNsCorbaloc()) {
                     try {
-                        ObjectName cssBean;
-                        if (remoteRef.isSetCssName()) {
-                            cssBean = ObjectName.getInstance(getStringValue(remoteRef.getCssName()));
-                        } else if (remoteRef.isSetCssLink()) {
+                        AbstractNameQuery cssBean;
+                        if (remoteRef.isSetCssLink()) {
                             String cssLink = remoteRef.getCssLink().trim();
                             //TODO is this correct?
                             String moduleType = null;
-                            cssBean = refContext.locateComponentName(cssLink, moduleURI, moduleType, NameFactory.CORBA_CSS, earContext.getModuleName(), earContext, "css gbean");
+                            cssBean = buildAbstractNameQuery(null, NameFactory.CORBA_CSS, cssLink);
                         } else {
-                            GerCssType css = remoteRef.getCss();
-                            cssBean = NameFactory.getComponentName(getStringValue(css.getDomain()),
-                                    getStringValue(css.getServer()),
-                                    getStringValue(css.getApplication()),
-                                    getStringValue(css.getModule()),
-                                    getStringValue(css.getName()),
-                                    getStringValue(NameFactory.CORBA_CSS),
-                                    earContext.getModuleName());
+                            GerPatternType css = remoteRef.getCss();
+                            cssBean = buildAbstractNameQuery(css, NameFactory.CORBA_CSS);
                         }
-                        ejbReference = refContext.getCORBARemoteRef(new URI(getStringValue(remoteRef.getNsCorbaloc())),
+                        //TODO configID this is probably completely messed up
+                        ejbReference = refContext.getCORBARemoteRef(earContext.getConfigID(), cssBean, new URI(getStringValue(remoteRef.getNsCorbaloc())),
                                 getStringValue(remoteRef.getName()),
-                                ObjectName.getInstance(cssBean),
                                 home);
                     } catch (URISyntaxException e) {
                         throw new DeploymentException("Could not construct CORBA NameServer URI: " + remoteRef.getNsCorbaloc(), e);
-                    } catch (MalformedObjectNameException e) {
-                        throw new DeploymentException("Could not construct CSS container name: " + remoteRef.getCssName(), e);
                     }
                 } else {
                     if (remoteRef != null && remoteRef.isSetEjbLink()) {
@@ -440,28 +346,20 @@
                     } else if (ejbRef.isSetEjbLink()) {
                         ejbLink = getStringValue(ejbRef.getEjbLink());
                     }
-
+                    AbstractNameQuery containerId;
+                    String module = moduleURI == null? null: moduleURI.toString();
                     if (ejbLink != null) {
+                        //TODO 1. include artifact, we know it must be in this app.
+                        //TODO 2. use the isSession and reason about stateful/stateless
+                        containerId = buildAbstractNameQuery(module, null, ejbLink);
+                        //TODO WRONG
                         ejbReference = refContext.getEJBRemoteRef(moduleURI, ejbLink, isSession, home, remote, ejbContext);
                     } else if (remoteRef != null) {
-                        if (remoteRef.isSetTargetName()) {
-                            ejbReference = refContext.getEJBRemoteRef(getStringValue(remoteRef.getTargetName()), isSession, home, remote);
-                        } else {
-                            String containerId = null;
-                            try {
-                                containerId = NameFactory.getEjbComponentNameString(getStringValue(remoteRef.getDomain()),
-                                        getStringValue(remoteRef.getServer()),
-                                        getStringValue(remoteRef.getApplication()),
-                                        getStringValue(remoteRef.getModule()),
-                                        getStringValue(remoteRef.getName()),
-                                        getStringValue(remoteRef.getType()),
-                                        j2eeContext);
-                            } catch (MalformedObjectNameException e) {
-                                throw new DeploymentException("Could not construct ejb object name: " + remoteRef.getName(), e);
-                            }
-                            ejbReference = refContext.getEJBRemoteRef(containerId, isSession, home, remote);
-
-                        }
+                        //TODO 2 as above
+                        GerPatternType patternType = remoteRef.getPattern();
+                        containerId = buildAbstractNameQuery(patternType, null);
+                        //TODO WRONG
+                        ejbReference = refContext.getEJBRemoteRef(moduleURI, ejbLink, isSession, home, remote, ejbContext);
                     } else {
                         ejbReference = refContext.getImplicitEJBRemoteRef(moduleURI, ejbRefName, isSession, home, remote, ejbContext);
                     }
@@ -472,7 +370,6 @@
     }
 
     static void addEJBLocalRefs(NamingContext ejbContext, RefContext refContext, URI moduleURI, EjbLocalRefType[] ejbLocalRefs, Map ejbLocalRefMap, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
-        J2eeContext j2eeContext = ejbContext.getModuleName();
         for (int i = 0; i < ejbLocalRefs.length; i++) {
             EjbLocalRefType ejbLocalRef = ejbLocalRefs[i];
 
@@ -482,14 +379,14 @@
             try {
                 assureEJBLocalObjectInterface(local, cl);
             } catch (DeploymentException e) {
-                throw new DeploymentException("Error processing 'local' element for EJB Local Reference '"+ejbRefName+"' for module '"+moduleURI+"': "+e.getMessage());
+                throw new DeploymentException("Error processing 'local' element for EJB Local Reference '" + ejbRefName + "' for module '" + moduleURI + "': " + e.getMessage());
             }
 
             String localHome = getStringValue(ejbLocalRef.getLocalHome());
             try {
                 assureEJBLocalHomeInterface(localHome, cl);
             } catch (DeploymentException e) {
-                throw new DeploymentException("Error processing 'local-home' element for EJB Local Reference '"+ejbRefName+"' for module '"+moduleURI+"': "+e.getMessage());
+                throw new DeploymentException("Error processing 'local-home' element for EJB Local Reference '" + ejbRefName + "' for module '" + moduleURI + "': " + e.getMessage());
             }
 
             boolean isSession = "Session".equals(getStringValue(ejbLocalRef.getEjbRefType()));
@@ -503,27 +400,21 @@
             }
 
             Reference ejbReference;
+            AbstractNameQuery containerId;
+            String module = moduleURI == null? null: moduleURI.toString();
             if (ejbLink != null) {
+                //TODO 1. include artifact, we know it must be in this app.
+                //TODO 2. use the isSession and reason about stateful/stateless
+                containerId = buildAbstractNameQuery(module, null, ejbLink);
+                //TODO WRONG
                 ejbReference = refContext.getEJBLocalRef(moduleURI, ejbLink, isSession, localHome, local, ejbContext);
             } else if (localRef != null) {
-                if (localRef.isSetTargetName()) {
-                    ejbReference = refContext.getEJBLocalRef(getStringValue(localRef.getTargetName()), isSession, localHome, local);
-                } else {
-                    String containerId = null;
-                    try {
-                        containerId = NameFactory.getEjbComponentNameString(getStringValue(localRef.getDomain()),
-                                getStringValue(localRef.getServer()),
-                                getStringValue(localRef.getApplication()),
-                                getStringValue(localRef.getModule()),
-                                getStringValue(localRef.getName()),
-                                getStringValue(localRef.getType()),
-                                j2eeContext);
-                    } catch (MalformedObjectNameException e) {
-                        throw new DeploymentException("Could not construct ejb object name: " + localRef.getName(), e);
-                    }
-                    ejbReference = refContext.getEJBLocalRef(containerId, isSession, localHome, local);
+                //TODO 2 as above
+                GerPatternType patternType = localRef.getPattern();
+                containerId = buildAbstractNameQuery(patternType, null);
+                //TODO WRONG
+                ejbReference = refContext.getEJBLocalRef(moduleURI, ejbLink, isSession, localHome, local, ejbContext);
 
-                }
             } else {
                 ejbReference = refContext.getImplicitEJBLocalRef(moduleURI, ejbLink, isSession, localHome, local, ejbContext);
             }
@@ -532,6 +423,7 @@
     }
 
 //TODO current implementation does not deal with portComponentRef links.
+
     static void addServiceRefs(EARContext earContext, Module module, ServiceRefType[] serviceRefs, Map serviceRefMap, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
 
         RefContext refContext = earContext.getRefContext();
@@ -656,7 +548,7 @@
     }
 
     public static Class assureInterface(String interfaceName, String superInterfaceName, String interfaceType, ClassLoader cl) throws DeploymentException {
-        if(interfaceName == null || interfaceName.equals("")) {
+        if (interfaceName == null || interfaceName.equals("")) {
             throw new DeploymentException("interface name cannot be blank");
         }
         Class clazz = null;
@@ -715,7 +607,7 @@
                     && !JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
 
                 GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(resourceRefType.getResRefName().getStringValue());
-                String containerId = getResourceContainerId(getStringValue(resourceRefType.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, uri, gerResourceRef, earContext);
+                AbstractNameQuery containerId = getResourceContainerId(getStringValue(resourceRefType.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, uri, gerResourceRef, earContext);
 
                 if ("Unshareable".equals(getStringValue(resourceRefType.getResSharingScope()))) {
                     unshareableResources.add(containerId);
@@ -753,12 +645,9 @@
             builder.addUserTransaction(userTransaction);
         }
 
-        ObjectName corbaGBean = earContext.getCORBAGBeanObjectName();
+        AbstractNameQuery corbaGBean = earContext.getCORBAGBeanObjectName();
         if (corbaGBean != null) {
-            if (corbaGBean.isPattern()) {
-                corbaGBean = refContext.locateUniqueName(earContext, corbaGBean);
-            }
-            builder.addORB(corbaGBean);
+            builder.addORB(earContext.getConfigID(), corbaGBean);
         }
 
         Object handleDelegateReference = earContext.getRefContext().getHandleDelegateReference();
@@ -852,5 +741,38 @@
         }
         return refMap;
     }
+
+    //TODO consider including target interface
+    private static AbstractNameQuery buildAbstractNameQuery(GerPatternType pattern, String type) {
+        String groupId = pattern.isSetGroupId() ? pattern.getGroupId().trim() : null;
+        String artifactid = pattern.isSetArtifactId() ? pattern.getArtifactId().trim() : null;
+        String version = pattern.isSetVersion() ? pattern.getVersion().trim() : null;
+        String module = pattern.isSetModule() ? pattern.getModule().trim() : null;
+        String name = pattern.getName().trim();
+
+        Artifact artifact = artifactid != null ? new Artifact(groupId, artifactid, version, "car") : null;
+        Map nameMap = new HashMap();
+        nameMap.put("name", name);
+        if (type != null) {
+            nameMap.put("type", type);
+        }
+        if (module != null) {
+            nameMap.put("module", module);
+        }
+        return new AbstractNameQuery(artifact, nameMap, Collections.EMPTY_SET);
+    }
+
+    private static AbstractNameQuery buildAbstractNameQuery(String module, String type, String name) {
+        Map nameMap = new HashMap();
+        nameMap.put("name", name);
+        if (type != null) {
+            nameMap.put("type", type);
+        }
+        if (module != null) {
+            nameMap.put("module", module);
+        }
+        return new AbstractNameQuery(null, nameMap, Collections.EMPTY_SET);
+    }
+
 
 }

Modified: geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java (original)
+++ geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java Sun Mar 12 13:44:50 2006
@@ -2,7 +2,7 @@
 
 import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
 import org.apache.geronimo.xbeans.geronimo.naming.GerGbeanLocatorType;
-import org.apache.xmlbeans.XmlObject;
+import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
 
 /**
  * Represents an element of the gbean-locatorType in a Geronimo
@@ -39,38 +39,10 @@
     public void setGBeanLink(String link) {
         GerGbeanLocatorType locator = getGBeanLocator();
         if(link != null) {
-            ObjectNameGroup before = null;
-            if(locator.isSetApplication()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetApplication();
-            }
-            if(locator.isSetDomain()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetDomain();
-            }
-            if(locator.isSetModule()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetModule();
-            }
-            if(locator.isSetName()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetName();
-            }
-            if(locator.isSetServer()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetServer();
-            }
-            if(locator.isSetType()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetType();
-            }
-            if(before != null) {
-                pcs.firePropertyChange("objectNameComponents", before, null);
-            }
-            if(locator.isSetTargetName()) {
-                String temp = locator.getTargetName();
-                locator.unsetTargetName();
-                pcs.firePropertyChange("targetName", temp, null);
+            if(locator.isSetPattern()) {
+                Pattern oldPattern = buildPattern(locator.getPattern());
+                locator.unsetPattern();
+                pcs.firePropertyChange("objectNameComponents", oldPattern, null);
             }
         }
         String old = getGBeanLink();
@@ -78,65 +50,18 @@
         pcs.firePropertyChange("GBeanLink", old, link);
     }
 
-    public String getTargetName() {
-        return getGBeanLocator().getGbeanLink();
-    }
-
-    public void setTargetName(String name) {
-        GerGbeanLocatorType locator = getGBeanLocator();
-        if(name != null) {
-            ObjectNameGroup before = null;
-            if(locator.isSetApplication()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetApplication();
-            }
-            if(locator.isSetDomain()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetDomain();
-            }
-            if(locator.isSetModule()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetModule();
-            }
-            if(locator.isSetName()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetName();
-            }
-            if(locator.isSetServer()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetServer();
-            }
-            if(locator.isSetType()) {
-                if(before == null) before = getObjectNameComponents();
-                locator.unsetType();
-            }
-            if(before != null) {
-                pcs.firePropertyChange("objectNameComponents", before, null);
-            }
-            if(locator.isSetGbeanLink()) {
-                String temp = locator.getGbeanLink();
-                locator.unsetGbeanLink();
-                pcs.firePropertyChange("GBeanLink", temp, null);
-            }
-        }
-        String old = getTargetName();
-        locator.setTargetName(name);
-        pcs.firePropertyChange("targetName", old, name);
-    }
 
-    public ObjectNameGroup getObjectNameComponents() {
-        ObjectNameGroup group = new ObjectNameGroup();
-        GerGbeanLocatorType locator = getGBeanLocator();
-        group.setApplication(locator.getApplication());
-        group.setDomain(locator.getDomain());
-        group.setModule(locator.getModule());
-        group.setName(locator.getName());
-        group.setServer(locator.getServer());
-        group.setType(locator.getType());
+    public Pattern buildPattern(GerPatternType patternType) {
+        Pattern group = new Pattern();
+        group.setGroupId(patternType.getGroupId());
+        group.setArtifactId(patternType.getArtifactId());
+        group.setVersion(patternType.getVersion());
+        group.setModule(patternType.getModule());
+        group.setName(patternType.getName());
         return group.empty() ? null : group;
     }
 
-    public void setObjectNamecomponents(ObjectNameGroup group) {
+    public void setPattern(Pattern group) {
         GerGbeanLocatorType locator = getGBeanLocator();
         if(group != null && !group.empty()) {
             if(locator.isSetGbeanLink()) {
@@ -144,53 +69,28 @@
                 locator.unsetGbeanLink();
                 pcs.firePropertyChange("GBeanLink", temp, null);
             }
-            if(locator.isSetTargetName()) {
-                String temp = locator.getTargetName();
-                locator.unsetTargetName();
-                pcs.firePropertyChange("targetName", temp, null);
-            }
         }
-        ObjectNameGroup old = getObjectNameComponents();
-        if(group == null) {
-            locator.unsetApplication();
-            locator.unsetDomain();
-            locator.unsetModule();
-            locator.unsetName();
-            locator.unsetServer();
-            locator.unsetType();
-        } else {
-            if(isEmpty(group.getApplication())) {
-                locator.unsetApplication();
-            } else {
-                locator.setApplication(group.getApplication());
-            }
-            if(isEmpty(group.getDomain())) {
-                locator.unsetDomain();
-            } else {
-                locator.setDomain(group.getDomain());
-            }
-            if(isEmpty(group.getModule())) {
-                locator.unsetModule();
-            } else {
-                locator.setModule(group.getModule());
-            }
-            if(isEmpty(group.getName())) {
-                locator.unsetName();
-            } else {
-                locator.setName(group.getName());
-            }
-            if(isEmpty(group.getServer())) {
-                locator.unsetServer();
-            } else {
-                locator.setServer(group.getServer());
-            }
-            if(isEmpty(group.getType())) {
-                locator.unsetType();
-            } else {
-                locator.setType(group.getType());
+        Pattern old = buildPattern(locator.getPattern());
+            locator.unsetPattern();
+        if(group != null) {
+            GerPatternType patternType = locator.addNewPattern();
+            if(!isEmpty(group.getGroupId())) {
+                patternType.setGroupId(group.getGroupId());
+            }
+            if(!isEmpty(group.getArtifactId())) {
+                patternType.setArtifactId(group.getArtifactId());
+            }
+            if(!isEmpty(group.getModule())) {
+                patternType.setModule(group.getModule());
+            }
+            if(!isEmpty(group.getName())) {
+                patternType.setName(group.getName());
+            }
+            if(!isEmpty(group.getVersion())) {
+                patternType.setVersion(group.getVersion());
             }
         }
-        pcs.firePropertyChange("objectNameComponents", old, getObjectNameComponents());
+        pcs.firePropertyChange("objectNameComponents", old, group);
     }
 
     private static boolean isEmpty(String s) {

Copied: geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/Pattern.java (from r385036, geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/ObjectNameGroup.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/Pattern.java?p2=geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/Pattern.java&p1=geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/ObjectNameGroup.java&r1=385036&r2=385372&rev=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/ObjectNameGroup.java (original)
+++ geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/Pattern.java Sun Mar 12 13:44:50 2006
@@ -25,28 +25,36 @@
  *
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
  */
-public class ObjectNameGroup implements Serializable {
-    private String application;
-    private String domain;
+public class Pattern implements Serializable {
+    private String groupId;
+    private String artifactId;
+    private String version;
     private String module;
     private String name;
-    private String server;
     private String type;
 
-    public String getApplication() {
-        return application;
+    public String getGroupId() {
+        return groupId;
     }
 
-    public void setApplication(String application) {
-        this.application = application;
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
     }
 
-    public String getDomain() {
-        return domain;
+    public String getArtifactId() {
+        return artifactId;
     }
 
-    public void setDomain(String domain) {
-        this.domain = domain;
+    public void setArtifactId(String artifactId) {
+        this.artifactId = artifactId;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
     }
 
     public String getModule() {
@@ -65,13 +73,6 @@
         this.name = name;
     }
 
-    public String getServer() {
-        return server;
-    }
-
-    public void setServer(String server) {
-        this.server = server;
-    }
 
     public String getType() {
         return type;
@@ -82,11 +83,11 @@
     }
 
     public boolean empty() {
-        return (application == null || application.trim().equals("")) &&
-                (domain == null || domain.trim().equals("")) &&
+        return (groupId == null || groupId.trim().equals("")) &&
+                (artifactId == null || artifactId.trim().equals("")) &&
+                (version == null || version.trim().equals("")) &&
                 (module == null || module.trim().equals("")) &&
                 (name == null || name.trim().equals("")) &&
-                (server == null || server.trim().equals("")) &&
                 (type == null || type.trim().equals(""));
     }
 
@@ -94,25 +95,25 @@
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
 
-        final ObjectNameGroup group = (ObjectNameGroup) o;
+        final Pattern pattern = (Pattern) o;
 
-        if (application != null ? !application.equals(group.application) : group.application != null) return false;
-        if (domain != null ? !domain.equals(group.domain) : group.domain != null) return false;
-        if (module != null ? !module.equals(group.module) : group.module != null) return false;
-        if (name != null ? !name.equals(group.name) : group.name != null) return false;
-        if (server != null ? !server.equals(group.server) : group.server != null) return false;
-        if (type != null ? !type.equals(group.type) : group.type != null) return false;
+        if (artifactId != null ? !artifactId.equals(pattern.artifactId) : pattern.artifactId != null) return false;
+        if (groupId != null ? !groupId.equals(pattern.groupId) : pattern.groupId != null) return false;
+        if (module != null ? !module.equals(pattern.module) : pattern.module != null) return false;
+        if (name != null ? !name.equals(pattern.name) : pattern.name != null) return false;
+        if (type != null ? !type.equals(pattern.type) : pattern.type != null) return false;
+        if (version != null ? !version.equals(pattern.version) : pattern.version != null) return false;
 
         return true;
     }
 
     public int hashCode() {
         int result;
-        result = (application != null ? application.hashCode() : 0);
-        result = 29 * result + (domain != null ? domain.hashCode() : 0);
+        result = (groupId != null ? groupId.hashCode() : 0);
+        result = 29 * result + (artifactId != null ? artifactId.hashCode() : 0);
+        result = 29 * result + (version != null ? version.hashCode() : 0);
         result = 29 * result + (module != null ? module.hashCode() : 0);
         result = 29 * result + (name != null ? name.hashCode() : 0);
-        result = 29 * result + (server != null ? server.hashCode() : 0);
         result = 29 * result + (type != null ? type.hashCode() : 0);
         return result;
     }

Propchange: geronimo/branches/1.1/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/Pattern.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/branches/1.1/modules/naming-builder/src/schema/geronimo-naming-1.1.xsd
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/src/schema/geronimo-naming-1.1.xsd?rev=385372&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/naming-builder/src/schema/geronimo-naming-1.1.xsd (added)
+++ geronimo/branches/1.1/modules/naming-builder/src/schema/geronimo-naming-1.1.xsd Sun Mar 12 13:44:50 2006
@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2004-2005 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<xsd:schema
+        targetNamespace="http://geronimo.apache.org/xml/ns/naming-1.1"
+        xmlns:gernaming="http://geronimo.apache.org/xml/ns/naming-1.1"
+        xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        elementFormDefault="qualified"
+        attributeFormDefault="unqualified"
+        version="1.0">
+
+    <xsd:import namespace="http://geronimo.apache.org/xml/ns/deployment-1.1" schemaLocation="geronimo-config-1.1.xsd"/>
+
+    <xsd:annotation>
+        <xsd:documentation>
+            <![CDATA[
+            Partial schema containing common naming elements which can be included in other schemas.
+            ]]>
+        </xsd:documentation>
+    </xsd:annotation>
+
+
+    <xsd:element name="ejb-ref" type="gernaming:ejb-refType"/>
+    <!--    <xsd:element name="ejb-local-ref" type="gernaming:ejb-local-refType"/>-->
+    <xsd:element name="service-ref" type="gernaming:service-refType"/>
+    <xsd:element name="resource-ref" type="gernaming:resource-refType"/>
+    <xsd:element name="resource-env-ref" type="gernaming:resource-env-refType"/>
+
+    <xsd:element name="message-destination" type="gernaming:message-destinationType"/>
+
+    <xsd:group name="jndiEnvironmentRefsGroup">
+        <xsd:annotation>
+            <xsd:documentation>
+
+                This group keeps the usage of the contained JNDI environment
+                reference elements consistent across J2EE deployment descriptors.
+
+            </xsd:documentation>
+        </xsd:annotation>
+        <xsd:sequence>
+            <xsd:element name="gbean-ref" type="gernaming:gbean-refType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="ejb-ref" type="gernaming:ejb-refType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="ejb-local-ref" type="gernaming:ejb-local-refType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="service-ref" type="gernaming:service-refType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="resource-ref" type="gernaming:resource-refType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="resource-env-ref" type="gernaming:resource-env-refType" minOccurs="0"
+                         maxOccurs="unbounded"/>
+        </xsd:sequence>
+    </xsd:group>
+
+    <!--ejb-link acts like ejb-link in spec descriptors-->
+    <!--resource-link contains the name of the outbound-connectionfactory-instance -->
+    <!--message-destination-link acts like message-destination-link in spec descriptors-->
+    <!--url in resource-ref contains the url for URL typed resource refs-->
+    <!--Possibly the external-uri element should be revived to connect to other naming systems-->
+    <!--when server to server communication exists we will need an element in ejb-ref to specify the geronimo server
+    we wish to talk to.  It might be possible to use the objectName server element for this depending on what we decide it means-->
+    <!--otherwise you can supply the entire object name using the gbean-nameGroup-->
+
+    <xsd:complexType name="ejb-refType">
+        <xsd:sequence>
+            <xsd:element name="ref-name" type="xsd:string"/>
+            <xsd:choice>
+                <xsd:element name="pattern" type="gernaming:patternType"/>
+                <xsd:group ref="gernaming:corbaNameGroup"/>
+                <xsd:element name="ejb-link" type="xsd:string"/>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="ejb-local-refType">
+        <xsd:sequence>
+            <xsd:element name="ref-name" type="xsd:string"/>
+            <xsd:choice>
+                <xsd:element name="pattern" type="gernaming:patternType"/>
+                <xsd:element name="ejb-link" type="xsd:string"/>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="resource-refType">
+        <xsd:sequence>
+            <xsd:element name="ref-name" type="xsd:string"/>
+            <xsd:choice>
+                <xsd:element name="pattern" type="gernaming:patternType"/>
+                <xsd:element name="resource-link" type="xsd:string"/>
+                <xsd:element name="url" type="xsd:string"/>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="gbean-refType">
+        <xsd:sequence>
+            <xsd:element name="ref-name" type="xsd:string"/>
+            <xsd:element name="ref-type" type="xsd:string"/>
+            <xsd:element name="proxy-type" type="xsd:string" minOccurs="0"/>
+            <xsd:choice minOccurs="0" maxOccurs="unbounded">
+                <xsd:element name="pattern" type="gernaming:patternType"/>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <!--used by openejb cmp datasource specification -->
+    <xsd:element name="cmp-connection-factory" type="gernaming:resource-locatorType"/>
+
+    <!--used by openejb mdb resource adapter specification -->
+    <xsd:element name="resource-adapter" type="gernaming:resource-locatorType"/>
+
+    <xsd:complexType name="resource-locatorType">
+        <xsd:sequence>
+            <xsd:choice>
+                <xsd:element name="pattern" type="gernaming:patternType"/>
+                <xsd:element name="resource-link" type="xsd:string"/>
+                <xsd:element name="url" type="xsd:string"/>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="resource-env-refType">
+        <xsd:sequence>
+            <xsd:element name="ref-name" type="xsd:string"/>
+            <xsd:choice>
+                <xsd:element name="pattern" type="gernaming:patternType"/>
+                <xsd:element name="message-destination-link" type="xsd:string">
+                    <xsd:annotation>
+                        <xsd:documentation>
+                            This element is deprecated and should not be used. Use admin-object-link instead.
+                            That is effectively a renamed version of this.
+                        </xsd:documentation>
+                    </xsd:annotation>
+                </xsd:element>
+                <xsd:sequence>
+                    <xsd:element name="admin-object-module" type="xsd:string" minOccurs="0"/>
+                    <xsd:element name="admin-object-link" type="xsd:string"/>
+                </xsd:sequence>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="message-destinationType">
+        <xsd:sequence>
+            <xsd:element name="message-destination-name" type="xsd:string"/>
+            <xsd:choice>
+                <xsd:element name="pattern" type="gernaming:patternType"/>
+                <xsd:sequence>
+                    <xsd:element name="admin-object-module" type="xsd:string" minOccurs="0"/>
+                    <xsd:element name="admin-object-link" type="xsd:string"/>
+                </xsd:sequence>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <!--used by resource adapter -->
+    <xsd:element name="workmanager" type="gernaming:gbean-locatorType"/>
+
+    <xsd:complexType name="gbean-locatorType">
+        <xsd:sequence>
+            <xsd:choice>
+                <xsd:element name="pattern" type="gernaming:patternType"/>
+                <xsd:element name="gbean-link" type="xsd:string"/>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="patternType">
+        <xsd:sequence>
+            <xsd:element name="groupId" type="xsd:string" minOccurs="0"/>
+            <xsd:element name="artifactId" type="xsd:string" minOccurs="0"/>
+            <xsd:element name="version" type="xsd:string" minOccurs="0"/>
+            <xsd:element name="module" type="xsd:string" minOccurs="0"/>
+            <xsd:element name="name" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:group name="serverGroup">
+        <xsd:annotation>
+            <xsd:documentation>This group contains the protocol, address, and port for a server</xsd:documentation>
+        </xsd:annotation>
+        <xsd:sequence>
+            <xsd:element name="protocol" type="xsd:string"/>
+            <xsd:element name="host" type="xsd:string"/>
+            <xsd:element name="port" type="xsd:int"/>
+        </xsd:sequence>
+    </xsd:group>
+
+    <xsd:complexType name="portType">
+        <xsd:sequence>
+            <xsd:element name="port-name" type="xsd:string"/>
+            <xsd:group ref="gernaming:serverGroup" minOccurs="0"/>
+            <xsd:element name="uri" type="xsd:string"/>
+            <xsd:element name="credentials-name" type="xsd:string" minOccurs="0"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="service-refType">
+        <xsd:sequence>
+            <xsd:element name="service-ref-name" type="xsd:string"/>
+            <xsd:choice>
+                <xsd:element name="service-completion" type="gernaming:service-completionType"/>
+                <xsd:element name="port" type="gernaming:portType" maxOccurs="unbounded"/>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="service-completionType">
+        <xsd:sequence>
+            <xsd:element name="service-name" type="xsd:string"/>
+            <xsd:element name="port-completion" type="gernaming:port-completionType" maxOccurs="unbounded"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="port-completionType">
+        <xsd:sequence>
+            <xsd:element name="port" type="gernaming:portType"/>
+            <xsd:element name="binding-name" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:group name="corbaNameGroup">
+        <xsd:annotation>
+            <xsd:documentation>
+                This group contains the location of the CORBA name server, the
+                name, and the client security server used to make interop calls.
+            </xsd:documentation>
+        </xsd:annotation>
+        <xsd:sequence>
+            <xsd:element name="ns-corbaloc" type="xsd:anyURI">
+                <xsd:annotation>
+                    <xsd:documentation>
+                        The corbaloc used to access the CORBA name server.
+                    </xsd:documentation>
+                </xsd:annotation>
+            </xsd:element>
+            <xsd:element name="name" type="xsd:string">
+                <xsd:annotation>
+                    <xsd:documentation>
+                        The name of the object in the name server.
+                    </xsd:documentation>
+                </xsd:annotation>
+            </xsd:element>
+            <xsd:choice>
+                <xsd:element name="css" type="gernaming:patternType"/>
+                <xsd:element name="css-link" type="xsd:string"/>
+                <xsd:element name="css-name" type="xsd:string">
+                    <xsd:annotation>
+                        <xsd:documentation>
+                            The GBean name of the client security server used to make interop calls.
+                        </xsd:documentation>
+                    </xsd:annotation>
+                </xsd:element>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:group>
+
+</xsd:schema>
\ No newline at end of file

Modified: geronimo/branches/1.1/modules/naming-builder/src/schema/xmlconfig.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/src/schema/xmlconfig.xml?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/naming-builder/src/schema/xmlconfig.xml (original)
+++ geronimo/branches/1.1/modules/naming-builder/src/schema/xmlconfig.xml Sun Mar 12 13:44:50 2006
@@ -1,7 +1,7 @@
 <xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config"
     >
 
-    <xb:namespace uri="http://geronimo.apache.org/xml/ns/naming-1.0">
+    <xb:namespace uri="http://geronimo.apache.org/xml/ns/naming-1.1">
         <xb:package>org.apache.geronimo.xbeans.geronimo.naming</xb:package>
         <xb:prefix>Ger</xb:prefix>
     </xb:namespace>

Modified: geronimo/branches/1.1/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java (original)
+++ geronimo/branches/1.1/modules/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java Sun Mar 12 13:44:50 2006
@@ -36,11 +36,13 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.GBeanDataRegistry;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.xbeans.j2ee.MessageDestinationType;
 import org.apache.geronimo.xbeans.j2ee.MessageDestinationRefType;
@@ -78,11 +80,11 @@
                 return null;
             }
         }, new ResourceReferenceBuilder() {
-            public Reference createResourceRef(String containerId, Class iface) throws DeploymentException {
+            public Reference createResourceRef(AbstractNameQuery containerId, Class iface, Configuration configuration) throws DeploymentException {
                 return null;
             }
 
-            public Reference createAdminObjectRef(String containerId, Class iface) throws DeploymentException {
+            public Reference createAdminObjectRef(AbstractNameQuery containerId, Class iface, Configuration configuration) throws DeploymentException {
                 return null;
             }
 

Modified: geronimo/branches/1.1/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java?rev=385372&r1=385371&r2=385372&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java (original)
+++ geronimo/branches/1.1/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java Sun Mar 12 13:44:50 2006
@@ -17,18 +17,16 @@
 
 package org.apache.geronimo.naming.java;
 
-import java.util.Map;
-import java.util.HashMap;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.naming.NamingException;
-import javax.transaction.UserTransaction;
-
-import org.apache.geronimo.kernel.ClassLoading;
-import org.apache.geronimo.naming.reference.GBeanProxyReference;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.naming.reference.KernelReference;
 import org.apache.geronimo.naming.reference.ORBReference;
 
+import javax.naming.NamingException;
+import javax.transaction.UserTransaction;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * TODO consider removing this class. The only purpose is to slightly hide the internalBind method.
  *
@@ -46,8 +44,8 @@
         context.put("UserTransaction", userTransaction);
     }
 
-    public void addORB(ObjectName corbaGBeanObjectName) {
-        context.put("ORB", new ORBReference(corbaGBeanObjectName));
+    public void addORB(Artifact configId, AbstractNameQuery corbaGBeanObjectName) {
+        context.put("ORB", new ORBReference(configId, corbaGBeanObjectName));
     }
 
     public void addHandleDelegateReference(Object handleDelegateReference) {
@@ -85,24 +83,24 @@
         } else if ("java.lang.Double".equals(type)) {
             value = Double.valueOf(text);
         } else {
-            Class clazz = null;
-            try {
-                clazz = ClassLoading.loadClass(type, classLoader);
-            } catch (ClassNotFoundException e) {
-                throw new IllegalArgumentException("Could not load class for env-entry " + name + ", " + type);
-            }
-            ObjectName objectName = null;
-            try {
-                objectName = ObjectName.getInstance(text);
-            } catch (MalformedObjectNameException e) {
-                throw new IllegalArgumentException("If env-entry type is not String, Character, Byte, Short, Integer, Long, " +
-                        "Boolean, Double, or Float, the text value must be a valid ObjectName for use in a GBeanProxy:" +
-                        " name= " + name +
-                        ", value=" + type +
-                        ", text=" + text);
-            }
-            value = new GBeanProxyReference(objectName, clazz);
-
+//            Class clazz = null;
+//            try {
+//                clazz = ClassLoading.loadClass(type, classLoader);
+//            } catch (ClassNotFoundException e) {
+//                throw new IllegalArgumentException("Could not load class for env-entry " + name + ", " + type);
+//            }
+//            ObjectName objectName = null;
+//            try {
+//                objectName = ObjectName.getInstance(text);
+//            } catch (MalformedObjectNameException e) {
+//                throw new IllegalArgumentException("If env-entry type is not String, Character, Byte, Short, Integer, Long, " +
+//                        "Boolean, Double, or Float, the text value must be a valid ObjectName for use in a GBeanProxy:" +
+//                        " name= " + name +
+//                        ", value=" + type +
+//                        ", text=" + text);
+//            }
+//            value = new GBeanProxyReference(configId, objectName, clazz);
+            throw new IllegalArgumentException("No proxy references right now");
         }
         context.put(ENV + name, value);
     }

Added: geronimo/branches/1.1/modules/naming/src/java/org/apache/geronimo/naming/reference/ConfigurationAwareReference.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming/src/java/org/apache/geronimo/naming/reference/ConfigurationAwareReference.java?rev=385372&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/naming/src/java/org/apache/geronimo/naming/reference/ConfigurationAwareReference.java (added)
+++ geronimo/branches/1.1/modules/naming/src/java/org/apache/geronimo/naming/reference/ConfigurationAwareReference.java Sun Mar 12 13:44:50 2006
@@ -0,0 +1,63 @@
+/**
+ *
+ * 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.naming.reference;
+
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+
+import java.util.Set;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public abstract class ConfigurationAwareReference extends SimpleAwareReference {
+
+    private final Artifact configId;
+    protected final AbstractNameQuery abstractNameQuery;
+
+    protected ConfigurationAwareReference(Artifact configId, AbstractNameQuery abstractNameQuery) {
+        this.configId = configId;
+        this.abstractNameQuery = abstractNameQuery;
+    }
+
+    public Configuration getConfiguration() {
+        Kernel kernel = getKernel();
+        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+        return configurationManager.getConfiguration(configId);
+    }
+
+    public AbstractName resolveTargetName() throws GBeanNotFoundException {
+        Configuration configuration = getConfiguration();
+        try {
+            return configuration.findGBean(abstractNameQuery);
+        } catch (GBeanNotFoundException e) {
+            Set results = getKernel().listGBeans(abstractNameQuery);
+            if (results.size() == 1) {
+                return (AbstractName) results.iterator().next();
+            }
+            throw new GBeanNotFoundException("Name query " + abstractNameQuery + " not satisfied in kernel, matches: " + results, e);
+        }
+    }
+
+}



Mime
View raw message