Author: vsiveton
Date: Fri Dec 31 00:00:36 2010
New Revision: 1054029

URL: http://svn.apache.org/viewvc?rev=1054029&view=rev
Log:
o refactoring, create a dedicated class to improve maintenance (tx to Hervé's 
tip)

Added:
    
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/options/
    
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/options/ASFExtOptionsUtil.java
   (with props)
Modified:
    
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
    maven/plugins/trunk/maven-doap-plugin/src/main/mdo/asfextOptions.mdo

Modified: 
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java?rev=1054029&r1=1054028&r2=1054029&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
 Fri Dec 31 00:00:36 2010
@@ -55,6 +55,7 @@ import org.apache.maven.model.Scm;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.doap.options.ASFExtOptions;
+import org.apache.maven.plugin.doap.options.ASFExtOptionsUtil;
 import org.apache.maven.plugin.doap.options.DoapArtifact;
 import org.apache.maven.plugin.doap.options.DoapOptions;
 import org.apache.maven.plugin.doap.options.Standard;
@@ -491,7 +492,7 @@ public class DoapMojo
         // Includes ASF extensions
         // 
----------------------------------------------------------------------------
 
-        if ( !asfExtOptions.isIncluded() && ASFExtOptions.isASFProject( 
project ) )
+        if ( !asfExtOptions.isIncluded() && ASFExtOptionsUtil.isASFProject( 
project ) )
         {
             getLog().info( "This project is an ASF project, ASF Extensions to 
DOAP will be added." );
             asfExtOptions.setIncluded( true );
@@ -541,7 +542,7 @@ public class DoapMojo
         writer.addAttribute( "xmlns:foaf", "http://xmlns.com/foaf/0.1/"; );
         if ( asfExtOptions.isIncluded() )
         {
-            writer.addAttribute( "xmlns:asfext", 
ASFExtOptions.ASFEXT_NAMESPACE );
+            writer.addAttribute( "xmlns:asfext", 
ASFExtOptionsUtil.ASFEXT_NAMESPACE );
         }
 
         // Project
@@ -687,9 +688,9 @@ public class DoapMojo
             }
             getLog().error( "" );
 
-            if ( ASFExtOptions.isASFProject( project ) )
+            if ( ASFExtOptionsUtil.isASFProject( project ) )
             {
-                getLog().error( "For more information about the errors and 
possible solutions, please read the following articles:" );
+                getLog().error( "For more information about the errors and 
possible solutions, please read the plugin documentation:" );
                 getLog().error( 
"http://maven.apache.org/plugins/maven-doap-plugin/usage.html#DOAP_ASF_Configuration";
 );
                 throw new MojoExecutionException( "The generated DOAP doesn't 
respect ASF rules, see above." );
             }
@@ -914,12 +915,12 @@ public class DoapMojo
 
             if ( asfExtOptions.isIncluded() )
             {
-                String asfLanguage = 
ASFExtOptions.getProgrammingLanguageSupportedByASF( language );
+                String asfLanguage = 
ASFExtOptionsUtil.getProgrammingLanguageSupportedByASF( language );
                 if ( asfLanguage == null )
                 {
                     errorMessages.add( "The deprecated <language>" + language
                         + "</language> parameter is not supported by ASF. 
Should be one of "
-                        + Arrays.toString( ASFExtOptions.PROGRAMMING_LANGUAGES 
) );
+                        + Arrays.toString( 
ASFExtOptionsUtil.PROGRAMMING_LANGUAGES ) );
                 }
                 else
                 {
@@ -947,12 +948,12 @@ public class DoapMojo
 
                 if ( asfExtOptions.isIncluded() )
                 {
-                    String asfLanguage = 
ASFExtOptions.getProgrammingLanguageSupportedByASF( language );
+                    String asfLanguage = 
ASFExtOptionsUtil.getProgrammingLanguageSupportedByASF( language );
                     if ( asfLanguage == null )
                     {
                         errorMessages.add( "The 
<doapOptions><programmingLanguage>" + language
                             + "</programmingLanguage></doapOptions> parameter 
is not supported by ASF. "
-                            + "Should be one of " + Arrays.toString( 
ASFExtOptions.PROGRAMMING_LANGUAGES ) );
+                            + "Should be one of " + Arrays.toString( 
ASFExtOptionsUtil.PROGRAMMING_LANGUAGES ) );
                     }
                     else
                     {
@@ -1004,19 +1005,19 @@ public class DoapMojo
 
             if ( asfExtOptions.isIncluded() )
             {
-                String asfCategory = ASFExtOptions.getCategorySupportedByASF( 
category );
+                String asfCategory = 
ASFExtOptionsUtil.getCategorySupportedByASF( category );
                 if ( asfCategory == null )
                 {
                     errorMessages.add( "The deprecated <category>" + category
                         + "</category> parameter is not supported by ASF. 
Should be one of "
-                        + Arrays.toString( ASFExtOptions.CATEGORIES ) );
+                        + Arrays.toString( ASFExtOptionsUtil.CATEGORIES ) );
                 }
                 else
                 {
                     XmlWriterUtil.writeLineBreak( writer );
                     XmlWriterUtil.writeCommentText( writer, "A category of 
project.", 2 );
                     addComment = true;
-                    DoapUtil.writeRdfResourceElement( writer, "category", 
ASFExtOptions.CATEGORY_RESOURCE + asfCategory );
+                    DoapUtil.writeRdfResourceElement( writer, "category", 
ASFExtOptionsUtil.CATEGORY_RESOURCE + asfCategory );
                 }
             }
             else
@@ -1037,12 +1038,12 @@ public class DoapMojo
 
                 if ( asfExtOptions.isIncluded() )
                 {
-                    String asfCategory = 
ASFExtOptions.getCategorySupportedByASF( category );
+                    String asfCategory = 
ASFExtOptionsUtil.getCategorySupportedByASF( category );
                     if ( asfCategory == null )
                     {
                         errorMessages.add( "The <doapOptions><category>" + 
category
                             + "</category></doapOptions> parameter is not 
supported by ASF. Should be one of "
-                            + Arrays.toString( ASFExtOptions.CATEGORIES ) );
+                            + Arrays.toString( ASFExtOptionsUtil.CATEGORIES ) 
);
                     }
                     else
                     {
@@ -1052,7 +1053,7 @@ public class DoapMojo
                             XmlWriterUtil.writeCommentText( writer, "A 
category of project.", 2 );
                             addComment = true;
                         }
-                        DoapUtil.writeRdfResourceElement( writer, "category", 
ASFExtOptions.CATEGORY_RESOURCE
+                        DoapUtil.writeRdfResourceElement( writer, "category", 
ASFExtOptionsUtil.CATEGORY_RESOURCE
                             + asfCategory );
                     }
                 }
@@ -1797,7 +1798,7 @@ public class DoapMojo
      */
     private void writeASFext( XMLWriter writer, MavenProject project )
     {
-        if ( !ASFExtOptions.isASFProject( project ) )
+        if ( !ASFExtOptionsUtil.isASFProject( project ) )
         {
             return;
         }
@@ -1874,7 +1875,7 @@ public class DoapMojo
         }
         else
         {
-            Developer chair = ASFExtOptions.findChair( developers );
+            Developer chair = ASFExtOptionsUtil.findChair( developers );
             if ( chair != null )
             {
                 writeContributor( writer, chair, "asfext:chair" );
@@ -1889,7 +1890,7 @@ public class DoapMojo
         // asfext:member
         if ( developers != null && developers.size() > 0 )
         {
-            List<Developer> pmcMembers = ASFExtOptions.findPMCMembers( 
developers );
+            List<Developer> pmcMembers = ASFExtOptionsUtil.findPMCMembers( 
developers );
             for ( Developer pmcMember : pmcMembers )
             {
                 writeContributor( writer, pmcMember, "asfext:member" );

Added: 
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/options/ASFExtOptionsUtil.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/options/ASFExtOptionsUtil.java?rev=1054029&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/options/ASFExtOptionsUtil.java
 (added)
+++ 
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/options/ASFExtOptionsUtil.java
 Fri Dec 31 00:00:36 2010
@@ -0,0 +1,323 @@
+package org.apache.maven.plugin.doap.options;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.model.Developer;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Utility class for {...@link ASFExtOptions} class.
+ *
+ * @author <a href="mailto:vincent.sive...@gmail.com";>Vincent Siveton</a>
+ * @version $Id:$
+ * @since 1.1
+ */
+public class ASFExtOptionsUtil
+{
+    /** Apache domain name, i.e. apache.org */
+    public static final String APACHE_DOMAIN_NAME = "apache.org";
+
+    /** The ASF ext namespace. */
+    public static final String ASFEXT_NAMESPACE = 
"http://projects.apache.org/ns/asfext#";;
+
+    /**
+     * The ASF category resource.
+     *
+     * @see <a 
href="http://projects.apache.org/guidelines.html";>http://projects.apache.org/guidelines.html</a>
+     */
+    public static final String CATEGORY_RESOURCE = 
"http://projects.apache.org/category/";;
+
+    /** Projects related to building/maintaining source code/websites. */
+    public static final String BUILD_MANAGEMENT_CATEGORY = "build-management";
+
+    /** Projects related to databases. */
+    public static final String DATABASE_CATEGORY = "database";
+
+    /** Related to the HyperText Transfer Protocol. */
+    public static final String HTTP_CATEGORY = "http";
+
+    /** Modules designed for use by the Apache HTTP Server. */
+    public static final String HTTP_MODULES_CATEGORY = "httpd-modules";
+
+    /** A library meant to be used by other applications. */
+    public static final String LIBRARY_CATEGORY = "library";
+
+    /** Servers or applications related to internet mail protocols. */
+    public static final String MAIL_CATEGORY = "mail";
+
+    /** Anything that acts as a client across a network. */
+    public static final String NETWORK_CLIENT_CATEGORY = "network-client";
+
+    /** Anything that acts as a server across a network. */
+    public static final String NETWORK_SERVER_CATEGORY = "network-server";
+
+    /** Software designed to test or verify other software. */
+    public static final String TESTING_CATEGORY = "testing";
+
+    /** Unifying frameworks for website development. */
+    public static final String WEB_FRAMEWORK_CATEGORY = "web-framework";
+
+    /** Software based on XML technologies. */
+    public static final String XML_CATEGORY = "xml";
+
+    /** All categories supported by ASF */
+    public static final String[] CATEGORIES = { BUILD_MANAGEMENT_CATEGORY, 
DATABASE_CATEGORY, HTTP_CATEGORY,
+        HTTP_MODULES_CATEGORY, LIBRARY_CATEGORY, MAIL_CATEGORY, 
NETWORK_CLIENT_CATEGORY, NETWORK_SERVER_CATEGORY,
+        TESTING_CATEGORY, WEB_FRAMEWORK_CATEGORY, XML_CATEGORY };
+
+    /** C or C++ Programming Language. */
+    public static final String C_PROGRAMMING_LANGUAGE = "C";
+
+    /** Java Programming Language and all its components. */
+    public static final String JAVA_PROGRAMMING_LANGUAGE = "Java";
+
+    /** Perl Programming Language. */
+    public static final String PERL_PROGRAMMING_LANGUAGE = "Perl";
+
+    /** Python Programming Language. */
+    public static final String PYTHON_PROGRAMMING_LANGUAGE = "Python";
+
+    /** Scalable Vector Graphic Programming Language. */
+    public static final String SVG_PROGRAMMING_LANGUAGE = "SVG";
+
+    /** Tcl Programming Language. */
+    public static final String TCL_PROGRAMMING_LANGUAGE = "Tcl";
+
+    /** All Programming Languages supported by ASF */
+    public static final String[] PROGRAMMING_LANGUAGES = { 
C_PROGRAMMING_LANGUAGE, JAVA_PROGRAMMING_LANGUAGE,
+        PERL_PROGRAMMING_LANGUAGE, PYTHON_PROGRAMMING_LANGUAGE, 
SVG_PROGRAMMING_LANGUAGE, TCL_PROGRAMMING_LANGUAGE };
+
+    /**
+     * @param category not null
+     * @return if the given category is supported by ASF (correctly formatted) 
or <code>null</code> if not found.
+     * @see <a 
href="http://projects.apache.org/categories.html";>http://projects.apache.org/categories.html</a>
+     * @see #CATEGORIES
+     */
+    public static String getCategorySupportedByASF( String category )
+    {
+        for ( String category_ : CATEGORIES )
+        {
+            if ( category_.equalsIgnoreCase( category ) )
+            {
+                return category_;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * @param programmingLanguage not null
+     * @return the given programming language supported by ASF (correctly 
formatted) or <code>null</code> if not found.
+     * @see <a 
href="http://projects.apache.org/languages.html";>http://projects.apache.org/languages.html</a>
+     * @see #PROGRAMMING_LANGUAGES
+     */
+    public static String getProgrammingLanguageSupportedByASF( String 
programmingLanguage )
+    {
+        for ( String programmingLanguage_ : PROGRAMMING_LANGUAGES )
+        {
+            if ( programmingLanguage_.equalsIgnoreCase( programmingLanguage ) )
+            {
+                return programmingLanguage_;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Find the chair man of the project. The role of the developer should 
contain <code>chair</code>.
+     *
+     * @param developers list of <code>{...@link Developer}</code>
+     * @return a Developer or null if not found.
+     */
+    public static Developer findChair( List<Developer> developers )
+    {
+        if ( developers == null || developers.isEmpty() )
+        {
+            return null;
+        }
+
+        for ( Developer developer : developers )
+        {
+            List<String> roles = developer.getRoles();
+
+            for ( String role : roles )
+            {
+                if ( role.toLowerCase().contains( "chair" ) )
+                {
+                    return developer;
+                }
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Find the list of PMC members of the project. The role of each developer 
should contain <code>pmc</code>.
+     *
+     * @param developers list of <code>{...@link Developer}</code>
+     * @return a not null list of Developer.
+     */
+    public static List<Developer> findPMCMembers( List<Developer> developers )
+    {
+        if ( developers == null || developers.isEmpty() )
+        {
+            return null;
+        }
+
+        List<Developer> pmcs = new ArrayList<Developer>();
+        for ( Developer developer : developers )
+        {
+            List<String> roles = developer.getRoles();
+
+            for ( String role : roles )
+            {
+                if ( role.toLowerCase().contains( "pmc" ) )
+                {
+                    pmcs.add( developer );
+                }
+            }
+        }
+
+        return pmcs;
+    }
+
+    /**
+     * Try to find if the given project is hosted at Apache.
+     *
+     * @param project not null
+     * @return <code>true</code> if the SCM url, distribution management url, 
project url or organization url is hosted
+     *         in the Apache domain name, <code>false</code> otherwise.
+     * @see #APACHE_DOMAIN_NAME
+     * @since 1.1
+     */
+    public static boolean isASFProject( MavenProject project )
+    {
+        if ( project == null )
+        {
+            throw new IllegalArgumentException( "project is required" );
+        }
+
+        // check organization name
+        if ( project.getOrganization() != null && StringUtils.isNotEmpty( 
project.getOrganization().getName() )
+            && project.getOrganization().getName().trim().equals( "The Apache 
Software Foundation" ) ) // see
+                                                                               
                        // org.apache:apache
+                                                                               
                        // artifact
+        {
+            return true;
+        }
+
+        // check domain name
+        if ( project.getOrganization() != null && isHostedAtASF( 
project.getOrganization().getUrl() ) )
+        {
+            return true;
+        }
+
+        if ( isHostedAtASF( project.getUrl() ) )
+        {
+            return true;
+        }
+
+        if ( project.getScm() != null )
+        {
+            if ( StringUtils.isNotEmpty( project.getScm().getUrl() )
+                && project.getScm().getUrl().contains( APACHE_DOMAIN_NAME ) )
+            {
+                return true;
+            }
+
+            if ( StringUtils.isNotEmpty( project.getScm().getConnection() )
+                && project.getScm().getConnection().contains( 
APACHE_DOMAIN_NAME ) )
+            {
+                return true;
+            }
+
+            if ( StringUtils.isNotEmpty( 
project.getScm().getDeveloperConnection() )
+                && project.getScm().getDeveloperConnection().contains( 
APACHE_DOMAIN_NAME ) )
+            {
+                return true;
+            }
+        }
+
+        if ( project.getDistributionManagement() != null )
+        {
+            if ( isHostedAtASF( 
project.getDistributionManagement().getDownloadUrl() ) )
+            {
+                return true;
+            }
+
+            if ( project.getDistributionManagement().getRepository() != null
+                && isHostedAtASF( 
project.getDistributionManagement().getRepository().getUrl() ) )
+            {
+                return true;
+            }
+
+            if ( project.getDistributionManagement().getSnapshotRepository() 
!= null
+                && isHostedAtASF( 
project.getDistributionManagement().getSnapshotRepository().getUrl() ) )
+            {
+                return true;
+            }
+
+            if ( project.getDistributionManagement().getSite() != null
+                && isHostedAtASF( 
project.getDistributionManagement().getSite().getUrl() ) )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * @param str an url could be null
+     * @return <code>true</code> if the str is hosted by ASF.
+     * @see #APACHE_DOMAIN_NAME
+     */
+    private static boolean isHostedAtASF( String str )
+    {
+        if ( StringUtils.isEmpty( str ) )
+        {
+            return false;
+        }
+
+        str = str.trim();
+        try
+        {
+            URL url = new URL( str );
+            if ( url.getHost().endsWith( APACHE_DOMAIN_NAME ) )
+            {
+                return true;
+            }
+        }
+        catch ( MalformedURLException e )
+        {
+        }
+
+        return false;
+    }
+}

Propchange: 
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/options/ASFExtOptionsUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/options/ASFExtOptionsUtil.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/options/ASFExtOptionsUtil.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugins/trunk/maven-doap-plugin/src/main/mdo/asfextOptions.mdo
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-doap-plugin/src/main/mdo/asfextOptions.mdo?rev=1054029&r1=1054028&r2=1054029&view=diff
==============================================================================
--- maven/plugins/trunk/maven-doap-plugin/src/main/mdo/asfextOptions.mdo 
(original)
+++ maven/plugins/trunk/maven-doap-plugin/src/main/mdo/asfextOptions.mdo Fri 
Dec 31 00:00:36 2010
@@ -95,312 +95,6 @@ http://svn.apache.org/repos/asf/infrastr
           </association>
         </field>
       </fields>
-
-      <codeSegments>
-        <codeSegment>
-          <code>
-            <![CDATA[
-    /** Apache domain name, i.e. apache.org */
-    public static final String APACHE_DOMAIN_NAME = "apache.org";
-
-    /** The ASF ext namespace. */
-    public static final String ASFEXT_NAMESPACE = 
"http://projects.apache.org/ns/asfext#";;
-
-    /**
-     * The ASF category resource.
-     *
-     * @see <a 
href="http://projects.apache.org/guidelines.html";>http://projects.apache.org/guidelines.html</a>
-     */
-    public static final String CATEGORY_RESOURCE = 
"http://projects.apache.org/category/";;
-
-    /** Projects related to building/maintaining source code/websites. */
-    public static final String BUILD_MANAGEMENT_CATEGORY = "build-management";
-
-    /** Projects related to databases. */
-    public static final String DATABASE_CATEGORY = "database";
-
-    /** Related to the HyperText Transfer Protocol. */
-    public static final String HTTP_CATEGORY = "http";
-
-    /** Modules designed for use by the Apache HTTP Server. */
-    public static final String HTTP_MODULES_CATEGORY = "httpd-modules";
-
-    /** A library meant to be used by other applications. */
-    public static final String LIBRARY_CATEGORY = "library";
-
-    /** Servers or applications related to internet mail protocols. */
-    public static final String MAIL_CATEGORY = "mail";
-
-    /** Anything that acts as a client across a network. */
-    public static final String NETWORK_CLIENT_CATEGORY = "network-client";
-
-    /** Anything that acts as a server across a network. */
-    public static final String NETWORK_SERVER_CATEGORY = "network-server";
-
-    /** Software designed to test or verify other software. */
-    public static final String TESTING_CATEGORY = "testing";
-
-    /** Unifying frameworks for website development. */
-    public static final String WEB_FRAMEWORK_CATEGORY = "web-framework";
-
-    /** Software based on XML technologies. */
-    public static final String XML_CATEGORY = "xml";
-
-    /** All categories supported by ASF */
-    public static final String[] CATEGORIES = {
-        BUILD_MANAGEMENT_CATEGORY,
-        DATABASE_CATEGORY,
-        HTTP_CATEGORY,
-        HTTP_MODULES_CATEGORY,
-        LIBRARY_CATEGORY,
-        MAIL_CATEGORY,
-        NETWORK_CLIENT_CATEGORY,
-        NETWORK_SERVER_CATEGORY,
-        TESTING_CATEGORY,
-        WEB_FRAMEWORK_CATEGORY,
-        XML_CATEGORY };
-
-    /** C or C++ Programming Language. */
-    public static final String C_PROGRAMMING_LANGUAGE = "C";
-
-    /** Java Programming Language and all its components.*/
-    public static final String JAVA_PROGRAMMING_LANGUAGE = "Java";
-
-    /** Perl Programming Language.*/
-    public static final String PERL_PROGRAMMING_LANGUAGE = "Perl";
-
-    /** Python Programming Language.*/
-    public static final String PYTHON_PROGRAMMING_LANGUAGE = "Python";
-
-    /** Scalable Vector Graphic Programming Language.*/
-    public static final String SVG_PROGRAMMING_LANGUAGE = "SVG";
-
-    /** Tcl Programming Language.*/
-    public static final String TCL_PROGRAMMING_LANGUAGE = "Tcl";
-
-    /** All Programming Languages supported by ASF */
-    public static final String[] PROGRAMMING_LANGUAGES = {
-        C_PROGRAMMING_LANGUAGE,
-        JAVA_PROGRAMMING_LANGUAGE,
-        PERL_PROGRAMMING_LANGUAGE,
-        PYTHON_PROGRAMMING_LANGUAGE,
-        SVG_PROGRAMMING_LANGUAGE,
-        TCL_PROGRAMMING_LANGUAGE};
-
-    /**
-     * @param category not null
-     * @return if the given category is supported by ASF (correctly formatted) 
or <code>null</code> if not found.
-     * @see <a 
href="http://projects.apache.org/categories.html";>http://projects.apache.org/categories.html</a>
-     * @see #CATEGORIES
-     */
-    public static String getCategorySupportedByASF( String category )
-    {
-        for ( String category_ : CATEGORIES )
-        {
-            if ( category_.equalsIgnoreCase( category ) )
-            {
-                return category_;
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * @param programmingLanguage not null
-     * @return the given programming language supported by ASF (correctly 
formatted) or <code>null</code> if not found.
-     * @see <a 
href="http://projects.apache.org/languages.html";>http://projects.apache.org/languages.html</a>
-     * @see #PROGRAMMING_LANGUAGES
-     */
-    public static String getProgrammingLanguageSupportedByASF( String 
programmingLanguage )
-    {
-        for ( String programmingLanguage_ : PROGRAMMING_LANGUAGES )
-        {
-            if ( programmingLanguage_.equalsIgnoreCase( programmingLanguage ) )
-            {
-                return programmingLanguage_;
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Find the chair man of the project. The role of the developer should 
contain <code>chair</code>.
-     *
-     * @param developers list of <code>{...@link 
org.apache.maven.model.Developer}</code>
-     * @return a Developer or null if not found.
-     */
-    public static org.apache.maven.model.Developer findChair( 
java.util.List<org.apache.maven.model.Developer> developers )
-    {
-        if ( developers == null || developers.isEmpty() )
-        {
-            return null;
-        }
-
-        for ( org.apache.maven.model.Developer developer : developers )
-        {
-            java.util.List<String> roles = developer.getRoles();
-
-            for ( String role : roles )
-            {
-                if ( role.toLowerCase().contains( "chair" ) )
-                {
-                    return developer;
-                }
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Find the list of PMC members of the project. The role of each developer 
should contain <code>pmc</code>.
-     *
-     * @param developers list of <code>{...@link 
org.apache.maven.model.Developer}</code>
-     * @return a not null list of Developer.
-     */
-    public static java.util.List<org.apache.maven.model.Developer> 
findPMCMembers( java.util.List<org.apache.maven.model.Developer> developers )
-    {
-        if ( developers == null || developers.isEmpty() )
-        {
-            return null;
-        }
-
-        java.util.List<org.apache.maven.model.Developer> pmcs = new 
java.util.ArrayList<org.apache.maven.model.Developer>();
-        for ( org.apache.maven.model.Developer developer : developers )
-        {
-            java.util.List<String> roles = developer.getRoles();
-
-            for ( String role : roles )
-            {
-                if ( role.toLowerCase().contains( "pmc" ) )
-                {
-                    pmcs.add( developer );
-                }
-            }
-        }
-
-        return pmcs;
-    }
-
-    /**
-     * Try to find if the given project is hosted at Apache.
-     *
-     * @param project not null
-     * @return <code>true</code> if the SCM url, distribution management url, 
project url or organization url is hosted
-     *         in the Apache domain name, <code>false</code> otherwise.
-     * @see #APACHE_DOMAIN_NAME
-     * @since 1.1
-     */
-    public static boolean isASFProject( org.apache.maven.project.MavenProject 
project )
-    {
-        if ( project == null )
-        {
-            throw new IllegalArgumentException( "project is required" );
-        }
-
-        // check organization name
-        if ( project.getOrganization() != null
-            && org.codehaus.plexus.util.StringUtils.isNotEmpty( 
project.getOrganization().getName() )
-            && project.getOrganization().getName().trim().equals( "The Apache 
Software Foundation" ) ) // see org.apache:apache artifact
-        {
-            return true;
-        }
-
-        // check domain name
-        if ( project.getOrganization() != null
-            && isHostedAtASF( project.getOrganization().getUrl() ) )
-        {
-            return true;
-        }
-
-        if ( isHostedAtASF( project.getUrl() ) )
-        {
-            return true;
-        }
-
-        if ( project.getScm() != null )
-        {
-            if ( org.codehaus.plexus.util.StringUtils.isNotEmpty( 
project.getScm().getUrl() )
-                && project.getScm().getUrl().contains( APACHE_DOMAIN_NAME ) )
-            {
-                return true;
-            }
-
-            if ( org.codehaus.plexus.util.StringUtils.isNotEmpty( 
project.getScm().getConnection() )
-                && project.getScm().getConnection().contains( 
APACHE_DOMAIN_NAME ) )
-            {
-                return true;
-            }
-
-            if ( org.codehaus.plexus.util.StringUtils.isNotEmpty( 
project.getScm().getDeveloperConnection() )
-                && project.getScm().getDeveloperConnection().contains( 
APACHE_DOMAIN_NAME ) )
-            {
-                return true;
-            }
-        }
-
-        if ( project.getDistributionManagement() != null )
-        {
-            if ( isHostedAtASF( 
project.getDistributionManagement().getDownloadUrl() ) )
-            {
-                return true;
-            }
-
-            if ( project.getDistributionManagement().getRepository() != null
-                && isHostedAtASF( 
project.getDistributionManagement().getRepository().getUrl() ) )
-            {
-                return true;
-            }
-
-            if ( project.getDistributionManagement().getSnapshotRepository() 
!= null
-                && isHostedAtASF( 
project.getDistributionManagement().getSnapshotRepository().getUrl() ) )
-            {
-                return true;
-            }
-
-            if ( project.getDistributionManagement().getSite() != null
-                && isHostedAtASF( 
project.getDistributionManagement().getSite().getUrl() ) )
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * @param str an url could be null
-     * @return <code>true</code> if the str is hosted by ASF.
-     * @see #APACHE_DOMAIN_NAME
-     */
-    private static boolean isHostedAtASF( String str )
-    {
-        if ( org.codehaus.plexus.util.StringUtils.isEmpty( str ) )
-        {
-            return false;
-        }
-
-        str = str.trim();
-        try
-        {
-            java.net.URL url = new java.net.URL( str );
-            if ( url.getHost().endsWith( APACHE_DOMAIN_NAME ) )
-            {
-                return true;
-            }
-        }
-        catch ( java.net.MalformedURLException e )
-        {
-        }
-
-        return false;
-    }
-            ]]>
-          </code>
-        </codeSegment>
-      </codeSegments>
     </class>
 
     <class>


Reply via email to