As per the discussion on the irc channel, this patch does the following:

1. Adds a new Organization object into the Project model.

So the

<organization>Apache Software Foundation</organization>

element is replaced with

<organization>
  <name>Apache Software Foundation</name>
  <url>http://jakarta.apache.org</url>        
</organization>

2. Modified site.dvsl so that

2a. If the <project href="<project-url>" > attribute doesn't exist, the 
    POM <url> element is used in the project logo.

2b. If there is a <organizationLogo> element in xdocs/project.xml (same 
    format as the <logo> element) the standard Jakarta logo is replaced 
    with the specified logo.

    The logo will link to the organization URL defined in the POM.

2c. The copyright notice in the page footer pays attention to the 
    organization name and inception year defined in the POM.

3. Fixed a bug where the javadocs had ${organization} (literally) in the 
   copyright footer.


Things to do:

1. Test the transformation (sorry, I'm really flagging right now) from 
   version 2 -> version 3 of the POM.

Glenn McAllister
SOMA Networks, Inc.

package org.apache.maven.project;

/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2002 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Apache" and "Apache Software Foundation" and
 *    "Apache Maven" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Maven", nor may "Apache" appear in their name, without
 *    prior written permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 */

/**
 * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
 * @version $Id$
 */
public class Organization
     extends BaseObject
{
    /**
     * Organization url
     */
    private String url;

    /**
     * Sets the url attribute of the Organization object
     */
    public void setUrl(String url)
    {
        this.url = url;
    }

    /**
     * Gets the organization URL.
     *
     * @returns the organization url.
     */
    public String getUrl()
    {
        return url;
    }
} 
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/project.xml,v
retrieving revision 1.64
diff -u -r1.64 project.xml
--- project.xml 21 Apr 2002 12:14:22 -0000      1.64
+++ project.xml 22 Apr 2002 23:08:47 -0000
@@ -5,7 +5,10 @@
   <name>jakarta-turbine-maven</name>
   <id>maven</id>
   <currentVersion>1.0-b4-dev</currentVersion>
-  <organization>Apache Software Foundation</organization>
+  <organization>
+    <name>Apache Software Foundation</name>
+    <url>http://jakarta.apache.org/</url>
+  </organization>
   <inceptionYear>2001</inceptionYear>
   <package>org.apache.maven</package>
 
Index: src/dtd/project.dtd
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/dtd/project.dtd,v
retrieving revision 1.2
diff -u -r1.2 project.dtd
--- src/dtd/project.dtd 29 Mar 2002 10:18:58 -0000      1.2
+++ src/dtd/project.dtd 22 Apr 2002 23:08:47 -0000
@@ -13,7 +13,7 @@
 
 <!ELEMENT currentVersion>
 
-<!ELEMENT organization>
+<!ELEMENT organization (name,url)>
 
 <!ELEMENT inceptionYear>
 
Index: src/dvsl/xdocs/site.dvsl
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/dvsl/xdocs/site.dvsl,v
retrieving revision 1.27
diff -u -r1.27 site.dvsl
--- src/dvsl/xdocs/site.dvsl    22 Apr 2002 15:10:28 -0000      1.27
+++ src/dvsl/xdocs/site.dvsl    22 Apr 2002 23:08:47 -0000
@@ -66,16 +66,44 @@
         <table border="0" cellspacing="0" cellpadding="8" width="100%">
           <tr>
             <td>
-              <a href="http://jakarta.apache.org/";>
-                <img src="$relativePath/images/jakarta-logo-blue.gif" align="left" 
alt="The Jakarta Project" border="0"/>
-              </a>
+              #if( $project.organizationLogo )
+
+                #set( $alt = $project.organizationLogo )
+                #set( $src = $project.organizationLogo.attribute("href") )
+
+                #if ( $projectDescriptor.organization.url )
+                  #set( $home = $projectDescriptor.organization.url )
+                #else
+                  ## Fall back to the project url
+                  #set( $home = $project.attribute( "href" ) )
+                #end
+
+                <a href="$home">
+                #if( $src.startsWith("http") )
+                  <img src="$src" align="left" alt="$alt" border="0" />
+                #else
+                  <img src="$relativePath$src" align="left" alt="$alt" border="0" />
+                #end
+                
+              #else
+              
+                ## Default to the Jakarta logo if one has not been defined.
+                <a href="http://jakarta.apache.org/";>
+                  <img src="$relativePath/images/jakarta-logo-blue.gif" align="left" 
+alt="The Jakarta Project" border="0"/>
+                </a>
+              
+              #end
             </td>
             <td>
               <div align="right" id="login">
                 #if( $project.logo )
 
                   #set( $alt = $project.logo )
-                  #set( $home = $project.attribute("href") )
+                  #if( $project.attribute("href") )
+                    #set( $home = $project.attribute("href") )
+                  #else
+                    #set( $home = $projectDescriptor.url )
+                  #end
                   #set( $src = $project.logo.attribute( "href" ) )
 
                   <a href="$home">
@@ -162,7 +190,19 @@
         <table border="0" cellspacing="0" cellpadding="4">
           <tr>
             <td>
-              &copy; 1999-2002, Apache Software Foundation
+              #if( $projectDescriptor.organization.name )
+                #if( $projectDescriptor.inceptionYear )
+                    #if( $projectDescriptor.inceptionYear == 
+$context.toolbox.currentYear )
+                &copy; ${context.toolbox.currentYear}, 
+$projectDescriptor.organization.name
+                    #else
+                &copy; 
+${projectDescriptor.inceptionYear}-${context.toolbox.currentYear}, 
+$projectDescriptor.organization.name
+                    #end
+                #else
+                &copy; ${context.toolbox.currentYear}, 
+$projectDescriptor.organization.name
+                #end
+              #else
+                &copy; 1999-2002, Apache Software Foundation
+              #end
             </td>
           </tr>
         </table>
