org.apache.maven.tools.plugin.extractor.java
Class JavaMojoDescriptorExtractor

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.apache.maven.tools.plugin.extractor.java.JavaMojoDescriptorExtractor
All Implemented Interfaces:
JavaMojoAnnotation, MojoDescriptorExtractor, org.codehaus.plexus.logging.LogEnabled

@Component(role=MojoDescriptorExtractor.class,
           hint="java")
public class JavaMojoDescriptorExtractor
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements MojoDescriptorExtractor, JavaMojoAnnotation

Extracts Mojo descriptors from Java sources.
For more information about the usage tag, have a look to: http://maven.apache.org/developers/mojo-api-specification.html

Version:
$Id: JavaMojoDescriptorExtractor.java 1343166 2012-05-28 08:54:25Z hboutemy $
See Also:
MojoDescriptor

Field Summary
static String COMPONENT
          Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT instead of.
static String COMPONENT_ROLE
          Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT_ROLE instead of.
static String COMPONENT_ROLEHINT
          Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT_ROLEHINT instead of.
static String CONFIGURATOR
          Deprecated. since 2.4, use JavaMojoAnnotation.CONFIGURATOR instead of.
static String DEPRECATED
          Deprecated. since 2.4, use JavaMojoAnnotation.DEPRECATED instead of.
static String EXECUTE
          Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE instead of.
static String EXECUTE_GOAL
          Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_GOAL instead of.
static String EXECUTE_LIFECYCLE
          Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_LIFECYCLE instead of.
static String EXECUTE_PHASE
          Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_PHASE instead of.
static String GOAL
          Deprecated. since 2.4, use JavaMojoAnnotation.GOAL instead of.
static String GOAL_DESCRIPTION
          Deprecated. since 2.4, use JavaMojoAnnotation.DESCRIPTION instead of.
static String GOAL_INHERIT_BY_DEFAULT
          Deprecated. since 2.4, use JavaMojoAnnotation.INHERIT_BY_DEFAULT instead of.
static String GOAL_IS_AGGREGATOR
          Deprecated. since 2.4, use JavaMojoAnnotation.AGGREGATOR instead of.
static String GOAL_MULTI_EXECUTION_STRATEGY
          Deprecated. since 2.4, use JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY instead of.
static String GOAL_REQUIRES_DEPENDENCY_RESOLUTION
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_DEPENDENCY_RESOLUTION instead of.
static String GOAL_REQUIRES_DIRECT_INVOCATION
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_DIRECT_INVOCATION instead of.
static String GOAL_REQUIRES_ONLINE
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_ONLINE instead of.
static String GOAL_REQUIRES_PROJECT
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_PROJECT instead of.
static String GOAL_REQUIRES_REPORTS
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_REPORTS instead of.
static String MAVEN_PLUGIN_INSTANTIATION
          Deprecated. since 2.4, use JavaMojoAnnotation.INSTANTIATION_STRATEGY instead of.
static String PARAMETER
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER instead of.
static String PARAMETER_ALIAS
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_ALIAS instead of.
static String PARAMETER_DEFAULT_VALUE
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_DEFAULT_VALUE instead of.
static String PARAMETER_EXPRESSION
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_EXPRESSION instead of.
static String PARAMETER_IMPLEMENTATION
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_IMPLEMENTATION instead of.
static String PHASE
          Deprecated. since 2.4, use JavaMojoAnnotation.PHASE instead of.
static String READONLY
          Deprecated. since 2.4, use JavaMojoAnnotation.READONLY instead of.
static String REQUIRED
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRED instead of.
static String SINCE
          Deprecated. since 2.4, use JavaMojoAnnotation.SINCE instead of.
 
Fields inherited from interface org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor
ROLE
 
