You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2012/01/04 00:08:44 UTC

svn commit: r1226981 - in /commons/proper/digester/trunk: ./ src/main/java/org/apache/commons/digester3/annotations/processor/

Author: simonetripodi
Date: Tue Jan  3 23:08:44 2012
New Revision: 1226981

URL: http://svn.apache.org/viewvc?rev=1226981&view=rev
Log:
added skeletons classes for preparing DIGESTER-158 development

Added:
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessor.java   (with props)
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessorFactory.java   (with props)
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterDeclarationVisitor.java   (with props)
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/package-info.java   (with props)
Modified:
    commons/proper/digester/trunk/pom.xml

Modified: commons/proper/digester/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/pom.xml?rev=1226981&r1=1226980&r2=1226981&view=diff
==============================================================================
--- commons/proper/digester/trunk/pom.xml (original)
+++ commons/proper/digester/trunk/pom.xml Tue Jan  3 23:08:44 2012
@@ -215,6 +215,29 @@
 
     <plugins>
       <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>apt-maven-plugin</artifactId>
+        <version>1.0-alpha-4</version>
+        <executions>
+          <execution>
+            <phase>generate-test-resources</phase>
+            <goals>
+              <goal>test-process</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <factory>org.apache.commons.digester3.annotations.processor.DigesterAnnotationProcessorFactory</factory>
+          <verbose>true</verbose>
+          <includes>
+            <include>**/annotations/rss/*.java</include>
+          </includes>
+          <outputFileEndings>
+            <outputFileEnding>.txt</outputFileEnding>
+          </outputFileEndings>
+        </configuration>
+      </plugin>
+      <plugin>
         <!--
           - A number of the pre-maven test case "suport" classes have names starting with Test.
           - This confuses the maven surefire "auto-detect test case" functionality, so we

Added: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessor.java?rev=1226981&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessor.java (added)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessor.java Tue Jan  3 23:08:44 2012
@@ -0,0 +1,68 @@
+package org.apache.commons.digester3.annotations.processor;
+
+/*
+ * 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 java.util.Collection;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Messager;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.util.DeclarationVisitor;
+
+/**
+ * {@code org.apache.commons.digester3.annotations.rules.*} annotations processor.
+ *
+ * @since 3.3
+ */
+@SuppressWarnings( "restriction" )
+final class DigesterAnnotationProcessor
+    implements AnnotationProcessor
+{
+
+    private final AnnotationProcessorEnvironment environment;
+
+    DigesterAnnotationProcessor( AnnotationProcessorEnvironment environment )
+    {
+        this.environment = environment;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void process()
+    {
+        Messager messager = environment.getMessager();
+        messager.printNotice( "Processing Digester annotations..." );
+
+        DeclarationVisitor visitor = new DigesterDeclarationVisitor( messager );
+
+        Collection<TypeDeclaration> declarations = environment.getTypeDeclarations();
+        for ( TypeDeclaration declaration : declarations )
+        {
+            messager.printNotice( "+---------------------------------------------------------------------------+" );
+
+            declaration.accept( visitor );
+        }
+
+        messager.printNotice( "Digester annotations processing terminated." );
+    }
+
+}

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessorFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessorFactory.java?rev=1226981&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessorFactory.java (added)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessorFactory.java Tue Jan  3 23:08:44 2012
@@ -0,0 +1,73 @@
+package org.apache.commons.digester3.annotations.processor;
+
+/*
+ * 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 static java.util.Collections.emptyList;
+import static java.util.Collections.singleton;
+
+import java.util.Collection;
+import java.util.Set;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.mirror.apt.AnnotationProcessors;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+
+/**
+ * {@link DigesterAnnotationProcessor} factory.
+ *
+ * @since 3.3
+ */
+@SuppressWarnings( "restriction" )
+public final class DigesterAnnotationProcessorFactory
+    implements AnnotationProcessorFactory
+{
+
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotationProcessor getProcessorFor( Set<AnnotationTypeDeclaration> declarations,
+                                                AnnotationProcessorEnvironment environment )
+    {
+        if ( declarations.isEmpty() )
+        {
+            return AnnotationProcessors.NO_OP;
+        }
+        return new DigesterAnnotationProcessor( environment );
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Collection<String> supportedAnnotationTypes()
+    {
+        return singleton( "org.apache.commons.digester3.annotations.rules.*" );
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Collection<String> supportedOptions()
+    {
+        return emptyList();
+    }
+
+}

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessorFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessorFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterAnnotationProcessorFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterDeclarationVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterDeclarationVisitor.java?rev=1226981&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterDeclarationVisitor.java (added)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterDeclarationVisitor.java Tue Jan  3 23:08:44 2012
@@ -0,0 +1,186 @@
+package org.apache.commons.digester3.annotations.processor;
+
+/*
+ * 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 com.sun.mirror.apt.Messager;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.ConstructorDeclaration;
+import com.sun.mirror.declaration.Declaration;
+import com.sun.mirror.declaration.EnumConstantDeclaration;
+import com.sun.mirror.declaration.EnumDeclaration;
+import com.sun.mirror.declaration.ExecutableDeclaration;
+import com.sun.mirror.declaration.FieldDeclaration;
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.MemberDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.PackageDeclaration;
+import com.sun.mirror.declaration.ParameterDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.declaration.TypeParameterDeclaration;
+import com.sun.mirror.util.DeclarationVisitor;
+
+/**
+ * {@code DeclarationVisitor} implementation for Digester rules handling.
+ *
+ * @since 3.3
+ */
+@SuppressWarnings( "restriction" )
+final class DigesterDeclarationVisitor
+    implements DeclarationVisitor
+{
+
+    private final Messager messager;
+
+    DigesterDeclarationVisitor( Messager messager )
+    {
+        this.messager = messager;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitAnnotationTypeDeclaration( AnnotationTypeDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitAnnotationTypeElementDeclaration( AnnotationTypeElementDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitClassDeclaration( ClassDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitConstructorDeclaration( ConstructorDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitDeclaration( Declaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitEnumConstantDeclaration( EnumConstantDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitEnumDeclaration( EnumDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitExecutableDeclaration( ExecutableDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitFieldDeclaration( FieldDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitInterfaceDeclaration( InterfaceDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitMemberDeclaration( MemberDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitMethodDeclaration( MethodDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitPackageDeclaration( PackageDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitParameterDeclaration( ParameterDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitTypeDeclaration( TypeDeclaration declaration )
+    {
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void visitTypeParameterDeclaration( TypeParameterDeclaration declaration )
+    {
+
+    }
+
+}

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterDeclarationVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterDeclarationVisitor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/DigesterDeclarationVisitor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/package-info.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/package-info.java?rev=1226981&view=auto
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/package-info.java (added)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/package-info.java Tue Jan  3 23:08:44 2012
@@ -0,0 +1,26 @@
+/**
+ * The <code>processor</code> package contains the
+ * Digester annotations rules processor implementation.
+ *
+ * @since 3.3
+ */
+package org.apache.commons.digester3.annotations.processor;
+
+/*
+ * 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.
+ */

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/processor/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain