You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2004/05/22 04:46:03 UTC
cvs commit: maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator AbstractGenerator.java BeanPluginGenerator.java PluginDescriptorGenerator.java PluginXdocGenerator.java
jvanzyl 2004/05/21 19:46:03
Modified: maven-plugin/src/main/java/org/apache/maven/plugin/generator
AbstractGenerator.java BeanPluginGenerator.java
PluginDescriptorGenerator.java
PluginXdocGenerator.java
Log:
o pass in the plugin descriptor to artifactName() so that any plugin
descriptor info can be used. in this case i want info about the plugin
name so it can be used as the basis for the name for the generated
bean adapter.
Revision Changes Path
1.3 +2 -2 maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/AbstractGenerator.java
Index: AbstractGenerator.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/AbstractGenerator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractGenerator.java 20 May 2004 16:59:45 -0000 1.2
+++ AbstractGenerator.java 22 May 2004 02:46:03 -0000 1.3
@@ -32,7 +32,7 @@
protected abstract void writePluginArtifact( PluginDescriptor pluginDescriptor, File destination )
throws Exception;
- protected abstract String pluginArtifactName();
+ protected abstract String pluginArtifactName( PluginDescriptor pluginDescriptor );
public void execute( String sourceDirectory, String destinationDirectory )
throws Exception
@@ -53,7 +53,7 @@
{
PluginDescriptor pluginDescriptor = createPluginDescriptor( javaSources[i] );
- File pluginDescriptorFile = new File( destinationDirectory, pluginArtifactName() );
+ File pluginDescriptorFile = new File( destinationDirectory, pluginArtifactName( pluginDescriptor ) );
writePluginArtifact( pluginDescriptor, pluginDescriptorFile );
}
1.2 +19 -11 maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/BeanPluginGenerator.java
Index: BeanPluginGenerator.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/BeanPluginGenerator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BeanPluginGenerator.java 22 May 2004 00:50:06 -0000 1.1
+++ BeanPluginGenerator.java 22 May 2004 02:46:03 -0000 1.2
@@ -21,36 +21,44 @@
import java.util.List;
import java.util.Map;
+/**
+ * @todo use the descriptions in the descriptor for the javadoc pushed into
+ * the source code.
+ */
public class BeanPluginGenerator
extends AbstractGenerator
{
- protected String pluginArtifactName()
+ protected String pluginArtifactName( PluginDescriptor pluginDescriptor )
{
- return "BeanPlugin.java";
+ // ----------------------------------------------------------------------
+ // We will base the classname on the implementation we are wrapping
+ // ----------------------------------------------------------------------
+
+ String implementation = pluginDescriptor.getImplementation();
+
+ return implementation.substring( implementation.lastIndexOf( "." ) + 1 ) + "Bean.java";
}
protected void writePluginArtifact( PluginDescriptor pluginDescriptor, File destination )
throws Exception
{
- JClass jClass = new JClass( pluginArtifactName() );
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
+ String implementation = pluginDescriptor.getImplementation();
- jClass.addImport( "org.apache.maven.plugin.BeanPluginAdapter" );
+ JClass jClass = new JClass( pluginArtifactName( pluginDescriptor ) );
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
- jClass.setSuperClass( "BeanPluginAdapter" );
+ jClass.setSuperClass( "org.apache.maven.plugin.BeanPluginAdapter" );
// ----------------------------------------------------------------------
- //
+ // Use the same package as the plugin we are wrapping.
// ----------------------------------------------------------------------
- jClass.setPackageName( "org.apache.maven.plugin" );
+ String packageName = implementation.substring( 0, implementation.lastIndexOf( "." ) );
+
+ jClass.setPackageName( packageName );
// ----------------------------------------------------------------------
//
1.4 +1 -1 maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/PluginDescriptorGenerator.java
Index: PluginDescriptorGenerator.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/PluginDescriptorGenerator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PluginDescriptorGenerator.java 21 May 2004 23:49:43 -0000 1.3
+++ PluginDescriptorGenerator.java 22 May 2004 02:46:03 -0000 1.4
@@ -18,7 +18,7 @@
public class PluginDescriptorGenerator
extends AbstractGenerator
{
- protected String pluginArtifactName()
+ protected String pluginArtifactName( PluginDescriptor pluginDescriptor )
{
return "plugin.xml";
}
1.3 +1 -4 maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/PluginXdocGenerator.java
Index: PluginXdocGenerator.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/generator/PluginXdocGenerator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PluginXdocGenerator.java 20 May 2004 16:59:45 -0000 1.2
+++ PluginXdocGenerator.java 22 May 2004 02:46:03 -0000 1.3
@@ -5,9 +5,6 @@
import org.apache.maven.plugin.descriptor.Goal;
import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.plugin.descriptor.Goal;
-import org.apache.maven.plugin.descriptor.Parameter;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
import java.io.File;
import java.io.FileWriter;
@@ -22,7 +19,7 @@
public class PluginXdocGenerator
extends AbstractGenerator
{
- protected String pluginArtifactName()
+ protected String pluginArtifactName( PluginDescriptor pluginDescriptor )
{
return "plugin-doco.xml";
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org