From c0b1429c818238a034e2cd228a045e43e003178d Mon Sep 17 00:00:00 2001 From: Vincent Siveton Date: Tue, 19 Feb 2008 02:14:51 +0000 Subject: [PATCH] o more javadoc git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@628966 13f79535-47bb-0310-9956-ffa450edef68 --- .../ant/AntMojoDescriptorExtractor.java | 11 +++- .../BeanshellMojoDescriptorExtractor.java | 5 ++ .../java/JavaMojoDescriptorExtractor.java | 64 ++++++++++++++++--- 3 files changed, 71 insertions(+), 9 deletions(-) diff --git a/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java b/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java index 5cbbb63..6958900 100644 --- a/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java +++ b/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java @@ -36,14 +36,21 @@ import java.util.List; import java.util.Map; import java.util.Set; +/** + * Extracts Mojo descriptors from Ant sources. + * + * @version $Id$ + */ public class AntMojoDescriptorExtractor extends AbstractScriptedMojoDescriptorExtractor { - + /** Default metada file extension */ private static final String METADATA_FILE_EXTENSION = ".mojos.xml"; + /** Default Ant build file extension */ private static final String SCRIPT_FILE_EXTENSION = ".build.xml"; + /** {@inheritDoc} */ protected List extractMojoDescriptorsFromMetadata( Map metadataFilesKeyedByBasedir, PluginDescriptor pluginDescriptor ) throws ExtractionException, InvalidPluginDescriptorException @@ -156,11 +163,13 @@ public class AntMojoDescriptorExtractor return descriptors; } + /** {@inheritDoc} */ protected String getScriptFileExtension() { return SCRIPT_FILE_EXTENSION; } + /** {@inheritDoc} */ protected String getMetadataFileExtension() { return METADATA_FILE_EXTENSION; diff --git a/maven-plugin-tools-beanshell/src/main/java/org/apache/maven/tools/plugin/extractor/beanshell/BeanshellMojoDescriptorExtractor.java b/maven-plugin-tools-beanshell/src/main/java/org/apache/maven/tools/plugin/extractor/beanshell/BeanshellMojoDescriptorExtractor.java index 673d936..1b2126a 100644 --- a/maven-plugin-tools-beanshell/src/main/java/org/apache/maven/tools/plugin/extractor/beanshell/BeanshellMojoDescriptorExtractor.java +++ b/maven-plugin-tools-beanshell/src/main/java/org/apache/maven/tools/plugin/extractor/beanshell/BeanshellMojoDescriptorExtractor.java @@ -36,10 +36,13 @@ import java.util.Map; import java.util.Set; /** + * Extracts Mojo descriptors from BeanShell sources. + * * @todo share constants * @todo add example usage tag that can be shown in the doco * @todo need to add validation directives so that systems embedding maven2 can * get validation directives to help users in IDEs. + * @version $Id$ */ public class BeanshellMojoDescriptorExtractor extends AbstractScriptedMojoDescriptorExtractor @@ -73,11 +76,13 @@ public class BeanshellMojoDescriptorExtractor return mojoDescriptor; } + /** {@inheritDoc} */ protected String getScriptFileExtension() { return ".bsh"; } + /** {@inheritDoc} */ protected List extractMojoDescriptors( Map scriptFilesKeyedByBasedir, PluginDescriptor pluginDescriptor ) throws ExtractionException, InvalidPluginDescriptorException { diff --git a/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java b/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java index 559c925..80ed85a 100644 --- a/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java +++ b/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java @@ -46,40 +46,49 @@ import java.util.Map; import java.util.TreeMap; /** - * Extracts Mojo descriptors from Java sources. + * Extracts Mojo descriptors from Java sources. + *
+ * For more information, have a look to: + * http://maven.apache.org/developers/mojo-api-specification.html * * @todo add example usage tag that can be shown in the doco * @todo need to add validation directives so that systems embedding maven2 can * get validation directives to help users in IDEs. + * @version $Id$ */ public class JavaMojoDescriptorExtractor extends AbstractLogEnabled implements MojoDescriptorExtractor { + /** Refer to @instantiationStrategy */ public static final String MAVEN_PLUGIN_INSTANTIATION = "instantiationStrategy"; + /** Refer to @configurator */ public static final String CONFIGURATOR = "configurator"; + /** Refer to @parameter */ public static final String PARAMETER = "parameter"; + /** Refer to expression combined to @parameter */ public static final String PARAMETER_EXPRESSION = "expression"; + /** Refer to default-value combined to @parameter */ public static final String PARAMETER_DEFAULT_VALUE = "default-value"; + /** Refer to alias combined to @parameter */ public static final String PARAMETER_ALIAS = "alias"; + /** Refer to @since */ public static final String SINCE = "since"; - /** - * This defines the default implementation in the case the parameter type is an interface. - */ + /** This defines the default implementation in the case the parameter type is an interface. + * Refer to implementation combined to @parameter */ public static final String PARAMETER_IMPLEMENTATION = "implementation"; /** * This indicates the base name of the bean properties used to read/write this parameter's value. - * So: - * - * @parameter property="project" + *
+ * Refer to @parameter property="project" *

* Would say there is a getProject() method and a setProject(Project) method. Here the field * name would not be the basis for the parameter's name. This mode of operation will allow the @@ -87,48 +96,74 @@ public class JavaMojoDescriptorExtractor */ public static final String PARAMETER_PROPERTY = "property"; + /** Refer to @required */ public static final String REQUIRED = "required"; + /** Refer to @deprecated */ public static final String DEPRECATED = "deprecated"; + /** Refer to @readonly */ public static final String READONLY = "readonly"; + /** Refer to @goal */ public static final String GOAL = "goal"; + /** Refer to @phase */ public static final String PHASE = "phase"; + /** Refer to @execute */ public static final String EXECUTE = "execute"; + /** Refer to lifecycle combined to @execute */ public static final String EXECUTE_LIFECYCLE = "lifecycle"; + /** Refer to phase combined to @execute */ public static final String EXECUTE_PHASE = "phase"; + /** Refer to goal combined to @execute */ public static final String EXECUTE_GOAL = "goal"; + /** Refer to @description */ public static final String GOAL_DESCRIPTION = "description"; + /** Refer to requiresDependencyResolution combined to @goal */ public static final String GOAL_REQUIRES_DEPENDENCY_RESOLUTION = "requiresDependencyResolution"; + /** Refer to requiresProject combined to @goal */ public static final String GOAL_REQUIRES_PROJECT = "requiresProject"; + /** Refer to requiresReports combined to @goal */ public static final String GOAL_REQUIRES_REPORTS = "requiresReports"; + /** Refer to aggregator combined to @goal */ public static final String GOAL_IS_AGGREGATOR = "aggregator"; + /** Refer to requiresOnline combined to @goal */ public static final String GOAL_REQUIRES_ONLINE = "requiresOnline"; + /** Refer to inheritByDefault combined to @goal */ public static final String GOAL_INHERIT_BY_DEFAULT = "inheritByDefault"; + /** Refer to attainAlways combined to @goal */ public static final String GOAL_MULTI_EXECUTION_STRATEGY = "attainAlways"; + /** Refer to attainAlways combined to @goal */ public static final String GOAL_REQUIRES_DIRECT_INVOCATION = "requiresDirectInvocation"; + /** Refer to @component */ public static final String COMPONENT = "component"; + /** Refer to role combined to @component */ public static final String COMPONENT_ROLE = "role"; + /** Refer to roleHint combined to @component */ public static final String COMPONENT_ROLEHINT = "roleHint"; + /** + * @param parameter not null + * @param i + * @throws InvalidParameterException if any + */ protected void validateParameter( Parameter parameter, int i ) throws InvalidParameterException { @@ -161,6 +196,11 @@ public class JavaMojoDescriptorExtractor // Mojo descriptor creation from @tags // ---------------------------------------------------------------------- + /** + * @param javaClass not null + * @return a mojo descriptor + * @throws InvalidPluginDescriptorException if any + */ protected MojoDescriptor createMojoDescriptor( JavaClass javaClass ) throws InvalidPluginDescriptorException { @@ -543,6 +583,7 @@ public class JavaMojoDescriptorExtractor return rawParams; } + /** {@inheritDoc} */ public List execute( MavenProject project, PluginDescriptor pluginDescriptor ) throws ExtractionException, InvalidPluginDescriptorException { @@ -569,8 +610,11 @@ public class JavaMojoDescriptorExtractor return descriptors; } + /** + * @param project not null + * @return an array of java class + */ protected JavaClass[] discoverClasses( final MavenProject project ) - throws ExtractionException { JavaDocBuilder builder = new JavaDocBuilder(); @@ -589,6 +633,10 @@ public class JavaMojoDescriptorExtractor return builder.getClasses(); } + /** + * @param mojoDescriptor not null + * @throws InvalidParameterException if any + */ protected void validate( MojoDescriptor mojoDescriptor ) throws InvalidParameterException {