Permalink
Browse files

Added javadocs and changed MavenPlugin to getCoordinate() instead of …

…getDependency()
  • Loading branch information...
1 parent 3b556d8 commit ef4a10796bf4b77a7f488497b5f91be249130369 @gastaldi gastaldi committed Apr 10, 2013
@@ -10,6 +10,8 @@
import java.util.List;
/**
+ * Builds a {@link Configuration} object
+ *
* @author <a href="mailto:paul.bakker.nl@gmail.com">Paul Bakker</a>
*/
public class ConfigurationBuilder implements Configuration
@@ -9,9 +9,31 @@
import java.util.List;
-public interface Execution {
- String getId();
- String getPhase();
- List<String> getGoals();
- Configuration getConfig();
+/**
+ * Represents an <execution> element in the pom.xml
+ *
+ * @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a>
+ *
+ */
+public interface Execution
+{
+ /**
+ * @return the ID of this execution
+ */
+ String getId();
+
+ /**
+ * @return the phase where this execution belongs
+ */
+ String getPhase();
+
+ /**
+ * @return the goals configured for this execution
+ */
+ List<String> getGoals();
+
+ /**
+ * @return the {@link Configuration} object associated with this execution
+ */
+ Configuration getConfig();
}
@@ -9,6 +9,7 @@
import java.util.List;
+import org.jboss.forge.dependencies.Coordinate;
import org.jboss.forge.dependencies.Dependency;
/**
@@ -19,14 +20,29 @@
public interface MavenPlugin extends PluginElement
{
- Dependency getDependency();
-
+ /**
+ * Returns the {@link Coordinate} represented by this plugin
+ */
+ Coordinate getCoordinate();
+
+ /**
+ * Returns the {@link Configuration} associated with this plugin, if any
+ */
Configuration getConfig();
+ /**
+ * Return the list of {@link Execution} associated with this plugin, if any
+ */
List<Execution> listExecutions();
+ /**
+ * @return if this plugin extensions is enabled
+ */
boolean isExtensionsEnabled();
+ /**
+ * @return the dependencies for this plugin, if any
+ */
List<Dependency> getDirectDependencies();
}
@@ -12,14 +12,18 @@
import java.util.List;
import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
import org.jboss.forge.dependencies.Coordinate;
import org.jboss.forge.dependencies.Dependency;
+import org.jboss.forge.dependencies.builder.CoordinateBuilder;
import org.jboss.forge.dependencies.builder.DependencyBuilder;
/**
+ * A plugin adapter for {@link Plugin} and {@link MavenPlugin}
+ *
* @author <a href="mailto:paul.bakker.nl@gmail.com">Paul Bakker</a>
*/
@@ -29,11 +33,11 @@
public MavenPluginAdapter(final MavenPlugin mavenPlugin)
{
- Dependency dependency = mavenPlugin.getDependency();
+ Coordinate coordinate = mavenPlugin.getCoordinate();
- setGroupId(dependency.getCoordinate().getGroupId());
- setArtifactId(dependency.getCoordinate().getArtifactId());
- setVersion(dependency.getCoordinate().getVersion());
+ setGroupId(coordinate.getGroupId());
+ setArtifactId(coordinate.getArtifactId());
+ setVersion(coordinate.getVersion());
setConfiguration(parseConfig(mavenPlugin.getConfig()));
setExecutions(transformExecutions(mavenPlugin));
if (mavenPlugin.isExtensionsEnabled())
@@ -152,9 +156,9 @@ public Configuration getConfig()
}
@Override
- public Dependency getDependency()
+ public Coordinate getCoordinate()
{
- return DependencyBuilder.create()
+ return CoordinateBuilder.create()
.setGroupId(getGroupId())
.setArtifactId(getArtifactId())
.setVersion(getVersion());
@@ -9,6 +9,7 @@
import java.util.List;
+import org.jboss.forge.dependencies.Coordinate;
import org.jboss.forge.dependencies.Dependency;
/**
@@ -44,14 +45,14 @@ public MavenPluginBuilder setConfiguration(final Configuration configuration)
}
@Override
- public Dependency getDependency()
+ public Coordinate getCoordinate()
{
- return plugin.getDependency();
+ return plugin.getCoordinate();
}
- public MavenPluginBuilder setDependency(final Dependency dependency)
+ public MavenPluginBuilder setCoordinate(final Coordinate coordinate)
{
- plugin.setDependency(dependency);
+ plugin.setCoordinate(coordinate);
return this;
}
@@ -19,7 +19,7 @@
public class MavenPluginImpl implements MavenPlugin
{
- private Dependency dependency;
+ private Coordinate coordinate;
private Configuration configuration;
private final List<Execution> executions = new ArrayList<Execution>();
private boolean extensions;
@@ -31,19 +31,19 @@ public MavenPluginImpl()
public MavenPluginImpl(final MavenPlugin plugin)
{
- this.dependency = plugin.getDependency();
- this.configuration = plugin.getConfig();
+ setCoordinate(plugin.getCoordinate());
+ setConfiguration(plugin.getConfig());
}
@Override
- public Dependency getDependency()
+ public Coordinate getCoordinate()
{
- return dependency;
+ return coordinate;
}
- public void setDependency(final Dependency dependency)
+ public void setCoordinate(Coordinate coordinate)
{
- this.dependency = dependency;
+ this.coordinate = coordinate;
}
@Override
@@ -78,7 +78,7 @@ public boolean isExtensionsEnabled()
public String toString()
{
StringBuilder b = new StringBuilder("<plugin>");
- appendDependency(b, dependency);
+ appendCoordinates(b, coordinate, true);
if (extensions)
{
@@ -138,7 +138,7 @@ public void addPluginDependency(final Dependency dependency)
private void appendDependency(StringBuilder builder, Dependency appendDependency)
{
- appendDependencyData(builder, appendDependency.getCoordinate(), true);
+ appendCoordinates(builder, appendDependency.getCoordinate(), true);
if (!appendDependency.getExcludedCoordinates().isEmpty())
{
builder.append("<exclusions>");
@@ -153,11 +153,11 @@ private void appendDependency(StringBuilder builder, Dependency appendDependency
private void appendExclusion(StringBuilder builder, Coordinate exclusion)
{
builder.append("<exclusion>");
- appendDependencyData(builder, exclusion, false);
+ appendCoordinates(builder, exclusion, false);
builder.append("</exclusion>");
}
- private void appendDependencyData(StringBuilder builder, Coordinate coordinate, boolean withVersion)
+ private void appendCoordinates(StringBuilder builder, Coordinate coordinate, boolean withVersion)
{
if (coordinate.getGroupId() != null)
{

0 comments on commit ef4a107

Please sign in to comment.