geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r412620 - in /geronimo/trunk: applications/console/console-standard/src/java/org/apache/geronimo/console/car/ assemblies/j2ee-jetty-server/src/var/config/ assemblies/j2ee-tomcat-server/src/var/config/ assemblies/minimal-jetty-server/src/var...
Date Thu, 08 Jun 2006 00:04:50 GMT
Author: ammulder
Date: Wed Jun  7 17:04:49 2006
New Revision: 412620

URL: http://svn.apache.org/viewvc?rev=412620&view=rev
Log:
Merge fixes for GERONIMO-2076 GERONIMO-2088 and GERONIMO-2089 to trunk
 - updated to point to 1.2 plugin repo (which is currently empty)

Modified:
    geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
    geronimo/trunk/assemblies/j2ee-jetty-server/src/var/config/config.xml
    geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml
    geronimo/trunk/assemblies/minimal-jetty-server/src/var/config/config.xml
    geronimo/trunk/assemblies/minimal-tomcat-server/src/var/config/config.xml
    geronimo/trunk/assemblies/zzzzj2ee-installer/src/var/config/config.xml
    geronimo/trunk/configs/directory/src/conf/geronimo-plugin.xml
    geronimo/trunk/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java

Modified: geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
(original)
+++ geronimo/trunk/applications/console/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
Wed Jun  7 17:04:49 2006
@@ -152,9 +152,9 @@
                 progressInfo.setMainMessage(results.getCurrentMessage());
                 progressInfo.setProgressPercent(results.getCurrentFilePercent());
                 progressInfo.setFinished(results.isFinished());
