geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r573120 [1/2] - in /geronimo/server/trunk: assemblies/geronimo-jetty6-jee5/src/main/resources/var/config/ configs/rmi-naming/src/main/plan/ configs/rmi-naming/src/plan/ maven-plugins/car-maven-plugin/src/it/j2ee-system/ maven-plugins/car-ma...
Date Thu, 06 Sep 2007 00:30:23 GMT
Author: djencks
Date: Wed Sep  5 17:30:21 2007
New Revision: 573120

URL: http://svn.apache.org/viewvc?rev=573120&view=rev
Log:
GERONIMO-3330 GERONIMO-3453  More changes.  Plugin installer now installs stuff into config.xml, config-substitutions.properties, and external_aliases.properties.  Car-maven-plugin more or less gets this stuff into the geronimo-plugin.xml.

Added:
    geronimo/server/trunk/maven-plugins/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PluginMetadataTest.java   (with props)
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/AliasedArtifactResolver.java   (with props)
    geronimo/server/trunk/modules/geronimo-system/src/test/data/geronimo-plugin.xml   (with props)
    geronimo/server/trunk/modules/geronimo-system/src/test/java/org/apache/geronimo/system/plugin/CopyConfigTest.java   (with props)
Modified:
    geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/resources/var/config/config.xml
    geronimo/server/trunk/configs/rmi-naming/src/main/plan/plan.xml
    geronimo/server/trunk/configs/rmi-naming/src/plan/plan.xml
    geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system/pom.xml
    geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/pom.xml
    geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Attribute.java
    geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanLifecycle.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/PluginAttributeStore.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java
    geronimo/server/trunk/modules/geronimo-system/src/main/xsd/attributes-1.2.xsd
    geronimo/server/trunk/modules/geronimo-system/src/main/xsd/plugins-1.2.xsd
    geronimo/server/trunk/modules/geronimo-system/src/test/java/org/apache/geronimo/system/plugin/PluginInstallerTest.java

Modified: geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/resources/var/config/config.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/resources/var/config/config.xml?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/resources/var/config/config.xml (original)
+++ geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/resources/var/config/config.xml Wed Sep  5 17:30:21 2007
@@ -36,7 +36,7 @@
         </gbean>
         <gbean name="DownloadedPluginRepos">
           <attribute name="repositoryList">http://geronimo.apache.org/plugins/plugin-repository-list-2.1.txt</attribute>
-          <attribute name="userRepositories">file://~/.m2/repository</attribute>
+          <attribute name="userRepositories">~/.m2/repository</attribute>
         </gbean>
     </module>
 

Modified: geronimo/server/trunk/configs/rmi-naming/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/rmi-naming/src/main/plan/plan.xml?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/configs/rmi-naming/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/rmi-naming/src/main/plan/plan.xml Wed Sep  5 17:30:21 2007
@@ -120,9 +120,12 @@
     <reference name="PluginAttributeStore">
       <name>AttributeManager</name>
     </reference>
+    <reference name="ArtifactResolver">
+      <name>ArtifactResolver</name>
+    </reference>
   </gbean>
   <gbean name="DownloadedPluginRepos" class="org.apache.geronimo.system.plugin.PluginRepositoryDownloader">
     <attribute name="repositoryList">http://geronimo.apache.org/plugins/plugin-repository-list-2.0.txt</attribute>
-    <attribute name="userRepositories">file://~/.m2/repository</attribute>
+    <attribute name="userRepositories">~/.m2/repository</attribute>
   </gbean>
 </module>

Modified: geronimo/server/trunk/configs/rmi-naming/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/rmi-naming/src/plan/plan.xml?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/configs/rmi-naming/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/rmi-naming/src/plan/plan.xml Wed Sep  5 17:30:21 2007
@@ -77,11 +77,14 @@
         <reference name="PluginAttributeStore">
             <name>AttributeManager</name>
         </reference>
+        <reference name="ArtifactResolver">
+          <name>ArtifactResolver</name>
+        </reference>
     </gbean>
 
     <gbean name="DownloadedPluginRepos" class="org.apache.geronimo.system.plugin.PluginRepositoryDownloader">
-        <attribute name="repositoryList">http://geronimo.apache.org/plugins/plugin-repository-list-2.0.txt</attribute>
-        <attribute name="userRepositories">file://~/.m2/repository</attribute>
+        <attribute name="repositoryList">http://geronimo.apache.org/plugins/plugin-repository-list-2.1.txt</attribute>
+        <attribute name="userRepositories">~/.m2/repository</attribute>
     </gbean>
     
 </module>

Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system/pom.xml?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system/pom.xml (original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system/pom.xml Wed Sep  5 17:30:21 2007
@@ -213,9 +213,12 @@
 
                     <category>Geronimo Core</category>
                     <osiApproved>true</osiApproved>
+                    <geronimoVersion>2.1-SNAPSHOT</geronimoVersion>
+<!--
                     <geronimoVersions>
                         <value>2.1-SNAPSHOT</value>
                     </geronimoVersions>
+-->
                     <jvmVersions>
                         <value>1.5</value>
                     </jvmVersions>

Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/pom.xml?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/pom.xml (original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/pom.xml Wed Sep  5 17:30:21 2007
@@ -110,10 +110,14 @@
                 <configuration>
                     <category>Test</category>
                     <osiApproved>true</osiApproved>
+                        <geronimoVersion>2.0.1</geronimoVersion>
+                        <geronimoVersion>2.1-SNAPSHOT</geronimoVersion>
+<!--
                     <geronimoVersions>
                         <value>2.0.1</value>
                         <value>2.1-SNAPSHOT</value>
                     </geronimoVersions>
+-->
                     <jvmVersions>
                         <value>1.5</value>
                         <value>1.5.2</value>
@@ -174,6 +178,13 @@
                             </attributes>
                         </gbean>
                     </gbeans>
+                    <configSubstitutions>
+                        key1=value1
+                        key2=value2
+                    </configSubstitutions>
+                    <artifactAliases>
+                        org.apache.geronimo.test/foo//car=org.apache.geronimo.test/bar/1.0/car
+                    </artifactAliases>
                 </configuration>
             </plugin>
         </plugins>

Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Attribute.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Attribute.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Attribute.java (original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Attribute.java Wed Sep  5 17:30:21 2007
@@ -37,18 +37,26 @@
     private String value;
 
 
+    public Attribute() {
+    }
+
+    public Attribute(String name, String value) {
+        this.name = name;
+        this.value = value;
+    }
+
     public String getName() {
         return name;
     }
 
     public String getValue() {
-        return value;
+        return value == null? null: value.replace("#{", "${");
     }
 
     public AttributeType toAttributeType() {
         AttributeType attributeType = new AttributeType();
         attributeType.setName(name);
-        attributeType.getContent().add(value);
+        attributeType.getContent().add(getValue());
         return attributeType;
     }
 }

Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java (original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java Wed Sep  5 17:30:21 2007
@@ -24,13 +24,17 @@
 import java.io.FileOutputStream;
 import java.util.Collections;
 import java.util.List;
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
 
-import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.system.plugin.PluginInstallerGBean;
 import org.apache.geronimo.system.plugin.model.ArtifactType;
 import org.apache.geronimo.system.plugin.model.LicenseType;
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
 import org.apache.geronimo.system.plugin.model.PluginType;
+import org.apache.geronimo.system.plugin.model.PropertyType;
+import org.apache.geronimo.common.propertyeditor.PropertiesEditor;
 import org.apache.maven.model.License;
 
 /**
@@ -111,6 +115,15 @@
      */
     private List<Gbean> gbeans;
 
+    /**
+     * @parameter
+     */
+    private String configSubstitutions;
+    /**
+     * @parameter
+     */
+    private String artifactAliases;
+
     protected void doExecute() throws Exception {
 
         PluginType metadata = new PluginType();
@@ -162,6 +175,19 @@
             instance.setConfigXmlContent(configXmlContent);
         }
 
+        for (Map.Entry<Object, Object> entry: toProperties(configSubstitutions).entrySet()) {
+            PropertyType property = new PropertyType();
+            property.setKey((String) entry.getKey());
+            property.setValue((String) entry.getValue());
+            instance.getConfigSubstitution().add(property);
+        }
+        for (Map.Entry<Object, Object> entry: toProperties(artifactAliases).entrySet()) {
+            PropertyType property = new PropertyType();
+            property.setKey((String) entry.getKey());
+            property.setValue((String) entry.getValue());
+            instance.getArtifactAlias().add(property);
+        }
+
         targetDir.mkdirs();
         FileOutputStream out = new FileOutputStream(targetFile);
         try {
@@ -170,6 +196,15 @@
             out.close();
         }
         getProject().getResources().add(targetFile);
+    }
+
+    private Properties toProperties(String text) {
+        if (text == null) {
+            return new Properties();
+        }
+        PropertiesEditor editor = new PropertiesEditor();
+        editor.setAsText(text);
+        return (Properties) editor.getValue();
     }
 
 }

Added: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PluginMetadataTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PluginMetadataTest.java?rev=573120&view=auto
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PluginMetadataTest.java (added)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PluginMetadataTest.java Wed Sep  5 17:30:21 2007
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.mavenplugins.car;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PluginMetadataTest extends TestCase {
+
+    public void testAttributeEscape() throws Exception {
+        Attribute attr = new Attribute("foo", "#{bar}");
+        assertEquals("${bar}", attr.getValue());
+        assertEquals("${bar}", "#{bar}".replace("#{", "${"));
+    }
+}

Propchange: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PluginMetadataTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PluginMetadataTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PluginMetadataTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanLifecycle.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanLifecycle.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanLifecycle.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanLifecycle.java Wed Sep  5 17:30:21 2007
@@ -17,6 +17,8 @@
 
 package org.apache.geronimo.gbean;
 
+import java.util.Properties;
+
 
 /**
  * An optional interface for a GBean.  When a GBean implements this interface, the implementation

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java Wed Sep  5 17:30:21 2007
@@ -22,6 +22,7 @@
 import java.util.Map;
 import java.util.SortedSet;
 import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -33,20 +34,24 @@
 public class DefaultArtifactResolver implements ArtifactResolver {
     private final ArtifactManager artifactManager;
     private final Collection<? extends ListableRepository> repositories;
-    private final Map<Artifact, Artifact> explicitResolution;
+    private final Map<Artifact, Artifact> explicitResolution = new ConcurrentHashMap<Artifact, Artifact>();
 
     public DefaultArtifactResolver(ArtifactManager artifactManager, ListableRepository repository) {
         this.artifactManager = artifactManager;
         this.repositories = Collections.singleton(repository);
-        this.explicitResolution = Collections.emptyMap();
     }
 
     public DefaultArtifactResolver(ArtifactManager artifactManager, Collection<? extends ListableRepository> repositories, Map<Artifact, Artifact> explicitResolution) {
         this.artifactManager = artifactManager;
         this.repositories = repositories;
-        this.explicitResolution = explicitResolution == null? Collections.<Artifact, Artifact>emptyMap(): explicitResolution;
+        if (explicitResolution != null) {
+            this.explicitResolution.putAll(explicitResolution);
+        }
     }
 
+    protected Map<Artifact, Artifact> getExplicitResolution() {
+        return explicitResolution;
+    }
 
     public Artifact generateArtifact(Artifact source, String defaultType) {
         if(source.isResolved()) {
@@ -100,21 +105,6 @@
     }
 
     public Artifact resolveInClassLoader(Artifact source, Collection<Configuration> parentConfigurations) throws MissingDependencyException {
-        // Some tests break if we acntually try to search for fully-resolved artifacts
-//        if(source.isResolved()) {
-//            return source;
-//        }
-//        if (artifact.getType() == null) {
-//            throw new IllegalArgumentException("Type not set " + artifact);
-//        }
-//
-//        String groupId = source.getGroupId();
-//        if (groupId == null) {
-//            groupId = Artifact.DEFAULT_GROUP_ID;
-//        }
-
-//        Version version = source.getVersion();
-
         Artifact working = resolveVersion(parentConfigurations, source);
         if (working == null || !working.isResolved()) {
             throw new MissingDependencyException("Unable to resolve dependency " + source);

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java Wed Sep  5 17:30:21 2007
@@ -26,9 +26,10 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
+import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -43,14 +44,17 @@
 import org.apache.geronimo.gbean.GAttributeInfo;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.util.XmlUtil;
-import org.apache.geronimo.util.EncryptionManager;
 import org.apache.geronimo.system.configuration.condition.JexlExpressionParser;
+import org.apache.geronimo.system.plugin.model.AttributeType;
+import org.apache.geronimo.system.plugin.model.GbeanType;
+import org.apache.geronimo.system.plugin.model.ReferenceType;
+import org.apache.geronimo.util.EncryptionManager;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -151,6 +155,85 @@
         this.expressionParser = expressionParser;
     }
 
+    public GBeanOverride(GbeanType gbean, JexlExpressionParser expressionParser) throws InvalidGBeanException {
+        String nameString = gbean.getName();
+        if (nameString.indexOf('?') > -1) {
+            name = new AbstractName(URI.create(nameString));
+        } else {
+            name = nameString;
+        }
+
+        String gbeanInfoString = gbean.getGbeanInfo();
+        if ( gbeanInfoString != null && gbeanInfoString.length() > 0) {
+            gbeanInfo = gbeanInfoString;
+        } else {
+            gbeanInfo = null;
+        }
+        if (gbeanInfo != null && !(name instanceof AbstractName)) {
+            throw new InvalidGBeanException("A gbean element using the gbeanInfo attribute must be specified using a full AbstractName: name=" + nameString);
+        }
+
+        load = gbean.isLoad();
+
+        // attributes
+        for (Object o : gbean.getAttributeOrReference()) {
+            if (o instanceof AttributeType) {
+                AttributeType attr = (AttributeType) o;
+                if (attr.isNull()) {
+                    getNullAttributes().add(attr.getName());
+                } else {
+                    List<Object> content = attr.getContent();
+                    StringBuffer buf = new StringBuffer();
+                    for (Object o2 : content) {
+                        if (o2 instanceof String) {
+                            buf.append((String) o2);
+                        } else if (o2 instanceof Node) {
+                            buf.append(getContentsAsText((Node)o2));
+                        } else {
+                            buf.append("===============").append(o2.getClass()).append("===========");
+                            buf.append(o2);
+                        }
+                    }
+                    String value = buf.toString();
+                    if (value.length() == 0) {
+                        setClearAttribute(attr.getName());
+                    } else {
+                        String truevalue = (String) EncryptionManager.decrypt(value);
+                        getAttributes().put(attr.getName(), truevalue);
+                    }
+                }
+            } else if (o instanceof ReferenceType) {
+                ReferenceType ref = (ReferenceType) o;
+                Set<AbstractNameQuery> patternSet = new HashSet<AbstractNameQuery>();
+                for (ReferenceType.Pattern pattern : ref.getPattern()) {
+                    String groupId = pattern.getGroupId();
+                    String artifactId = pattern.getArtifactId();
+                    String version = pattern.getVersion();
+                    String type = pattern.getType();
+                    String module = pattern.getModule();
+                    String name = pattern.getName();
+
+                    Artifact referenceArtifact = null;
+                    if (artifactId != null) {
+                        referenceArtifact = new Artifact(groupId, artifactId, version, type);
+                    }
+                    Map<String, String> nameMap = new HashMap<String, String>();
+                    if (module != null) {
+                        nameMap.put("module", module);
+                    }
+                    if (name != null) {
+                        nameMap.put("name", name);
+                    }
+                    AbstractNameQuery abstractNameQuery = new AbstractNameQuery(referenceArtifact, nameMap, Collections.EMPTY_SET);
+                    patternSet.add(abstractNameQuery);
+                }
+                ReferencePatterns patterns = new ReferencePatterns(patternSet);
+                getReferences().put(ref.getName(), patterns);
+            }
+        }
+        this.expressionParser = expressionParser;
+    }
+
     public GBeanOverride(Element gbean, JexlExpressionParser expressionParser) throws InvalidGBeanException {
         String nameString = gbean.getAttribute("name");
         if (nameString.indexOf('?') > -1) {
@@ -262,10 +345,10 @@
         if (children.getLength() > 1) {
             throw new InvalidGBeanException("invalid name, too many parts named: " + name);
         }
-        return getContentsAsText((Element) children.item(0));
+        return getContentsAsText(children.item(0));
     }
 
-    private static String getContentsAsText(Element element) throws InvalidGBeanException {
+    private static String getContentsAsText(Node element) throws InvalidGBeanException {
         String value = "";
         NodeList text = element.getChildNodes();
         for (int t = 0; t < text.getLength(); t++) {
@@ -462,7 +545,8 @@
      * Creates a new child of the supplied parent with the data for this
      * GBeanOverride, adds it to the parent, and then returns the new
      * child element.
-     * @param doc document containing the module, hence also the element returned from this method.
+     *
+     * @param doc    document containing the module, hence also the element returned from this method.
      * @param parent module element this override will be inserted into
      * @return newly created element for this override
      */
@@ -650,7 +734,7 @@
             return attributeStringValue;
         } catch (ClassNotFoundException e) {
             //todo: use the Configuration's ClassLoader to load the attribute, if this ever becomes an issue
-            throw (InvalidAttributeException)new InvalidAttributeException("Unable to store attribute type " + type).initCause(e);
+            throw (InvalidAttributeException) new InvalidAttributeException("Unable to store attribute type " + type).initCause(e);
         }
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Wed Sep  5 17:30:21 2007
@@ -63,6 +63,7 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.util.XmlUtil;
 import org.apache.geronimo.system.configuration.condition.JexlExpressionParser;
+import org.apache.geronimo.system.plugin.model.GbeanType;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -102,11 +103,18 @@
 
     private boolean kernelFullyStarted;
 
-    public LocalAttributeManager(String configFile, String configSubstitutionsFile, String configSubstitutionsPrefix, boolean readOnly, ServerInfo serverInfo) {
+    private String prefix;
+    private File configSubstitutionsFile;
+    private Properties localConfigSubstitutions;
+
+    public LocalAttributeManager(String configFile, String configSubstitutionsFileName, String configSubstitutionsPrefix, boolean readOnly, ServerInfo serverInfo) {
         this.configFile = System.getProperty(CONFIG_FILE_PROPERTY, configFile);
-        String resolvedPropertiesFile = System.getProperty(SUBSTITUTIONS_FILE_PROPERTY, configSubstitutionsFile);
-        String prefix = System.getProperty(SUBSTITUTION_PREFIX_PREFIX, configSubstitutionsPrefix);
-        expressionParser = loadProperties(resolvedPropertiesFile, serverInfo, prefix);
+        String resolvedPropertiesFile = System.getProperty(SUBSTITUTIONS_FILE_PROPERTY, configSubstitutionsFileName);
+        configSubstitutionsFile = resolvedPropertiesFile == null? null: serverInfo.resolveServer(resolvedPropertiesFile);
+        localConfigSubstitutions = loadConfigSubstitutions(configSubstitutionsFile);
+        prefix = System.getProperty(SUBSTITUTION_PREFIX_PREFIX, configSubstitutionsPrefix);
+        Map<String, String> configSubstitutions = loadAllConfigSubstitutions(localConfigSubstitutions, prefix);
+        expressionParser = new JexlExpressionParser(configSubstitutions);
         this.readOnly = readOnly;
         this.serverInfo = serverInfo;
         serverOverride = new ServerOverride();
@@ -174,13 +182,13 @@
     /**
      * Set the attributes from the attribute store on a single gbean, and return whether or not to load the gbean.
      *
-     * @param data GBeanData we are going to override attributes on
+     * @param data          GBeanData we are going to override attributes on
      * @param configuration the module override the gbean relates to
-     * @param configName name of the module (why can't this be determined from the configuration?)
-     * @param classLoader ClassLoader to use for property objects/PropertyEditors
+     * @param configName    name of the module (why can't this be determined from the configuration?)
+     * @param classLoader   ClassLoader to use for property objects/PropertyEditors
      * @return true if the gbean should be loaded, false otherwise.
-     * @throws org.apache.geronimo.kernel.config.InvalidConfigException if we cannot update the gbeanData
-     *
+     * @throws org.apache.geronimo.kernel.config.InvalidConfigException
+     *          if we cannot update the gbeanData
      */
     private synchronized boolean setAttributes(GBeanData data, ConfigurationOverride configuration, Artifact configName, ClassLoader classLoader) throws InvalidConfigException {
         AbstractName gbeanName = data.getAbstractName();
@@ -197,17 +205,25 @@
         return gbean.applyOverrides(data, configName, gbeanName, classLoader);
     }
 
-    public void setModuleGBeans(Artifact moduleName, GBeanOverride[] gbeans) {
+    public void setModuleGBeans(Artifact moduleName, List<GbeanType> gbeans) throws InvalidGBeanException {
         if (readOnly) {
             return;
         }
         ConfigurationOverride configuration = serverOverride.getConfiguration(moduleName, true);
-        for (GBeanOverride gbean : gbeans) {
-            configuration.addGBean(gbean);
+        for (GbeanType gbean : gbeans) {
+            GBeanOverride override = new GBeanOverride(gbean, expressionParser);
+            configuration.addGBean(override);
         }
         attributeChanged();
     }
 
+    public void addConfigSubstitutions(Properties properties) {
+        localConfigSubstitutions.putAll(properties);
+        Map<String, String> configSubstutions = loadAllConfigSubstitutions(localConfigSubstitutions, prefix);
+        storeConfigSubstitutions(configSubstitutionsFile, localConfigSubstitutions);
+        expressionParser.setVariables(configSubstutions);
+    }
+
     public synchronized void setValue(Artifact configurationName, AbstractName gbeanName, GAttributeInfo attribute, Object value, ClassLoader classLoader) {
         if (readOnly) {
             return;
@@ -397,7 +413,8 @@
 
         // rename the temp file the the configuration file
         if (!tempFile.renameTo(attributeFile)) {
-            throw new IOException("EXTREMELY CRITICAL!  Unable to move manageable attributes working file to proper file name!  Configuration will revert to defaults unless this is manually corrected!  (could not rename " + tempFile.getAbsolutePath() + " to " + attributeFile.getAbsolutePath() + ")");
+            throw new IOException(
+                    "EXTREMELY CRITICAL!  Unable to move manageable attributes working file to proper file name!  Configuration will revert to defaults unless this is manually corrected!  (could not rename " + tempFile.getAbsolutePath() + " to " + attributeFile.getAbsolutePath() + ")");
         }
     }
 
@@ -612,35 +629,63 @@
         }
     }
 
-    private static JexlExpressionParser loadProperties(String propertiesFile, ServerInfo serverInfo, String prefix) {
+    private static Map<String, String> loadAllConfigSubstitutions(Properties configSubstitutions, String prefix) {
         Map<String, String> vars = new HashMap<String, String>();
+        //most significant are the command line system properties
+        addGeronimoSubstitutions(vars, System.getProperties(), prefix);
+        //environment variables are next
+        addGeronimoSubstitutions(vars, System.getenv(), prefix);
         //properties file is least significant
-        if (propertiesFile != null) {
-            Properties properties = new Properties();
-            File thePropertiesFile = serverInfo.resolveServer(propertiesFile);
-            log.debug("Loading properties file " + thePropertiesFile.getAbsolutePath());
+        if (configSubstitutions != null) {
+            addGeronimoSubstitutions(vars, configSubstitutions, "");
+        }
+        return vars;
+    }
+
+    private static Properties loadConfigSubstitutions(File configSubstitutionsFile) {
+        Properties properties = new Properties();
+        if (configSubstitutionsFile != null) {
+            try {
+                FileInputStream in = new FileInputStream(configSubstitutionsFile);
+                try {
+                    properties.load(in);
+                } finally {
+                    in.close();
+                }
+            } catch (Exception e) {
+                log.error("Caught exception " + e
+                        + " trying to open properties file " + configSubstitutionsFile.getAbsolutePath());
+            }
+        }
+        return properties;
+    }
+
+    private static void storeConfigSubstitutions(File configSubstitutionsFile, Properties properties) {
+        if (configSubstitutionsFile != null) {
             try {
-                properties.load(new FileInputStream(thePropertiesFile));
+                FileOutputStream out = new FileOutputStream(configSubstitutionsFile);
+                try {
+                    properties.store(out, null);
+                } finally {
+                    out.close();
+                }
             } catch (Exception e) {
                 log.error("Caught exception " + e
-                        + " trying to open properties file " + thePropertiesFile.getAbsolutePath());
+                        + " trying to open properties file " + configSubstitutionsFile.getAbsolutePath());
             }
-            addGeronimoSubstitutions(vars, properties, "");
         }
-        //environment variables are next
-        addGeronimoSubstitutions(vars, System.getenv(), prefix);
-        //most significant are the command line system properties
-        addGeronimoSubstitutions(vars, System.getProperties(), prefix);
-        return new JexlExpressionParser(vars);
     }
 
     private static void addGeronimoSubstitutions(Map<String, String> vars, Map props, String prefix) {
         if (prefix != null) {
             int start = prefix.length();
-            for (Object o: props.entrySet()) {
+            for (Object o : props.entrySet()) {
                 Map.Entry entry = (Map.Entry) o;
-                if (((String)entry.getKey()).startsWith(prefix)) {
-                    vars.put(((String)entry.getKey()).substring(start), (String)entry.getValue());
+                if (((String) entry.getKey()).startsWith(prefix)) {
+                    String key = ((String) entry.getKey()).substring(start);
+                    if (!vars.containsKey(key)) {
+                        vars.put(key, (String) entry.getValue());
+                    }
                 }
             }
         }

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/PluginAttributeStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/PluginAttributeStore.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/PluginAttributeStore.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/PluginAttributeStore.java Wed Sep  5 17:30:21 2007
@@ -16,8 +16,13 @@
  */
 package org.apache.geronimo.system.configuration;
 
+import java.util.List;
+import java.util.Properties;
+
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.InvalidGBeanException;
+import org.apache.geronimo.system.plugin.model.GbeanType;
 
 /**
  * Extension to the ManageableAttributeStore that supports the plugin
@@ -31,5 +36,7 @@
      * Adds a group of settings to the attribute store.  This is used by e.g.
      * the plugin installer to add the settings needed for a new plugin.
      */
-    public void setModuleGBeans(Artifact moduleName, GBeanOverride[] gbeans);
+    public void setModuleGBeans(Artifact moduleName, List<GbeanType> gbeans) throws InvalidGBeanException;
+
+    void addConfigSubstitutions(Properties properties);
 }

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java Wed Sep  5 17:30:21 2007
@@ -89,6 +89,13 @@
         getVariables().putAll(map);
     }
 
+    public void setVariables(final Map map) {
+        if (map == null) {
+            throw new IllegalArgumentException("map");
+        }
+        context.setVars(map);
+    }
+
     private FlatResolver resolver = new FlatResolver(true);
 
     protected Expression createExpression(final String expression) throws Exception {

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Wed Sep  5 17:30:21 2007
@@ -18,11 +18,11 @@
 
 import java.io.BufferedOutputStream;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.FileInputStream;
 import java.io.OutputStream;
 import java.io.Writer;
 import java.net.HttpURLConnection;
@@ -40,6 +40,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.jar.JarEntry;
@@ -52,8 +53,8 @@
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
@@ -61,29 +62,21 @@
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
-import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.ArtifactResolver;
-import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.kernel.repository.FileWriteMonitor;
 import org.apache.geronimo.kernel.repository.ImportType;
@@ -94,15 +87,17 @@
 import org.apache.geronimo.kernel.util.XmlUtil;
 import org.apache.geronimo.system.configuration.ConfigurationStoreUtil;
 import org.apache.geronimo.system.configuration.PluginAttributeStore;
-import org.apache.geronimo.system.plugin.model.PluginArtifactType;
-import org.apache.geronimo.system.plugin.model.PluginListType;
-import org.apache.geronimo.system.plugin.model.PluginType;
-import org.apache.geronimo.system.plugin.model.HashType;
 import org.apache.geronimo.system.plugin.model.ArtifactType;
-import org.apache.geronimo.system.plugin.model.PrerequisiteType;
 import org.apache.geronimo.system.plugin.model.CopyFileType;
 import org.apache.geronimo.system.plugin.model.DependencyType;
+import org.apache.geronimo.system.plugin.model.HashType;
 import org.apache.geronimo.system.plugin.model.ObjectFactory;
+import org.apache.geronimo.system.plugin.model.PluginArtifactType;
+import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.plugin.model.PluginType;
+import org.apache.geronimo.system.plugin.model.PrerequisiteType;
+import org.apache.geronimo.system.plugin.model.PropertyType;
+import org.apache.geronimo.system.resolver.AliasedArtifactResolver;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.system.threads.ThreadPool;
 import org.apache.geronimo.util.encoders.Base64;
@@ -136,24 +131,24 @@
     }
 
     private static int counter;
-    private ConfigurationManager configManager;
-    private WritableListableRepository writeableRepo;
-    private ConfigurationStore configStore;
-    private ArtifactResolver resolver;
-    private ServerInfo serverInfo;
-    private Map asyncKeys;
-    private ThreadPool threadPool;
-    private PluginAttributeStore attributeStore;
+    private final ConfigurationManager configManager;
+    private final WritableListableRepository writeableRepo;
+    private final ConfigurationStore configStore;
+    private final AliasedArtifactResolver artifactResolver;
+    private final ServerInfo serverInfo;
+    private final Map<Object, DownloadResults> asyncKeys;
+    private final ThreadPool threadPool;
+    private final PluginAttributeStore attributeStore;
 
-    public PluginInstallerGBean(ConfigurationManager configManager, WritableListableRepository repository, ConfigurationStore configStore, ServerInfo serverInfo, ThreadPool threadPool, PluginAttributeStore store) {
+    public PluginInstallerGBean(ConfigurationManager configManager, WritableListableRepository repository, ConfigurationStore configStore, ServerInfo serverInfo, ThreadPool threadPool, PluginAttributeStore store, AliasedArtifactResolver artifactResolver) {
         this.configManager = configManager;
         this.writeableRepo = repository;
         this.configStore = configStore;
         this.serverInfo = serverInfo;
         this.threadPool = threadPool;
-        resolver = new DefaultArtifactResolver(null, writeableRepo);
-        asyncKeys = Collections.synchronizedMap(new HashMap());
+        asyncKeys = Collections.synchronizedMap(new HashMap<Object, DownloadResults>());
         attributeStore = store;
+        this.artifactResolver = artifactResolver;
     }
 
     /**
@@ -164,11 +159,10 @@
      *         (config ID of the plugin).
      */
     public Map getInstalledPlugins() {
-        SortedSet artifacts = writeableRepo.list();
+        SortedSet<Artifact> artifacts = writeableRepo.list();
 
         Map plugins = new HashMap();
-        for (Iterator i = artifacts.iterator(); i.hasNext();) {
-            Artifact configId = (Artifact) i.next();
+        for (Artifact configId : artifacts) {
             File dir = writeableRepo.getLocation(configId);
             if (dir.isDirectory()) {
                 File meta = new File(dir, "META-INF");
@@ -226,7 +220,6 @@
             }
         }
         File dir = writeableRepo.getLocation(moduleId);
-        Document doc;
         ConfigurationData configData;
         String source = dir.getAbsolutePath();
         InputStream in;
@@ -406,7 +399,7 @@
         try {
             //todo: use a progress monitor
             InputStream in = openStream(null, Collections.singletonList(url), username, password, null).getStream();
-            return loadPluginList(mavenRepository, in);
+            return loadPluginList(in);
         } catch (MissingDependencyException e) {
             log.error("Cannot find plugin index at site " + url);
             return null;
@@ -454,7 +447,7 @@
         try {
             Map<Artifact, PluginType> metaMap = new HashMap<Artifact, PluginType>();
             // Step 1: validate everything
-            for (PluginType metadata: pluginsToInstall.getPlugin()) {
+            for (PluginType metadata : pluginsToInstall.getPlugin()) {
                 validatePlugin(metadata);
                 PluginArtifactType instance = metadata.getPluginArtifact().get(0);
 
@@ -464,15 +457,14 @@
             }
 
             // Step 2: everything is valid, do the installation
-            for (PluginType metadata: pluginsToInstall.getPlugin()) {
+            for (PluginType metadata : pluginsToInstall.getPlugin()) {
                 // 2. Unload obsoleted configurations
                 PluginArtifactType instance = metadata.getPluginArtifact().get(0);
                 List<Artifact> obsoletes = new ArrayList<Artifact>();
-                for (ArtifactType obs: instance.getObsoletes()) {
+                for (ArtifactType obs : instance.getObsoletes()) {
                     Artifact obsolete = toArtifact(obs);
                     Artifact[] list = configManager.getArtifactResolver().queryArtifacts(obsolete);
-                    for (int k = 0; k < list.length; k++) {
-                        Artifact artifact = list[k];
+                    for (Artifact artifact : list) {
                         if (configManager.isLoaded(artifact)) {
                             if (configManager.isRunning(artifact)) {
                                 configManager.stopConfiguration(artifact);
@@ -493,7 +485,7 @@
                             username, password, new ResultsFileWriteMonitor(poller), working, false);
                 } else {
                     List<DependencyType> deps = instance.getDependency();
-                    for (DependencyType dep: deps) {
+                    for (DependencyType dep : deps) {
                         Artifact entry = toArtifact(dep);
                         List<String> repos = pluginsToInstall.getDefaultRepository();
                         if (!instance.getSourceRepository().isEmpty()) {
@@ -511,9 +503,9 @@
             }
 
             // Step 3: Start anything that's marked accordingly
-            for (PluginType metadata: pluginsToInstall.getPlugin()) {
+            for (PluginType metadata : pluginsToInstall.getPlugin()) {
                 PluginArtifactType instance = metadata.getPluginArtifact().get(0);
-                for (DependencyType dep: instance.getDependency()) {
+                for (DependencyType dep : instance.getDependency()) {
                     if (dep.isStart()) {
                         Artifact artifact = toArtifact(dep);
                         if (configManager.isConfiguration(artifact)) {
@@ -610,7 +602,7 @@
      * @param key Identifies the operation to check on
      */
     public DownloadResults checkOnInstall(Object key) {
-        DownloadResults results = (DownloadResults) asyncKeys.get(key);
+        DownloadResults results = asyncKeys.get(key);
         results = results.duplicate();
         if (results.isFinished()) {
             asyncKeys.remove(key);
@@ -620,6 +612,11 @@
 
     /**
      * Installs from a pre-downloaded CAR file
+     *
+     * @param carFile  care file to install
+     * @param username repo username
+     * @param password repo password
+     * @param poller   monitor for reporting progress
      */
     public void install(File carFile, String username, String password, DownloadPoller poller) {
         try {
@@ -660,6 +657,10 @@
 
     /**
      * Ensures that a plugin is installable.
+     *
+     * @param plugin plugin to check
+     * @throws org.apache.geronimo.kernel.repository.MissingDependencyException
+     *          if plugin requires a dependency that is not present
      */
     private void validatePlugin(PluginType plugin) throws MissingDependencyException {
         if (plugin.getPluginArtifact().size() != 1) {
@@ -671,7 +672,7 @@
             Artifact artifact = toArtifact(metadata.getModuleId());
             if (configManager.isRunning(artifact)) {
                 boolean upgrade = false;
-                for (ArtifactType obsolete: metadata.getObsoletes()) {
+                for (ArtifactType obsolete : metadata.getObsoletes()) {
                     Artifact test = toArtifact(obsolete);
                     if (test.matches(artifact)) {
                         upgrade = true;
@@ -687,8 +688,8 @@
         }
         // 2. Check that we meet the prerequisites
         List<PrerequisiteType> prereqs = metadata.getPrerequisite();
-        for (PrerequisiteType prereq: prereqs) {
-            if (resolver.queryArtifacts(toArtifact(prereq.getId())).length == 0) {
+        for (PrerequisiteType prereq : prereqs) {
+            if (artifactResolver.queryArtifacts(toArtifact(prereq.getId())).length == 0) {
                 log.error("Required configuration '" + prereq.getId() + "' is not installed.");
                 throw new MissingDependencyException(
                         "Required configuration '" + prereq.getId() + "' is not installed.");
@@ -714,11 +715,14 @@
      * be just a JAR.  For each artifact processed, all its dependencies will be
      * processed as well.
      *
-     * @param configID Identifies the artifact to install
-     * @param repos    The URLs to contact the repositories (in order of preference)
-     * @param username The username used for repositories secured with HTTP Basic authentication
-     * @param password The password used for repositories secured with HTTP Basic authentication
-     * @param monitor  The ongoing results of the download operations, with some monitoring logic
+     * @param configID   Identifies the artifact to install
+     * @param metadata   name to plugin map
+     * @param repos      The URLs to contact the repositories (in order of preference)
+     * @param username   The username used for repositories secured with HTTP Basic authentication
+     * @param password   The password used for repositories secured with HTTP Basic authentication
+     * @param monitor    The ongoing results of the download operations, with some monitoring logic
+     * @param soFar      The set of dependencies already downloaded.
+     * @param dependency Is this a dependency or the original artifact?
      * @throws IOException                When there's a problem reading or writing data
      * @throws FailedLoginException       When a repository requires authentication and either no username
      *                                    and password are supplied or the username and password supplied
@@ -749,6 +753,7 @@
                     try {
                         result.getStream().close();
                     } catch (IOException ignored) {
+                        //ignore
                     }
                 }
                 return;
@@ -771,15 +776,16 @@
                                 "File download incorrect (expected " + hash.getType() + " hash " + hash.getValue() + " but got " + actual + ")");
                     }
                 }
-                // See if the download file has plugin metadata
-                if (pluginData == null) {
-                    try {
-                        pluginData = loadCARFile(tempFile, false);
-                    } catch (Exception e) {
-                        log.error("Unable to read plugin metadata: " + e.getMessage());
-                        throw (IOException) new IOException(
-                                "Unable to read plugin metadata: " + e.getMessage()).initCause(e);
+                // See if the download file has plugin metadata and use it in preference to what is in the catalog.
+                try {
+                    PluginType realPluginData = loadCARFile(tempFile, false);
+                    if (realPluginData != null) {
+                        pluginData = realPluginData;
                     }
+                } catch (Exception e) {
+                    log.error("Unable to read plugin metadata: " + e.getMessage());
+                    throw (IOException) new IOException(
+                            "Unable to read plugin metadata: " + e.getMessage()).initCause(e);
                 }
                 PluginArtifactType instance = null;
                 if (pluginData != null) { // it's a plugin, not a plain JAR
@@ -811,6 +817,11 @@
                             "Installed plugin with moduleId=" + pluginData.getPluginArtifact().get(0).getModuleId() + " and name=" + pluginData.getName());
                 else
                     log.info("Installed artifact=" + configID);
+            } catch (InvalidGBeanException e) {
+                log.error("Invalid gbean configuration ", e);
+                throw new IllegalStateException(
+                        "Invalid GBean configuration: " + e.getMessage(), e);
+
             } finally {
                 result.getStream().close();
             }
@@ -847,8 +858,7 @@
             }
             Dependency[] dependencies = data == null ? getDependencies(writeableRepo, configID) : getDependencies(data);
             // Download the dependencies
-            for (int i = 0; i < dependencies.length; i++) {
-                Dependency dep = dependencies[i];
+            for (Dependency dep : dependencies) {
                 Artifact artifact = dep.getArtifact();
                 log.debug("Attempting to download dependency=" + artifact + " for configuration=" + configID);
                 downloadArtifact(artifact, metadata, repos, username, password, monitor, soFar, true);
@@ -871,7 +881,7 @@
 
     private void extractPluginFiles(Artifact configID, PluginType currentPlugin, ResultsFileWriteMonitor monitor) throws IOException {
         PluginArtifactType instance = currentPlugin.getPluginArtifact().get(0);
-        for (CopyFileType data: instance.getCopyFile()) {
+        for (CopyFileType data : instance.getCopyFile()) {
             monitor.getResults().setCurrentFilePercent(-1);
             monitor.getResults().setCurrentFile(data.getValue());
             monitor.getResults().setCurrentMessage(
@@ -903,7 +913,7 @@
                         "Plugin install cannot write file " + data.getValue() + " to " + data.getDestDir() + " because " + targetDir.getAbsolutePath() + " is not writable");
                 continue;
             }
-            for (URL url: set) {
+            for (URL url : set) {
                 String path = url.getPath();
                 if (path.lastIndexOf('/') > -1) {
                     path = path.substring(path.lastIndexOf('/'));
@@ -947,6 +957,11 @@
     /**
      * Downloads to a temporary file so we can validate the download before
      * installing into the repository.
+     *
+     * @param result  source of download
+     * @param monitor monitor to report results of download
+     * @return downloaded file
+     * @throws IOException if input cannot be read or file cannot be written
      */
     private File downloadFile(OpenResult result, ResultsFileWriteMonitor monitor) throws IOException {
         InputStream in = result.getStream();
@@ -955,7 +970,7 @@
             throw new IllegalStateException();
         }
         FileOutputStream out = null;
-        byte[] buf = null;
+        byte[] buf;
         try {
             monitor.writeStarted(result.getConfigID().toString(), result.fileSize);
             File file = File.createTempFile("geronimo-plugin-download-", ".tmp");
@@ -972,24 +987,22 @@
             in = null;
             out.close();
             out = null;
-            buf = null;
             return file;
         } finally {
             if (in != null) {
                 try {
                     in.close();
-                    in = null;
                 } catch (IOException ignored) {
+                    //ignore
                 }
             }
             if (out != null) {
                 try {
                     out.close();
-                    out = null;
                 } catch (IOException ignored) {
+                    //ignore
                 }
             }
-            buf = null;
         }
     }
 
@@ -997,24 +1010,26 @@
      * Used to get dependencies for a JAR
      */
     private static Dependency[] getDependencies(Repository repo, Artifact artifact) {
-        Set set = repo.getDependencies(artifact);
+        Set<Artifact> set = repo.getDependencies(artifact);
         Dependency[] results = new Dependency[set.size()];
         int index = 0;
-        for (Iterator it = set.iterator(); it.hasNext(); ++index) {
-            Artifact dep = (Artifact) it.next();
+        for (Artifact dep : set) {
             results[index] = new Dependency(dep, ImportType.CLASSES);
+            ++index;
         }
         return results;
     }
 
     /**
      * Used to get dependencies for a Configuration
+     *
+     * @param data configuration data
+     * @return dependencies of configuration
      */
     private static Dependency[] getDependencies(ConfigurationData data) {
-        List dependencies = new ArrayList(data.getEnvironment().getDependencies());
-        Collection children = data.getChildConfigurations().values();
-        for (Iterator it = children.iterator(); it.hasNext();) {
-            ConfigurationData child = (ConfigurationData) it.next();
+        List<Dependency> dependencies = new ArrayList<Dependency>(data.getEnvironment().getDependencies());
+        Collection<ConfigurationData> children = data.getChildConfigurations().values();
+        for (ConfigurationData child : children) {
             dependencies.addAll(child.getEnvironment().getDependencies());
         }
         return (Dependency[]) dependencies.toArray(new Dependency[dependencies.size()]);
@@ -1412,7 +1427,7 @@
     /**
      * Read a set of plugin metadata from a DOM document.
      */
-    private PluginType loadPluginMetadata(InputStream in) throws SAXException, MalformedURLException, JAXBException, XMLStreamException {
+    static PluginType loadPluginMetadata(InputStream in) throws SAXException, MalformedURLException, JAXBException, XMLStreamException {
         XMLStreamReader xmlStream = XMLINPUT_FACTORY.createXMLStreamReader(in);
         Unmarshaller unmarshaller = PLUGIN_CONTEXT.createUnmarshaller();
         JAXBElement<PluginType> element = unmarshaller.unmarshal(xmlStream, PluginType.class);
@@ -1424,7 +1439,7 @@
      * Loads the list of all available plugins from the specified stream
      * (representing geronimo-plugins.xml at the specified repository).
      */
-    private PluginListType loadPluginList(URL repo, InputStream in) throws ParserConfigurationException, IOException, SAXException, JAXBException, XMLStreamException {
+    private static PluginListType loadPluginList(InputStream in) throws ParserConfigurationException, IOException, SAXException, JAXBException, XMLStreamException {
         Unmarshaller unmarshaller = PLUGIN_LIST_CONTEXT.createUnmarshaller();
         XMLStreamReader xmlStream = XMLINPUT_FACTORY.createXMLStreamReader(in);
         JAXBElement<PluginListType> element = unmarshaller.unmarshal(xmlStream, PluginListType.class);
@@ -1443,7 +1458,7 @@
         if (jvmVersions.size() == 0) return true;
         String version = System.getProperty("java.version");
         boolean match = false;
-        for (String jvmVersion: jvmVersions) {
+        for (String jvmVersion : jvmVersions) {
             if (jvmVersion == null || jvmVersion.equals("")) {
                 log.error("jvm-version should not be empty!");
                 throw new IllegalStateException("jvm-version should not be empty!");
@@ -1504,10 +1519,10 @@
     private static String getText(Node target) {
         NodeList nodes = target.getChildNodes();
         StringBuffer buf = null;
-        for(int j=0; j<nodes.getLength(); j++) {
+        for (int j = 0; j < nodes.getLength(); j++) {
             Node node = nodes.item(j);
-            if(node.getNodeType() == Node.TEXT_NODE) {
-                if(buf == null) {
+            if (node.getNodeType() == Node.TEXT_NODE) {
+                if (buf == null) {
                     buf = new StringBuffer();
                 }
                 buf.append(node.getNodeValue());
@@ -1517,35 +1532,35 @@
     }
 
     /**
-      * Gets the text out of all the child nodes of a certain type.  The result
-      * array has one element for each child of the specified DOM element that
-      * has the specified name.
-      *
-      * @param root      The parent DOM element
-      * @param property  The name of the child elements that hold the text
-      */
-     private static String[] getChildrenText(Element root, String property) {
-         NodeList children = root.getChildNodes();
-         List results = new ArrayList();
-         for(int i=0; i<children.getLength(); i++) {
-             Node check = children.item(i);
-             if(check.getNodeType() == Node.ELEMENT_NODE && check.getNodeName().equals(property)) {
-                 NodeList nodes = check.getChildNodes();
-                 StringBuffer buf = null;
-                 for(int j=0; j<nodes.getLength(); j++) {
-                     Node node = nodes.item(j);
-                     if(node.getNodeType() == Node.TEXT_NODE) {
-                         if(buf == null) {
-                             buf = new StringBuffer();
-                         }
-                         buf.append(node.getNodeValue());
-                     }
-                 }
-                 results.add(buf == null ? null : buf.toString());
-             }
-         }
-         return (String[]) results.toArray(new String[results.size()]);
-     }
+     * Gets the text out of all the child nodes of a certain type.  The result
+     * array has one element for each child of the specified DOM element that
+     * has the specified name.
+     *
+     * @param root     The parent DOM element
+     * @param property The name of the child elements that hold the text
+     */
+    private static String[] getChildrenText(Element root, String property) {
+        NodeList children = root.getChildNodes();
+        List results = new ArrayList();
+        for (int i = 0; i < children.getLength(); i++) {
+            Node check = children.item(i);
+            if (check.getNodeType() == Node.ELEMENT_NODE && check.getNodeName().equals(property)) {
+                NodeList nodes = check.getChildNodes();
+                StringBuffer buf = null;
+                for (int j = 0; j < nodes.getLength(); j++) {
+                    Node node = nodes.item(j);
+                    if (node.getNodeType() == Node.TEXT_NODE) {
+                        if (buf == null) {
+                            buf = new StringBuffer();
+                        }
+                        buf.append(node.getNodeValue());
+                    }
+                }
+                results.add(buf == null ? null : buf.toString());
+            }
+        }
+        return (String[]) results.toArray(new String[results.size()]);
+    }
 
     /**
      * Generates dependencies and an optional prerequisite based on a list of
@@ -1571,7 +1586,7 @@
         DependencyType dependency = new DependencyType();
         dependency.setGroupId(id.getGroupId());
         dependency.setArtifactId(id.getArtifactId());
-        dependency.setVersion(id.getVersion() == null? null: id.getVersion().toString());
+        dependency.setVersion(id.getVersion() == null ? null : id.getVersion().toString());
         dependency.setType(id.getType());
         return dependency;
     }
@@ -1588,7 +1603,7 @@
         ArtifactType artifact = new ArtifactType();
         artifact.setGroupId(id.getGroupId());
         artifact.setArtifactId(id.getArtifactId());
-        artifact.setVersion(id.getVersion() == null? null: id.getVersion().toString());
+        artifact.setVersion(id.getVersion() == null ? null : id.getVersion().toString());
         artifact.setType(id.getType());
         return artifact;
     }
@@ -1635,12 +1650,25 @@
      * If a plugin includes config.xml content, copy it into the attribute
      * store.
      */
-    private void installConfigXMLData(Artifact configID, PluginArtifactType pluginData) {
+    private void installConfigXMLData(Artifact configID, PluginArtifactType pluginData) throws InvalidGBeanException, IOException {
         if (configManager.isConfiguration(configID) && attributeStore != null
                 && pluginData != null && pluginData.getConfigXmlContent() != null) {
-            //TODO fix this!!!
-//            attributeStore.setModuleGBeans(configID, pluginData.getConfigXmlContent());
+            attributeStore.setModuleGBeans(configID, pluginData.getConfigXmlContent().getGbean());
+        }
+        if (!pluginData.getConfigSubstitution().isEmpty() && attributeStore != null) {
+            attributeStore.addConfigSubstitutions(toProperties(pluginData.getConfigSubstitution()));
+        }
+        if (!pluginData.getArtifactAlias().isEmpty() && artifactResolver != null) {
+            artifactResolver.addAliases(toProperties(pluginData.getArtifactAlias()));
+        }
+    }
+
+    private Properties toProperties(List<PropertyType> propertyTypes) {
+        Properties properties = new Properties();
+        for (PropertyType propertyType : propertyTypes) {
+            properties.setProperty(propertyType.getKey(), propertyType.getValue());
         }
+        return properties;
     }
 
     /**
@@ -1785,10 +1813,11 @@
         infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
         infoFactory.addReference("ThreadPool", ThreadPool.class, "GBean");
         infoFactory.addReference("PluginAttributeStore", PluginAttributeStore.class, "AttributeStore");
+        infoFactory.addReference("ArtifactResolver", AliasedArtifactResolver.class, "ArtifactResolver");
         infoFactory.addInterface(PluginInstaller.class);
 
         infoFactory.setConstructor(new String[]{"ConfigManager", "Repository", "ConfigStore",
-                "ServerInfo", "ThreadPool", "PluginAttributeStore"});
+                "ServerInfo", "ThreadPool", "PluginAttributeStore", "ArtifactResolver"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java Wed Sep  5 17:30:21 2007
@@ -94,7 +94,7 @@
                         list.add(url);
                     } else if (userRepository.startsWith("~")) {
                         userRepository = userRepository.substring(2);
-                        URI fullUri = new URI("file", System.getProperty("user.home") + "/", null).resolve(userRepository);
+                        URI fullUri = new File(System.getProperty("user.home")).getAbsoluteFile().toURI().resolve(userRepository);
                         list.add(fullUri.toURL());
                     } else {
                         log.error("Can't interpret path: " + userRepository);

Added: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/AliasedArtifactResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/AliasedArtifactResolver.java?rev=573120&view=auto
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/AliasedArtifactResolver.java (added)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/AliasedArtifactResolver.java Wed Sep  5 17:30:21 2007
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.system.resolver;
+
+import java.util.Properties;
+import java.io.IOException;
+
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AliasedArtifactResolver extends ArtifactResolver {
+    void addAliases(Properties properties) throws IOException;
+}

Propchange: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/AliasedArtifactResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/AliasedArtifactResolver.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/AliasedArtifactResolver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java Wed Sep  5 17:30:21 2007
@@ -20,6 +20,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.FileOutputStream;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
@@ -37,13 +38,23 @@
 /**
  * @version $Rev$ $Date$
  */
-public class ExplicitDefaultArtifactResolver extends DefaultArtifactResolver {
+public class ExplicitDefaultArtifactResolver extends DefaultArtifactResolver implements AliasedArtifactResolver {
+    private static final String COMMENT = "#You can use this file to indicate that you want to substitute one module for another.\n" +
+            "#format is oldartifactid=newartifactId e.g.\n" +
+            "#org.apache.geronimo.configs/transaction//car=org.apache.geronimo.configs/transaction-jta11/1.2-SNAPSHOT/car\n" +
+            "#versions can be ommitted on the left side but not the right.\n" +
+            "#This can also specify explicit versions in the same format.";
+
+    private final String versionMapLocation;
+    private final ServerInfo serverInfo;
 
     public ExplicitDefaultArtifactResolver(String versionMapLocation,
             ArtifactManager artifactManager,
             Collection<? extends ListableRepository> repositories,
             ServerInfo serverInfo ) throws IOException {
         super(artifactManager, repositories, buildExplicitResolution(versionMapLocation, serverInfo));
+        this.versionMapLocation = versionMapLocation;
+        this.serverInfo = serverInfo;
     }
 
     private static Map<Artifact, Artifact> buildExplicitResolution(String versionMapLocation, ServerInfo serverInfo) throws IOException {
@@ -71,6 +82,40 @@
             explicitResolution.put(source, resolved);
         }
         return explicitResolution;
+    }
+
+    private static void saveExplicitResolution(Map<Artifact, Artifact> artifactMap, String versionMapLocation, ServerInfo serverInfo) throws IOException {
+        if (versionMapLocation == null) {
+            return;
+        }
+        File location = serverInfo == null? new File(versionMapLocation): serverInfo.resolveServer(versionMapLocation);
+        FileOutputStream in = new FileOutputStream(location);
+        Properties properties = artifactMapToProperties(artifactMap);
+        try {
+            properties.store(in, COMMENT);
+        } finally {
+            in.close();
+        }
+    }
+
+    private static Properties artifactMapToProperties(Map<Artifact, Artifact> artifactMap) {
+        Properties properties = new Properties();
+        for (Map.Entry<Artifact, Artifact> entry: artifactMap.entrySet()) {
+            properties.setProperty(entry.getKey().toString(), entry.getValue().toString());
+        }
+        return properties;
+    }
+
+    /**
+     * Add some more artifact aliases.  The plugin installer calls this
+     * TODO when a plugin is uninstalled, remove the aliases?
+     * @param properties Properties object containing the new aliases
+     * @throws IOException if the modified aliases map cannot be saved.                                            
+     */
+    public synchronized void addAliases(Properties properties) throws IOException {
+        Map<Artifact, Artifact> explicitResolutions = propertiesToArtifactMap(properties);
+        getExplicitResolution().putAll(explicitResolutions);
+        saveExplicitResolution(getExplicitResolution(), versionMapLocation, serverInfo);
     }
 
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/xsd/attributes-1.2.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/xsd/attributes-1.2.xsd?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/xsd/attributes-1.2.xsd (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/xsd/attributes-1.2.xsd Wed Sep  5 17:30:21 2007
@@ -168,7 +168,7 @@
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
-                <xsd:attribute name="null" use="optional">
+                <xsd:attribute name="null" use="optional" type="xsd:boolean" default="false">
                     <xsd:annotation>
                         <xsd:documentation>
                             The null attribute defines if this atribute is null

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/xsd/plugins-1.2.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/xsd/plugins-1.2.xsd?rev=573120&r1=573119&r2=573120&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/xsd/plugins-1.2.xsd (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/xsd/plugins-1.2.xsd Wed Sep  5 17:30:21 2007
@@ -361,7 +361,29 @@
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
+            <xs:element name="artifact-alias" type="list:propertyType" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="config-substitution" type="list:propertyType" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="propertyType">
+        <xs:annotation>
+            <xs:documentation>
+                holds key-value pair.  key is in 'key' attribute, value is in content
+            </xs:documentation>
+        </xs:annotation>
+
+        <xs:simpleContent>
+            <xs:extension base="xs:string">
+                <xs:attribute name="key" use="required" type="xs:string">
+                    <xs:annotation>
+                        <xs:documentation>
+                            key for key-value pair.
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:attribute>
+            </xs:extension>
+        </xs:simpleContent>
     </xs:complexType>
 
     <xs:complexType name="licenseType">

Added: geronimo/server/trunk/modules/geronimo-system/src/test/data/geronimo-plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/test/data/geronimo-plugin.xml?rev=573120&view=auto
==============================================================================
    (empty)

Propchange: geronimo/server/trunk/modules/geronimo-system/src/test/data/geronimo-plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-system/src/test/data/geronimo-plugin.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-system/src/test/data/geronimo-plugin.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message