You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/05/04 12:00:20 UTC
svn commit: r1333836 - in
/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src:
main/java/org/apache/maven/tools/plugin/annotations/datamodel/
main/java/org/apache/maven/tools/plugin/annotations/scanner/
main/java/org/apache/mave...
Author: olamy
Date: Fri May 4 10:00:19 2012
New Revision: 1333836
URL: http://svn.apache.org/viewvc?rev=1333836&view=rev
Log:
[MPLUGIN-189] cleanup with moving some classes to separate packages
Added:
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/AnnotatedField.java (contents, props changed)
- copied, changed from r1333835, maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/AnnotatedField.java
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ComponentAnnotationContent.java
- copied, changed from r1333835, maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ComponentAnnotationContent.java
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ExecuteAnnotationContent.java (contents, props changed)
- copied, changed from r1333835, maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ComponentAnnotationContent.java
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java (with props)
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java (contents, props changed)
- copied, changed from r1333835, maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ParameterAnnotationContent.java
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoAnnotationVisitor.java (with props)
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java (with props)
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoFieldVisitor.java (with props)
Removed:
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/AnnotatedField.java
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ComponentAnnotationContent.java
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/MojoClassVisitor.java
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ParameterAnnotationContent.java
Modified:
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/MojoAnnotatedClass.java
maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java
Copied: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/AnnotatedField.java (from r1333835, maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/AnnotatedField.java)
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/AnnotatedField.java?p2=maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/AnnotatedField.java&p1=maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/AnnotatedField.java&r1=1333835&r2=1333836&rev=1333836&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/AnnotatedField.java (original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/AnnotatedField.java Fri May 4 10:00:19 2012
@@ -1,4 +1,4 @@
-package org.apache.maven.tools.plugin.annotations.scanner;
+package org.apache.maven.tools.plugin.annotations.datamodel;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/AnnotatedField.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/AnnotatedField.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Copied: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ComponentAnnotationContent.java (from r1333835, maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ComponentAnnotationContent.java)
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ComponentAnnotationContent.java?p2=maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ComponentAnnotationContent.java&p1=maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ComponentAnnotationContent.java&r1=1333835&r2=1333836&rev=1333836&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ComponentAnnotationContent.java (original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ComponentAnnotationContent.java Fri May 4 10:00:19 2012
@@ -1,4 +1,4 @@
-package org.apache.maven.tools.plugin.annotations.scanner;
+package org.apache.maven.tools.plugin.annotations.datamodel;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Copied: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ExecuteAnnotationContent.java (from r1333835, maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ComponentAnnotationContent.java)
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ExecuteAnnotationContent.java?p2=maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ExecuteAnnotationContent.java&p1=maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ComponentAnnotationContent.java&r1=1333835&r2=1333836&rev=1333836&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ComponentAnnotationContent.java (original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ExecuteAnnotationContent.java Fri May 4 10:00:19 2012
@@ -1,4 +1,4 @@
-package org.apache.maven.tools.plugin.annotations.scanner;
+package org.apache.maven.tools.plugin.annotations.datamodel;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,53 +18,55 @@ package org.apache.maven.tools.plugin.an
* under the License.
*/
-import org.apache.maven.tools.plugin.annotations.Component;
+import org.apache.maven.tools.plugin.annotations.Execute;
+import org.apache.maven.tools.plugin.annotations.LifecyclePhase;
import java.lang.annotation.Annotation;
/**
* @author Olivier Lamy
*/
-public class ComponentAnnotationContent
- extends AnnotatedField
- implements Component
+public class ExecuteAnnotationContent
+ implements Execute
{
- private String role;
+ private String goal;
- private String roleHint;
+ private String lifecycle;
- public ComponentAnnotationContent( String fieldName )
+ private LifecyclePhase phase;
+
+ public LifecyclePhase phase()
{
- super( fieldName );
+ return this.phase;
}
- public ComponentAnnotationContent( String fieldName, String role, String roleHint )
+ public String goal()
{
- this( fieldName );
- this.role = role;
- this.roleHint = roleHint;
+ return this.goal;
}
- public String role()
+ public String lifecycle()
{
- return role;
+ return this.lifecycle;
}
- public void role( String role )
+
+ public void phase( String phase )
{
- this.role = role;
+ this.phase = LifecyclePhase.valueOf( phase );
}
- public String roleHint()
+ public void goal( String goal )
{
- return roleHint;
+ this.goal = goal;
}
- public void roleHint( String roleHint )
+ public void lifecycle( String lifecycle )
{
- this.roleHint = roleHint;
+ this.lifecycle = lifecycle;
}
+
public Class<? extends Annotation> annotationType()
{
return null;
@@ -74,10 +76,10 @@ public class ComponentAnnotationContent
public String toString()
{
final StringBuilder sb = new StringBuilder();
- sb.append( super.toString() );
- sb.append( "ComponentAnnotationContent" );
- sb.append( "{role='" ).append( role ).append( '\'' );
- sb.append( ", roleHint='" ).append( roleHint ).append( '\'' );
+ sb.append( "ExecuteAnnotationContent" );
+ sb.append( "{goal='" ).append( goal ).append( '\'' );
+ sb.append( ", lifecycle='" ).append( lifecycle ).append( '\'' );
+ sb.append( ", phase=" ).append( phase );
sb.append( '}' );
return sb.toString();
}
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ExecuteAnnotationContent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ExecuteAnnotationContent.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java?rev=1333836&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java (added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java Fri May 4 10:00:19 2012
@@ -0,0 +1,227 @@
+package org.apache.maven.tools.plugin.annotations.datamodel;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.tools.plugin.annotations.LifecyclePhase;
+import org.apache.maven.tools.plugin.annotations.Mojo;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MojoAnnotationContent
+ implements Mojo
+{
+ private String name;
+
+ private LifecyclePhase defaultPhase = LifecyclePhase.NONE;
+
+ private String requiresDependencyResolution = "runtime";
+
+ private String requiresDependencyCollection = "runtime";
+
+ private String instantiationStrategy = "per-lookup";
+
+ private String executionStrategy = "once-per-session";
+
+ private boolean requiresProject = true;
+
+ private boolean requiresReports = false;
+
+ private boolean aggregator = false;
+
+ private boolean requiresDirectInvocation = false;
+
+ private boolean requiresOnline = false;
+
+ private boolean inheritByDefault = true;
+
+ private String configurator;
+
+ private boolean threadSafe = false;
+
+ public Class<? extends Annotation> annotationType()
+ {
+ return null;
+ }
+
+ public LifecyclePhase defaultPhase()
+ {
+ return defaultPhase;
+ }
+
+ public void defaultPhase( String phase )
+ {
+ this.defaultPhase = LifecyclePhase.valueOf( phase );
+ }
+
+ public String requiresDependencyResolution()
+ {
+ return requiresDependencyResolution;
+ }
+
+ public void requiresDependencyResolution( String requiresDependencyResolution )
+ {
+ this.requiresDependencyResolution = requiresDependencyResolution;
+ }
+
+ public String requiresDependencyCollection()
+ {
+ return requiresDependencyCollection;
+ }
+
+ public void requiresDependencyCollection( String requiresDependencyCollection )
+ {
+ this.requiresDependencyCollection = requiresDependencyCollection;
+ }
+
+ public String instantiationStrategy()
+ {
+ return instantiationStrategy;
+ }
+
+ public void instantiationStrategy( String instantiationStrategy )
+ {
+ this.instantiationStrategy = instantiationStrategy;
+ }
+
+ public String executionStrategy()
+ {
+ return executionStrategy;
+ }
+
+ public void executionStrategy( String executionStrategy )
+ {
+ this.executionStrategy = executionStrategy;
+ }
+
+ public boolean requiresProject()
+ {
+ return requiresProject;
+ }
+
+ public void requiresProject( boolean requiresProject )
+ {
+ this.requiresProject = requiresProject;
+ }
+
+ public boolean requiresReports()
+ {
+ return requiresReports;
+ }
+
+ public void requiresReports( boolean requiresReports )
+ {
+ this.requiresReports = requiresReports;
+ }
+
+ public boolean aggregator()
+ {
+ return aggregator;
+ }
+
+ public void aggregator( boolean aggregator )
+ {
+ this.aggregator = aggregator;
+ }
+
+ public boolean requiresDirectInvocation()
+ {
+ return requiresDirectInvocation;
+ }
+
+ public void requiresDirectInvocation( boolean requiresDirectInvocation )
+ {
+ this.requiresDirectInvocation = requiresDirectInvocation;
+ }
+
+ public boolean requiresOnline()
+ {
+ return requiresOnline;
+ }
+
+ public void requiresOnline( boolean requiresOnline )
+ {
+ this.requiresOnline = requiresOnline;
+ }
+
+ public boolean inheritByDefault()
+ {
+ return inheritByDefault;
+ }
+
+ public void inheritByDefault( boolean inheritByDefault )
+ {
+ this.inheritByDefault = inheritByDefault;
+ }
+
+ public String configurator()
+ {
+ return configurator;
+ }
+
+ public void configurator( String configurator )
+ {
+ this.configurator = configurator;
+ }
+
+ public boolean threadSafe()
+ {
+ return threadSafe;
+ }
+
+ public void threadSafe( boolean threadSafe )
+ {
+ this.threadSafe = threadSafe;
+ }
+
+ public String name()
+ {
+ return this.name;
+ }
+
+ public void name( String name )
+ {
+ this.name = name;
+ }
+
+ @Override
+ public String toString()
+ {
+ final StringBuilder sb = new StringBuilder();
+ sb.append( "MojoAnnotationContent" );
+ sb.append( "{name='" ).append( name ).append( '\'' );
+ sb.append( ", defaultPhase=" ).append( defaultPhase );
+ sb.append( ", requiresDependencyResolution='" ).append( requiresDependencyResolution ).append( '\'' );
+ sb.append( ", requiresDependencyCollection='" ).append( requiresDependencyCollection ).append( '\'' );
+ sb.append( ", instantiationStrategy='" ).append( instantiationStrategy ).append( '\'' );
+ sb.append( ", executionStrategy='" ).append( executionStrategy ).append( '\'' );
+ sb.append( ", requiresProject=" ).append( requiresProject );
+ sb.append( ", requiresReports=" ).append( requiresReports );
+ sb.append( ", aggregator=" ).append( aggregator );
+ sb.append( ", requiresDirectInvocation=" ).append( requiresDirectInvocation );
+ sb.append( ", requiresOnline=" ).append( requiresOnline );
+ sb.append( ", inheritByDefault=" ).append( inheritByDefault );
+ sb.append( ", configurator='" ).append( configurator ).append( '\'' );
+ sb.append( ", threadSafe=" ).append( threadSafe );
+ sb.append( '}' );
+ return sb.toString();
+ }
+}
\ No newline at end of file
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Copied: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java (from r1333835, maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ParameterAnnotationContent.java)
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java?p2=maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java&p1=maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ParameterAnnotationContent.java&r1=1333835&r2=1333836&rev=1333836&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/ParameterAnnotationContent.java (original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java Fri May 4 10:00:19 2012
@@ -1,4 +1,4 @@
-package org.apache.maven.tools.plugin.annotations.scanner;
+package org.apache.maven.tools.plugin.annotations.datamodel;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java?rev=1333836&r1=1333835&r2=1333836&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java (original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java Fri May 4 10:00:19 2012
@@ -22,6 +22,13 @@ import org.apache.maven.tools.plugin.ann
import org.apache.maven.tools.plugin.annotations.Execute;
import org.apache.maven.tools.plugin.annotations.Mojo;
import org.apache.maven.tools.plugin.annotations.Parameter;
+import org.apache.maven.tools.plugin.annotations.datamodel.ComponentAnnotationContent;
+import org.apache.maven.tools.plugin.annotations.datamodel.ExecuteAnnotationContent;
+import org.apache.maven.tools.plugin.annotations.datamodel.MojoAnnotationContent;
+import org.apache.maven.tools.plugin.annotations.datamodel.ParameterAnnotationContent;
+import org.apache.maven.tools.plugin.annotations.scanner.visitors.MojoAnnotationVisitor;
+import org.apache.maven.tools.plugin.annotations.scanner.visitors.MojoClassVisitor;
+import org.apache.maven.tools.plugin.annotations.scanner.visitors.MojoFieldVisitor;
import org.apache.maven.tools.plugin.extractor.ExtractionException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.DirectoryScanner;
@@ -128,14 +135,11 @@ public class DefaultMojoAnnotationsScann
try
{
- MojoClassVisitor.MojoAnnotationVisitor mojoAnnotationVisitor =
+ MojoAnnotationVisitor mojoAnnotationVisitor =
mojoClassVisitor.getAnnotationVisitorMap().get( Mojo.class.getName() );
if ( mojoAnnotationVisitor != null )
{
- MojoClassVisitor.MojoAnnotationContent mojoAnnotationContent =
- new MojoClassVisitor.MojoAnnotationContent();
- Class clazz = Thread.currentThread().getContextClassLoader().loadClass(
- MojoClassVisitor.MojoAnnotationContent.class.getName() );
+ MojoAnnotationContent mojoAnnotationContent = new MojoAnnotationContent();
for ( Map.Entry<String, Object> entry : mojoAnnotationVisitor.getAnnotationValues().entrySet() )
{
reflector.invoke( mojoAnnotationContent, entry.getKey(), new Object[]{ entry.getValue() } );
@@ -146,10 +150,8 @@ public class DefaultMojoAnnotationsScann
mojoAnnotationVisitor = mojoClassVisitor.getAnnotationVisitorMap().get( Execute.class.getName() );
if ( mojoAnnotationVisitor != null )
{
- MojoClassVisitor.ExecuteAnnotationContent executeAnnotationContent =
- new MojoClassVisitor.ExecuteAnnotationContent();
- Class clazz = Thread.currentThread().getContextClassLoader().loadClass(
- MojoClassVisitor.MojoAnnotationContent.class.getName() );
+ ExecuteAnnotationContent executeAnnotationContent = new ExecuteAnnotationContent();
+
for ( Map.Entry<String, Object> entry : mojoAnnotationVisitor.getAnnotationValues().entrySet() )
{
reflector.invoke( executeAnnotationContent, entry.getKey(), new Object[]{ entry.getValue() } );
@@ -157,10 +159,10 @@ public class DefaultMojoAnnotationsScann
mojoClassVisitor.getMojoAnnotatedClass().setExecute( executeAnnotationContent );
}
- List<MojoClassVisitor.MojoFieldVisitor> mojoFieldVisitors =
+ List<MojoFieldVisitor> mojoFieldVisitors =
mojoClassVisitor.findFieldWithAnnotationClass( Parameter.class.getName() );
- for ( MojoClassVisitor.MojoFieldVisitor mojoFieldVisitor : mojoFieldVisitors )
+ for ( MojoFieldVisitor mojoFieldVisitor : mojoFieldVisitors )
{
ParameterAnnotationContent parameterAnnotationContent =
new ParameterAnnotationContent( mojoFieldVisitor.getFieldName() );
@@ -178,7 +180,7 @@ public class DefaultMojoAnnotationsScann
mojoFieldVisitors = mojoClassVisitor.findFieldWithAnnotationClass( Component.class.getName() );
- for ( MojoClassVisitor.MojoFieldVisitor mojoFieldVisitor : mojoFieldVisitors )
+ for ( MojoFieldVisitor mojoFieldVisitor : mojoFieldVisitors )
{
ComponentAnnotationContent componentAnnotationContent =
new ComponentAnnotationContent( mojoFieldVisitor.getFieldName() );
Modified: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/MojoAnnotatedClass.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/MojoAnnotatedClass.java?rev=1333836&r1=1333835&r2=1333836&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/MojoAnnotatedClass.java (original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/MojoAnnotatedClass.java Fri May 4 10:00:19 2012
@@ -20,6 +20,8 @@ package org.apache.maven.tools.plugin.an
import org.apache.maven.tools.plugin.annotations.Execute;
import org.apache.maven.tools.plugin.annotations.Mojo;
+import org.apache.maven.tools.plugin.annotations.datamodel.ComponentAnnotationContent;
+import org.apache.maven.tools.plugin.annotations.datamodel.ParameterAnnotationContent;
import java.util.ArrayList;
import java.util.List;
Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoAnnotationVisitor.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoAnnotationVisitor.java?rev=1333836&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoAnnotationVisitor.java (added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoAnnotationVisitor.java Fri May 4 10:00:19 2012
@@ -0,0 +1,83 @@
+package org.apache.maven.tools.plugin.annotations.scanner.visitors;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.plexus.logging.Logger;
+import org.objectweb.asm.AnnotationVisitor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MojoAnnotationVisitor
+ implements AnnotationVisitor
+{
+ private Logger logger;
+
+ private String annotationClassName;
+
+ private Map<String, Object> annotationValues = new HashMap<String, Object>();
+
+ MojoAnnotationVisitor( Logger logger, String annotationClassName )
+ {
+ this.logger = logger;
+ this.annotationClassName = annotationClassName;
+ }
+
+ public Map<String, Object> getAnnotationValues()
+ {
+ return annotationValues;
+ }
+
+ public void visit( String name, Object value )
+ {
+ annotationValues.put( name, value );
+ logger.debug( "MojoAnnotationVisitor#visit:" + name + ":" + value );
+ }
+
+ public void visitEnum( String name, String desc, String value )
+ {
+ annotationValues.put( name, value );
+ logger.debug( "MojoAnnotationVisitor#visitEnum:" + name + ":" + desc + ":" + value );
+ }
+
+ public AnnotationVisitor visitAnnotation( String name, String desc )
+ {
+ logger.debug( "MojoAnnotationVisitor#visitAnnotation:" + name + ":" + desc );
+ return new MojoAnnotationVisitor( logger, this.annotationClassName );
+ }
+
+ public AnnotationVisitor visitArray( String s )
+ {
+ logger.debug( "MojoAnnotationVisitor#visitArray" );
+ return new MojoAnnotationVisitor( logger, this.annotationClassName );
+ }
+
+ public void visitEnd()
+ {
+ logger.debug( "MojoAnnotationVisitor#visitEnd" );
+ }
+
+ public String getAnnotationClassName()
+ {
+ return annotationClassName;
+ }
+}
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoAnnotationVisitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoAnnotationVisitor.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java?rev=1333836&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java (added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java Fri May 4 10:00:19 2012
@@ -0,0 +1,160 @@
+package org.apache.maven.tools.plugin.annotations.scanner.visitors;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.tools.plugin.annotations.scanner.MojoAnnotatedClass;
+import org.apache.maven.tools.plugin.annotations.scanner.MojoAnnotationsScanner;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Type;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MojoClassVisitor
+ implements ClassVisitor
+{
+ private Logger logger;
+
+ private MojoAnnotatedClass mojoAnnotatedClass;
+
+ private Map<String, MojoAnnotationVisitor> annotationVisitorMap = new HashMap<String, MojoAnnotationVisitor>();
+
+ private List<MojoFieldVisitor> fieldVisitors = new ArrayList<MojoFieldVisitor>();
+
+ public MojoClassVisitor( Logger logger )
+ {
+ this.logger = logger;
+ }
+
+ public MojoAnnotatedClass getMojoAnnotatedClass()
+ {
+ return mojoAnnotatedClass;
+ }
+
+ public void setMojoAnnotatedClass( MojoAnnotatedClass mojoAnnotatedClass )
+ {
+ this.mojoAnnotatedClass = mojoAnnotatedClass;
+ }
+
+ public Map<String, MojoAnnotationVisitor> getAnnotationVisitorMap()
+ {
+ return annotationVisitorMap;
+ }
+
+ public void setAnnotationVisitorMap( Map<String, MojoAnnotationVisitor> annotationVisitorMap )
+ {
+ this.annotationVisitorMap = annotationVisitorMap;
+ }
+
+ public List<MojoFieldVisitor> getFieldVisitors()
+ {
+ return fieldVisitors;
+ }
+
+ public void setFieldVisitors( List<MojoFieldVisitor> fieldVisitors )
+ {
+ this.fieldVisitors = fieldVisitors;
+ }
+
+ public List<MojoFieldVisitor> findFieldWithAnnotationClass( String annotationClassName )
+ {
+ List<MojoFieldVisitor> mojoFieldVisitors = new ArrayList<MojoFieldVisitor>();
+
+ for ( MojoFieldVisitor mojoFieldVisitor : this.fieldVisitors )
+ {
+ MojoAnnotationVisitor mojoAnnotationVisitor = mojoFieldVisitor.getMojoAnnotationVisitor();
+ if ( mojoAnnotationVisitor != null && StringUtils.equals( annotationClassName,
+ mojoAnnotationVisitor.getAnnotationClassName() ) )
+ {
+ mojoFieldVisitors.add( mojoFieldVisitor );
+ }
+ }
+
+ return mojoFieldVisitors;
+ }
+
+ public void visit( int version, int access, String name, String signature, String superName, String[] interfaces )
+ {
+ mojoAnnotatedClass = new MojoAnnotatedClass();
+ mojoAnnotatedClass.setClassName( Type.getObjectType( name ).getClassName() ).setParentClassName(
+ Type.getObjectType( superName ).getClassName() );
+ logger.debug( "MojoClassVisitor#visit" );
+ }
+
+ public AnnotationVisitor visitAnnotation( String desc, boolean visible )
+ {
+ logger.debug( "MojoClassVisitor#visitAnnotation" );
+ String annotationClassName = Type.getType( desc ).getClassName();
+ if ( !MojoAnnotationsScanner.acceptedClassLevelAnnotationClasses.contains( annotationClassName ) )
+ {
+ return null;
+ }
+ MojoAnnotationVisitor mojoAnnotationVisitor = new MojoAnnotationVisitor( logger, annotationClassName );
+ annotationVisitorMap.put( annotationClassName, mojoAnnotationVisitor );
+ return mojoAnnotationVisitor;
+ }
+
+ public FieldVisitor visitField( int access, String name, String desc, String signature, Object value )
+ {
+ // Type.getType( desc ).getClassName()
+ logger.debug( "MojoClassVisitor#visitField" );
+ MojoFieldVisitor mojoFieldVisitor = new MojoFieldVisitor( logger, name );
+ fieldVisitors.add( mojoFieldVisitor );
+ return mojoFieldVisitor;
+ }
+
+ public MethodVisitor visitMethod( int access, String name, String desc, String signature, String[] exceptions )
+ {
+ // we don't need methods informations
+ return null;
+ }
+
+ public void visitAttribute( Attribute attr )
+ {
+ }
+
+ public void visitSource( String source, String debug )
+ {
+ }
+
+ public void visitOuterClass( String owner, String name, String desc )
+ {
+ }
+
+ public void visitInnerClass( String name, String outerName, String innerName, int access )
+ {
+ }
+
+ public void visitEnd()
+ {
+ logger.debug( "MojoClassVisitor#visitEnd" );
+ }
+
+}
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoClassVisitor.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoFieldVisitor.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoFieldVisitor.java?rev=1333836&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoFieldVisitor.java (added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoFieldVisitor.java Fri May 4 10:00:19 2012
@@ -0,0 +1,77 @@
+package org.apache.maven.tools.plugin.annotations.scanner.visitors;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.tools.plugin.annotations.scanner.MojoAnnotationsScanner;
+import org.codehaus.plexus.logging.Logger;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.Type;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MojoFieldVisitor
+ implements FieldVisitor
+{
+ private Logger logger;
+
+ private String fieldName;
+
+ private MojoAnnotationVisitor mojoAnnotationVisitor;
+
+ MojoFieldVisitor( Logger logger, String fieldName )
+ {
+ this.logger = logger;
+ this.fieldName = fieldName;
+ }
+
+ public MojoAnnotationVisitor getMojoAnnotationVisitor()
+ {
+ return mojoAnnotationVisitor;
+ }
+
+ public String getFieldName()
+ {
+ return fieldName;
+ }
+
+ public AnnotationVisitor visitAnnotation( String desc, boolean visible )
+ {
+ logger.debug( "MojoFieldVisitor#visitAnnotation:" + desc );
+ String annotationClassName = Type.getType( desc ).getClassName();
+ if ( !MojoAnnotationsScanner.acceptedFieldLevelAnnotationClasses.contains( annotationClassName ) )
+ {
+ return null;
+ }
+ mojoAnnotationVisitor = new MojoAnnotationVisitor( logger, annotationClassName );
+ return mojoAnnotationVisitor;
+ }
+
+ public void visitAttribute( Attribute attribute )
+ {
+ logger.debug( "MojoFieldVisitor#visitAttribute" );
+ }
+
+ public void visitEnd()
+ {
+ logger.debug( "MojoFieldVisitor#visitEnd" );
+ }
+}
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoFieldVisitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/visitors/MojoFieldVisitor.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java?rev=1333836&r1=1333835&r2=1333836&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java (original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java Fri May 4 10:00:19 2012
@@ -18,11 +18,11 @@ package org.apache.maven.tools.plugin.an
* under the License.
*/
-import org.apache.maven.tools.plugin.annotations.scanner.ComponentAnnotationContent;
+import org.apache.maven.tools.plugin.annotations.datamodel.ComponentAnnotationContent;
import org.apache.maven.tools.plugin.annotations.scanner.MojoAnnotatedClass;
import org.apache.maven.tools.plugin.annotations.scanner.MojoAnnotationsScanner;
import org.apache.maven.tools.plugin.annotations.scanner.MojoAnnotationsScannerRequest;
-import org.apache.maven.tools.plugin.annotations.scanner.ParameterAnnotationContent;
+import org.apache.maven.tools.plugin.annotations.datamodel.ParameterAnnotationContent;
import org.codehaus.plexus.PlexusTestCase;
import org.fest.assertions.Assertions;