-                log.info(progressInfo.getMainMessage());
+                log.debug(progressInfo.getMainMessage());
                 if (results.isFinished()) {
-                    log.info("Installation finished");
+                    log.debug("Installation finished");
                     session.setAttribute(DOWNLOAD_RESULTS_SESSION_KEY, results);
                     break;
                 } else {

Modified: geronimo/trunk/assemblies/j2ee-jetty-server/src/var/config/config.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/assemblies/j2ee-jetty-server/src/var/config/config.xml?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/assemblies/j2ee-jetty-server/src/var/config/config.xml (original)
+++ geronimo/trunk/assemblies/j2ee-jetty-server/src/var/config/config.xml Wed Jun  7 17:04:49
2006
@@ -15,6 +15,10 @@
             <!-- Check whether this really works if host name is 0.0.0.0 -->
             <attribute name="namingProviderUrl">rmi://${PlanServerHostname}:${PlanNamingPort}</attribute>
         </gbean>
+        <gbean name="DownloadedPluginRepos">
+          <attribute name="repositoryList">http://people.apache.org/~ammulder/plugin-repository-list-1.2.txt</attribute>
+          <attribute name="userRepositories">[]</attribute>
+        </gbean>
     </module>
     <module name="geronimo/j2ee-server/${pom.currentVersion}/car">
     </module>
@@ -62,13 +66,6 @@
         </gbean>
     </module>
     <module name="geronimo/activemq/${pom.currentVersion}/car"/>
-    <module name="geronimo/directory/${pom.currentVersion}/car" load="false">
-        <gbean name="geronimo.server:name=DirectoryService">
-            <attribute name="host">${PlanServerHostname}</attribute>
-            <attribute name="port">${PlanLdapPort}</attribute>
-        </gbean>
-    </module>
-    <module name="geronimo/ldap-realm/${pom.currentVersion}/car" load="false"/>
     <module name="geronimo/jetty/${pom.currentVersion}/car">
         <gbean name="JettyWebConnector">
             <attribute name="host">${PlanServerHostname}</attribute>

Modified: geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml (original)
+++ geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/config/config.xml Wed Jun  7 17:04:49
2006
@@ -15,6 +15,10 @@
             <!-- Check whether this really works if host name is 0.0.0.0 -->
             <attribute name="namingProviderUrl">rmi://${PlanServerHostname}:${PlanNamingPort}</attribute>
         </gbean>
+        <gbean name="DownloadedPluginRepos">
+          <attribute name="repositoryList">http://people.apache.org/~ammulder/plugin-repository-list-1.2.txt</attribute>
+          <attribute name="userRepositories">[]</attribute>
+        </gbean>
     </module>
     <module name="geronimo/j2ee-server/${pom.currentVersion}/car">
     </module>
@@ -62,13 +66,6 @@
         </gbean>
     </module>
     <module name="geronimo/activemq/${pom.currentVersion}/car"/>
-    <module name="geronimo/directory/${pom.currentVersion}/car" load="false">
-        <gbean name="geronimo.server:name=DirectoryService">
-            <attribute name="host">${PlanServerHostname}</attribute>
-            <attribute name="port">${PlanLdapPort}</attribute>
-        </gbean>
-    </module>
-    <module name="geronimo/ldap-realm/${pom.currentVersion}/car" load="false"/>
     <module name="geronimo/tomcat/${pom.currentVersion}/car">
         <gbean name="TomcatEngine">
             <reference name="TomcatValveChain" />

Modified: geronimo/trunk/assemblies/minimal-jetty-server/src/var/config/config.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/assemblies/minimal-jetty-server/src/var/config/config.xml?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/assemblies/minimal-jetty-server/src/var/config/config.xml (original)
+++ geronimo/trunk/assemblies/minimal-jetty-server/src/var/config/config.xml Wed Jun  7 17:04:49
2006
@@ -15,6 +15,10 @@
             <!-- Check whether this really works if host name is 0.0.0.0 -->
             <attribute name="namingProviderUrl">rmi://${PlanServerHostname}:${PlanNamingPort}</attribute>
         </gbean>
+        <gbean name="DownloadedPluginRepos">
+          <attribute name="repositoryList">http://people.apache.org/~ammulder/plugin-repository-list-1.2.txt</attribute>
+          <attribute name="userRepositories">[]</attribute>
+        </gbean>
     </module>
     <module name="geronimo/j2ee-server/${pom.currentVersion}/car"/>
     <module name="geronimo/j2ee-security/${pom.currentVersion}/car">

Modified: geronimo/trunk/assemblies/minimal-tomcat-server/src/var/config/config.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/assemblies/minimal-tomcat-server/src/var/config/config.xml?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/assemblies/minimal-tomcat-server/src/var/config/config.xml (original)
+++ geronimo/trunk/assemblies/minimal-tomcat-server/src/var/config/config.xml Wed Jun  7 17:04:49
2006
@@ -15,6 +15,10 @@
             <!-- Check whether this really works if host name is 0.0.0.0 -->
             <attribute name="namingProviderUrl">rmi://${PlanServerHostname}:${PlanNamingPort}</attribute>
         </gbean>
+        <gbean name="DownloadedPluginRepos">
+          <attribute name="repositoryList">http://people.apache.org/~ammulder/plugin-repository-list-1.2.txt</attribute>
+          <attribute name="userRepositories">[]</attribute>
+        </gbean>
     </module>
     <module name="geronimo/j2ee-server/${pom.currentVersion}/car"/>
     <module name="geronimo/j2ee-security/${pom.currentVersion}/car">

Modified: geronimo/trunk/assemblies/zzzzj2ee-installer/src/var/config/config.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/assemblies/zzzzj2ee-installer/src/var/config/config.xml?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/assemblies/zzzzj2ee-installer/src/var/config/config.xml (original)
+++ geronimo/trunk/assemblies/zzzzj2ee-installer/src/var/config/config.xml Wed Jun  7 17:04:49
2006
@@ -15,6 +15,10 @@
             <!-- Check whether this really works if host name is 0.0.0.0 -->
             <attribute name="namingProviderUrl">rmi://${PlanServerHostname}:${PlanNamingPort}</attribute>
         </gbean>
+        <gbean name="DownloadedPluginRepos">
+          <attribute name="repositoryList">http://people.apache.org/~ammulder/plugin-repository-list-1.2.txt</attribute>
+          <attribute name="userRepositories">[]</attribute>
+        </gbean>
     </module>
     <module name="geronimo/j2ee-server/${pom.currentVersion}/car" load="${J2EE.Features.enable}">
         <gbean name="geronimo:name=EJB,type=NetworkService">

Modified: geronimo/trunk/configs/directory/src/conf/geronimo-plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/directory/src/conf/geronimo-plugin.xml?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/configs/directory/src/conf/geronimo-plugin.xml (original)
+++ geronimo/trunk/configs/directory/src/conf/geronimo-plugin.xml Wed Jun  7 17:04:49 2006
@@ -26,4 +26,11 @@
 <dependency>geronimo/geronimo-directory//jar</dependency>
 <source-repository>http://www.geronimoplugins.com/repository/geronimo-1.1/</source-repository>
 <source-repository>http://www.ibiblio.org/maven2/</source-repository>
+<config-xml-content>
+  <gbean xmlns="http://geronimo.apache.org/xml/ns/attributes-1.1"
+         name="DirectoryService">
+    <attribute name="host">0.0.0.0</attribute>
+    <attribute name="port">1389</attribute>
+  </gbean>
+</config-xml-content>
 </geronimo-plugin>

Modified: geronimo/trunk/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java
(original)
+++ geronimo/trunk/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java
Wed Jun  7 17:04:49 2006
@@ -59,6 +59,16 @@
         checkContents(collection);
     }
 
