Author: vsiveton
Date: Thu Jun 26 09:21:12 2008
New Revision: 671933
URL: http://svn.apache.org/viewvc?rev=671933&view=rev
Log:
o added Modello to generate DoapOptions class
o deprecated category and language parameters
o added new methods to write more DOAP elements: download-page,
download-mirror, old-homepage, programming-language, category, os, screenshots
Added:
maven/plugins/trunk/maven-doap-plugin/src/main/mdo/
maven/plugins/trunk/maven-doap-plugin/src/main/mdo/doapOptions.mdo (with
props)
Modified:
maven/plugins/trunk/maven-doap-plugin/pom.xml
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
Modified: maven/plugins/trunk/maven-doap-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-doap-plugin/pom.xml?rev=671933&r1=671932&r2=671933&view=diff
==============================================================================
--- maven/plugins/trunk/maven-doap-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-doap-plugin/pom.xml Thu Jun 26 09:21:12 2008
@@ -108,6 +108,29 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.modello</groupId>
+ <artifactId>modello-maven-plugin</artifactId>
+ <version>1.0-alpha-18</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <version>1.0.0</version>
+ <models>
+ <model>src/main/mdo/doapOptions.mdo</model>
+ </models>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<properties>
<scmVersion>1.0</scmVersion>
</properties>
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=671933&r1=671932&r2=671933&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
Thu Jun 26 09:21:12 2008
@@ -34,6 +34,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.DoapOptions;
import org.apache.maven.project.MavenProject;
import org.apache.maven.scm.manager.NoSuchScmProviderException;
import org.apache.maven.scm.manager.ScmManager;
@@ -96,6 +97,7 @@
* notions of category yet.
*
* @parameter expression="${category}"
+ * @deprecated Since 1.0. Instead of, configure <code>category</code>
property in <code>doapOptions</code> parameter.
*/
private String category;
@@ -103,10 +105,19 @@
* The language which should be displayed in the DOAP file. The POM
doesn't have any
* notions of language yet.
*
- * @parameter expression="${language}" default-value="Java"
+ * @parameter expression="${language}"
+ * @deprecated Since 1.0. Instead of, configure
<code>programmingLanguage</code> property in <code>doapOptions</code> parameter.
*/
private String language;
+ /**
+ * Specific DOAP parameters, i.e. options that POM doesn't have any
notions.
+ *
+ * @parameter expression="${doapOptions}"
+ * @since 1.0
+ */
+ private DoapOptions doapOptions;
+
// ----------------------------------------------------------------------
// Public methods
// ----------------------------------------------------------------------
@@ -160,7 +171,7 @@
// created
writeCreated( writer );
- // homepage
+ // homepage and old-homepage
writeHomepage( writer );
// licenses
@@ -168,6 +179,15 @@
DoapUtil.writeRdfResourceElement( writer, "asfext:pmc",
project.getUrl() );
+ // programming-language
+ writeProgrammingLanguage( writer );
+
+ // category
+ writeCategory( writer );
+
+ // os
+ writeOS( writer );
+
// SCM
writeSourceRepositories( writer );
@@ -177,10 +197,11 @@
// mailing list
writeMailingList( writer );
- DoapUtil.writeRdfResourceElement( writer, "download-page", composeUrl(
project.getUrl(), "/download.html" ) );
- DoapUtil.writeElement( writer, "programming-language", language );
- //TODO: how to lookup category, map it, or just declare it.
- DoapUtil.writeRdfResourceElement( writer, "category",
"http://projects.apache.org/category/" + category );
+ // download-page and download-mirror
+ writeDownloadPage( writer );
+
+ // screenshots
+ writeScreenshots( writer );
// Releases
publishReleases();
@@ -266,26 +287,184 @@
XmlWriterUtil.writeCommentText( writer, "Date when something was
created, in YYYY-MM-DD form. e.g. 2004-04-05",
2 );
// http://usefulinc.com/ns/doap#created
- DoapUtil.writeElement( writer, "created", project.getInceptionYear() +
"/01/01" );
+ DoapUtil.writeElement( writer, "created", project.getInceptionYear() +
"-01-01" );
}
/**
- * Write DOAP homepage.
+ * Write DOAP homepage and old-homepage.
*
* @param writer
* @see <a
href="http://usefulinc.com/ns/doap#homepage">http://usefulinc.com/ns/doap#homepage</a>
+ * @see <a
href="http://usefulinc.com/ns/doap#old-homepage">http://usefulinc.com/ns/doap#old-homepage</a>
*/
private void writeHomepage( XMLWriter writer )
{
- if ( StringUtils.isEmpty( project.getUrl() ) )
+ if ( StringUtils.isNotEmpty( project.getUrl() ) )
+ {
+ XmlWriterUtil.writeLineBreak( writer );
+ XmlWriterUtil.writeCommentText( writer,
+ "URL of a project's homepage,
associated with exactly one project.", 2 );
+ // http://usefulinc.com/ns/doap#homepage
+ DoapUtil.writeRdfResourceElement( writer, "homepage",
project.getUrl() );
+ }
+
+ if ( StringUtils.isNotEmpty( doapOptions.getOldHomepage() ) )
+ {
+ XmlWriterUtil.writeLineBreak( writer );
+ XmlWriterUtil
+ .writeCommentText( writer, "URL of a project's past homepage,
associated with exactly one project.", 2 );
+ // http://usefulinc.com/ns/doap#old-homepage
+ DoapUtil.writeRdfResourceElement( writer, "old-homepage",
doapOptions.getOldHomepage() );
+ }
+ }
+
+ /**
+ * Write DOAP programming-language.
+ *
+ * @param writer
+ * @see <a
href="http://usefulinc.com/ns/doap#programming-language">http://usefulinc.com/ns/doap#programming-language</a>
+ */
+ private void writeProgrammingLanguage( XMLWriter writer )
+ {
+ if ( StringUtils.isEmpty( doapOptions.getProgrammingLanguage() ) &&
StringUtils.isEmpty( language ) )
+ {
+ return;
+ }
+
+ XmlWriterUtil.writeLineBreak( writer );
+ XmlWriterUtil.writeCommentText( writer, "Programming language.", 2 );
+
+ if ( StringUtils.isNotEmpty( language ) ) // backward compatible
+ {
+ // http://usefulinc.com/ns/doap#programming-language
+ DoapUtil.writeRdfResourceElement( writer, "programming-language",
language );
+ }
+
+ if ( StringUtils.isNotEmpty( doapOptions.getProgrammingLanguage() ) )
+ {
+ String[] languages = StringUtils.split(
doapOptions.getProgrammingLanguage(), "," );
+ for ( int i = 0; i < languages.length; i++ )
+ {
+ // http://usefulinc.com/ns/doap#programming-language
+ DoapUtil.writeRdfResourceElement( writer,
"programming-language", languages[i].trim() );
+ }
+ }
+ }
+
+ /**
+ * Write DOAP category.
+ *
+ * @param writer
+ * @see <a
href="http://usefulinc.com/ns/doap#category">http://usefulinc.com/ns/doap#category</a>
+ */
+ private void writeCategory( XMLWriter writer )
+ {
+ if ( StringUtils.isEmpty( doapOptions.getCategory() ) &&
StringUtils.isEmpty( category ) )
+ {
+ return;
+ }
+
+ //TODO: how to lookup category, map it, or just declare it.
+ XmlWriterUtil.writeLineBreak( writer );
+ XmlWriterUtil.writeCommentText( writer, "A category of project.", 2 );
+
+ if ( StringUtils.isNotEmpty( category ) ) // backward compatible
+ {
+ // http://usefulinc.com/ns/doap#category
+ DoapUtil.writeRdfResourceElement( writer, "category",
"http://projects.apache.org/category/" + category );
+ }
+
+ if ( StringUtils.isNotEmpty( doapOptions.getCategory() ) )
+ {
+ String[] categories = StringUtils.split(
doapOptions.getCategory(), "," );
+ for ( int i = 0; i < categories.length; i++ )
+ {
+ // http://usefulinc.com/ns/doap#category
+ DoapUtil.writeRdfResourceElement( writer, "category",
"http://projects.apache.org/category/"
+ + categories[i].trim() );
+ }
+ }
+ }
+
+ /**
+ * Write DOAP download-page and download-mirror.
+ *
+ * @param writer
+ * @see <a
href="http://usefulinc.com/ns/doap#download-page">http://usefulinc.com/ns/doap#download-page</a>
+ * @see <a
href="http://usefulinc.com/ns/doap#download-mirror">http://usefulinc.com/ns/doap#download-mirror</a>
+ */
+ private void writeDownloadPage( XMLWriter writer )
+ {
+ if ( StringUtils.isEmpty( doapOptions.getDownloadPage() ) )
+ {
+ if ( StringUtils.isNotEmpty( project.getUrl() ) )
+ {
+ doapOptions.setDownloadPage( composeUrl( project.getUrl(),
"/download.html" ) );
+ }
+ }
+
+ if ( StringUtils.isNotEmpty( doapOptions.getDownloadPage() ) )
+ {
+ XmlWriterUtil.writeLineBreak( writer );
+ XmlWriterUtil.writeCommentText( writer, "Download page.", 2 );
+ // http://usefulinc.com/ns/doap#download-page
+ DoapUtil.writeRdfResourceElement( writer, "download-page",
doapOptions.getDownloadPage() );
+ }
+
+ if ( StringUtils.isNotEmpty( doapOptions.getDownloadMirror() ) )
+ {
+ XmlWriterUtil.writeLineBreak( writer );
+ XmlWriterUtil.writeCommentText( writer, "Mirror of software
download web page.", 2 );
+ String[] downloadMirrors = StringUtils.split(
doapOptions.getDownloadMirror(), "," );
+ for ( int i = 0; i < downloadMirrors.length; i++ )
+ {
+ // http://usefulinc.com/ns/doap#download-mirror
+ DoapUtil.writeRdfResourceElement( writer, "download-mirror",
downloadMirrors[i].trim() );
+ }
+ }
+ }
+
+ /**
+ * Write DOAP OS.
+ *
+ * @param writer
+ * @see <a
href="http://usefulinc.com/ns/doap#os">http://usefulinc.com/ns/doap#os</a>
+ */
+ private void writeOS( XMLWriter writer )
+ {
+ if ( StringUtils.isEmpty( doapOptions.getOs() ) )
+ {
+ return;
+ }
+
+ XmlWriterUtil.writeLineBreak( writer );
+ XmlWriterUtil.writeCommentText( writer, "Operating system that a
project is limited to.", 2 );
+
+ String[] oses = StringUtils.split( doapOptions.getOs(), "," );
+ for ( int i = 0; i < oses.length; i++ )
+ {
+ // http://usefulinc.com/ns/doap#os
+ DoapUtil.writeRdfResourceElement( writer, "os", oses[i].trim() );
+ }
+ }
+
+ /**
+ * Write DOAP screenshots.
+ *
+ * @param writer
+ * @see <a
href="http://usefulinc.com/ns/doap#screenshots">http://usefulinc.com/ns/doap#screenshots</a>
+ */
+ private void writeScreenshots( XMLWriter writer )
+ {
+ if ( StringUtils.isEmpty( doapOptions.getScreenshots() ) )
{
return;
}
XmlWriterUtil.writeLineBreak( writer );
- XmlWriterUtil.writeCommentText( writer, "URL of a project's homepage,
associated with exactly one project.", 2 );
- // http://usefulinc.com/ns/doap#homepage
- DoapUtil.writeRdfResourceElement( writer, "homepage", project.getUrl()
);
+ XmlWriterUtil.writeCommentText( writer, "Web page with screenshots of
project.", 2 );
+ // http://usefulinc.com/ns/doap#screenshots
+ DoapUtil.writeRdfResourceElement( writer, "screenshots",
doapOptions.getScreenshots() );
}
/**
@@ -418,12 +597,12 @@
}
XmlWriterUtil.writeLineBreak( writer );
- XmlWriterUtil.writeCommentText( writer, "Anonymous Connection", 2 );
+ XmlWriterUtil.writeCommentText( writer, "Anonymous Source Repository",
2 );
String anonymousConnection = scm.getConnection();
writeSourceRepository( writer, anonymousConnection );
XmlWriterUtil.writeLineBreak( writer );
- XmlWriterUtil.writeCommentText( writer, "Developer Connection", 2 );
+ XmlWriterUtil.writeCommentText( writer, "Developer Source Repository",
2 );
String developerConnection = scm.getDeveloperConnection();
writeSourceRepository( writer, developerConnection );
}
Added: maven/plugins/trunk/maven-doap-plugin/src/main/mdo/doapOptions.mdo
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-doap-plugin/src/main/mdo/doapOptions.mdo?rev=671933&view=auto
==============================================================================
--- maven/plugins/trunk/maven-doap-plugin/src/main/mdo/doapOptions.mdo (added)
+++ maven/plugins/trunk/maven-doap-plugin/src/main/mdo/doapOptions.mdo Thu Jun
26 09:21:12 2008
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<model>
+ <id>doapOptions</id>
+ <name>doapOptions</name>
+ <description><![CDATA[Model for DOAP Options.]]></description>
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.plugin.doap.options</value>
+ </default>
+ </defaults>
+ <classes>
+ <class>
+ <name>DoapOptions</name>
+ <description>Specific DOAP parameters, i.e. options that POM doesn't
have any notions.</description>
+ <version>1.0.0</version>
+ <fields>
+ <field>
+ <name>category</name>
+ <description><![CDATA[A category of project.<br/>
+<b>Note</b>: This string is comma separated to allow several categories.
[EMAIL PROTECTED] <a
href="http://usefulinc.com/ns/doap#category">http://usefulinc.com/ns/doap#category</a>]]></description>
+ <version>1.0.0</version>
+ <type>String</type>
+ <identifier>true</identifier>
+ </field>
+ <field>
+ <name>downloadPage</name>
+ <description><![CDATA[Web page from which the project software can
be downloaded.
[EMAIL PROTECTED] <a
href="http://usefulinc.com/ns/doap#download-page">http://usefulinc.com/ns/doap#download-page</a>]]></description>
+ <version>1.0.0</version>
+ <type>String</type>
+ <identifier>true</identifier>
+ </field>
+ <field>
+ <name>downloadMirror</name>
+ <description><![CDATA[Mirror of software download web page.<br/>
+<b>Note</b>: This string is comma separated to allow several mirror pages.
[EMAIL PROTECTED] <a
href="http://usefulinc.com/ns/doap#download-mirror">http://usefulinc.com/ns/doap#download-mirror</a>]]></description>
+ <version>1.0.0</version>
+ <type>String</type>
+ <identifier>true</identifier>
+ </field>
+ <field>
+ <name>oldHomepage</name>
+ <description><![CDATA[URL of a project's past homepage, associated
with exactly one project.
[EMAIL PROTECTED] <a
href="http://usefulinc.com/ns/doap#old-homepage">http://usefulinc.com/ns/doap#old-homepage</a>]]></description>
+ <version>1.0.0</version>
+ <type>String</type>
+ <identifier>true</identifier>
+ </field>
+ <field>
+ <name>os</name>
+ <description><![CDATA[Operating system that a project is limited to.
Omit this property if the project is not OS-specific.<br/>
+<b>Note</b>: This string is comma separated to allow several OS.
[EMAIL PROTECTED] <a
href="http://usefulinc.com/ns/doap#os">http://usefulinc.com/ns/doap#os</a>]]></description>
+ <version>1.0.0</version>
+ <type>String</type>
+ <identifier>true</identifier>
+ </field>
+ <field>
+ <name>programmingLanguage</name>
+ <description><![CDATA[Programming language a project is implemented
in or intended for use with.<br/>
+<b>Note</b>: This string is comma separated to allow several
programming-language.
[EMAIL PROTECTED] <a
href="http://usefulinc.com/ns/doap#programming-language">http://usefulinc.com/ns/doap#programming-language</a>]]></description>
+ <version>1.0.0</version>
+ <type>String</type>
+ <identifier>true</identifier>
+ <defaultValue>java</defaultValue>
+ </field>
+ <field>
+ <name>screenshots</name>
+ <description><![CDATA[Web page with screenshots of project.
[EMAIL PROTECTED] <a
href="http://usefulinc.com/ns/doap#screenshots">http://usefulinc.com/ns/doap#screenshots</a>]]></description>
+ <version>1.0.0</version>
+ <type>String</type>
+ <identifier>true</identifier>
+ </field>
+ <field>
+ <name>wiki</name>
+ <description><![CDATA[URL of Wiki for collaborative discussion of
project.
[EMAIL PROTECTED] <a
href="http://usefulinc.com/ns/doap#wiki">http://usefulinc.com/ns/doap#wiki</a>]]></description>
+ <version>1.0.0</version>
+ <type>String</type>
+ <identifier>true</identifier>
+ </field>
+ </fields>
+ </class>
+ </classes>
+</model>
Propchange: maven/plugins/trunk/maven-doap-plugin/src/main/mdo/doapOptions.mdo
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-doap-plugin/src/main/mdo/doapOptions.mdo
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision