geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r462614 - in /geronimo/xbean/sandbox: ./ maven-apt-plugin/ maven-apt-plugin/src/ maven-apt-plugin/src/main/ maven-apt-plugin/src/main/java/ maven-apt-plugin/src/main/java/org/ maven-apt-plugin/src/main/java/org/apache/ maven-apt-plugin/src/...
Date Tue, 10 Oct 2006 22:35:50 GMT
Author: jstrachan
Date: Tue Oct 10 15:35:48 2006
New Revision: 462614

URL: http://svn.apache.org/viewvc?view=rev&rev=462614
Log:
Added an apt plugin to auto-generate files from annotations

Added:
    geronimo/xbean/sandbox/maven-apt-plugin/
    geronimo/xbean/sandbox/maven-apt-plugin/pom.xml   (with props)
    geronimo/xbean/sandbox/maven-apt-plugin/src/
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AbstractAPTMojo.java   (with props)
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java   (with props)
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/EclipseAptMojo.java   (with props)
    geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/TestAptMojo.java   (with props)
    geronimo/xbean/sandbox/maven-apt-plugin/src/site/
    geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/
    geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/howto.apt   (with props)
    geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/introduction.apt   (with props)
    geronimo/xbean/sandbox/maven-apt-plugin/src/site/site.xml   (with props)
    geronimo/xbean/sandbox/pom.xml   (with props)
    geronimo/xbean/sandbox/xbean-apt/
    geronimo/xbean/sandbox/xbean-apt/pom.xml   (with props)
    geronimo/xbean/sandbox/xbean-apt/src/
    geronimo/xbean/sandbox/xbean-apt/src/main/
    geronimo/xbean/sandbox/xbean-apt/src/main/java/
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlElement.java   (with props)
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlRootElement.java   (with props)
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/VelocityClassVisitor.java   (with props)
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessor.java   (with props)
    geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessorFactory.java   (with props)
    geronimo/xbean/sandbox/xbean-apt/src/main/resources/
    geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm
    geronimo/xbean/sandbox/xbean-apt/src/main/resources/META-INF/
    geronimo/xbean/sandbox/xbean-apt/src/main/resources/META-INF/services/
    geronimo/xbean/sandbox/xbean-apt/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory   (with props)

