On 6/8/06, Alan D. Cabrera <[EMAIL PROTECTED]> wrote:
I see some gold plating sneaking into a feature "frozen" branch.  Since
I am not doing any heavy lifting, I'll leave my comment at that.

I've volunteered to be release manager for 1.2.  Want to join me?  A
little counterweight?  :)

Thanks,
    Aaron

Matt Hogstrom wrote:
> Aaron,
>
> Its been a long day and I've caught up on the JIRAs you created.  I
> think I'm ok with your fixes given the JIRA entries I read through.
>
> I think the PluginRepositoryExporter.java should not be hardcoding
> values in it.  Can you look at moving this to a property file in the
> future?  Geronimo has way too many configuration items hard coded in
> the server (or requires a server rebuild to make changes).  I would
> prefer not to see any other changes in this area for 1.1.
>
> Are there any other bugs that you are aware of that we need to be
> tracking?
>
> Also, if you could take a whack at the JIRAs you moved into 1.1 and
> move them out that would be really helpful.
>
> Thanks
>
> Matt
>
> Matt Hogstrom wrote:
>> Aaron,
>>
>> We are in the process of releasing 1.1.  In the release note I
>> requested that people please let me know before commiting changes to
>> 1.1.  The number of changes you've made below are significant
>> changes.  Can you please revert this change as well as 412621 and
>> hold them for 1.1 please.
>>
>> For specific issues with 1.1 please post a note about the change so
>> we can discuss the content of hte change before applying it to the
>> build.
>>
>> If you would like to bring these issues forward for discussion that
>> would be fine but I'm inclinced to get 1.1 out and have these in 1.1.1.
>>
>> Thanks.
>>
>> Matt
>>
>> [EMAIL PROTECTED] wrote:
>>> Author: ammulder
>>> Date: Wed Jun  7 15:56:52 2006
>>> New Revision: 412604
>>>
>>> URL: http://svn.apache.org/viewvc?rev=412604&view=rev
>>> Log:
>>> Fixes to config.xml, plugins, plugin repo list, plugin installer
>>>  - Plugin exporter can map current version to a set of supported
>>> versions
>>>    to help with problems caused by plugins not running on new test
>>> builds
>>>    of Geronimo
>>>  - config.xml has placeholder for user-added plugin repositories
>>>    GERONIMO-2076
>>>  - Removed Apache directory content from config.xml for 4 main
>>> assemblies
>>>  - Added directory config.xml content to directory plugin metadata
>>>  - Plugin installer writes correct elements for config.xml content
>>>    GERONIMO-2088
>>>  - Plugin exporter includes file copy and config.xml content
>>>    GERONIMO-2089
>>>  - Plugin repository list points to a version-specific file (so 1.1 and
>>>    1.2 can point to different repositories)
>>>  - Trim entries in plugin repository list, just in case
>>>  - Remove some extraneous logging during console plugin download
>>>
>>> Modified:
>>>
>>> 
geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
>>>
>>>
>>> geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml
>>>
>>>
>>> 
geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
>>>
>>>
>>> 
geronimo/branches/1.1/assemblies/minimal-jetty-server/src/var/config/config.xml
>>>
>>>
>>> 
geronimo/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/config.xml
>>>
>>>
>>> 
geronimo/branches/1.1/assemblies/zzzzj2ee-installer/src/var/config/config.xml
>>>
>>>
>>> geronimo/branches/1.1/configs/directory/src/conf/geronimo-plugin.xml
>>>
>>> 
geronimo/branches/1.1/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java
>>>
>>>
>>> 
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
>>>
>>>
>>> 
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
>>>
>>>
>>> 
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java
>>>
>>>
>>> Modified:
>>> 
geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> 
geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
>>> (original)
>>> +++
>>> 
geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
>>> Wed Jun  7 15:56:52 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/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml
>>> (original)
>>> +++
>>> geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml
>>> Wed Jun  7 15:56:52 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.1.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/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> 
geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
>>> (original)
>>> +++
>>> 
geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
>>> Wed Jun  7 15:56:52 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.1.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/branches/1.1/assemblies/minimal-jetty-server/src/var/config/config.xml
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/assemblies/minimal-jetty-server/src/var/config/config.xml?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> 
geronimo/branches/1.1/assemblies/minimal-jetty-server/src/var/config/config.xml
>>> (original)
>>> +++
>>> 
geronimo/branches/1.1/assemblies/minimal-jetty-server/src/var/config/config.xml
>>> Wed Jun  7 15:56:52 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.1.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/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/config.xml
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/config.xml?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> 
geronimo/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/config.xml
>>> (original)
>>> +++
>>> 
geronimo/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/config.xml
>>> Wed Jun  7 15:56:52 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.1.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/branches/1.1/assemblies/zzzzj2ee-installer/src/var/config/config.xml
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/assemblies/zzzzj2ee-installer/src/var/config/config.xml?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> 
geronimo/branches/1.1/assemblies/zzzzj2ee-installer/src/var/config/config.xml
>>> (original)
>>> +++
>>> 
geronimo/branches/1.1/assemblies/zzzzj2ee-installer/src/var/config/config.xml
>>> Wed Jun  7 15:56:52 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.1.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/branches/1.1/configs/directory/src/conf/geronimo-plugin.xml
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/configs/directory/src/conf/geronimo-plugin.xml?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> geronimo/branches/1.1/configs/directory/src/conf/geronimo-plugin.xml
>>> (original)
>>> +++
>>> geronimo/branches/1.1/configs/directory/src/conf/geronimo-plugin.xml
>>> Wed Jun  7 15:56:52 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/branches/1.1/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> 
geronimo/branches/1.1/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java
>>> (original)
>>> +++
>>> 
geronimo/branches/1.1/modules/common/src/test/org/apache/geronimo/common/propertyeditor/AbstractCollectionEditorTest.java
>>> Wed Jun  7 15:56:52 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/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> 
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
>>> (original)
>>> +++
>>> 
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
>>> Wed Jun  7 15:56:52 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/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> 
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
>>> (original)
>>> +++
>>> 
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginRepositoryDownloader.java
>>> Wed Jun  7 15:56:52 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/branches/1.1/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java
>>>
>>> URL:
>>> 
http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java?rev=412604&r1=412603&r2=412604&view=diff
>>>
>>> 
==============================================================================
>>>
>>> ---
>>> 
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java
>>> (original)
>>> +++
>>> 
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java
>>> Wed Jun  7 15:56:52 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());
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>


Reply via email to