Fields inherited from interface org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation
AGGREGATOR, DESCRIPTION, EXECUTION_STATEGY, IMPLEMENTATION, INHERIT_BY_DEFAULT, INSTANTIATION_STRATEGY, LANGUAGE, MULTI_EXECUTION_STRATEGY, PARAMETER_PROPERTY, REQUIRES_DEPENDENCY_COLLECTION, REQUIRES_DEPENDENCY_RESOLUTION, REQUIRES_DIRECT_INVOCATION, REQUIRES_ONLINE, REQUIRES_PROJECT, REQUIRES_REPORTS, THREAD_SAFE
 
Constructor Summary
JavaMojoDescriptorExtractor()
           
 
Method Summary
protected  org.apache.maven.plugin.descriptor.MojoDescriptor createMojoDescriptor(com.thoughtworks.qdox.model.JavaClass javaClass)
           
protected  com.thoughtworks.qdox.model.JavaClass[] discoverClasses(PluginToolsRequest request)
           
 List<org.apache.maven.plugin.descriptor.MojoDescriptor> execute(org.apache.maven.project.MavenProject project, org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor)
          Execute the mojo extraction.
 List<org.apache.maven.plugin.descriptor.MojoDescriptor> execute(PluginToolsRequest request)
          Execute the mojo extraction.
protected  void validate(org.apache.maven.plugin.descriptor.MojoDescriptor mojoDescriptor)
           
protected  void validateParameter(org.apache.maven.plugin.descriptor.Parameter parameter, int i)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAVEN_PLUGIN_INSTANTIATION

public static final String MAVEN_PLUGIN_INSTANTIATION
Deprecated. since 2.4, use JavaMojoAnnotation.INSTANTIATION_STRATEGY instead of.
See Also:
Constant Field Values

CONFIGURATOR

public static final String CONFIGURATOR
Deprecated. since 2.4, use JavaMojoAnnotation.CONFIGURATOR instead of.
See Also:
Constant Field Values

PARAMETER

public static final String PARAMETER
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER instead of.
See Also:
Constant Field Values

PARAMETER_EXPRESSION

public static final String PARAMETER_EXPRESSION
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_EXPRESSION instead of.
See Also:
Constant Field Values

PARAMETER_DEFAULT_VALUE

public static final String PARAMETER_DEFAULT_VALUE
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_DEFAULT_VALUE instead of.
See Also:
Constant Field Values

PARAMETER_ALIAS

public static final String PARAMETER_ALIAS
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_ALIAS instead of.
See Also:
Constant Field Values

SINCE

public static final String SINCE
Deprecated. since 2.4, use JavaMojoAnnotation.SINCE instead of.
See Also:
Constant Field Values

PARAMETER_IMPLEMENTATION

public static final String PARAMETER_IMPLEMENTATION
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_IMPLEMENTATION instead of.
See Also:
Constant Field Values

REQUIRED

public static final String REQUIRED
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRED instead of.
See Also:
Constant Field Values

DEPRECATED

public static final String DEPRECATED
Deprecated. since 2.4, use JavaMojoAnnotation.DEPRECATED instead of.
See Also:
Constant Field Values

READONLY

public static final String READONLY
Deprecated. since 2.4, use JavaMojoAnnotation.READONLY instead of.
See Also:
Constant Field Values

GOAL

public static final String GOAL
Deprecated. since 2.4, use JavaMojoAnnotation.GOAL instead of.
See Also:
Constant Field Values

PHASE

public static final String PHASE
Deprecated. since 2.4, use JavaMojoAnnotation.PHASE instead of.
See Also:
Constant Field Values

EXECUTE

public static final String EXECUTE
Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE instead of.
See Also:
Constant Field Values

EXECUTE_LIFECYCLE

public static final String EXECUTE_LIFECYCLE
Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_LIFECYCLE instead of.
See Also:
Constant Field Values

EXECUTE_PHASE

public static final String EXECUTE_PHASE
Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_PHASE instead of.
See Also:
Constant Field Values

EXECUTE_GOAL

public static final String EXECUTE_GOAL
Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_GOAL instead of.
See Also:
Constant Field Values

GOAL_DESCRIPTION

public static final String GOAL_DESCRIPTION
Deprecated. since 2.4, use JavaMojoAnnotation.DESCRIPTION instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_DEPENDENCY_RESOLUTION

public static final String GOAL_REQUIRES_DEPENDENCY_RESOLUTION
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_DEPENDENCY_RESOLUTION instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_PROJECT

public static final String GOAL_REQUIRES_PROJECT
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_PROJECT instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_REPORTS

public static final String GOAL_REQUIRES_REPORTS
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_REPORTS instead of.
See Also:
Constant Field Values

GOAL_IS_AGGREGATOR

public static final String GOAL_IS_AGGREGATOR
Deprecated. since 2.4, use JavaMojoAnnotation.AGGREGATOR instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_ONLINE

public static final String GOAL_REQUIRES_ONLINE
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_ONLINE instead of.
See Also:
Constant Field Values

GOAL_INHERIT_BY_DEFAULT

public static final String GOAL_INHERIT_BY_DEFAULT
Deprecated. since 2.4, use JavaMojoAnnotation.INHERIT_BY_DEFAULT instead of.
See Also:
Constant Field Values

GOAL_MULTI_EXECUTION_STRATEGY

public static final String GOAL_MULTI_EXECUTION_STRATEGY
Deprecated. since 2.4, use JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_DIRECT_INVOCATION

public static final String GOAL_REQUIRES_DIRECT_INVOCATION
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_DIRECT_INVOCATION instead of.
See Also:
Constant Field Values

COMPONENT

public static final String COMPONENT
Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT instead of.
See Also:
Constant Field Values

COMPONENT_ROLE

public static final String COMPONENT_ROLE
Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT_ROLE instead of.
See Also:
Constant Field Values

COMPONENT_ROLEHINT

public static final String COMPONENT_ROLEHINT
Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT_ROLEHINT instead of.
See Also:
Constant Field Values
Constructor Detail

JavaMojoDescriptorExtractor

public JavaMojoDescriptorExtractor()
Method Detail

validateParameter

protected void validateParameter(org.apache.maven.plugin.descriptor.Parameter parameter,
                                 int i)
                          throws org.apache.maven.plugin.descriptor.InvalidParameterException
Parameters:
parameter - not null
i - positive number
Throws:
org.apache.maven.plugin.descriptor.InvalidParameterException - if any

createMojoDescriptor

protected org.apache.maven.plugin.descriptor.MojoDescriptor createMojoDescriptor(com.thoughtworks.qdox.model.JavaClass javaClass)
                                                                          throws org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException
Parameters:
javaClass - not null
Returns:
a mojo descriptor
Throws:
org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException - if any

execute

public List<org.apache.maven.plugin.descriptor.MojoDescriptor> execute(org.apache.maven.project.MavenProject project,
                                                                       org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor)
                                                                throws ExtractionException,
                                                                       org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException
Execute the mojo extraction.

Specified by:
execute in interface MojoDescriptorExtractor
Returns:
a list of mojo descriptors.
Throws:
ExtractionException - if any
org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException - if any

execute

public List<org.apache.maven.plugin.descriptor.MojoDescriptor> execute(PluginToolsRequest request)
                                                                throws ExtractionException,
                                                                       org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException
Execute the mojo extraction.

Specified by:
execute in interface MojoDescriptorExtractor
Parameters:
request - The PluginToolsRequest containing information for the extraction process.
Returns:
a list of mojo descriptors.
Throws:
ExtractionException - if any
org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException - if any

discoverClasses

protected com.thoughtworks.qdox.model.JavaClass[] discoverClasses(PluginToolsRequest request)
Parameters:
request - The plugin request.
Returns:
an array of java class

validate

protected void validate(org.apache.maven.plugin.descriptor.MojoDescriptor mojoDescriptor)
                 throws org.apache.maven.plugin.descriptor.InvalidParameterException
Parameters:
mojoDescriptor - not null
Throws:
org.apache.maven.plugin.descriptor.InvalidParameterException - if any


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.