+    public void testEmpty() {
+        String input = "[]";
+        editor.setAsText(input);
+        Object output = editor.getValue();
+        assertNotNull(output);
+        checkType(output);
+        Collection collection = (Collection) output;
+        assertEquals(0, collection.size());
+    }
+
     private void checkContents(Collection collection) {
         assertEquals(2, collection.size());
         Iterator iterator = collection.iterator();

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Wed Jun  7 17:04:49 2006
@@ -21,6 +21,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.BufferedOutputStream;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -37,8 +38,11 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedSet;
+import java.util.Enumeration;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
 import java.util.zip.ZipEntry;
 import javax.security.auth.login.FailedLoginException;
 import javax.xml.parsers.DocumentBuilder;
@@ -174,6 +178,15 @@
      *                 The configId must be fully resolved (isResolved() == true)
      */
     public PluginMetadata getPluginMetadata(Artifact moduleId) {
+        if(configManager != null) {
+            if(!configManager.isConfiguration(moduleId)) {
+                return null;
+            }
+        } else {
+            if(!configStore.containsConfiguration(moduleId)) {
+                return null;
+            }
+        }
         File dir = writeableRepo.getLocation(moduleId);
         Document doc;
         ConfigurationData configData;
@@ -216,8 +229,10 @@
             overrideDependencies(configData, result);
             return result;
         } catch (InvalidConfigException e) {
+            e.printStackTrace();
             log.warn("Unable to generate metadata for "+moduleId, e);
         } catch (Exception e) {
+            e.printStackTrace();
             log.warn("Invalid XML at "+source, e);
         }
         return null;
@@ -238,25 +253,73 @@
         if(dir == null) {
             throw new IllegalArgumentException(metadata.getModuleId()+" is not installed!");
         }
-        File meta = new File(dir, "META-INF");
-        if(!meta.isDirectory() || !meta.canRead()) {
-            throw new IllegalArgumentException(metadata.getModuleId()+" is not a plugin!");
-        }
-        File xml = new File(meta, "geronimo-plugin.xml");
-        try {
-            if(!xml.isFile()) {
-                if(!xml.createNewFile()) {
-                    throw new RuntimeException("Cannot create plugin metadata file for "+metadata.getModuleId());
+        if(!dir.isDirectory()) { // must be a packed (JAR-formatted) plugin
+            try {
+                File temp = new File(dir.getParentFile(), dir.getName()+".temp");
+                JarFile input = new JarFile(dir);
+                Manifest manifest = input.getManifest();
+                JarOutputStream out = manifest == null ? new JarOutputStream(new BufferedOutputStream(new
FileOutputStream(temp)))
+                        : new JarOutputStream(new BufferedOutputStream(new FileOutputStream(temp)),
manifest);
+                Enumeration enum = input.entries();
+                byte[] buf = new byte[4096];
+                int count;
+                while (enum.hasMoreElements()) {
+                    JarEntry entry = (JarEntry) enum.nextElement();
+                    if(entry.getName().equals("META-INF/geronimo-plugin.xml")) {
+                        entry = new JarEntry(entry.getName());
+                        out.putNextEntry(entry);
+                        Document doc = writePluginMetadata(metadata);
+                        TransformerFactory xfactory = TransformerFactory.newInstance();
+                        Transformer xform = xfactory.newTransformer();
+                        xform.setOutputProperty(OutputKeys.INDENT, "yes");
+                        xform.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
"2");
+                        xform.transform(new DOMSource(doc), new StreamResult(out));
+                    } else if(entry.getName().equals("META-INF/MANIFEST.MF")) {
+                        // do nothing, already passed in a manifest
+                    } else {
+                        out.putNextEntry(entry);
+                        InputStream in = input.getInputStream(entry);
+                        while((count = in.read(buf)) > -1) {
+                            out.write(buf, 0, count);
+                        }
+                        in.close();
+                        out.closeEntry();
+                    }
                 }
+                out.flush();
+                out.close();
+                input.close();
+                if(!dir.delete()) {
+                    throw new IOException("Unable to delete old plugin at "+dir.getAbsolutePath());
+                }
+                if(!temp.renameTo(dir)) {
+                    throw new IOException("Unable to move new plugin "+temp.getAbsolutePath()+"
to "+dir.getAbsolutePath());
+                }
+            } catch (Exception e) {
+                log.error("Unable to update plugin metadata", e);
+                throw new RuntimeException("Unable to update plugin metadata", e);
+            }
+        } else {
+            File meta = new File(dir, "META-INF");
+            if(!meta.isDirectory() || !meta.canRead()) {
+                throw new IllegalArgumentException(metadata.getModuleId()+" is not a plugin!");
+            }
+            File xml = new File(meta, "geronimo-plugin.xml");
+            try {
+                if(!xml.isFile()) {
+                    if(!xml.createNewFile()) {
+                        throw new RuntimeException("Cannot create plugin metadata file for
"+metadata.getModuleId());
+                    }
+                }
+                Document doc = writePluginMetadata(metadata);
+                TransformerFactory xfactory = TransformerFactory.newInstance();
+                Transformer xform = xfactory.newTransformer();
+                xform.setOutputProperty(OutputKeys.INDENT, "yes");
+                xform.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+                xform.transform(new DOMSource(doc), new StreamResult(xml));
+            } catch (Exception e) {
+                log.error("Unable to save plugin metadata for "+metadata.getModuleId(), e);
             }
-            Document doc = writePluginMetadata(metadata);
-            TransformerFactory xfactory = TransformerFactory.newInstance();
-            Transformer xform = xfactory.newTransformer();
-            xform.setOutputProperty(OutputKeys.INDENT, "yes");
-            xform.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
-            xform.transform(new DOMSource(doc), new StreamResult(xml));
-        } catch (Exception e) {
-            log.error("Unable to save plugin metadata for "+metadata.getModuleId(), e);
         }
     }
 
@@ -1522,10 +1585,14 @@
             copy.appendChild(doc.createTextNode(file.getSourceFile()));
             config.appendChild(copy);
         }
-        for (int i = 0; i < data.getConfigXmls().length; i++) {
-            GBeanOverride override = data.getConfigXmls()[i];
-            Element gbean = override.writeXml(doc, config);
-            gbean.setAttribute("xmlns", "http://geronimo.apache.org/xml/ns/attributes-1.1");
+        if(data.getConfigXmls().length > 0) {
+            Element content = doc.createElement("config-xml-content");
+            for (int i = 0; i < data.getConfigXmls().length; i++) {
+                GBeanOverride override = data.getConfigXmls()[i];
+                Element gbean = override.writeXml(doc, content);
+                gbean.setAttribute("xmlns", "http://geronimo.apache.org/xml/ns/attributes-1.1");
+            }
+            config.appendChild(content);
         }
         return doc;
     }

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
Wed Jun  7 17:04:49 2006
@@ -76,7 +76,7 @@
         for (int i = 0; i < downloadRepositories.size(); i++) {
             String url = (String) downloadRepositories.get(i);
             try {
-                list.add(new URL(url));
+                list.add(new URL(url.trim()));
             } catch (MalformedURLException e) {
                 log.error("Unable to format plugin repository URL "+url, e);
             }
@@ -84,7 +84,7 @@
         for (int i = 0; i < userRepositories.size(); i++) {
             String url = (String) userRepositories.get(i);
             try {
-                list.add(new URL(url));
+                list.add(new URL(url.trim()));
             } catch (MalformedURLException e) {
                 log.error("Unable to format plugin repository URL "+url, e);
             }

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java?rev=412620&r1=412619&r2=412620&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java
Wed Jun  7 17:04:49 2006
@@ -26,6 +26,8 @@
 import java.util.SortedSet;
 import java.util.Properties;
 import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -40,6 +42,7 @@
 import org.apache.geronimo.kernel.repository.Version;
 import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
 import org.apache.geronimo.system.configuration.ConfigurationStoreUtil;
+import org.apache.geronimo.system.configuration.GBeanOverride;
 import org.apache.geronimo.system.repository.Maven1Repository;
 import org.apache.geronimo.system.repository.Maven2Repository;
 import org.apache.geronimo.system.repository.CopyArtifactTypeHandler;
@@ -53,16 +56,48 @@
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
 import org.xml.sax.SAXException;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
 
 /**
- * A utility that exports a repository of plugins.
+ * A utility that exports a repository of plugins.  To use this:
+ *
+ * 1) Clear out your Maven repo
+ * 2) Build Geronimo or any plugins
+ * 3) Create an output repo
+ * 4) Rsync the current plugin site to the output repo
+ * 5) Run this against your Maven repo and the output repo
+ * 6) Rsync the output repo to the plugin site
+ *
+ * It will migrate all the plugins from the Maven repo location to the output
+ * location, updating the supported Geronimo versions for any that declare only
+ * a snapshot release (using the map below), and calculating hashes for all the
+ * plugins.  It will update the master plugin metadata file and the Maven
+ * metadata file for each artifact directory.
  *
  * @version $Rev$ $Date$
  */
 public class PluginRepositoryExporter {
     private final static String NAMESPACE = "http://geronimo.apache.org/xml/ns/plugins-1.1";
+    private final static Map VERSION_MAP = new HashMap();
+    static {
+        List list = new ArrayList();
+        list.add("1.1-SNAPSHOT");
+        list.add("1.1-20060607");
+        list.add("1.1-rc1");
+        list.add("1.1-rc2");
+        list.add("1.1-rc3");
+        list.add("1.1");
+        VERSION_MAP.put("1.1-SNAPSHOT", list);
+        list = new ArrayList();
+        list.add("1.2-SNAPSHOT");
+        list.add("1.2-beta1");
+        list.add("1.2-beta2");
+        list.add("1.2-beta3");
+        list.add("1.2-rc1");
+        list.add("1.2-rc2");
+        list.add("1.2-rc3");
+        list.add("1.2");
+        VERSION_MAP.put("1.2-SNAPSHOT", list);
+    }
     private Maven1Repository sourceRepo;
     private Maven2Repository destRepo;
     private Map targetVersions;
@@ -196,6 +231,7 @@
                     if(!artifactDir.isDirectory() || !artifactDir.canRead()) {
                         throw new IllegalStateException("Failed to located group/artifact
dir for "+artifact+" (got "+artifactDir.getAbsolutePath()+")");
                     }
+                    updatePluginMetadata(artifact);
                     updateMavenMetadata(artifactDir, artifact);
                 }
             }
@@ -217,6 +253,42 @@
 
     }
 
+    private void updatePluginMetadata(Artifact artifact) {
+        PluginMetadata data = installer.getPluginMetadata(artifact);
+        if(data == null) {
+            return;
+        }
+        if(data.getGeronimoVersions() != null && data.getGeronimoVersions().length
== 1 &&
+                VERSION_MAP.containsKey(data.getGeronimoVersions()[0])) {
+            data.setGeronimoVersions((String[]) ((List) VERSION_MAP.get(data.getGeronimoVersions()[0])).toArray(new
String[0]));
+            if(data.getHash() != null) {
+                data = copy(data);
+            }
+            installer.updatePluginMetadata(data);
+        }
+    }
+
+    /**
+     * Create a copy of a metadata, but with an empty hash.  Used when
+     * something changed so an existing hash would be invalid.
+     */
+    private PluginMetadata copy(PluginMetadata source) {
+        PluginMetadata data = new PluginMetadata(source.getName(), source.getModuleId(),
source.getCategory(),
+                source.getDescription(), source.getPluginURL(), source.getAuthor(), null,
source.isInstalled(),
+                source.isEligible());
+        data.setConfigXmls(source.getConfigXmls());
+        data.setDependencies(source.getDependencies());
+        data.setFilesToCopy(source.getFilesToCopy());
+        data.setForceStart(source.getForceStart());
+        data.setGeronimoVersions(source.getGeronimoVersions());
+        data.setJvmVersions(source.getJvmVersions());
+        data.setLicenses(source.getLicenses());
+        data.setObsoletes(source.getObsoletes());
+        data.setPrerequisites(source.getPrerequisites());
+        data.setRepositories(source.getRepositories());
+        return data;
+    }
+
     private void updateMavenMetadata(File dir, Artifact artifact) throws TransformerException,
IOException, SAXException, ParserConfigurationException {
         File mavenFile = new File(dir, "maven-metadata.xml");
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@@ -280,12 +352,6 @@
         factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",
                              schema.getName());
         DocumentBuilder builder = factory.newDocumentBuilder();
-        builder.setEntityResolver(new EntityResolver() {
-            public InputSource resolveEntity(String publicId, String systemId) throws SAXException,
IOException {
-                System.out.println("RESOLVING PUB "+publicId+" SYS "+systemId);
-                return null;
-            }
-        });
         Document doc = builder.newDocument();
         Element root = doc.createElementNS(NAMESPACE, "geronimo-plugin-list");
         root.setAttribute("xmlns", NAMESPACE);
@@ -353,6 +419,23 @@
 //                URL url = data.getRepositories()[i];
 //                createText(doc, config, "source-repository", url.toString());
 //            }
+            for (int i = 0; i < data.getFilesToCopy().length; i++) {
+                PluginMetadata.CopyFile copyFile = data.getFilesToCopy()[i];
+                Element copy = doc.createElement("copy-file");
+                copy.setAttribute("relative-to", copyFile.isRelativeToVar() ? "server" :
"geronimo");
+                copy.setAttribute("dest-dir", copyFile.getDestDir());
+                copy.appendChild(doc.createTextNode(copyFile.getSourceFile()));
+                config.appendChild(copy);
+            }
+            if(data.getConfigXmls().length > 0) {
+                Element content = doc.createElement("config-xml-content");
+                for (int i = 0; i < data.getConfigXmls().length; i++) {
+                    GBeanOverride override = data.getConfigXmls()[i];
+                    Element gbean = override.writeXml(doc, content);
+                    gbean.setAttribute("xmlns", "http://geronimo.apache.org/xml/ns/attributes-1.1");
+                }
+                config.appendChild(content);
+            }
         }
         Version ger = (Version) targetVersions.get("geronimo");
         createText(doc, root, "default-repository", "http://www.geronimoplugins.com/repository/geronimo-"+ger.getMajorVersion()+"."+ger.getMinorVersion());



Mime
View raw message