kaz         02/04/22 18:52:50

  Modified:    .        project.xml
               src/dtd  project.dtd project.xsd
               src/dvsl/xdocs site.dvsl
               src/java/org/apache/maven ProjectProperties.java
               src/java/org/apache/maven/project Project.java
               src/templates/build build-docs.xml build.init.target
               src/test/org/apache/maven/project ProjectMapperTest.java
               src/update/v2-v3 update-descriptor.dvsl
               xdocs    project.xml
  Added:       src/java/org/apache/maven/project Organization.java
  Log:
  Patch submitted by Glenn A. McAllister <[EMAIL PROTECTED]>.
  Thanks!  Just need to test the v2-v3 transform .. I started to but was
  getting errors from the other stuff already in there .. didn't have time
  to figure out the problems.
  
  [glenn's comments]
  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 [in
      xdocs/project.xml] , 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.
  
  Revision  Changes    Path
  1.65      +4 -1      jakarta-turbine-maven/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/project.xml,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- project.xml       21 Apr 2002 12:14:22 -0000      1.64
  +++ project.xml       23 Apr 2002 01:52:50 -0000      1.65
  @@ -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>
   
  
  
  
  1.3       +1 -1      jakarta-turbine-maven/src/dtd/project.dtd
  
  Index: project.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/dtd/project.dtd,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- project.dtd       29 Mar 2002 10:18:58 -0000      1.2
  +++ project.dtd       23 Apr 2002 01:52:50 -0000      1.3
  @@ -13,7 +13,7 @@
   
   <!ELEMENT currentVersion>
   
  -<!ELEMENT organization>
  +<!ELEMENT organization (name,url)>
   
   <!ELEMENT inceptionYear>
   
  
  
  
  1.7       +9 -1      jakarta-turbine-maven/src/dtd/project.xsd
  
  Index: project.xsd
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/dtd/project.xsd,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- project.xsd       15 Apr 2002 08:20:50 -0000      1.6
  +++ project.xsd       23 Apr 2002 01:52:50 -0000      1.7
  @@ -33,7 +33,6 @@
     <xs:element name="name" type='xs:string'/>
     <xs:element name="id" type='xs:string'/>
     <xs:element name="currentVersion" type='xs:string'/>
  -  <xs:element name="organization" type='xs:string'/>
     <xs:element name="inceptionYear" type='xs:string'/>
     <xs:element name="package" type='xs:string'/>
     <xs:element name="shortDescription" type='xs:string'/>
  @@ -45,6 +44,15 @@
     <xs:element name="siteAddress" type='xs:string'/>
     <xs:element name="siteDirectory" type='xs:string'/>
     <xs:element name="distributionDirectory" type='xs:string'/>
  +
  +  <xs:element name="organization">
  +    <xs:complexType>
  +      <xs:sequence>
  +        <xs:element ref="name"/>
  +        <xs:element ref="url"/>
  +      </xs:sequence>
  +    </xs:complexType>
  +  </xs:element>
   
     <xs:element name="distributions">
       <xs:complexType>
  
  
  
  1.28      +45 -5     jakarta-turbine-maven/src/dvsl/xdocs/site.dvsl
  
  Index: site.dvsl
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/dvsl/xdocs/site.dvsl,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- site.dvsl 22 Apr 2002 15:10:28 -0000      1.27
  +++ site.dvsl 23 Apr 2002 01:52:50 -0000      1.28
  @@ -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.toString() == 
$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>
  
  
  
  1.28      +16 -2     
jakarta-turbine-maven/src/java/org/apache/maven/ProjectProperties.java
  
  Index: ProjectProperties.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ProjectProperties.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ProjectProperties.java    20 Apr 2002 00:17:58 -0000      1.27
  +++ ProjectProperties.java    23 Apr 2002 01:52:50 -0000      1.28
  @@ -79,7 +79,7 @@
    * paths required to build the project.
    *
    * @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: ProjectProperties.java,v 1.27 2002/04/20 00:17:58 kaz Exp $
  + * @version $Id: ProjectProperties.java,v 1.28 2002/04/23 01:52:50 kaz Exp $
    */
   public class ProjectProperties
       extends ProjectExecutor
  @@ -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() );
  +        }
       }
   }
  
  
  
  1.15      +10 -6     
jakarta-turbine-maven/src/java/org/apache/maven/project/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/project/Project.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Project.java      19 Apr 2002 17:06:48 -0000      1.14
  +++ Project.java      23 Apr 2002 01:52:50 -0000      1.15
  @@ -59,7 +59,7 @@
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: Project.java,v 1.14 2002/04/19 17:06:48 jvanzyl Exp $
  + * @version $Id: Project.java,v 1.15 2002/04/23 01:52:50 kaz Exp $
    */
   public class Project
        extends BaseObject
  @@ -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;
       }
  
  
  
  1.1                  