Index: src/java/org/apache/maven/ProjectProperties.java
===================================================================
RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ProjectProperties.java,v
retrieving revision 1.27
diff -u -r1.27 ProjectProperties.java
--- src/java/org/apache/maven/ProjectProperties.java    20 Apr 2002 00:17:58 -0000     
 1.27
+++ src/java/org/apache/maven/ProjectProperties.java    22 Apr 2002 23:08:47 -0000
@@ -119,7 +119,9 @@
         for (int i = 0; i < properties.length; i++)
         {
             setProjectProperty(properties[i], mavenProjectMap);            
-        }    
+        } 
+
+        createOrganizationProperties();
                 
         // Let the build process know that the POM has
         // been loaded.
@@ -264,5 +266,17 @@
         AntUtils.createPatternSetReference(getProject(),"jar.resources.set",
             getMavenProject().getBuild().getJarResources());
 
+    }
+
+    private void createOrganizationProperties()
+    {
+        if (getMavenProject().getOrganization() != null)
+        {
+            getProject().setProperty( "maven.organization", 
+                getMavenProject().getOrganization().getName() );
+
+            getProject().setProperty( "maven.organization.url", 
+                getMavenProject().getOrganization().getUrl() );
+        }
     }
 }
Index: src/java/org/apache/maven/project/Project.java
===================================================================
RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/project/Project.java,v
retrieving revision 1.14
diff -u -r1.14 Project.java
--- src/java/org/apache/maven/project/Project.java      19 Apr 2002 17:06:48 -0000     
 1.14
+++ src/java/org/apache/maven/project/Project.java      22 Apr 2002 23:08:48 -0000
@@ -117,7 +117,7 @@
     /**
      * Organization that hosts the project.
      */
-    private String organization;
+    private Organization organization;
 
     /**
      * Year the project was started.
@@ -411,17 +411,21 @@
     }
 
     /**
-     * Sets the organization attribute of the Project object
+     * Sets the project Organization.
+     *
+     * @param organization
      */
-    public void setOrganization(String organization)
+    public void setOrganization(Organization organization)
     {
         this.organization = organization;
     }
 
     /**
-     * Gets the organization attribute of the Project object
+     * Get the Project Organization.
+     *
+     * @return the Project Organization object.
      */
-    public String getOrganization()
+    public Organization getOrganization()
     {
         return organization;
     }
