geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r388468 [2/2] - in /geronimo/branches/1.1: configs/activemq-broker/src/plan/ configs/client-security/src/plan/ configs/client-system/src/plan/ configs/client/src/plan/ configs/console-jetty/src/plan/ configs/console-tomcat/src/plan/ configs...
Date Fri, 24 Mar 2006 09:12:09 GMT
Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java Fri Mar 24 01:12:03 2006
@@ -25,7 +25,6 @@
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.Naming;
 
 import javax.naming.Reference;
@@ -33,6 +32,7 @@
 import java.net.URI;
 import java.net.URL;
 import java.util.jar.JarFile;
+import java.util.Collection;
 
 
 /**
@@ -54,7 +54,7 @@
         return new EJBModule(false, moduleName, null, moduleFile, targetPath, null, null, null);
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module ejbModule, ConfigurationStore configurationStore, Repository repository) {
+    public void installModule(JarFile earFile, EARContext earContext, Module ejbModule, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) {
         assertNotNull(earFile);
         assertNotNull(earContext);
         this.earContext = earContext;
@@ -74,7 +74,7 @@
         this.cl = cl;
     }
 
-    public void addGBeans(EARContext earContext, Module ejbModule, ClassLoader cl, Repository repository) {
+    public void addGBeans(EARContext earContext, Module ejbModule, ClassLoader cl, Collection repository) {
         assertEquals(this.earContext, earContext);
 //        assertEquals(this.ejbModule, ejbModule);
         assertEquals(this.cl, cl);

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java Fri Mar 24 01:12:03 2006
@@ -18,17 +18,17 @@
 
 import junit.framework.Assert;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
 import java.io.File;
 import java.net.URL;
 import java.util.Map;
+import java.util.Collection;
 import java.util.jar.JarFile;
 
 /**
@@ -53,7 +53,7 @@
         return new WebModule(false, moduleName, null, moduleFile, targetPath, null, null, null, contextRoot, portMap, namespace);
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module webModule, ConfigurationStore configurationStore, Repository repository) throws DeploymentException {
+    public void installModule(JarFile earFile, EARContext earContext, Module webModule, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException {
         assertNotNull(earFile);
         assertNotNull(earContext);
         this.earContext = earContext;
@@ -73,7 +73,7 @@
         this.cl = cl;
     }
 
-    public void addGBeans(EARContext earContext, Module webModule, ClassLoader cl, Repository repository) throws DeploymentException {
+    public void addGBeans(EARContext earContext, Module webModule, ClassLoader cl, Collection repository) throws DeploymentException {
         assertEquals(this.earContext, earContext);
 //        assertEquals(this.webModule, webModule);
         assertEquals(this.cl, cl);

Modified: geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Fri Mar 24 01:12:03 2006
@@ -30,6 +30,7 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
@@ -47,7 +48,6 @@
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
 import org.apache.geronimo.schema.SchemaConversionUtils;
@@ -121,7 +121,7 @@
 public class JettyModuleBuilder extends AbstractWebModuleBuilder {
     private final static Log log = LogFactory.getLog(JettyModuleBuilder.class);
     private final Environment defaultEnvironment;
-    private final AbstractName jettyContainerObjectName;
+    private final AbstractNameQuery jettyContainerObjectName;
     private final Collection defaultServlets;
     private final Collection defaultFilters;
     private final Collection defaultFilterMappings;
@@ -139,7 +139,7 @@
             Integer defaultSessionTimeoutSeconds,
             boolean defaultContextPriorityClassloader,
             List defaultWelcomeFiles,
-            AbstractName jettyContainerName,
+            AbstractNameQuery jettyContainerName,
             Collection defaultServlets,
             Collection defaultFilters,
             Collection defaultFilterMappings,
@@ -317,7 +317,7 @@
         }
     }
 
-    public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Repository repository) throws DeploymentException {
+    public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository) throws DeploymentException {
         EARContext moduleContext = module.getEarContext();
         ClassLoader moduleClassLoader = moduleContext.getClassLoader();
         AbstractName moduleName = moduleContext.getModuleName();
@@ -336,7 +336,9 @@
 
         GBeanData webModuleData = new GBeanData(moduleName, JettyWebAppContext.GBEAN_INFO);
         try {
-            webModuleData.setReferencePattern("J2EEServer", moduleContext.getServerName());
+            if (moduleContext.getServerName() != null) {
+                webModuleData.setReferencePattern("J2EEServer", moduleContext.getServerName());
+            }
             if (!module.isStandAlone()) {
                 webModuleData.setReferencePattern("J2EEApplication", moduleContext.getModuleName());
             }
@@ -901,7 +903,7 @@
         infoBuilder.addAttribute("defaultSessionTimeoutSeconds", Integer.class, true, true);
         infoBuilder.addAttribute("defaultContextPriorityClassloader", boolean.class, true, true);
         infoBuilder.addAttribute("defaultWelcomeFiles", List.class, true, true);
-        infoBuilder.addAttribute("jettyContainerObjectName", AbstractName.class, true, true);
+        infoBuilder.addAttribute("jettyContainerObjectName", AbstractNameQuery.class, true, true);
         infoBuilder.addReference("DefaultServlets", Object.class, NameFactory.DEFAULT_SERVLET);
         infoBuilder.addReference("DefaultFilters", Object.class);
         infoBuilder.addReference("DefaultFilterMappings", Object.class);

Modified: geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Fri Mar 24 01:12:03 2006
@@ -120,7 +120,7 @@
         EARContext earContext = createEARContext(outputPath, defaultEnvironment, repository, configStore, moduleName);
         module.setEarContext(earContext);
         builder.initContext(earContext, module, cl);
-        builder.addGBeans(earContext, module, cl, null);
+        builder.addGBeans(earContext, module, cl, Collections.EMPTY_SET);
         ConfigurationData configurationData = earContext.getConfigurationData();
         earContext.close();
         module.close();
@@ -284,7 +284,7 @@
 
         defaultEnvironment.addDependency(baseId, ImportType.ALL);
         defaultEnvironment.setConfigId(webModuleArtifact);
-        builder = new JettyModuleBuilder(defaultEnvironment, new Integer(1800), false, Collections.EMPTY_LIST, containerName, defaultServlets, defaultFilters, defaultFilterMappings, pojoWebServiceTemplate, webServiceBuilder, kernel);
+        builder = new JettyModuleBuilder(defaultEnvironment, new Integer(1800), false, Collections.EMPTY_LIST, new AbstractNameQuery(containerName), defaultServlets, defaultFilters, defaultFilterMappings, pojoWebServiceTemplate, webServiceBuilder, kernel);
     }
 
     protected void tearDown() throws Exception {

Modified: geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java Fri Mar 24 01:12:03 2006
@@ -6,6 +6,7 @@
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Jsr77Naming;
@@ -39,7 +40,7 @@
     private Naming naming = new Jsr77Naming();
     private Artifact baseId = new Artifact("test", "base", "1", "car");
     private AbstractName baseRootName = naming.createRootName(baseId, "root", NameFactory.SERVICE_MODULE);
-    private AbstractName jettyContainerObjectName = naming.createChildName(baseRootName, "jettyContainer", NameFactory.GERONIMO_SERVICE);
+    private AbstractNameQuery jettyContainerObjectName = new AbstractNameQuery(naming.createChildName(baseRootName, "jettyContainer", NameFactory.GERONIMO_SERVICE));
     private AbstractName pojoWebServiceTemplate = null;
     private WebServiceBuilder webServiceBuilder = null;
     private Environment defaultEnvironment = new Environment();

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=388468&r1=388467&r2=388468&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 Fri Mar 24 01:12:03 2006
@@ -76,7 +76,7 @@
     }
 
     public AbstractName(URI uri) {
-        if (uri == null) new NullPointerException("uri is null");
+        if (uri == null) throw new NullPointerException("uri is null");
 
         //
         // Artifact
@@ -165,6 +165,7 @@
         }
     }
 
+    //TODO why not use String.split?
     private static List split(String source, char delim) {
         List parts = new ArrayList();
         for (int index = source.indexOf(delim); index >= 0; index = source.indexOf(delim)) {
@@ -193,13 +194,14 @@
     }
 
     public String toString() {
-        StringBuffer buf = new StringBuffer("AbstractName:");
-        for (Iterator iterator = name.entrySet().iterator(); iterator.hasNext();) {
-            Map.Entry entry = (Map.Entry) iterator.next();
-            buf.append(",").append(entry.getKey()).append("=").append(entry.getValue());
-        }
-        buf.append(",artifact=").append(artifact);
-        return buf.toString();
+//        StringBuffer buf = new StringBuffer("AbstractName:");
+//        for (Iterator iterator = name.entrySet().iterator(); iterator.hasNext();) {
+//            Map.Entry entry = (Map.Entry) iterator.next();
+//            buf.append(",").append(entry.getKey()).append("=").append(entry.getValue());
+//        }
+//        buf.append(",artifact=").append(artifact);
+//        return buf.toString();
+        return uri.toString();
     }
 
     public boolean equals(Object o) {

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=388468&r1=388467&r2=388468&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 Fri Mar 24 01:12:03 2006
@@ -18,10 +18,17 @@
 package org.apache.geronimo.gbean;
 
 import java.io.Serializable;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
 
 import org.apache.geronimo.kernel.repository.Artifact;
 
@@ -35,6 +42,8 @@
     private final Map name;
     private final Set interfaceTypes;
 
+    private final URI uri;
+
     public AbstractNameQuery(AbstractName abstractName) {
         this(abstractName, null);
     }
@@ -42,13 +51,15 @@
     public AbstractNameQuery(AbstractName abstractName, Set interfaceTypes) {
         this.artifact = abstractName.getArtifact();
         this.name = abstractName.getName();
-        this.interfaceTypes = interfaceTypes == null? Collections.EMPTY_SET: interfaceTypes;
+        this.interfaceTypes = interfaceTypes == null ? Collections.EMPTY_SET : interfaceTypes;
+        this.uri = createURI(artifact, name, this.interfaceTypes);
     }
 
     public AbstractNameQuery(Artifact artifact, Map name) {
         this.artifact = artifact;
         this.name = name;
         this.interfaceTypes = Collections.EMPTY_SET;
+        this.uri = createURI(artifact, name, interfaceTypes);
     }
 
     public AbstractNameQuery(Artifact artifact, Map name, String interfaceType) {
@@ -59,12 +70,14 @@
         } else {
             this.interfaceTypes = Collections.EMPTY_SET;
         }
+        this.uri = createURI(artifact, name, interfaceTypes);
     }
 
     public AbstractNameQuery(String interfaceType) {
         this.artifact = null;
         this.name = Collections.EMPTY_MAP;
         this.interfaceTypes = Collections.singleton(interfaceType);
+        this.uri = createURI(artifact, name, interfaceTypes);
     }
 
     public AbstractNameQuery(Artifact artifact, Map name, Set interfaceTypes) {
@@ -72,8 +85,119 @@
         this.name = name;
         if (interfaceTypes == null) interfaceTypes = Collections.EMPTY_SET;
         this.interfaceTypes = interfaceTypes;
+        this.uri = createURI(artifact, name, this.interfaceTypes);
     }
 
+    public AbstractNameQuery(URI uri) {
+        if (uri == null) throw new NullPointerException("uri is null");
+
+        //
+        // Artifact
+        //
+        String artifactString = uri.getPath();
+        //this doesn't seem to happen
+//        if (artifactString == null) throw new IllegalArgumentException("uri does not contain a path part used for the artifact");
+
+        if (artifactString != null && artifactString.length() > 0) {
+            List artifactParts = split(artifactString, '/');
+            if (artifactParts.size() != 4) {
+                throw new IllegalArgumentException("uri path must be in the form [groupId]/[artifactId]/[version]/[type] : " + artifactString);
+            }
+
+            String groupId = (String) artifactParts.get(0);
+            if (groupId.length() == 0) groupId = null;
+
+            String artifactId = (String) artifactParts.get(1);
+            if (artifactId.length() == 0) artifactId = null;
+
+            String version = (String) artifactParts.get(2);
+            if (version.length() == 0) version = null;
+
+            String type = (String) artifactParts.get(3);
+            if (type.length() == 0) type = null;
+
+            artifact = new Artifact(groupId, artifactId, version, type);
+        } else {
+            artifact = null;
+        }
+
+        //
+        // name map
+        //
+        name = new TreeMap();
+        String nameString = uri.getQuery();
+        List nameParts = split(nameString, ',');
+        for (Iterator iterator = nameParts.iterator(); iterator.hasNext();) {
+            String namePart = (String) iterator.next();
+            List keyValue = split(namePart, '=');
+            if (keyValue.size() != 2) {
+                throw new IllegalArgumentException("uri query string must be in the form [vendorId]/artifactId/[version]/[type] : " + nameString);
+            }
+            String key = (String) keyValue.get(0);
+            String value = (String) keyValue.get(1);
+            if (name.containsKey(key)) {
+                throw new IllegalArgumentException("uri query string contains the key '" + key + "' twice : " + nameString);
+            }
+            name.put(key, value);
+        }
+//        if (name.isEmpty()) {
+//            throw new IllegalArgumentException("name is empty: " + nameString);
+//        }
+
+        String interfaceString = uri.getFragment();
+        List interfaces = split(interfaceString, ',');
+        interfaceTypes = new HashSet(interfaces);
+
+        //
+        // uri
+        //
+        this.uri = createURI(artifact, name, interfaceTypes);
+    }
+
+    private static List split(String source, char delim) {
+        List parts = new ArrayList();
+        if (source != null) {
+            for (int index = source.indexOf(delim); index >= 0; index = source.indexOf(delim)) {
+                String part = source.substring(0, index);
+                source = source.substring(index + 1);
+                parts.add(part);
+            }
+            parts.add(source);
+        }
+        return parts;
+    }
+
+    private static URI createURI(Artifact artifact, Map name, Set interfaceTypes) {
+        StringBuffer queryString = new StringBuffer();
+        TreeMap treeMap = new TreeMap(name);
+        for (Iterator iterator = treeMap.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String key = (String) entry.getKey();
+            String value = (String) entry.getValue();
+            queryString.append(key).append('=').append(value);
+            if (iterator.hasNext()) {
+                queryString.append(',');
+            }
+        }
+        StringBuffer fragmentString = new StringBuffer();
+        TreeSet treeSet = new TreeSet(interfaceTypes);
+        for (Iterator iterator = treeSet.iterator(); iterator.hasNext();) {
+            String interfaceType = (String) iterator.next();
+            fragmentString.append(interfaceType);
+            if (iterator.hasNext()) {
+                fragmentString.append(',');
+            }
+        }
+        try {
+            return new URI(null, null, artifact == null? null: artifact.toString(), queryString.toString(), fragmentString.toString());
+        } catch (URISyntaxException e) {
+            IllegalArgumentException illegalArgumentException = new IllegalArgumentException();
+            illegalArgumentException.initCause(e);
+            throw illegalArgumentException;
+        }
+    }
+
+
     public Artifact getArtifact() {
         return artifact;
     }
@@ -87,17 +211,23 @@
     }
 
     public String toString() {
-        StringBuffer buf = new StringBuffer("artifact=");
-        buf.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();
+        return uri.toString();
+        //TODO configid need a URI format
+//        StringBuffer buf = new StringBuffer("artifact=");
+//        buf.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 URI toURI() {
+        return uri;
     }
 
     public boolean equals(Object o) {
@@ -139,6 +269,7 @@
     /**
      * N.B. parameter info is supposed to be more specific than this.
      * This is the opposite of the meaning of Artifact.matches.
+     *
      * @param info
      * @return if info is a more specific version of this name query.
      */

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java Fri Mar 24 01:12:03 2006
@@ -199,7 +199,7 @@
 
         // add all interfaces based on GBean type
         if (gbeanType.isArray()) {
-            throw new IllegalArgumentException("GBean is an array type: gbeanType=" + gbeanType);
+            throw new IllegalArgumentException("GBean is an array type: gbeanType=" + gbeanType.getName());
         }
         Set allTypes = ClassLoading.getAllTypes(gbeanType);
         for (Iterator iterator = allTypes.iterator(); iterator.hasNext();) {
@@ -282,7 +282,7 @@
                                     null));
                 } else {
                     if (!attributeType.equals(attribute.getType())) {
-                        throw new IllegalArgumentException("Getter and setter type do not match: " + attributeName);
+                        throw new IllegalArgumentException("Getter and setter type do not match: " + attributeName + " for gbeanType: " + gbeanType.getName());
                     }
                     attributes.put(attributeName,
                             new GAttributeInfo(attributeName,
@@ -306,7 +306,7 @@
                                     method.getName()));
                 } else {
                     if (!attributeType.equals(attribute.getType())) {
-                        throw new IllegalArgumentException("Getter and setter type do not match: " + attributeName);
+                        throw new IllegalArgumentException("Getter and setter type do not match: " + attributeName + " for gbeanType: " + gbeanType.getName());
                     }
                     attributes.put(attributeName,
                             new GAttributeInfo(attributeName,
@@ -420,7 +420,7 @@
                 if (setter == null) {
                     setter = searchForSetterMethod(referenceName, Collection.class.getName(), gbeanType);
                     if (setter == null) {
-                        throw new InvalidConfigurationException("Reference must be a constructor argument or have a setter: name=" + referenceName);
+                        throw new InvalidConfigurationException("Reference must be a constructor argument or have a setter: name=" + referenceName + " for gbeanType: " + gbeanType);
                     }
                 }
                 proxyType = setter.getParameterTypes()[0].getName();
@@ -429,7 +429,7 @@
             }
 
             if (!proxyType.equals(Collection.class.getName()) && !proxyType.equals(referenceType)) {
-                throw new InvalidConfigurationException("Reference proxy type must be Collection or " + referenceType + ": name=" + referenceName);
+                throw new InvalidConfigurationException("Reference proxy type must be Collection or " + referenceType + ": name=" + referenceName + " for gbeanType: " + gbeanType.getName());
             }
 
             referenceInfos.add(new GReferenceInfo(referenceName, referenceType, proxyType, setterName, namingType));

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java Fri Mar 24 01:12:03 2006
@@ -42,6 +42,9 @@
     private final Artifact configurationId;
     private final ArtifactResolver artifactResolver;
     private final Collection repositories;
+    /**
+     * file or configstore used to resolve classpath parts
+     */
     private final File baseDir;
     private final ConfigurationStore configurationStore;
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java Fri Mar 24 01:12:03 2006
@@ -103,6 +103,10 @@
         ObjectOutputStream objectOutputStream = null;
         try {
             GBeanData configurationGBeanData = toConfigurationGBeanData(configurationData, null, null, null);
+            //TODO configid DAIN please review!!
+            //configurationResolver is not serializable in principle, but is useful for local manipulation of
+            //ConfigurationData/ configuration as a GBeanData.
+            configurationGBeanData.setAttribute("configurationResolver", null);
             objectOutputStream = new ObjectOutputStream(out);
             configurationGBeanData.writeExternal(objectOutputStream);
         } catch (IOException e) {

Modified: geronimo/branches/1.1/modules/security-builder/src/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security-builder/src/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/security-builder/src/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/security-builder/src/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java Fri Mar 24 01:12:03 2006
@@ -47,16 +47,17 @@
 import org.apache.geronimo.xbeans.geronimo.loginconfig.GerLoginModuleRefType;
 import org.apache.geronimo.xbeans.geronimo.loginconfig.GerLoginModuleType;
 import org.apache.geronimo.xbeans.geronimo.loginconfig.GerOptionType;
+import org.apache.geronimo.xbeans.geronimo.loginconfig.GerLoginConfigDocument;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 
 
 /**
- * @version $Rev: 384933 $ $Date$
+ * @version $Rev$ $Date$
  */
 public class LoginConfigBuilder implements XmlReferenceBuilder {
-    public static final String LOGIN_CONFIG_NAMESPACE = "http://geronimo.apache.org/xml/ns/loginconfig-1.0";
+    public static final String LOGIN_CONFIG_NAMESPACE = GerLoginConfigDocument.type.getDocumentElementName().getNamespaceURI();
 
     private final Naming naming;
 

Modified: geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java Fri Mar 24 01:12:03 2006
@@ -163,7 +163,7 @@
         String version = pattern.isSetVersion() ? pattern.getVersion().trim() : null;
         String module = pattern.isSetModule() ? pattern.getModule().trim() : null;
         String type = pattern.isSetType() ? pattern.getType().trim() : null;
-        String name = pattern.getName().trim();
+        String name = pattern.isSetName() ? pattern.getName().trim() : null;
 
         Artifact artifact = artifactid != null? new Artifact(groupId, artifactid, version, "car"): null;
         //get the type from the gbean info if not supplied explicitly
@@ -171,14 +171,16 @@
             type = referenceInfo.getNameTypeName();
         }
         Map nameMap = new HashMap();
-        nameMap.put("name", name);
+        if (name != null) {
+            nameMap.put("name", name);
+        }
         if (type != null) {
             nameMap.put("j2eeType", type);
         }
         if (module != null) {
             nameMap.put("J2EEModule", module);
         }
-        String interfaceType = referenceInfo.getProxyType();
+        String interfaceType = referenceInfo.getReferenceType();
         return new AbstractNameQuery(artifact, nameMap, Collections.singleton(interfaceType));
     }
 

Modified: geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java Fri Mar 24 01:12:03 2006
@@ -17,6 +17,16 @@
 
 package org.apache.geronimo.deployment.service;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.jar.JarFile;
+
+import javax.xml.namespace.QName;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ConfigurationBuilder;
 import org.apache.geronimo.deployment.DeploymentContext;
@@ -50,22 +60,12 @@
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.jar.JarFile;
-
 /**
  * @version $Rev$ $Date$
  */
 public class ServiceConfigBuilder implements ConfigurationBuilder {
     private final Environment defaultEnvironment;
-    private final Repository repository;
+    private final Collection repositories;
 
     //TODO this being static is a really good argument that all other builders should have a reference to this gbean, not use static methods on it.
     private static final Map xmlAttributeBuilderMap = new HashMap();
@@ -76,21 +76,21 @@
     private final Naming naming;
 
 
-    public ServiceConfigBuilder(Environment defaultEnvironment, Repository repository, Naming naming) {
-        this(defaultEnvironment, repository, null, null, naming);
+    public ServiceConfigBuilder(Environment defaultEnvironment, Collection repositories, Naming naming) {
+        this(defaultEnvironment, repositories, null, null, naming);
     }
 
-    public ServiceConfigBuilder(Environment defaultEnvironment, Repository repository, Collection xmlAttributeBuilders, Collection xmlReferenceBuilders, Kernel kernel) {
-        this(defaultEnvironment, repository, xmlAttributeBuilders, xmlReferenceBuilders, kernel.getNaming());
+    public ServiceConfigBuilder(Environment defaultEnvironment, Collection repositories, Collection xmlAttributeBuilders, Collection xmlReferenceBuilders, Kernel kernel) {
+        this(defaultEnvironment, repositories, xmlAttributeBuilders, xmlReferenceBuilders, kernel.getNaming());
     }
 
-    public ServiceConfigBuilder(Environment defaultEnvironment, Repository repository, Collection xmlAttributeBuilders, Collection xmlReferenceBuilders, Naming naming) {
+    public ServiceConfigBuilder(Environment defaultEnvironment, Collection repositories, Collection xmlAttributeBuilders, Collection xmlReferenceBuilders, Naming naming) {
         this.naming = naming;
         EnvironmentBuilder environmentBuilder = new EnvironmentBuilder();
         xmlAttributeBuilderMap.put(environmentBuilder.getNamespace(), environmentBuilder);
         this.defaultEnvironment = defaultEnvironment;
 
-        this.repository = repository;
+        this.repositories = repositories;
         if (xmlAttributeBuilders != null) {
             ReferenceMap.Key key = new ReferenceMap.Key() {
 
@@ -153,31 +153,34 @@
         return environment.getConfigId();
     }
 
-    public ConfigurationData buildConfiguration(Object plan, JarFile unused, ConfigurationStore configurationStore) throws IOException, DeploymentException {
+    public ConfigurationData buildConfiguration(Object plan, JarFile unused, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
         ConfigurationType configType = (ConfigurationType) plan;
 
-        return buildConfiguration(configType, configurationStore);
+        return buildConfiguration(configType, configurationStores, targetConfigurationStore);
     }
 
-    public ConfigurationData buildConfiguration(ConfigurationType configurationType, ConfigurationStore configurationStore) throws DeploymentException, IOException {
+    public ConfigurationData buildConfiguration(ConfigurationType configurationType, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws DeploymentException, IOException {
 
         Environment environment = EnvironmentBuilder.buildEnvironment(configurationType.getEnvironment(), defaultEnvironment);
         Artifact configId = environment.getConfigId();
         File outfile;
         try {
-            outfile = configurationStore.createNewConfigurationDir(configId);
+            outfile = targetConfigurationStore.createNewConfigurationDir(configId);
         } catch (ConfigurationAlreadyExistsException e) {
             throw new DeploymentException(e);
         }
-        DeploymentContext context = new DeploymentContext(outfile, environment, ConfigurationModuleType.SERVICE, naming, Collections.singleton(repository), Collections.singleton(configurationStore));
+        DeploymentContext context = new DeploymentContext(outfile, environment, ConfigurationModuleType.SERVICE, naming, repositories, configurationStores);
         ClassLoader cl = context.getClassLoader();
 
 
         AbstractName moduleName = naming.createRootName(configId, configId.toString(), NameFactory.SERVICE_MODULE);
         GbeanType[] gbeans = configurationType.getGbeanArray();
-        addGBeans(gbeans, cl, moduleName, context);
-        context.close();
-        return context.getConfigurationData();
+        try {
+            addGBeans(gbeans, cl, moduleName, context);
+            return context.getConfigurationData();
+        } finally {
+            context.close();
+        }
     }
 
     public static void addGBeans(GbeanType[] gbeans, ClassLoader cl, AbstractName moduleName, DeploymentContext context) throws DeploymentException {
@@ -268,7 +271,7 @@
         infoFactory.addInterface(ConfigurationBuilder.class);
 
         infoFactory.addAttribute("defaultEnvironment", Environment.class, true);
-        infoFactory.addReference("Repository", Repository.class, NameFactory.GERONIMO_SERVICE);
+        infoFactory.addReference("Repository", Repository.class, "Repository");
         infoFactory.addReference("XmlAttributeBuilders", XmlAttributeBuilder.class, "XmlAttributeBuilder");
         infoFactory.addReference("XmlReferenceBuilders", XmlReferenceBuilder.class, "XmlReferenceBuilder");
         infoFactory.addAttribute("kernel", Kernel.class, false, false);

Modified: geronimo/branches/1.1/modules/service-builder/src/schema/geronimo-config-1.1.xsd
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/schema/geronimo-config-1.1.xsd?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/schema/geronimo-config-1.1.xsd (original)
+++ geronimo/branches/1.1/modules/service-builder/src/schema/geronimo-config-1.1.xsd Fri Mar 24 01:12:03 2006
@@ -267,7 +267,7 @@
                 <xs:element name="version" type="xs:string" minOccurs="0"/>
                 <xs:element name="module" type="xs:string" minOccurs="0"/>
                 <xs:element name="type" type="xs:string" minOccurs="0"/>
-                <xs:element name="name" type="xs:string"/>
+                <xs:element name="name" type="xs:string" minOccurs="0"/>
             </xs:sequence>
         </xs:sequence>
     </xs:complexType>

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Fri Mar 24 01:12:03 2006
@@ -32,6 +32,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.Collection;
 import java.util.jar.JarFile;
 
 import javax.transaction.UserTransaction;
@@ -61,7 +62,6 @@
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
 import org.apache.geronimo.schema.SchemaConversionUtils;
@@ -268,7 +268,7 @@
         }
     }
 
-    public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Repository repository) throws DeploymentException {
+    public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository) throws DeploymentException {
         EARContext moduleContext = module.getEarContext();
         ClassLoader moduleClassLoader = moduleContext.getClassLoader();
         AbstractName moduleName = moduleContext.getModuleName();

Modified: geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java Fri Mar 24 01:12:03 2006
@@ -32,7 +32,6 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.ImportType;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
 import org.apache.geronimo.security.util.URLPattern;
 import org.apache.geronimo.xbeans.j2ee.FilterMappingType;
@@ -65,6 +64,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.Collection;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
 
@@ -164,7 +164,7 @@
         return path;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module, ConfigurationStore configurationStore, Repository repository) throws DeploymentException {
+    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories) throws DeploymentException {
         EARContext moduleContext;
         if (module.isStandAlone()) {
             moduleContext = earContext;
@@ -173,9 +173,10 @@
             Artifact earConfigId = earContext.getConfigID();
             Artifact configId = new Artifact(earConfigId.getGroupId(), earConfigId.getArtifactId() + "_" + module.getTargetPath(), earConfigId.getVersion(), "car");
             environment.setConfigId(configId);
+            environment.addDependency(earConfigId, ImportType.ALL);
             File configurationDir;
             try {
-                configurationDir = configurationStore.createNewConfigurationDir(environment.getConfigId());
+                configurationDir = targetConfigurationStore.createNewConfigurationDir(environment.getConfigId());
             } catch (ConfigurationAlreadyExistsException e) {
                 throw new DeploymentException(e);
             }
@@ -187,8 +188,8 @@
                         environment,
                         ConfigurationModuleType.WAR,
                         earContext.getNaming(),
-                        repository,
-                        configurationStore,
+                        repositories,
+                        configurationStores,
                         earContext.getServerName(),
                         module.getModuleName(),
                         earContext.getTransactionContextManagerObjectName(),

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/plugin.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/plugin.properties?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/plugin.properties (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/plugin.properties Fri Mar 24 01:12:03 2006
@@ -28,7 +28,8 @@
 
 geronimo.packaging.repository=${maven.repo.local}
 geronimo.packaging.deploymentConfig=geronimo/geronimo-gbean-deployer/${geronimo.packaging.geronimo_version}/car,geronimo/j2ee-deployer/${geronimo.packaging.geronimo_version}/car
-geronimo.packaging.deployerName=geronimo.maven:name=Deployer,j2eeType=Deployer,J2EEModule=geronimo/geronimo-gbean-deployer/${geronimo.packaging.geronimo_version}/car,*
+geronimo.packaging.deployerName=geronimo/geronimo-gbean-deployer/${geronimo.packaging.geronimo_version}/car?j2eeType=Deployer,name=Deployer
+#  geronimo.maven:name=Deployer,j2eeType=Deployer,J2EEModule=geronimo/geronimo-gbean-deployer/${geronimo.packaging.geronimo_version}/car,*
 
 geronimo.packaging.user=system
 geronimo.packaging.password=manager

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml Fri Mar 24 01:12:03 2006
@@ -42,6 +42,7 @@
                 <packaging.classpath>true</packaging.classpath>
             </properties>
         </dependency>
+<!--
         <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-j2ee</artifactId>
@@ -50,6 +51,7 @@
                 <packaging.classpath>true</packaging.classpath>
             </properties>
         </dependency>
+-->
 
         <dependency>
             <groupId>cglib</groupId>

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java Fri Mar 24 01:12:03 2006
@@ -86,7 +86,7 @@
     }
 
     static {
-        GBeanInfoBuilder builder = GBeanInfoBuilder.createStatic(MavenConfigStore.class);
+        GBeanInfoBuilder builder = GBeanInfoBuilder.createStatic(MavenConfigStore.class, "ConfigurationStore");
         builder.addInterface(ConfigurationStore.class);
         builder.addInterface(ConfigurationStore.class);
         builder.addAttribute("objectName", String.class, false);

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java?rev=388468&r1=388467&r2=388468&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java Fri Mar 24 01:12:03 2006
@@ -22,12 +22,15 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GReferenceInfo;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.KernelConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
@@ -78,7 +81,7 @@
     private File repository;
     private String deploymentConfigString;
     private Artifact[] deploymentConfig;
-    private ObjectName deployerName;
+    private AbstractName deployerName;
 
     private File planFile;
     private File moduleFile;
@@ -147,11 +150,7 @@
      * @param deployerName the name of the Deployer GBean
      */
     public void setDeployerName(String deployerName) {
-        try {
-            this.deployerName = new ObjectName(deployerName);
-        } catch (MalformedObjectNameException e) {
-            throw new IllegalArgumentException("deployerName is not a valid ObjectName: " + deployerName);
-        }
+            this.deployerName = new AbstractName(URI.create(deployerName));
     }
 
     public File getPlanFile() {
@@ -251,7 +250,7 @@
                 ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
             }
 
-            ObjectName deployer = locateDeployer(kernel);
+            AbstractName deployer = locateDeployer(kernel);
             invokeDeployer(kernel, deployer);
             System.out.println("Generated package " + packageFile);
         } catch (Exception e) {
@@ -291,67 +290,108 @@
      * the local maven installation.
      */
     private static void bootDeployerSystem(Kernel kernel, File repository, String repoClass, String configStoreClass) throws Exception {
-        Artifact artifact = new Artifact("geronimo", "packaging", "fixed", "car");
-        Map nameMap = new HashMap();
-        nameMap.put("type", "plugin");
-        nameMap.put("name", "packaging");
-        ObjectName objectName;
-        try {
-            objectName = ObjectName.getInstance(KERNEL_NAME + "j2eeType=plugin,name=packaging");
-        } catch (MalformedObjectNameException e) {
-            throw (IllegalArgumentException)new IllegalArgumentException("Could not construct a fixed object name").initCause(e);
-        }
-        AbstractName rootName = new AbstractName(artifact, nameMap, objectName);
-        AbstractName repositoryName = kernel.getNaming().createChildName(rootName, "Repository", "Repository");
-        AbstractName artifactManagerName = kernel.getNaming().createChildName(rootName, "ArtifactManager", "ArtifactManager");
-        AbstractName artifactResolverName = kernel.getNaming().createChildName(rootName, "ArtifactResolver", "ArtifactResolver");
-        AbstractName configStoreName = kernel.getNaming().createChildName(rootName, "PackageBuilderConfigStore", "ConfigurationStore");
-        AbstractName configManagerName = kernel.getNaming().createChildName(rootName, "ConfigurationManager", "ConfigurationManager");
-        AbstractName attributeStoreName = kernel.getNaming().createChildName(rootName, "ManagedAttributeStore", "ManagedAttributeStore");
-
+        Artifact baseId = new Artifact("geronimo", "packaging", "fixed", "car");
+        Naming naming = kernel.getNaming();
+        ConfigurationData bootstrap = new ConfigurationData(baseId, naming);
         ClassLoader cl = PackageBuilder.class.getClassLoader();
-        GBeanInfo repoInfo = GBeanInfo.getGBeanInfo(repoClass, cl);
-        GBeanData repoGBean = new GBeanData(repositoryName, repoInfo);
+
+        GBeanData repoGBean = bootstrap.addGBean("Repository", GBeanInfo.getGBeanInfo(repoClass, cl));
         URI repositoryURI = repository.toURI();
         repoGBean.setAttribute("root", repositoryURI);
-        kernel.loadGBean(repoGBean, cl);
-        kernel.startGBean(repositoryName);
 
-        //TODO parameterize these?
-        GBeanData artifactManagerGBean = new GBeanData(artifactManagerName, DefaultArtifactManager.GBEAN_INFO);
-        kernel.loadGBean(artifactManagerGBean, cl);
-        kernel.startGBean(artifactManagerName);
-
-        GBeanData artifactResolverGBean = new GBeanData(artifactResolverName, DefaultArtifactResolver.GBEAN_INFO);
-        artifactResolverGBean.setReferencePattern("Repositories", repositoryName);
-        artifactResolverGBean.setReferencePattern("ArtifactManager", artifactManagerName);
-        kernel.loadGBean(artifactResolverGBean, cl);
-        kernel.startGBean(artifactResolverName);
+        GBeanData artifactManagerGBean = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
+
+        GBeanData artifactResolverGBean = bootstrap.addGBean("ArtifactResolver", DefaultArtifactResolver.GBEAN_INFO);
+        artifactResolverGBean.setReferencePattern("Repositories", repoGBean.getAbstractName());
+        artifactResolverGBean.setReferencePattern("ArtifactManager", artifactManagerGBean.getAbstractName());
 
         GBeanInfo configStoreInfo = GBeanInfo.getGBeanInfo(configStoreClass, cl);
-        GBeanData storeGBean = new GBeanData(configStoreName, configStoreInfo);
-        Set refs = configStoreInfo.getReferences();
-        for (Iterator iterator = refs.iterator(); iterator.hasNext();) {
-            GReferenceInfo refInfo = (GReferenceInfo) iterator.next();
-            if ("Repository".equals(refInfo.getName())) {
-                storeGBean.setReferencePattern("Repository", repositoryName);
-                break;
-            }
+        GBeanData storeGBean = bootstrap.addGBean("ConfigStore", configStoreInfo);
+        if (configStoreInfo.getReference("Repository") != null) {
+            storeGBean.setReferencePattern("Repository", repoGBean.getAbstractName());
         }
-        kernel.loadGBean(storeGBean, cl);
-        kernel.startGBean(configStoreName);
+//        Set refs = configStoreInfo.getReferences();
+//        for (Iterator iterator = refs.iterator(); iterator.hasNext();) {
+//            GReferenceInfo refInfo = (GReferenceInfo) iterator.next();
+//            if ("Repository".equals(refInfo.getName())) {
+//                storeGBean.setReferencePattern("Repository", repositoryName);
+//                break;
+//            }
+//        }
+
+        GBeanData attrManagerGBean = bootstrap.addGBean("AttributeStore", MavenAttributeStore.GBEAN_INFO);
+
+        GBeanData configManagerGBean = bootstrap.addGBean("ConfigManager", KernelConfigurationManager.GBEAN_INFO);
+        configManagerGBean.setReferencePattern("Stores", storeGBean.getAbstractName());
+        configManagerGBean.setReferencePattern("AttributeStore", attrManagerGBean.getAbstractName());
+        configManagerGBean.setReferencePattern("ArtifactManager", artifactManagerGBean.getAbstractName());
+        configManagerGBean.setReferencePattern("ArtifactResolver", artifactResolverGBean.getAbstractName());
+        configManagerGBean.setReferencePattern("Repositories", repoGBean.getAbstractName());
+
+        ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, cl);
+
+//        Map nameMap = new HashMap();
+//        nameMap.put("type", "plugin");
+//        nameMap.put("name", "packaging");
+//        ObjectName objectName;
+//        try {
+//            objectName = ObjectName.getInstance(KERNEL_NAME + "j2eeType=plugin,name=packaging");
+//        } catch (MalformedObjectNameException e) {
+//            throw (IllegalArgumentException)new IllegalArgumentException("Could not construct a fixed object name").initCause(e);
+//        }
+//        AbstractName rootName = new AbstractName(baseId, nameMap, objectName);
+//        AbstractName repositoryName = kernel.getNaming().createChildName(rootName, "Repository", "Repository");
+//        AbstractName artifactManagerName = kernel.getNaming().createChildName(rootName, "ArtifactManager", "ArtifactManager");
+//        AbstractName artifactResolverName = kernel.getNaming().createChildName(rootName, "ArtifactResolver", "ArtifactResolver");
+//        AbstractName configStoreName = kernel.getNaming().createChildName(rootName, "PackageBuilderConfigStore", "ConfigurationStore");
+//        AbstractName configManagerName = kernel.getNaming().createChildName(rootName, "ConfigurationManager", "ConfigurationManager");
+//        AbstractName attributeStoreName = kernel.getNaming().createChildName(rootName, "ManagedAttributeStore", "ManagedAttributeStore");
+//
+//        GBeanInfo repoInfo = GBeanInfo.getGBeanInfo(repoClass, cl);
+//        GBeanData repoGBean = new GBeanData(repositoryName, repoInfo);
+//        URI repositoryURI = repository.toURI();
+//        repoGBean.setAttribute("root", repositoryURI);
+//        kernel.loadGBean(repoGBean, cl);
+//        kernel.startGBean(repositoryName);
+
+        //TODO parameterize these?
+//        GBeanData artifactManagerGBean = new GBeanData(artifactManagerName, DefaultArtifactManager.GBEAN_INFO);
+//        kernel.loadGBean(artifactManagerGBean, cl);
+//        kernel.startGBean(artifactManagerName);
+
+//        GBeanData artifactResolverGBean = new GBeanData(artifactResolverName, DefaultArtifactResolver.GBEAN_INFO);
+//        artifactResolverGBean.setReferencePattern("Repositories", repositoryName);
+//        artifactResolverGBean.setReferencePattern("ArtifactManager", artifactManagerName);
+//        kernel.loadGBean(artifactResolverGBean, cl);
+//        kernel.startGBean(artifactResolverName);
+
+//        GBeanInfo configStoreInfo = GBeanInfo.getGBeanInfo(configStoreClass, cl);
+//        GBeanData storeGBean = new GBeanData(configStoreName, configStoreInfo);
+//        Set refs = configStoreInfo.getReferences();
+//        for (Iterator iterator = refs.iterator(); iterator.hasNext();) {
+//            GReferenceInfo refInfo = (GReferenceInfo) iterator.next();
+//            if ("Repository".equals(refInfo.getName())) {
+//                storeGBean.setReferencePattern("Repository", repositoryName);
+//                break;
+//            }
+//        }
+//        kernel.loadGBean(storeGBean, cl);
+//        kernel.startGBean(configStoreName);
+
+//        GBeanData configManagerGBean = new GBeanData(configManagerName, KernelConfigurationManager.GBEAN_INFO);
+//        configManagerGBean.setReferencePattern("Stores", configStoreName);
+//        configManagerGBean.setReferencePattern("AttributeStore", attributeStoreName);
+//        configManagerGBean.setReferencePattern("ArtifactManager", artifactManagerName);
+//        configManagerGBean.setReferencePattern("ArtifactResolver", artifactResolverName);
+//        kernel.loadGBean(configManagerGBean, cl);
+//        kernel.startGBean(configManagerName);
+//
+//        GBeanData attrManagerGBean = new GBeanData(attributeStoreName, MavenAttributeStore.GBEAN_INFO);
+//        kernel.loadGBean(attrManagerGBean, cl);
+//        kernel.startGBean(attributeStoreName);
+
+
 
-        GBeanData configManagerGBean = new GBeanData(configManagerName, KernelConfigurationManager.GBEAN_INFO);
-        configManagerGBean.setReferencePattern("Stores", configStoreName);
-        configManagerGBean.setReferencePattern("AttributeStore", attributeStoreName);
-        configManagerGBean.setReferencePattern("ArtifactManager", artifactManagerName);
-        configManagerGBean.setReferencePattern("ArtifactResolver", artifactResolverName);
-        kernel.loadGBean(configManagerGBean, cl);
-        kernel.startGBean(configManagerName);
-
-        GBeanData attrManagerGBean = new GBeanData(attributeStoreName, MavenAttributeStore.GBEAN_INFO);
-        kernel.loadGBean(attrManagerGBean, cl);
-        kernel.startGBean(attributeStoreName);
     }
 
     /**
@@ -361,19 +401,19 @@
      * @return the ObjectName of the Deployer GBean
      * @throws IllegalStateException if there is not exactly one GBean matching the deployerName pattern
      */
-    private ObjectName locateDeployer(Kernel kernel) {
-        Iterator i = kernel.listGBeans(deployerName).iterator();
+    private AbstractName locateDeployer(Kernel kernel) {
+        Iterator i = kernel.listGBeans(new AbstractNameQuery(deployerName)).iterator();
         if (!i.hasNext()) {
             throw new IllegalStateException("No deployer found matching deployerName: " + deployerName);
         }
-        ObjectName deployer = (ObjectName) i.next();
+        AbstractName deployer = (AbstractName) i.next();
         if (i.hasNext()) {
             throw new IllegalStateException("Multiple deployers found matching deployerName: " + deployerName);
         }
         return deployer;
     }
 
-    private List invokeDeployer(Kernel kernel, ObjectName deployer) throws Exception {
+    private List invokeDeployer(Kernel kernel, AbstractName deployer) throws Exception {
         boolean isExecutable = mainClass != null;
         Object[] args = {planFile, moduleFile, isExecutable ? packageFile : null, Boolean.valueOf(!isExecutable), mainClass, classPath, endorsedDirs, extensionDirs};
         return (List) kernel.invoke(deployer, "deploy", args, ARG_TYPES);



Mime
View raw message