jakarta-turbine-maven/src/java/org/apache/maven/project/Organization.java
  
  Index: Organization.java
  ===================================================================
  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: Organization.java,v 1.1 2002/04/23 01:52:50 kaz Exp $
   */
  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;
      }
  } 
  
  
  
  1.56      +3 -1      jakarta-turbine-maven/src/templates/build/build-docs.xml
  
  Index: build-docs.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build-docs.xml,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- build-docs.xml    22 Apr 2002 15:01:53 -0000      1.55
  +++ build-docs.xml    23 Apr 2002 01:52:50 -0000      1.56
  @@ -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="${current.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="${current.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>
  
  
  
  1.22      +4 -0      jakarta-turbine-maven/src/templates/build/build.init.target
  
  Index: build.init.target
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build.init.target,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- build.init.target 22 Apr 2002 20:59:56 -0000      1.21
  +++ build.init.target 23 Apr 2002 01:52:50 -0000      1.22
  @@ -137,6 +137,10 @@
       -->
       
       <project-properties projectDescriptor="project.xml"/>
  +
  +    <tstamp>
  +      <format property="current.year" pattern="yyyy" />
  +    </tstamp>
       
     </target>
   
  
  
  
  1.11      +2 -1      
jakarta-turbine-maven/src/test/org/apache/maven/project/ProjectMapperTest.java
  
  Index: ProjectMapperTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/test/org/apache/maven/project/ProjectMapperTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ProjectMapperTest.java    16 Apr 2002 21:15:20 -0000      1.10
  +++ ProjectMapperTest.java    23 Apr 2002 01:52:50 -0000      1.11
  @@ -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());
  
  
  
  1.5       +30 -19    jakarta-turbine-maven/src/update/v2-v3/update-descriptor.dvsl
  
  Index: update-descriptor.dvsl
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/update/v2-v3/update-descriptor.dvsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- update-descriptor.dvsl    19 Apr 2002 17:06:48 -0000      1.4
  +++ update-descriptor.dvsl    23 Apr 2002 01:52:50 -0000      1.5
  @@ -24,27 +24,36 @@
   ##    list can be used for nagging.
   ## -----------------------------------------------------------------------
   
  -#match ("project")
  -<project>
  -  $context.applyTemplates("*")
  -  if(!$context.cvsRoot)<cvsRoot></cvsRoot>#end
  -  if(!$context.cvsModule)<cvsModule></cvsModule>#end
  -  if(!$context.cvsPassword)<cvsPassword></cvsPassword>#end
  -</project>  
  -#end
  +###match ("project")
  +##<project>
  +##  $context.applyTemplates("*")
  +##  if(!$context.cvsRoot)<cvsRoot></cvsRoot>#end
  +##  if(!$context.cvsModule)<cvsModule></cvsModule>#end
  +##  if(!$context.cvsPassword)<cvsPassword></cvsPassword>#end
  +##</project>  
  +###end
   
  -#match ("dependencies")
  -  <dependencies>
  -  $context.applyTemplates("dependency")
  -  </dependencies>
  -#end
  +###match ("dependencies")
  +##  <dependencies>
  +##  $context.applyTemplates("dependency")
  +##  </dependencies>
  +###end
  +
  +###match ("dependency")
  +##  <dependency>
  +##    <id>$context.node.name</id>
  +##    <version>$context.node.version</version>
  +##    #if ($context.node.url != null)<url>$context.node.url</url>#end
  +##  </dependency>
  +###end
   
  -#match ("dependency")
  -  <dependency>
  -    <id>$context.node.name</id>
  -    <version>$context.node.version</version>
  -    #if ($context.node.url != null)<url>$context.node.url</url>#end
  -  </dependency>
  +#match ("organization")
  +  #if (! $context.node.url)
  +    <organization>
  +      <name>$context.node</name>
  +      <url></url>
  +    </organization>
  +  #end
   #end
   
   #match ("*")
  @@ -52,6 +61,8 @@
     <pomVersion>3</pomVersion>
   #elseif ($node.name() == "dependencies")
   $context.applyTemplates("dependencies")
  +#elseif ($node.name() == "organization")
  +$context.applyTemplates("organization")
   #else
   $node.copy()
   #end
  
  
  
  1.26      +2 -1      jakarta-turbine-maven/xdocs/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/xdocs/project.xml,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- project.xml       7 Apr 2002 23:52:34 -0000       1.25
  +++ project.xml       23 Apr 2002 01:52:50 -0000      1.26
  @@ -1,8 +1,9 @@
   <?xml version="1.0" encoding="ISO-8859-1"?>
  -<project name="Maven" href="http://jakarta.apache.org/turbine/maven/";>
  +<project name="Maven">
   
     <title>Maven</title>
     <logo href="/images/maven.jpg">Maven</logo>
  +  <organizationLogo href="/images/jakarta-logo-blue.gif">Jakarta</organizationLogo>
   
     <body>
       <links>
  
  
  


Reply via email to