[jboss-cvs] JBossAS SVN: r95784 - in projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann: repository/javassist and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 29 16:45:30 EDT 2009


Author: alesj
Date: 2009-10-29 16:45:30 -0400 (Thu, 29 Oct 2009)
New Revision: 95784

Added:
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/MutableAnnotationRepository.java
Modified:
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultAnnotationRepository.java
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/GenericAnnotationResourceVisitor.java
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/RepositoryPutList.java
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/javassist/JavassistTypeInfoProvider.java
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/DefaultAnnotationScanner.java
Log:
Less restrictions on repository in visitor.

Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultAnnotationRepository.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultAnnotationRepository.java	2009-10-29 20:08:19 UTC (rev 95783)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultAnnotationRepository.java	2009-10-29 20:45:30 UTC (rev 95784)
@@ -46,7 +46,7 @@
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public class DefaultAnnotationRepository extends WeakClassLoaderHolder implements AnnotationRepository, Serializable
+public class DefaultAnnotationRepository extends MutableAnnotationRepository implements Serializable
 {
    /** The serial version UID */
    private static final long serialVersionUID = 1L;
@@ -147,7 +147,7 @@
     * @param className the class name
     * @param signature the signature
     */
-   protected void putAnnotation(Annotation annotation, Class<? extends Annotation> annClass, ElementType type, String className, Signature signature)
+   void putAnnotation(Annotation annotation, Class<? extends Annotation> annClass, ElementType type, String className, Signature signature)
    {
       if (log.isTraceEnabled())
          log.trace("Adding annotation @" + annClass.getSimpleName() + " for " + className + " at type " + type + ", signature: " + signature);

Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/GenericAnnotationResourceVisitor.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/GenericAnnotationResourceVisitor.java	2009-10-29 20:08:19 UTC (rev 95783)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/GenericAnnotationResourceVisitor.java	2009-10-29 20:45:30 UTC (rev 95784)
@@ -50,11 +50,11 @@
 {
    private static final Logger log = Logger.getLogger(GenericAnnotationResourceVisitor.class);
 
-   private DefaultAnnotationRepository repository;
+   private MutableAnnotationRepository repository;
    private Settings settings;
    private TypeInfoProvider typeInfoProvider;
 
-   public GenericAnnotationResourceVisitor(DefaultAnnotationRepository repository, Settings settings, TypeInfoProvider typeInfoProvider)
+   public GenericAnnotationResourceVisitor(MutableAnnotationRepository repository, Settings settings, TypeInfoProvider typeInfoProvider)
    {
       if (repository == null)
          throw new IllegalArgumentException("Null repository.");

Copied: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/MutableAnnotationRepository.java (from rev 95780, projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultAnnotationRepository.java)
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/MutableAnnotationRepository.java	                        (rev 0)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/MutableAnnotationRepository.java	2009-10-29 20:45:30 UTC (rev 95784)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mcann.repository;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+
+import org.jboss.mcann.AnnotationRepository;
+import org.jboss.metadata.spi.signature.Signature;
+
+/**
+ * Mutable annotation repository.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class MutableAnnotationRepository extends WeakClassLoaderHolder implements AnnotationRepository
+{
+   protected MutableAnnotationRepository(ClassLoader classLoader)
+   {
+      super(classLoader);
+   }
+
+   /**
+    * Put the annotation info.
+    *
+    * @param annotation the annotation
+    * @param type the annotation type
+    * @param className the class name
+    * @param signature the signature
+    */
+   abstract void putAnnotation(Annotation annotation, ElementType type, String className, Signature signature);
+
+   /**
+    * Was class name already checked.
+    *
+    * @param className the class name
+    * @return true if already checked, false otherwise
+    */
+   abstract boolean isAlreadyChecked(String className);
+}
\ No newline at end of file

Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/RepositoryPutList.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/RepositoryPutList.java	2009-10-29 20:08:19 UTC (rev 95783)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/RepositoryPutList.java	2009-10-29 20:45:30 UTC (rev 95784)
@@ -30,9 +30,9 @@
  */
 class RepositoryPutList extends AbstractList<CommitElement>
 {
-   private DefaultAnnotationRepository repository;
+   private MutableAnnotationRepository repository;
 
-   RepositoryPutList(DefaultAnnotationRepository repository)
+   RepositoryPutList(MutableAnnotationRepository repository)
    {
       if (repository == null)
          throw new IllegalArgumentException("Null repository.");

Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/javassist/JavassistTypeInfoProvider.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/javassist/JavassistTypeInfoProvider.java	2009-10-29 20:08:19 UTC (rev 95783)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/javassist/JavassistTypeInfoProvider.java	2009-10-29 20:45:30 UTC (rev 95784)
@@ -91,7 +91,7 @@
 
       try
       {
-         CtClass ctClass = pool.makeClass(stream);
+         CtClass ctClass = pool.makeClassIfNew(stream);
          return JavassistUtil.toTypeInfo(ctClass);
       }
       finally

Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/DefaultAnnotationScanner.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/DefaultAnnotationScanner.java	2009-10-29 20:08:19 UTC (rev 95783)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/DefaultAnnotationScanner.java	2009-10-29 20:45:30 UTC (rev 95784)
@@ -29,6 +29,7 @@
 import org.jboss.classloading.spi.visitor.ResourceVisitor;
 import org.jboss.mcann.repository.DefaultAnnotationRepository;
 import org.jboss.mcann.repository.GenericAnnotationResourceVisitor;
+import org.jboss.mcann.repository.MutableAnnotationRepository;
 import org.jboss.mcann.repository.TypeInfoProvider;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
@@ -38,7 +39,7 @@
  *
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
  */
-public class DefaultAnnotationScanner extends AbstractAnnotationScanner<DefaultAnnotationRepository>
+public class DefaultAnnotationScanner extends AbstractAnnotationScanner<MutableAnnotationRepository>
 {
    private TypeInfoProvider typeInfoProvider;
 
@@ -47,12 +48,12 @@
    protected ClassFilter excluded;
    protected ResourceFilter recurseFilter;
 
-   protected DefaultAnnotationRepository createAnnotationRepository(ClassLoader classLoader)
+   protected MutableAnnotationRepository createAnnotationRepository(ClassLoader classLoader)
    {
       return new DefaultAnnotationRepository(classLoader);
    }
 
-   protected void rescan(DefaultAnnotationRepository repo, URL[] urls, ClassLoader classLoader) throws Exception
+   protected void rescan(MutableAnnotationRepository repo, URL[] urls, ClassLoader classLoader) throws Exception
    {
       typeInfoProvider = getConfiguration().createTypeInfoProvider();
       if (typeInfoProvider == null)
@@ -95,7 +96,7 @@
       VFSResourceVisitor.visit(roots, excludedRoots, included, excluded, classLoader, visitor, filter, recurseFilter, urls);
    }
 
-   protected ResourceVisitor createResourceVisitor(DefaultAnnotationRepository repository)
+   protected ResourceVisitor createResourceVisitor(MutableAnnotationRepository repository)
    {
       return new GenericAnnotationResourceVisitor(repository, getConfiguration(), typeInfoProvider);
    }




More information about the jboss-cvs-commits mailing list