Index: src/templates/build/build-docs.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build-docs.xml,v
retrieving revision 1.55
diff -u -r1.55 build-docs.xml
--- src/templates/build/build-docs.xml  22 Apr 2002 15:01:53 -0000      1.55
+++ src/templates/build/build-docs.xml  22 Apr 2002 23:08:48 -0000
@@ -239,6 +239,7 @@
       <tool name="toolbox.string.srcDir" value="${src.dir}"/>
       <tool name="toolbox.string.srcPresent" value="${sourcesPresent}"/>
       <tool name="toolbox.string.testSrcPresent" value="${unitTestSourcesPresent}"/>
+      <tool name="toolbox.string.currentYear" value="${maven.year}"/>
     </dvsl>
 
     <!-- Then transform user supplied xdocs next -->
@@ -259,6 +260,7 @@
       <tool name="toolbox.string.srcDir" value="${src.dir}"/>
       <tool name="toolbox.string.srcPresent" value="${sourcesPresent}"/>
       <tool name="toolbox.string.testSrcPresent" value="${unitTestSourcesPresent}"/>
+      <tool name="toolbox.string.currentYear" value="${maven.year}"/>
     </dvsl>
 
     <!-- Copy site images -->
@@ -423,7 +425,7 @@
 
     <property
       name="copyright"
-      value="Copyright &amp;copy; ${year} ${organization}. All Rights Reserved."
+      value="Copyright &amp;copy; ${year} ${maven.organization}. All Rights 
+Reserved."
     />
 
     <echo>
Index: src/templates/build/build.init.target
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build.init.target,v
retrieving revision 1.19
diff -u -r1.19 build.init.target
--- src/templates/build/build.init.target       22 Apr 2002 15:01:53 -0000      1.19
+++ src/templates/build/build.init.target       22 Apr 2002 23:08:48 -0000
@@ -35,6 +35,10 @@
     <!-- Set default values for the build -->
     <property file="${maven.home}/default.properties" />
 
+    <tstamp>
+      <format property="maven.year" pattern="yyyy" />
+    </tstamp>
+
   </target>
 
   <!-- We can't do this until Ant 1.5 because references aren't forwarded
Index: src/test/org/apache/maven/project/ProjectMapperTest.java
===================================================================
RCS file: 
/home/cvs/jakarta-turbine-maven/src/test/org/apache/maven/project/ProjectMapperTest.java,v

retrieving revision 1.10
diff -u -r1.10 ProjectMapperTest.java
--- src/test/org/apache/maven/project/ProjectMapperTest.java    16 Apr 2002 21:15:20 
-0000      1.10
+++ src/test/org/apache/maven/project/ProjectMapperTest.java    22 Apr 2002 23:08:48 
+-0000
@@ -95,7 +95,8 @@
 
         assertEquals("jakarta-turbine-maven",p.getName());
         assertEquals("maven", p.getId());
-        assertEquals("Apache Software Foundation", p.getOrganization());
+        assertEquals("Apache Software Foundation", p.getOrganization().getName());
+        assertEquals("http://jakarta.apache.org/";, p.getOrganization().getUrl());
         assertEquals("http://jakarta.apache.org/turbine/maven/",p.getUrl());
         
assertEquals("http://cvs.apache.org/viewcvs/jakarta-turbine-maven/",p.getCvsWebUrl());
         
assertEquals("http://nagoya.apache.org:8080/scarab/servlet/scarab/",p.getIssueTrackingUrl());

Index: src/update/v2-v3/update-descriptor.dvsl
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/update/v2-v3/update-descriptor.dvsl,v
retrieving revision 1.4
diff -u -r1.4 update-descriptor.dvsl
--- src/update/v2-v3/update-descriptor.dvsl     19 Apr 2002 17:06:48 -0000      1.4
+++ src/update/v2-v3/update-descriptor.dvsl     22 Apr 2002 23:08:48 -0000
@@ -47,11 +47,20 @@
   </dependency>
 #end
 
+#match ("organization")
+  <organization>
+    <name>$context.node</name>
+    <url></url>
+  </organization>
+#end
+
 #match ("*")
 #if ($node.name() == "version")
   <pomVersion>3</pomVersion>
 #elseif ($node.name() == "dependencies")
 $context.applyTemplates("dependencies")
+#elseif ($node.name() == "organization")
+$context.applyTemplates("organization")
 #else
 $node.copy()
 #end

Reply via email to