Added: geronimo/xbean/sandbox/maven-apt-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/maven-apt-plugin/pom.xml?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/maven-apt-plugin/pom.xml (added)
+++ geronimo/xbean/sandbox/maven-apt-plugin/pom.xml Tue Oct 10 15:35:48 2006
@@ -0,0 +1,26 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <artifactId>maven-plugin-parent</artifactId>
+        <groupId>org.apache.maven.plugins</groupId>
+        <version>2.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>maven-apt-plugin</artifactId>
+    <version>2.0</version>
+    <packaging>maven-plugin</packaging>
+    <name>apt-plugin</name>
+    <dependencies>
+        <dependency>
+            <groupId>plexus</groupId>
+            <artifactId>plexus-compiler-api</artifactId>
+            <version>1.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-project</artifactId>
+        </dependency>
+    </dependencies>
+</project>

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AbstractAPTMojo.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AbstractAPTMojo.java?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AbstractAPTMojo.java (added)
+++ geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AbstractAPTMojo.java Tue Oct 10 15:35:48 2006
@@ -0,0 +1,398 @@
+package org.apache.maven.plugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
+
+/**
+ * @author <a href="mailto:jubu@volny.cz">Juraj Burian</a>
+ * @version $Id: AbstractAPTMojo.java 11 2006-09-05 17:24:29Z jstrachan $
+ */
+public abstract class AbstractAPTMojo extends AbstractMojo
+{
+    protected static final String PATH_SEPARATOR = //
+    System.getProperty( "path.separator" );
+
+    protected static final String FILE_SEPARATOR = //
+    System.getProperty( "file.separator" );
+
+    /**
+     * Integer returned by the Apt compiler to indicate success.
+     */
+    private static final int APT_COMPILER_SUCCESS = 0;
+
+    /**
+     * class in tools.jar that implements APT
+     */
+    private static final String APT_ENTRY_POINT = "com.sun.tools.apt.Main";
+
+    /**
+     * method used to compile.
+     */
+    private static final String APT_METHOD_NAME = "process";
+
+    /**
+     * store info about modification of system classpath for Apt compiler
+     */
+    private static boolean isClasspathModified;
+
+    /**
+     * Whether to include debugging information in the compiled class files. The
+     * default value is true.
+     * 
+     * @parameter expression="${maven.compiler.debug}" default-value="true"
+     * @readonly
+     */
+    private boolean debug;
+
+    /**
+     * Comma separated list of "-A" options: Next two examples are equivalent:
+     * 
+     * <pre>
+     *         &lt;A&gt;-Adebug,-Aloglevel=3&lt;/A&gt;
+     * </pre>
+     * <pre>
+     *         &lt;A&gt;debug, loglevel=3&lt;/A&gt;
+     * </pre>
+     * 
+     * @parameter alias="A"
+     */
+    private String aptOptions;
+
+    /**
+     * Output source locations where deprecated APIs are used
+     * 
+     * @parameter
+     */
+    private boolean showDeprecation;
+
+    /**
+     * Output warnings
+     * 
+     * @parameter
+     */
+    private boolean showWarnings;
+
+    /**
+     * The -encoding argument for the Apt
+     * 
+     * @parameter
+     */
+    private String encoding;
+
+    /**
+     * run Apt in verbode mode
+     * 
+     * @parameter expression="${verbose}" default-value="false"
+     */
+    protected boolean verbose;
+
+    /**
+     * The -nocompile argument for the Apt
+     * 
+     * @parameter default-value="true"
+     */
+    private boolean nocompile;
+
+    /**
+     * The granularity in milliseconds of the last modification date for testing
+     * whether a source needs recompilation
+     * 
+     * @parameter expression="${lastModGranularityMs}" default-value="0"
+     */
+    protected int staleMillis;
+
+    /**
+     * Name of AnnotationProcessorFactory to use; bypasses default discovery
+     * process
+     * 
+     * @parameter
+     */
+    private String factory;
+
+    /**
+     * The directory to run the compiler from if fork is true.
+     * 
+     * @parameter expression="${project.build.directory}"
+     * @required
+     * @readonly
+     */
+    protected File builddir;
+
+    /**
+     * The maven project.
+     * 
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    protected MavenProject project;
+
+    protected abstract List getClasspathElements();
+
+    protected abstract List getCompileSourceRoots();
+
+    protected abstract File getOutputDirectory();
+
+    protected abstract String getGenerated();
+
+    protected abstract SourceInclusionScanner getSourceInclusionScanner();
+
+    public void execute() throws MojoExecutionException
+    {
+        getLog().debug( "Using apt compiler" );
+        List cmd = new LinkedList();
+
+        int result = APT_COMPILER_SUCCESS;
+        StringWriter writer = new StringWriter();
+        // finally invoke APT
+        // Use reflection to be able to build on all JDKs:
+        try
+        {
+            // we need to have tools.jar in lasspath
+            // due to bug in Apt compiler, system classpath must be modified but in future:
+            // TODO try separate ClassLoader (see Plexus compiler api)
+            if( false == isClasspathModified )
+            {
+                URL toolsJar = new File( System.getProperty( "java.home" ),
+                        "../lib/tools.jar" ).toURL();
+                Method m = URLClassLoader.class.getDeclaredMethod( "addURL",
+                        new Class[] { URL.class } );
+                m.setAccessible( true );
+                m.invoke( this.getClass().getClassLoader()
+                        .getSystemClassLoader(), new Object[] { toolsJar } );
+                isClasspathModified = true;
+            }
+            // init comand line
+            setAptCommandlineSwitches( cmd );
+            setAptSpecifics( cmd );
+            setStandards( cmd );
+            setClasspath( cmd );
+            if( false == setSourcepath( cmd ) )
+            {
+                if( true == getLog().isDebugEnabled() )
+                {
+                    getLog().debug( "there are not stale sources." );
+                }
+                return;
+            }
+            Class c = this.getClass().forName( APT_ENTRY_POINT ); // getAptCompilerClass();
+            Object compiler = c.newInstance();
+            Method compile = c.getMethod( APT_METHOD_NAME, new Class[] {
+                    PrintWriter.class, (new String[] {}).getClass() } );
+            result = ((Integer) //
+            compile.invoke( compiler, new Object[] { new PrintWriter( writer ),
+                    cmd.toArray( new String[cmd.size()] ) } )).intValue();
+
+        } catch ( Exception ex )
+        {
+            throw new MojoExecutionException( "Error starting apt compiler", ex );
+        } finally
+        {
+            if( result != APT_COMPILER_SUCCESS )
+            {
+                throw new MojoExecutionException( this, "Compilation error.",
+                        writer.getBuffer().toString() );
+            }
+            if( true == getLog().isDebugEnabled() )
+            {
+                String r = writer.getBuffer().toString();
+                if( 0 != r.length() )
+                {
+                    getLog().debug( r );
+                }
+                getLog().debug( "Apt finished." );
+            }
+        }
+    }
+
+    private void setAptCommandlineSwitches( List cmd )
+    {
+        if( null == aptOptions )
+        {
+            return;
+        }
+        StringTokenizer tokenizer = new StringTokenizer( aptOptions.trim(), "," );
+        while( tokenizer.hasMoreElements() )
+        {
+            String option = tokenizer.nextToken().trim();
+            if( false == option.startsWith( "-A" ) )
+            {
+                option = "-A" + option;
+            }
+            cmdAdd( cmd, option );
+        }
+    }
+
+    private void setAptSpecifics( List cmd ) throws MojoExecutionException
+    {
+        try
+        {
+            String g = builddir.getAbsolutePath() + FILE_SEPARATOR
+                    + getGenerated();
+            File generatedDir = new File( g );
+            cmdAdd( cmd, "-s", generatedDir.getCanonicalPath() );
+            if( false == generatedDir.exists() )
+            {
+                generatedDir.mkdirs();
+            }
+        } catch ( Exception e )
+        {
+            throw new MojoExecutionException( //
+                    "Generated directory is invalid.", e );
+        }
+        if( true == nocompile )
+        {
+            cmdAdd( cmd, "-nocompile" );
+        }
+        if( null != factory && 0 != factory.length() )
+        {
+            cmdAdd( cmd, "-factory", factory );
+        }
+    }
+
+    private void setStandards( List cmd ) throws MojoExecutionException
+    {
+        if( true == debug )
+        {
+            cmdAdd( cmd, "-g" );
+        }
+        if( false == showWarnings )
+        {
+            cmdAdd( cmd, "-nowarn" );
+        }
+        if( true == showDeprecation )
+        {
+            cmdAdd( cmd, "-depecation" );
+        }
+        if( null != encoding )
+        {
+            cmdAdd( cmd, "-encoding", encoding );
+        }
+        if( true == verbose )
+        {
+            cmdAdd( cmd, "-verbose" );
+        }
+        // add output directory
+        try
+        {
+            if( false == getOutputDirectory().exists() )
+            {
+                getOutputDirectory().mkdirs();
+            }
+            cmdAdd( cmd, "-d", getOutputDirectory().getCanonicalPath() );
+        } catch ( Exception ex )
+        {
+            throw new MojoExecutionException( //
+                    "Output directory is invalid.", ex );
+        }
+    }
+
+    private boolean setSourcepath( List cmd ) throws MojoExecutionException
+    {
+        boolean has = false;
+        // sources ....
+        Iterator it = getCompileSourceRoots().iterator();
+        while( true == it.hasNext() )
+        {
+            File srcFile = new File( (String) it.next() );
+            if( true == srcFile.isDirectory() )
+            {
+                Collection sources = null;
+                try
+                {
+                    sources = //
+                    getSourceInclusionScanner().getIncludedSources( srcFile,
+                            getOutputDirectory() );
+                } catch ( Exception ex )
+                {
+                    throw new MojoExecutionException(
+                            "Can't agregate sources.", ex );
+                }
+                if( getLog().isDebugEnabled() )
+                {
+                    getLog().debug(
+                            "sources from: " + srcFile.getAbsolutePath() );
+                    String s = "";
+                    for( Iterator jt = sources.iterator(); true == jt.hasNext(); )
+                    {
+                        s += jt.next() + "\n";
+                    }
+                    getLog().debug( s );
+                }
+                Iterator jt = sources.iterator();
+                while( true == jt.hasNext() )
+                {
+                    File src = (File) jt.next();
+                    cmd.add( src.getAbsolutePath() );
+                    has = true;
+                }
+            }
+        }
+        return has;
+    }
+
+    private void setClasspath( List cmd ) throws MojoExecutionException
+    {
+        StringBuffer buffer = new StringBuffer();
+        for( Iterator it = getClasspathElements().iterator(); true == it
+                .hasNext(); )
+        {
+            buffer.append( it.next() );
+            if( it.hasNext() )
+            {
+                buffer.append( PATH_SEPARATOR );
+            }
+        }
+        cmdAdd( cmd, "-classpath", buffer.toString() );
+    }
+
+    private void cmdAdd( List cmd, String arg )
+    {
+        /**
+         * OBSOLETE
+         * if( true == getLog().isDebugEnabled() ) { getLog().debug(
+         * arg ); }
+         */
+        cmd.add( arg );
+    }
+
+    private void cmdAdd( List cmd, String arg1, String arg2 )
+    {
+        /**
+         * OBSOLETE
+         * if( true == getLog().isDebugEnabled() ) { getLog().debug(
+         * arg1 + " " + arg2 ); }
+         */
+        cmd.add( arg1 );
+        cmd.add( arg2 );
+    }
+}

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AbstractAPTMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AbstractAPTMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java (added)
+++ geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java Tue Oct 10 15:35:48 2006
@@ -0,0 +1,141 @@
+package org.apache.maven.plugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 java.io.File;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.model.Resource;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
+import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
+import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+
+/**
+ * @author <a href="mailto:jubu@volny.cz">Juraj Burian</a>
+ * @version $Id: AptMojo.java 11 2006-09-05 17:24:29Z jstrachan $
+ * @goal execute
+ * @phase generate-sources
+ * @requiresDependencyResolution compile
+ * @description generates and/or compiles application sources
+ */
+public class AptMojo extends AbstractAPTMojo
+{
+
+    /**
+     * The source directory containing the generated sources.
+     * 
+     * @parameter default-value="main/generated"
+     */
+    private String generated;
+
+    /**
+     * The source directories containing the sources to be compiled.
+     * 
+     * @parameter expression="${project.compileSourceRoots}"
+     * @required
+     * @readonly
+     */
+    private List compileSourceRoots;
+
+    /**
+     * Project classpath.
+     * 
+     * @parameter expression="${project.compileClasspathElements}"
+     * @required
+     * @readonly
+     */
+    private List classpathElements;
+
+    /**
+     * The directory for compiled classes.
+     * 
+     * @parameter expression="${project.build.outputDirectory}"
+     * @required
+     * @readonly
+     */
+    private File outputDirectory;
+
+    /**
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    
+    protected String getGenerated()
+    {
+        return generated;
+    }
+
+    protected List getCompileSourceRoots()
+    {
+        return compileSourceRoots;
+    }
+
+    protected List getClasspathElements()
+    {
+        return classpathElements;
+    }
+
+    protected File getOutputDirectory()
+    {
+        return outputDirectory;
+    }
+
+    public void execute() throws MojoExecutionException
+    {
+        super.execute();
+
+		String genDir = builddir.getAbsolutePath() + FILE_SEPARATOR + getGenerated();
+        project.addCompileSourceRoot( genDir );
+        Resource resource = new Resource();
+        resource.setDirectory( genDir );
+        resource.addExclude( "**/*.java" );
+        project.addResource( resource );
+    }
+
+    /**
+     * A list of inclusion filters for the compiler.
+     * 
+     * @parameter
+     */
+    private Set includes = new HashSet();
+
+    /**
+     * A list of exclusion filters for the compiler.
+     * 
+     * @parameter
+     */
+    private Set excludes = new HashSet();
+
+    protected SourceInclusionScanner getSourceInclusionScanner()
+    {
+        StaleSourceScanner scanner = null;
+
+        if( includes.isEmpty() )
+        {
+            includes.add( "**/*.java" );
+        }
+        scanner = new StaleSourceScanner( staleMillis, includes, excludes );
+        scanner.addSourceMapping( new SuffixMapping( ".java", ".class" ) );
+        return scanner;
+    }
+}

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/EclipseAptMojo.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/EclipseAptMojo.java?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/EclipseAptMojo.java (added)
+++ geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/EclipseAptMojo.java Tue Oct 10 15:35:48 2006
@@ -0,0 +1,132 @@
+package org.apache.maven.plugin;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @author Juraj Burian
+ * @version $Revision: 11 $ by $Author: jstrachan $
+ * 
+ * @goal eclipse
+ * @requiresDependencyResolution compile
+ * @description create ./settings/org.eclipse.jdt.apt.core.prefs and
+ *              .factorypath.xml
+ */
+public class EclipseAptMojo extends AbstractMojo
+{
+    protected static final String FILE_SEPARATOR = //
+    System.getProperty( "file.separator" );
+
+    /**
+     * The source directory containing the generated sources.
+     * 
+     * @parameter default-value="main/generated"
+     */
+    private String generated;
+
+    /**
+     * The directory to run the compiler from if fork is true.
+     * 
+     * @parameter expression="${basedir}"
+     * @required
+     * @readonly
+     */
+    protected File basedir;
+
+    /**
+     * -classpath Path Specify where to find user class files. Path is a single
+     * argument containing a list of paths to zip files or directories,
+     * delimited by the platform-specific path delimiter.
+     * 
+     * @parameter expression="${project.compileClasspathElements}"
+     * @required
+     * @readonly
+     */
+    private List classpathElements;
+
+    /**
+     * The maven project.
+     * 
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    protected MavenProject project;
+
+    public void execute() throws MojoExecutionException, MojoFailureException
+    {
+        // exclude this :
+        if( "pom".endsWith( project.getPackaging() )
+                || "ear".endsWith( project.getPackaging() ) )
+        {
+            return;
+        }
+        if( !project.getPackaging().contains( "apt" ) )
+        {
+            return;
+        }
+
+        // write prefs file
+        File prefs = new File( basedir, ".settings" + FILE_SEPARATOR
+                + "org.eclipse.jdt.apt.core.prefs" );
+        try
+        {
+            prefs.getParentFile().mkdirs();
+            prefs.createNewFile();
+        } catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Can't create file: "
+                    + prefs.getPath() );
+        }
+        PrintWriter out = null;
+        try
+        {
+            out = new PrintWriter( prefs );
+        } catch ( FileNotFoundException e )
+        {
+            // can't happen
+        }
+        out.println( "#" + new Date() );
+        out.println( "eclipse.preferences.version=1" );
+        out.println( "org.eclipse.jdt.apt.aptEnabled=true" );
+        out.println( "org.eclipse.jdt.apt.genSrcDir=" + generated );
+        out.println( "org.eclipse.jdt.apt.processorOptions=" );
+        out.close();
+
+        // write .factorypath
+        File factorypath = new File( basedir, ".factorypath" );
+        try
+        {
+            prefs.createNewFile();
+        } catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Can't create file: "
+                    + factorypath.getPath() );
+        }
+        try
+        {
+            out = new PrintWriter( factorypath );
+        } catch ( FileNotFoundException e )
+        {
+            // can't happen
+        }
+        out.println( "<factorypath> " );
+        for( Iterator it = classpathElements.iterator(); it.hasNext(); )
+        {
+            String x = (String) it.next();
+            if( x.contains( "jar" ) ) {
+                out.println( "    <factorypathentry kind=\"EXTJAR\" id=\"" + x
+                        + " \" enabled=\"true\" runInBatchMode=\"false\"/>" );
+            }
+        }
+        out.println( "</factorypath> " );
+        out.close();
+    }
+}

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/EclipseAptMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/EclipseAptMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/TestAptMojo.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/TestAptMojo.java?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/TestAptMojo.java (added)
+++ geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/TestAptMojo.java Tue Oct 10 15:35:48 2006
@@ -0,0 +1,147 @@
+package org.apache.maven.plugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 java.io.File;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.model.Resource;
+import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
+import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
+import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+
+/**
+ * @author <a href="mailto:jubu@volny.cz">Juraj Burian</a>
+ * @version $Id: TestAptMojo.java 11 2006-09-05 17:24:29Z jstrachan $
+ * @goal testExecute
+ * @phase generate-sources
+ * @requiresDependencyResolution test
+ * description Generats and/or compiles test sources
+ */
+public class TestAptMojo extends AbstractAPTMojo
+{
+
+    /**
+     * The source directory containing the generated sources to be compiled.
+     * 
+     * @parameter default-value="test/generated"
+     */
+    private String testGenerated;
+
+    /**
+     * Set this to 'true' to bypass unit tests entirely. Its use is NOT
+     * RECOMMENDED, but quite convenient on occasion.
+     * 
+     * @parameter expression="${maven.test.skip}"
+     */
+    private boolean skip;
+
+    /**
+     * The source directories containing the test-source to be compiled.
+     * 
+     * @parameter expression="${project.testCompileSourceRoots}"
+     * @required
+     * @readonly
+     */
+    private List compileSourceRoots;
+
+    /**
+     * Project test classpath.
+     * 
+     * @parameter expression="${project.testClasspathElements}"
+     * @required
+     * @readonly
+     */
+    private List testClasspathElements;
+
+    /**
+     * The directory where compiled test classes go.
+     * 
+     * @parameter expression="${project.build.testOutputDirectory}"
+     * @required
+     * @readonly
+     */
+    private File outputDirectory;
+
+    /**
+     * A list of inclusion filters for the compiler.
+     * 
+     * @parameter
+     */
+    private Set testIncludes = new HashSet();
+
+    /**
+     * A list of exclusion filters for the compiler.
+     * 
+     * @parameter
+     */
+    private Set testExcludes = new HashSet();
+
+    public void execute() throws MojoExecutionException
+    {
+        if( skip )
+        {
+            getLog().info( "Not executing test sources" );
+            return;
+        } else
+        {
+            super.execute();
+
+			String genDir = builddir.getAbsolutePath() + FILE_SEPARATOR + getGenerated();
+            project.addTestCompileSourceRoot( genDir );
+            Resource resource = new Resource();
+            resource.setDirectory( genDir );
+            resource.addExclude( "**/*.java" );
+            project.addTestResource( resource );
+        }
+    }
+
+    protected String getGenerated()
+    {
+        return testGenerated;
+    }
+
+    protected List getCompileSourceRoots()
+    {
+        return compileSourceRoots;
+    }
+
+    protected List getClasspathElements()
+    {
+        return testClasspathElements;
+    }
+
+    protected File getOutputDirectory()
+    {
+        return outputDirectory;
+    }
+
+    protected SourceInclusionScanner getSourceInclusionScanner()
+    {
+        StaleSourceScanner scanner = null;
+
+        if( true == testIncludes.isEmpty() )
+        {
+            testIncludes.add( "**/*.java" );
+        }
+        scanner = new StaleSourceScanner( staleMillis, testIncludes, testExcludes );
+        scanner.addSourceMapping( new SuffixMapping( ".java", ".class" ) );
+        return scanner;
+    }
+}

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/TestAptMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/main/java/org/apache/maven/plugin/TestAptMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/howto.apt
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/howto.apt?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/howto.apt (added)
+++ geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/howto.apt Tue Oct 10 15:35:48 2006
@@ -0,0 +1,45 @@
+ ------
+ Maven 2 Compiler Plugin 
+ ------
+ Juraj Burian
+ <jubu@volny.cz>
+ ------
+ October 12, 2005
+
+How to Use
+
+  This example shows how to set the -A, generated excludes argument of the Apt.
+ 
+  It also shows how to exclude certain files on the items to be compiled.
+ 
+-------------------
+<project>
+   ...
+      <build>
+         ...
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-apt-plugin</artifactId>
+                <configuration>
+                    <generated>src/generated<generated>
+                    <A>debug, loglevel=3</A>
+                    <target>1.5</target>
+                    <excludes>
+                        <exclude implementation="java.lang.String">**/*Point*.java</exclude>
+                    </excludes>
+                </configuration>
+             </plugin>
+         </plugins>
+         ...
+      </build>
+   ...
+</project>
+-------------------
+
+  There are other parameters that you can configure includes/include, debug, showWarnings etc.
+  
+  There are unsupported options, namely: -version, -help, -factorypath.
+  
+  For full documentation, click {{{index.html}here}}.
+ 

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/howto.apt
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/introduction.apt
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/introduction.apt?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/introduction.apt (added)
+++ geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/introduction.apt Tue Oct 10 15:35:48 2006
@@ -0,0 +1,12 @@
+ ------
+ Maven 2 Apt Plugin 
+ ------
+ Juraj Burian
+ <jubu@volny.cz>
+ ------
+ October 12, 2005
+
+Introduction
+
+ This plugin provides the basic APT (Annotation Processing Tool) facilities. 
+

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/site/apt/introduction.apt
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/maven-apt-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/maven-apt-plugin/src/site/site.xml?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/maven-apt-plugin/src/site/site.xml (added)
+++ geronimo/xbean/sandbox/maven-apt-plugin/src/site/site.xml Tue Oct 10 15:35:48 2006
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+-->
+
+<project name="Maven Apt Plugin">
+  <bannerLeft>
+    <name>Maven Apt Plugin</name>
+    <src>http://maven.apache.org/images/apache-maven-project.png</src>
+    <href>http://maven.apache.org/</href>
+  </bannerLeft>
+  <bannerRight>
+    <src>http://maven.apache.org/images/maven-small.gif</src>
+  </bannerRight>
+  <body>
+    <links>
+      <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
+    </links>
+
+    <menu name="Overview">
+      <item name="Introduction" href="introduction.html"/>
+      <item name="How to Use" href="howto.html"/>
+    </menu>
+    ${reports}
+  </body>
+</project>

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/sandbox/maven-apt-plugin/src/site/site.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/pom.xml?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/pom.xml (added)
+++ geronimo/xbean/sandbox/pom.xml Tue Oct 10 15:35:48 2006
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0	http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.xbean</groupId>
+  <artifactId>xbean-factory-parent</artifactId>
+  <packaging>pom</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>XBean Factory Parent</name>
+
+    <modules>
+        <module>maven-apt-plugin</module>
+        <module>xbean-apt</module>
+        <module>xbean-factory</module>
+    </modules>
+</project>
+

Propchange: geronimo/xbean/sandbox/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/xbean-apt/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/pom.xml?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/xbean-apt/pom.xml (added)
+++ geronimo/xbean/sandbox/xbean-apt/pom.xml Tue Oct 10 15:35:48 2006
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.xbean</groupId>
+  <artifactId>xbean-apt</artifactId>
+  <name>XBean APT Processor</name>
+  <version>1.0-SNAPSHOT</version>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <configuration>
+            <source>1.5</source>
+            <target>1.5</target>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>2.1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.1</version>
+      <type>jar</type>
+    </dependency>
+  </dependencies>
+  <profiles>
+    <profile>
+      <id>default-tools.jar</id>
+      <activation>
+        <property>
+          <name>java.vendor</name>
+          <value>Sun Microsystems Inc.</value>
+        </property>
+      </activation>
+      <dependencies>
+        <dependency>
+          <groupId>com.sun</groupId>
+          <artifactId>tools</artifactId>
+          <version>1.5</version>
+          <scope>system</scope>
+          <systemPath>${java.home}/../lib/tools.jar</systemPath>
+        </dependency>
+      </dependencies>
+    </profile>
+  </profiles>
+</project>
\ No newline at end of file

Propchange: geronimo/xbean/sandbox/xbean-apt/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/sandbox/xbean-apt/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlElement.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlElement.java?view=auto&rev=462614
==============================================================================
Binary files /tmp/tmpWj6BMD and /tmp/tmprdfGqm differ

Propchange: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlRootElement.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlRootElement.java?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlRootElement.java (added)
+++ geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlRootElement.java Tue Oct 10 15:35:48 2006
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+package org.apache.xbean.annotations;
+
+/**
+ * @version $Revision: $
+ */
+@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target(value = {java.lang.annotation.ElementType.TYPE}) public @interface XmlRootElement {
+
+    java.lang.String namespace() default "##default";
+
+    java.lang.String name() default "##default";
+}

Propchange: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/annotations/XmlRootElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/VelocityClassVisitor.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/VelocityClassVisitor.java?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/VelocityClassVisitor.java (added)
+++ geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/VelocityClassVisitor.java Tue Oct 10 15:35:48 2006
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+package org.apache.xbean.apt;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.util.SimpleDeclarationVisitor;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.apache.xbean.annotations.XmlRootElement;
+
+import java.io.PrintWriter;
+import java.util.Properties;
+
+/**
+ * @version $Revision: 69 $
+ */
+public class VelocityClassVisitor extends SimpleDeclarationVisitor {
+    private final AnnotationProcessorEnvironment env;
+
+    private String templateName = "FactoryBean.vm";
+    private String packagePostfix = ".factory";
+    private String classPostfix = "FactoryBean";
+
+    private String packageName;
+    private String className;
+    private String qualifiedName;
+
+    public VelocityClassVisitor(final AnnotationProcessorEnvironment env) {
+        this.env = env;
+    }
+
+    public void visitClassDeclaration(ClassDeclaration declaration) {
+
+        if (!matchesDeclaration(declaration)) {
+            return;
+        }
+        createClassProperties(declaration);
+        System.out.println("Creating file: " + qualifiedName);
+        PrintWriter file = null;
+        try {
+            Properties p = new Properties();
+            p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
+
+            Velocity.init(p);
+
+            VelocityContext context = createVelocityContext(declaration);
+            file = env.getFiler().createSourceFile(qualifiedName);
+            // engine.evaluate(context, arg1, className, arg3)
+            Template template = Velocity.getTemplate(templateName);
+
+            template.merge(context, file);
+            file.close();
+            file = null;
+        }
+        catch (Throwable e) {
+            System.out.println(e);
+            e.printStackTrace();
+        }
+    }
+
+    protected void createClassProperties(ClassDeclaration declaration) {
+        packageName = declaration.getPackage().getQualifiedName();
+        packageName += packagePostfix;
+        className = declaration.getSimpleName() + classPostfix;
+        qualifiedName = packageName + "." + className;
+    }
+
+    protected VelocityContext createVelocityContext(ClassDeclaration declaration) {
+        VelocityContext answer = new VelocityContext();
+        answer.put("declaration", declaration);
+        answer.put("packageName", packageName);
+        answer.put("license", "/** TODO license goes here */");
+        answer.put("className", className);
+        answer.put("qualifiedName", qualifiedName);
+        /*
+          Class type = loadClass(declaration);
+          answer.put("info", new EntityInfo(type));
+          */
+        return answer;
+    }
+
+
+    protected boolean matchesDeclaration(ClassDeclaration declaration) {
+        XmlRootElement annotation = declaration.getAnnotation(XmlRootElement.class);
+        return annotation != null;
+    }
+}

Propchange: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/VelocityClassVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessor.java?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessor.java (added)
+++ geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessor.java Tue Oct 10 15:35:48 2006
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+package org.apache.xbean.apt;
+
+import static com.sun.mirror.util.DeclarationVisitors.NO_OP;
+import static com.sun.mirror.util.DeclarationVisitors.getDeclarationScanner;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.TypeDeclaration;
+
+public class XBeanAnnotationProcessor implements AnnotationProcessor {
+    private final AnnotationProcessorEnvironment env;
+
+    public XBeanAnnotationProcessor(AnnotationProcessorEnvironment env) {
+        this.env = env;
+    }
+
+    public void process() {
+        for (TypeDeclaration typeDecl : env.getSpecifiedTypeDeclarations()) {
+            typeDecl.accept(getDeclarationScanner(new VelocityClassVisitor(env), NO_OP));
+        }
+    }
+}
\ No newline at end of file

Propchange: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessorFactory.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessorFactory.java?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessorFactory.java (added)
+++ geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessorFactory.java Tue Oct 10 15:35:48 2006
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+package org.apache.xbean.apt;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+
+import java.util.Arrays;
+import java.util.Collection;
+import static java.util.Collections.emptySet;
+import static java.util.Collections.unmodifiableCollection;
+import java.util.Set;
+
+/*
+ */
+public class XBeanAnnotationProcessorFactory implements AnnotationProcessorFactory {
+    // Process any set of annotations
+    private static final Collection<String> supportedAnnotations = unmodifiableCollection(Arrays.asList("org.apache.xbean.annotations.XmlRootElement"));
+
+    // No supported options
+    private static final Collection<String> supportedOptions = emptySet();
+
+    public Collection<String> supportedAnnotationTypes() {
+        return supportedAnnotations;
+    }
+
+    public Collection<String> supportedOptions() {
+        return supportedOptions;
+    }
+
+    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) {
+        return new XBeanAnnotationProcessor(env);
+    }
+}

Propchange: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessorFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/sandbox/xbean-apt/src/main/java/org/apache/xbean/apt/XBeanAnnotationProcessorFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm (added)
+++ geronimo/xbean/sandbox/xbean-apt/src/main/resources/FactoryBean.vm Tue Oct 10 15:35:48 2006
@@ -0,0 +1,15 @@
+$license
+
+package $packageName;
+
+import $declaration.qualifiedName;
+
+import javax.xml.bind.annotation.*;
+
+
+/**
+ * JAXB2 Factory Bean
+ */
+@XmlRootElement
+public class $className {
+}

Added: geronimo/xbean/sandbox/xbean-apt/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-apt/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory?view=auto&rev=462614
==============================================================================
--- geronimo/xbean/sandbox/xbean-apt/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory (added)
+++ geronimo/xbean/sandbox/xbean-apt/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory Tue Oct 10 15:35:48 2006
@@ -0,0 +1 @@
+org.apache.xbean.apt.XBeanAnnotationProcessorFactory

Propchange: geronimo/xbean/sandbox/xbean-apt/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message