Author: krosenvold
Date: Mon Apr 26 21:32:51 2010
New Revision: 938248
URL: http://svn.apache.org/viewvc?rev=938248&view=rev
Log:
[MPLUGIN-169][MPLUGIN-159] Added support for @threadSafe and
@requiresDependencyCollection
Added:
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java
- copied, changed from r930751,
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source2/JavaExtractorTestThree.java
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoRequiresDependencyCollectionTypeTaglet.java
(with props)
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoThreadSafeTypeTaglet.java
(with props)
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/resources/pluginxdoc.properties
maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoAnnotation.java
maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source2/JavaExtractorTestThree.java
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/it/basic/pom.xml
Copied:
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java
(from r930751,
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source2/JavaExtractorTestThree.java)
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java?p2=maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java&p1=maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source2/JavaExtractorTestThree.java&r1=930751&r2=938248&rev=938248&view=diff
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source2/JavaExtractorTestThree.java
(original)
+++
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java
Mon Apr 26 21:32:51 2010
@@ -1,4 +1,4 @@
-package source2;
+package org.apache.maven.tools.plugin;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -9,7 +9,7 @@ package source2;
* "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
+ * 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
@@ -19,32 +19,35 @@ package source2;
* under the License.
*/
-import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
/**
- * Tests the implementation argument of the parameter annotation.
- *
- * @goal ideaThree
- * @requiresDependencyResolution compile
+ * @author Kristian Rosenvold
*/
-public class JavaExtractorTestThree
- extends AbstractMojo
+public class ExtendedMojoDescriptor
+ extends MojoDescriptor
{
- /**
- * @parameter implementation=source2.sub.MyBla
- * @required
- */
- private Bla bla;
+ private boolean threadSafe = false;
+
+ private String requiresDependencyCollection = null;
+
+ public boolean isThreadSafe()
+ {
+ return threadSafe;
+ }
+
+ public void setThreadSafe( boolean threadSafe )
+ {
+ this.threadSafe = threadSafe;
+ }
- public JavaExtractorTestThree()
+ public String getRequiresDependencyCollection()
{
+ return requiresDependencyCollection;
}
- public void execute()
+ public void setRequiresDependencyCollection( String
requiresDependencyCollection )
{
- if ( getLog() != null )
- {
- getLog().info( "bla: " + bla );
- }
+ this.requiresDependencyCollection = requiresDependencyCollection;
}
}
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java?rev=938248&r1=938247&r2=938248&view=diff
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
(original)
+++
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
Mon Apr 26 21:32:51 2010
@@ -24,6 +24,7 @@ import org.apache.maven.plugin.descripto
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.descriptor.Requirement;
import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
+import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
import org.apache.maven.tools.plugin.PluginToolsRequest;
import org.apache.maven.tools.plugin.util.PluginUtils;
import org.codehaus.plexus.util.IOUtil;
@@ -302,6 +303,23 @@ public class PluginDescriptorGenerator
}
//
----------------------------------------------------------------------
+ // Extended (3.0) descriptor
+ //
----------------------------------------------------------------------
+
+ if ( mojoDescriptor instanceof ExtendedMojoDescriptor )
+ {
+ ExtendedMojoDescriptor extendedMojoDescriptor =
(ExtendedMojoDescriptor) mojoDescriptor;
+ if ( extendedMojoDescriptor.getRequiresDependencyCollection() !=
null )
+ {
+ PluginUtils.element( w, "requiresDependencyCollection",
+
extendedMojoDescriptor.getRequiresDependencyCollection() );
+ }
+
+ PluginUtils.element( w, "threadSafe", "" + (
(ExtendedMojoDescriptor) mojoDescriptor ).isThreadSafe() );
+
+ }
+
+ //
----------------------------------------------------------------------
// Parameters
//
----------------------------------------------------------------------
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java?rev=938248&r1=938247&r2=938248&view=diff
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java
(original)
+++
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java
Mon Apr 26 21:32:51 2010
@@ -37,6 +37,7 @@ import org.apache.maven.plugin.descripto
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
+import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
import org.apache.maven.tools.plugin.PluginToolsRequest;
import org.apache.maven.tools.plugin.util.PluginUtils;
import org.codehaus.plexus.util.IOUtil;
@@ -308,6 +309,37 @@ public class PluginXdocGenerator
w.endElement(); //li
}
+ if ( mojoDescriptor instanceof ExtendedMojoDescriptor )
+ {
+ ExtendedMojoDescriptor extendedMojoDescriptor =
(ExtendedMojoDescriptor) mojoDescriptor;
+
+ value = extendedMojoDescriptor.getRequiresDependencyCollection();
+ if ( StringUtils.isNotEmpty( value ) )
+ {
+ if ( !addedUl )
+ {
+ w.startElement( "ul" );
+ addedUl = true;
+ }
+ w.startElement( "li" );
+ w.writeMarkup( format(
"pluginxdoc.mojodescriptor.dependencyCollectionRequired", value ) );
+ w.endElement(); //li
+ }
+
+ if ( extendedMojoDescriptor.isThreadSafe() )
+ {
+ if ( !addedUl )
+ {
+ w.startElement( "ul" );
+ addedUl = true;
+ }
+ w.startElement( "li" );
+ w.writeMarkup( getString(
"pluginxdoc.mojodescriptor.threadSafe" ) );
+ w.endElement(); //li
+ }
+
+ }
+
value = mojoDescriptor.getSince();
if ( StringUtils.isNotEmpty( value ) )
{
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/resources/pluginxdoc.properties
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/resources/pluginxdoc.properties?rev=938248&r1=938247&r2=938248&view=diff
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/resources/pluginxdoc.properties
(original)
+++
maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/resources/pluginxdoc.properties
Mon Apr 26 21:32:51 2010
@@ -30,6 +30,7 @@ pluginxdoc.mojodescriptor.projectRequire
pluginxdoc.mojodescriptor.aggregator=Executes as an aggregator plugin.
pluginxdoc.mojodescriptor.directInvocationOnly=Executes by direct invocation
only.
pluginxdoc.mojodescriptor.dependencyResolutionRequired=Requires dependency
resolution of artifacts in scope: <code>{0}</code>.
+pluginxdoc.mojodescriptor.dependencyCollectionRequired=Requires dependency
collection of artifacts in scope: <code>{0}</code>.
pluginxdoc.mojodescriptor.since=Since version: <code>{0}</code>.
pluginxdoc.mojodescriptor.phase=Binds by default to the lifecycle phase:
<code>{0}</code>.
pluginxdoc.mojodescriptor.executePhase=Invokes the execution of the lifecycle
phase <code>{0}</code> prior to executing itself.
@@ -53,3 +54,4 @@ pluginxdoc.mojodescriptor.requiredParame
pluginxdoc.mojodescriptor.optionalParameters=Optional Parameters
pluginxdoc.mojodescriptor.parameters=Parameters
pluginxdoc.mojodescriptor.noParameter=(no parameters)
+pluginxdoc.mojodescriptor.threadSafe=The mojo is threadsafe
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoAnnotation.java
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoAnnotation.java?rev=938248&r1=938247&r2=938248&view=diff
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoAnnotation.java
(original)
+++
maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoAnnotation.java
Mon Apr 26 21:32:51 2010
@@ -182,6 +182,18 @@ public interface JavaMojoAnnotation
String REQUIRES_DEPENDENCY_RESOLUTION = "requiresDependencyResolution";
/**
+ * Flags this Mojo as requiring the dependencies in the specified scope
(or an implied scope) to be collected
+ * before it can execute. Currently supports <code>compile</code>,
<code>runtime</code>, and
+ * <code>test</code> scopes.
+ * <br/>
+ * Refer to <code>@requiresDependencyCollection
<requiredScope></code>.
+ * <br/>
+ * <b>Note</b>: Should be defined in a Mojo Type.
+ */
+ String REQUIRES_DEPENDENCY_COLLECTION = "requiresDependencyCollection";
+
+
+ /**
* Refer to <code>@requiresDirectInvocation <true|false></code>.
* <br/>
* <b>Note</b>: Should be defined in a Mojo Type.
@@ -338,4 +350,12 @@ public interface JavaMojoAnnotation
* <b>Note</b>: Could be defined in a Mojo Type or a Mojo Field.
*/
String DEPRECATED = "deprecated";
+
+ /**
+ * Indicates that this mojo is threadsafe and can be run in parallel
+ *
+ * <b>Note</b>: Should be defined in a Mojo Type.
+ */
+ String THREADSAFE = "threadSafe";
+
}
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java?rev=938248&r1=938247&r2=938248&view=diff
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
(original)
+++
maven/plugin-tools/trunk/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
Mon Apr 26 21:32:51 2010
@@ -33,6 +33,7 @@ import org.apache.maven.plugin.descripto
import org.apache.maven.plugin.descriptor.Requirement;
import org.apache.maven.project.MavenProject;
import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
+import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
import org.apache.maven.tools.plugin.PluginToolsRequest;
import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
import org.apache.maven.tools.plugin.extractor.ExtractionException;
@@ -198,7 +199,7 @@ public class JavaMojoDescriptorExtractor
protected MojoDescriptor createMojoDescriptor( JavaClass javaClass )
throws InvalidPluginDescriptorException
{
- MojoDescriptor mojoDescriptor = new MojoDescriptor();
+ ExtendedMojoDescriptor mojoDescriptor = new ExtendedMojoDescriptor();
mojoDescriptor.setLanguage( "java" );
mojoDescriptor.setImplementation( javaClass.getFullyQualifiedName() );
mojoDescriptor.setDescription( javaClass.getComment() );
@@ -303,6 +304,14 @@ public class JavaMojoDescriptorExtractor
mojoDescriptor.setDependencyResolutionRequired( v );
}
+ // What version it was introduced in
+ DocletTag requiresDependencyCollection =
+ findInClassHierarchy( javaClass,
JavaMojoAnnotation.REQUIRES_DEPENDENCY_COLLECTION );
+ if ( requiresDependencyCollection != null )
+ {
+ mojoDescriptor.setRequiresDependencyCollection(
requiresDependencyCollection.getValue() );
+ }
+
// requiresDirectInvocation flag
value =
getBooleanTagValue( javaClass,
JavaMojoAnnotation.REQUIRES_DIRECT_INVOCATION,
@@ -324,7 +333,7 @@ public class JavaMojoDescriptorExtractor
getBooleanTagValue( javaClass,
JavaMojoAnnotation.REQUIRES_REPORTS, mojoDescriptor.isRequiresReports() );
mojoDescriptor.setRequiresReports( value );
- //
----------------------------------------------------------------------
+ // --------------------------------------------------------
--------------
// Javadoc annotations in alphabetical order
//
----------------------------------------------------------------------
@@ -342,6 +351,11 @@ public class JavaMojoDescriptorExtractor
mojoDescriptor.setSince( since.getValue() );
}
+ // Threadsafe mojo
+
+ value = getBooleanTagValue( javaClass, JavaMojoAnnotation.THREADSAFE,
true, mojoDescriptor.isThreadSafe() );
+ mojoDescriptor.setThreadSafe( value );
+
extractParameters( mojoDescriptor, javaClass );
return mojoDescriptor;
@@ -371,6 +385,35 @@ public class JavaMojoDescriptorExtractor
}
/**
+ * @param javaClass not null
+ * @param tagName not null
+ * @param defaultForTag The wanted default value when only the tagname is
present
+ * @param defaultValue the wanted default value when the tag is not
specified
+ * @return the boolean value of the given tagName
+ * @see #findInClassHierarchy(JavaClass, String)
+ */
+ private static boolean getBooleanTagValue( JavaClass javaClass, String
tagName, boolean defaultForTag,
+ boolean defaultValue )
+ {
+ DocletTag tag = findInClassHierarchy( javaClass, tagName );
+
+ if ( tag != null )
+ {
+ String value = tag.getValue();
+
+ if ( StringUtils.isEmpty( value ) )
+ {
+ return defaultForTag;
+ }
+ else if ( StringUtils.isNotEmpty( value ) )
+ {
+ return Boolean.valueOf( value ).booleanValue();
+ }
+ }
+ return defaultValue;
+ }
+
+ /**
* @param javaClass not null
* @param tagName not null
* @return docletTag instance
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java?rev=938248&r1=938247&r2=938248&view=diff
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
(original)
+++
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
Mon Apr 26 21:32:51 2010
@@ -26,6 +26,7 @@ import org.apache.maven.plugin.descripto
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
+import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
import org.apache.maven.tools.plugin.PluginToolsRequest;
import org.codehaus.plexus.util.FileUtils;
@@ -113,7 +114,20 @@ public class JavaMojoDescriptorExtractor
assertEquals( "Implementation parameter", "source2.sub.MyBla",
parameter.getImplementation() );
}
-
+
+ public void testMaven30Parameters()
+ throws Exception
+ {
+ List results = extract( "source2" );
+
+ assertEquals( 1, results.size() );
+
+ ExtendedMojoDescriptor mojoDescriptor = (ExtendedMojoDescriptor)
results.get( 0 );
+ assertTrue( mojoDescriptor.isThreadSafe());
+ assertEquals( "test", mojoDescriptor.getRequiresDependencyCollection()
);
+
+ }
+
/**
* Check that the mojo descriptor extractor will ignore any annotations
that are found.
*
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source2/JavaExtractorTestThree.java
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source2/JavaExtractorTestThree.java?rev=938248&r1=938247&r2=938248&view=diff
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source2/JavaExtractorTestThree.java
(original)
+++
maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source2/JavaExtractorTestThree.java
Mon Apr 26 21:32:51 2010
@@ -26,6 +26,9 @@ import org.apache.maven.plugin.AbstractM
*
* @goal ideaThree
* @requiresDependencyResolution compile
+ * @requiresDependencyCollection test
+ * @threadSafe
+ *
*/
public class JavaExtractorTestThree
extends AbstractMojo
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/it/basic/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/it/basic/pom.xml?rev=938248&r1=938247&r2=938248&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/it/basic/pom.xml
(original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/it/basic/pom.xml
Mon Apr 26 21:32:51 2010
@@ -94,6 +94,9 @@ under the License.
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet</tagletClass>
</taglet>
<taglet>
+
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyCollectionTypeTaglet</tagletClass>
+ </taglet>
+ <taglet>
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet</tagletClass>
</taglet>
<taglet>
@@ -105,6 +108,9 @@ under the License.
<taglet>
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet</tagletClass>
</taglet>
+ <taglet>
+
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoThreadSafeTypeTaglet</tagletClass>
+ </taglet>
</taglets>
<tagletArtifact>
Added:
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoRequiresDependencyCollectionTypeTaglet.java
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoRequiresDependencyCollectionTypeTaglet.java?rev=938248&view=auto
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoRequiresDependencyCollectionTypeTaglet.java
(added)
+++
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoRequiresDependencyCollectionTypeTaglet.java
Mon Apr 26 21:32:51 2010
@@ -0,0 +1,117 @@
+package org.apache.maven.tools.plugin.javadoc;
+
+/*
+ * 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 com.sun.tools.doclets.Taglet;
+import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
+
+import java.util.Map;
+
+/**
+ * The <tt>@requiresDependencyCollection</tt> tag is used to specify the
required dependencies in the specified scope
+ * and has parameter.
+ * <br/>
+ * The following is a sample declaration:
+ * <pre>
+ * /**
+ *  * Dummy Mojo.
+ *  *
+ *  * @requiresDependencyCollection <requiredScope>
+ *  * ...
+ *  */
+ * public class MyMojo extends AbstractMojo{}
+ * </pre>
+ * To use it, calling the <code>Javadoc</code> tool with the following:
+ * <pre>
+ * javadoc ... -taglet
'org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyCollectionTypeTaglet'
+ * </pre>
+ * <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool
with the following:
+ * <pre>
+ * javadoc ... -tag 'requiresDependencyCollection:t:Requires the collection of
the dependencies in this specified scope:'
+ * </pre>
+ *
+ * @see <a
href="package-summary.html#package_description">package-summary.html</a>
+ *
+ * @author Kristian Rosenvold
+ * @version $Id$
+ */
+public class MojoRequiresDependencyCollectionTypeTaglet
+ extends AbstractMojoTypeTaglet
+{
+ /** The Javadoc annotation */
+ private static final String NAME =
JavaMojoAnnotation.REQUIRES_DEPENDENCY_COLLECTION;
+
+ /** The Javadoc text which will be added to the generated page. */
+ protected static final String HEADER = "Collects the dependencies in this
specified scope";
+
+ /**
+ * @return By default, return the string defined in {...@linkplain
#HEADER}.
+ * @see AbstractMojoTaglet#getHeader()
+ * @see #HEADER
+ */
+ public String getHeader()
+ {
+ return HEADER;
+ }
+
+ /**
+ * @return <code>"*"</code> since
<code>@requiresDependencyCollection</code> has value.
+ * @see AbstractMojoTaglet#getAllowedValue()
+ */
+ public String getAllowedValue()
+ {
+ return "*";
+ }
+
+ /**
+ * @return <code>null</code> since
<code>@requiresDependencyCollection</code> has no parameter.
+ * @see AbstractMojoTaglet#getAllowedParameterNames()
+ */
+ public String[] getAllowedParameterNames()
+ {
+ return null;
+ }
+
+ /**
+ * @return By default, return the name of this taglet.
+ * @see com.sun.tools.doclets.Taglet#getName()
+ * @see
org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyCollectionTypeTaglet#NAME
+ */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /**
+ * Register this Taglet.
+ *
+ * @param tagletMap the map to register this tag to.
+ */
+ public static void register( Map tagletMap )
+ {
+ MojoRequiresDependencyCollectionTypeTaglet tag = new
MojoRequiresDependencyCollectionTypeTaglet();
+ Taglet t = (Taglet) tagletMap.get( tag.getName() );
+ if ( t != null )
+ {
+ tagletMap.remove( tag.getName() );
+ }
+ tagletMap.put( tag.getName(), tag );
+ }
+}
\ No newline at end of file
Propchange:
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoRequiresDependencyCollectionTypeTaglet.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoThreadSafeTypeTaglet.java
URL:
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoThreadSafeTypeTaglet.java?rev=938248&view=auto
==============================================================================
---
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoThreadSafeTypeTaglet.java
(added)
+++
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoThreadSafeTypeTaglet.java
Mon Apr 26 21:32:51 2010
@@ -0,0 +1,116 @@
+package org.apache.maven.tools.plugin.javadoc;
+
+/*
+ * 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 com.sun.tools.doclets.Taglet;
+import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
+
+import java.util.Map;
+
+/**
+ * The <tt>@threadSafe</tt> tag is used to indicate that a mojo is threadsafe
and can be run in parallel
+ * <br/>
+ * The following is a sample declaration:
+ * <pre>
+ * /**
+ *  * Dummy Mojo.
+ *  *
+ *  * @threadSafe <true|false>
+ *  * ...
+ *  */
+ * public class MyMojo extends AbstractMojo{}
+ * </pre>
+ * To use it, calling the <code>Javadoc</code> tool with the following:
+ * <pre>
+ * javadoc ... -taglet
'org.apache.maven.tools.plugin.javadoc.MojoThreadSafeTypeTaglet'
+ * </pre>
+ * <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool
with the following:
+ * <pre>
+ * javadoc ... -tag 'threadSafe:t:Indicates the mojo is threadsafe'
+ * </pre>
+ *
+ * @see <a
href="package-summary.html#package_description">package-summary.html</a>
+ *
+ * @author Kristian Rosenvold
+ * @version $Id$
+ */
+public class MojoThreadSafeTypeTaglet
+ extends AbstractMojoTypeTaglet
+{
+ /** The Javadoc annotation */
+ private static final String NAME = JavaMojoAnnotation.THREADSAFE;
+
+ /** The Javadoc text which will be added to the generated page. */
+ protected static final String HEADER = "Mojo is thread safe";
+
+ /**
+ * @return By default, return the string defined in {...@linkplain
#HEADER}.
+ * @see AbstractMojoTaglet#getHeader()
+ * @see #HEADER
+ */
+ public String getHeader()
+ {
+ return HEADER;
+ }
+
+ /**
+ * @return <code>true|false</code> since <code>@requiresProject</code> has
value.
+ * @see AbstractMojoTaglet#getAllowedValue()
+ */
+ public String getAllowedValue()
+ {
+ return "true|false";
+ }
+
+ /**
+ * @return <code>null</code> since <code>@requiresProject</code> has no
parameter.
+ * @see AbstractMojoTaglet#getAllowedParameterNames()
+ */
+ public String[] getAllowedParameterNames()
+ {
+ return null;
+ }
+
+ /**
+ * @return By default, return the name of this taglet.
+ * @see com.sun.tools.doclets.Taglet#getName()
+ * @see MojoThreadSafeTypeTaglet#NAME
+ */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /**
+ * Register this Taglet.
+ *
+ * @param tagletMap the map to register this tag to.
+ */
+ public static void register( Map tagletMap )
+ {
+ MojoThreadSafeTypeTaglet tag = new MojoThreadSafeTypeTaglet();
+ Taglet t = (Taglet) tagletMap.get( tag.getName() );
+ if ( t != null )
+ {
+ tagletMap.remove( tag.getName() );
+ }
+ tagletMap.put( tag.getName(), tag );
+ }
+}
\ No newline at end of file
Propchange:
maven/plugin-tools/trunk/maven-plugin-tools-javadoc/src/main/java/org/apache/maven/tools/plugin/javadoc/MojoThreadSafeTypeTaglet.java
------------------------------------------------------------------------------
svn:eol-style = native