You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2008/02/28 05:04:20 UTC
svn commit: r631837 -
/maven/components/branches/maven-2.0.x/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
Author: vsiveton
Date: Wed Feb 27 20:04:16 2008
New Revision: 631837
URL: http://svn.apache.org/viewvc?rev=631837&view=rev
Log:
o added more javadoc
Modified:
maven/components/branches/maven-2.0.x/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
Modified: maven/components/branches/maven-2.0.x/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java?rev=631837&r1=631836&r2=631837&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java (original)
+++ maven/components/branches/maven-2.0.x/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java Wed Feb 27 20:04:16 2008
@@ -31,18 +31,26 @@
import java.util.Map;
/**
- * The bean containing the mojo descriptor.
+ * The bean containing the Mojo descriptor.
+ * <br/>
+ * For more information about the usage tag, have a look to:
+ * <a href="http://maven.apache.org/developers/mojo-api-specification.html">http://maven.apache.org/developers/mojo-api-specification.html</a>
*
- * @todo is there a need for the delegation of MavenMojoDescriptor to this? Why not just extend ComponentDescriptor here?
+ * @todo is there a need for the delegation of MavenMojoDescriptor to this?
+ * Why not just extend ComponentDescriptor here?
+ * @version $Id$
*/
public class MojoDescriptor
extends ComponentDescriptor
implements Cloneable
{
+ /** The Plexus component type */
public static String MAVEN_PLUGIN = "maven-plugin";
+ /** "once-per-session" execution strategy */
public static final String SINGLE_PASS_EXEC_STRATEGY = "once-per-session";
+ /** "always" execution strategy */
public static final String MULTI_PASS_EXEC_STRATEGY = "always";
private static final String DEFAULT_INSTANTIATION_STRATEGY = "per-lookup";
@@ -53,44 +61,64 @@
private Map parameterMap;
+ /** By default, the execution strategy is "once-per-session" */
private String executionStrategy = SINGLE_PASS_EXEC_STRATEGY;
+ /** The goal name of the Mojo */
private String goal;
+ /** Reference the binded phase name of the Mojo */
private String phase;
-
+
+ /** Specify the version when the Mojo was added to the API. Similar to Javadoc since. */
private String since;
+ /** Reference the invocation phase of the Mojo */
private String executePhase;
+ /** Reference the invocation goal of the Mojo */
private String executeGoal;
+ /** Reference the invocation lifecycle of the Mojo */
private String executeLifecycle;
+ /** Specify the version when the Mojo was deprecated to the API. Similar to Javadoc deprecated. */
private String deprecated;
+ /** By default, no need to aggregate the Maven project and its child modules */
private boolean aggregator = false;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
+ /** Specify the required dependencies in a specified scope */
private String dependencyResolutionRequired = null;
+ /** By default, the Mojo needs a Maven project to be executed */
private boolean projectRequired = true;
+ /** By default, the Mojo is online */
private boolean onlineRequired = false;
+ /** Plugin configuration */
private PlexusConfiguration mojoConfiguration;
+ /** Plugin descriptor */
private PluginDescriptor pluginDescriptor;
+ /** By default, the Mojo is herited */
private boolean inheritedByDefault = true;
+ /** By default, the Mojo could not be invoke directly */
private boolean directInvocationOnly = false;
+ /** By default, the Mojo don't need reports to run */
private boolean requiresReports = false;
+ /**
+ * Default constructor.
+ */
public MojoDescriptor()
{
setInstantiationStrategy( DEFAULT_INSTANTIATION_STRATEGY );
@@ -101,31 +129,50 @@
//
// ----------------------------------------------------------------------
+ /**
+ * @return the language of this Mojo, i.e. <code>java</code>
+ */
public String getLanguage()
{
return getComponentFactory();
}
+ /**
+ * @param language the new language
+ */
public void setLanguage( String language )
{
setComponentFactory( language );
}
+ /**
+ * @return <code>true</code> if the Mojo is deprecated, <code>false</code> otherwise.
+ */
public String getDeprecated()
{
return deprecated;
}
+ /**
+ * @param deprecated <code>true</code> to deprecate the Mojo, <code>false</code> otherwise.
+ */
public void setDeprecated( String deprecated )
{
this.deprecated = deprecated;
}
+ /**
+ * @return the list of parameters
+ */
public List getParameters()
{
return parameters;
}
+ /**
+ * @param parameters the new list of parameters
+ * @throws DuplicateParameterException if any
+ */
public void setParameters( List parameters )
throws DuplicateParameterException
{
@@ -136,6 +183,10 @@
}
}
+ /**
+ * @param parameter add a new parameter
+ * @throws DuplicateParameterException if any
+ */
public void addParameter( Parameter parameter )
throws DuplicateParameterException
{
@@ -145,17 +196,18 @@
" has been declared multiple times in mojo with goal: " + getGoal() + " (implementation: " +
getImplementation() + ")" );
}
- else
- {
- if ( parameters == null )
- {
- parameters = new LinkedList();
- }
- parameters.add( parameter );
+ if ( parameters == null )
+ {
+ parameters = new LinkedList();
}
+
+ parameters.add( parameter );
}
+ /**
+ * @return the list parameters as a Map
+ */
public Map getParameterMap()
{
if ( parameterMap == null )
@@ -180,11 +232,18 @@
// Dependency requirement
// ----------------------------------------------------------------------
+ /**
+ * @param requiresDependencyResolution the new required dependencies in a specified scope
+ */
public void setDependencyResolutionRequired( String requiresDependencyResolution )
{
this.dependencyResolutionRequired = requiresDependencyResolution;
}
+ /**
+ * @return the required dependencies in a specified scope
+ * @TODO the name is not intelligible
+ */
public String isDependencyResolutionRequired()
{
return dependencyResolutionRequired;
@@ -194,11 +253,17 @@
// Project requirement
// ----------------------------------------------------------------------
+ /**
+ * @param requiresProject <code>true</code> if the Mojo needs a Maven project to be executed, <code>false</code> otherwise.
+ */
public void setProjectRequired( boolean requiresProject )
{
this.projectRequired = requiresProject;
}
+ /**
+ * @return <code>true</code> if the Mojo needs a Maven project to be executed, <code>false</code> otherwise.
+ */
public boolean isProjectRequired()
{
return projectRequired;
@@ -208,11 +273,17 @@
// Online vs. Offline requirement
// ----------------------------------------------------------------------
+ /**
+ * @param requiresOnline <code>true</code> if the Mojo is online, <code>false</code> otherwise.
+ */
public void setOnlineRequired( boolean requiresOnline )
{
this.onlineRequired = requiresOnline;
}
+ /**
+ * @return <code>true</code> if the Mojo is online, <code>false</code> otherwise.
+ */
// blech! this isn't even intelligible as a method name. provided for
// consistency...
public boolean isOnlineRequired()
@@ -220,67 +291,106 @@
return onlineRequired;
}
+ /**
+ * @return <code>true</code> if the Mojo is online, <code>false</code> otherwise.
+ */
// more english-friendly method...keep the code clean! :)
public boolean requiresOnline()
{
return onlineRequired;
}
+ /**
+ * @return the binded phase name of the Mojo
+ */
public String getPhase()
{
return phase;
}
+ /**
+ * @param phase the new binded phase name of the Mojo
+ */
public void setPhase( String phase )
{
this.phase = phase;
}
+ /**
+ * @return the version when the Mojo was added to the API
+ */
public String getSince()
{
return since;
}
+ /**
+ * @param since the new version when the Mojo was added to the API
+ */
public void setSince( String since )
{
this.since = since;
}
+ /**
+ * @return The goal name of the Mojo
+ */
public String getGoal()
{
return goal;
}
+ /**
+ * @param goal The new goal name of the Mojo
+ */
public void setGoal( String goal )
{
this.goal = goal;
}
+ /**
+ * @return the invocation phase of the Mojo
+ */
public String getExecutePhase()
{
return executePhase;
}
+ /**
+ * @param executePhase the new invocation phase of the Mojo
+ */
public void setExecutePhase( String executePhase )
{
this.executePhase = executePhase;
}
+ /**
+ * @return <code>true</code> if the Mojo uses <code>always</code> for the <code>executionStrategy</code>
+ */
public boolean alwaysExecute()
{
return MULTI_PASS_EXEC_STRATEGY.equals( executionStrategy );
}
+ /**
+ * @return the execution strategy
+ */
public String getExecutionStrategy()
{
return executionStrategy;
}
+ /**
+ * @param executionStrategy the new execution strategy
+ */
public void setExecutionStrategy( String executionStrategy )
{
this.executionStrategy = executionStrategy;
}
+ /**
+ * @return the mojo configuration
+ */
public PlexusConfiguration getMojoConfiguration()
{
if ( mojoConfiguration == null )
@@ -290,56 +400,83 @@
return mojoConfiguration;
}
+ /**
+ * @param mojoConfiguration a new mojo configuration
+ */
public void setMojoConfiguration( PlexusConfiguration mojoConfiguration )
{
this.mojoConfiguration = mojoConfiguration;
}
+ /** {@inheritDoc} */
public String getRole()
{
return Mojo.ROLE;
}
+ /** {@inheritDoc} */
public String getRoleHint()
{
return getId();
}
+ /**
+ * @return the id of the mojo, based on the goal name
+ */
public String getId()
{
return getPluginDescriptor().getId() + ":" + getGoal();
}
+ /**
+ * @return the full goal name
+ * @see PluginDescriptor#getGoalPrefix()
+ * @see #getGoal()
+ */
public String getFullGoalName()
{
return getPluginDescriptor().getGoalPrefix() + ":" + getGoal();
}
+ /** {@inheritDoc} */
public String getComponentType()
{
return MAVEN_PLUGIN;
}
+ /**
+ * @return the plugin descriptor
+ */
public PluginDescriptor getPluginDescriptor()
{
return pluginDescriptor;
}
+ /**
+ * @param pluginDescriptor the new plugin descriptor
+ */
public void setPluginDescriptor( PluginDescriptor pluginDescriptor )
{
this.pluginDescriptor = pluginDescriptor;
}
+ /**
+ * @return <code>true</code> if the Mojo is herited, <code>false</code> otherwise.
+ */
public boolean isInheritedByDefault()
{
return inheritedByDefault;
}
+ /**
+ * @param inheritedByDefault <code>true</code> if the Mojo is herited, <code>false</code> otherwise.
+ */
public void setInheritedByDefault( boolean inheritedByDefault )
{
this.inheritedByDefault = inheritedByDefault;
}
+ /** {@inheritDoc} */
public boolean equals( Object object )
{
if ( this == object )
@@ -382,6 +519,7 @@
return true;
}
+ /** {@inheritDoc} */
public int hashCode()
{
int result = 1;
@@ -403,51 +541,81 @@
return result;
}
+ /**
+ * @return the invocation lifecycle of the Mojo
+ */
public String getExecuteLifecycle()
{
return executeLifecycle;
}
+ /**
+ * @param executeLifecycle the new invocation lifecycle of the Mojo
+ */
public void setExecuteLifecycle( String executeLifecycle )
{
this.executeLifecycle = executeLifecycle;
}
+ /**
+ * @param aggregator <code>true</code> if the Mojo uses the Maven project and its child modules, <code>false</code> otherwise.
+ */
public void setAggregator( boolean aggregator )
{
this.aggregator = aggregator;
}
+ /**
+ * @return <code>true</code> if the Mojo uses the Maven project and its child modules, <code>false</code> otherwise.
+ */
public boolean isAggregator()
{
return aggregator;
}
+ /**
+ * @return <code>true</code> if the Mojo could not be invoke directly, <code>false</code> otherwise.
+ */
public boolean isDirectInvocationOnly()
{
return directInvocationOnly;
}
+ /**
+ * @param directInvocationOnly <code>true</code> if the Mojo could not be invoke directly, <code>false</code> otherwise.
+ */
public void setDirectInvocationOnly( boolean directInvocationOnly )
{
this.directInvocationOnly = directInvocationOnly;
}
+ /**
+ * @return <code>true</code> if the Mojo needs reports to run, <code>false</code> otherwise.
+ */
public boolean isRequiresReports()
{
return requiresReports;
}
+ /**
+ * @param requiresReports <code>true</code> if the Mojo needs reports to run, <code>false</code> otherwise.
+ */
public void setRequiresReports( boolean requiresReports )
{
this.requiresReports = requiresReports;
}
+ /**
+ * @param executeGoal the new invocation goal of the Mojo
+ */
public void setExecuteGoal( String executeGoal )
{
this.executeGoal = executeGoal;
}
+ /**
+ * @return the invocation goal of the Mojo
+ */
public String getExecuteGoal()
{
return executeGoal;