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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 22 17:19:49 EDT 2009


Author: alesj
Date: 2009-10-22 17:19:48 -0400 (Thu, 22 Oct 2009)
New Revision: 95448

Added:
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/AbstractSettings.java
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Settings.java
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/javassist/JavassistConfiguration.java
Removed:
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/ConfigurationCreator.java
Modified:
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/AnnotationScannerFactory.java
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Configuration.java
   projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultConfiguration.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/scanner/DefaultAnnotationScanner.java
Log:
Rremove CC - bad idea.

Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/AnnotationScannerFactory.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/AnnotationScannerFactory.java	2009-10-22 20:42:15 UTC (rev 95447)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/AnnotationScannerFactory.java	2009-10-22 21:19:48 UTC (rev 95448)
@@ -21,8 +21,7 @@
  */
 package org.jboss.mcann;
 
-import org.jboss.mcann.repository.DefaultConfiguration;
-import org.jboss.mcann.repository.javassist.JavassistTypeInfoProvider;
+import org.jboss.mcann.repository.javassist.JavassistConfiguration;
 import org.jboss.mcann.scanner.DefaultAnnotationScanner;
 
 /**
@@ -104,11 +103,7 @@
 
       DefaultAnnotationScanner scanner = new DefaultAnnotationScanner();
       if (strategy == JAVASSIST)
-      {
-         DefaultConfiguration configuration = new DefaultConfiguration();
-         configuration.setTypeInfoProvider(new JavassistTypeInfoProvider());
-         scanner.setConfiguration(configuration);
-      }
+         scanner.setConfiguration(new JavassistConfiguration());
 
       return scanner;
    }

Added: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/AbstractSettings.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/AbstractSettings.java	                        (rev 0)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/AbstractSettings.java	2009-10-22 21:19:48 UTC (rev 95448)
@@ -0,0 +1,141 @@
+/*
+ * 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 org.jboss.classloading.spi.visitor.ResourceFilter;
+import org.jboss.classloading.spi.visitor.ClassFilter;
+import org.jboss.reflect.spi.ClassInfo;
+
+/**
+ * Abstract settings.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractSettings implements Settings
+{
+   private ResourceFilter resourceFilter = ClassFilter.INSTANCE;
+   private boolean forceAnnotations;
+   private boolean keepAnnotations;
+   private boolean checkInterfaces;
+   private boolean checkSuper;
+
+   public AbstractSettings()
+   {
+   }
+
+   public AbstractSettings(Settings configuration)
+   {
+      merge(configuration);
+   }
+
+   public void merge(Settings settings)
+   {
+      if (settings == null)
+         throw new IllegalArgumentException("Null settings.");
+
+      setResourceFilter(settings.resourceFilter());
+      setForceAnnotations(settings.failOnError());
+      setKeepAnnotations(settings.keepAnnotations());
+      setCheckSuper(settings.checkSuper());
+      setCheckInterfaces(settings.checkInterfaces());
+   }
+
+   public boolean isRelevant(ClassInfo classInfo)
+   {
+      return Object.class.getName().equals(classInfo.getName()) == false;
+   }
+
+   public ResourceFilter resourceFilter()
+   {
+      return resourceFilter;
+   }
+
+   public boolean failOnError()
+   {
+      return forceAnnotations;
+   }
+
+   public boolean keepAnnotations()
+   {
+      return keepAnnotations;
+   }
+
+   public boolean checkSuper()
+   {
+      return checkSuper;
+   }
+
+   public boolean checkInterfaces()
+   {
+      return checkInterfaces;
+   }
+
+   /**
+    * Set the resource filter.
+    *
+    * @param resourceFilter the resource filter
+    */
+   public void setResourceFilter(ResourceFilter resourceFilter)
+   {
+      this.resourceFilter = resourceFilter;
+   }
+
+   /**
+    * Should we force all annotations to be available.
+    *
+    * @param forceAnnotations the force annotations flag
+    */
+   public void setForceAnnotations(boolean forceAnnotations)
+   {
+      this.forceAnnotations = forceAnnotations;
+   }
+
+   /**
+    * Set the keep annotations flag.
+    *
+    * @param keepAnnotations the keep annotations flag
+    */
+   public void setKeepAnnotations(boolean keepAnnotations)
+   {
+      this.keepAnnotations = keepAnnotations;
+   }
+
+   /**
+    * Should we check super class for annotations as well.
+    *
+    * @param checkSuper the check super flag
+    */
+   public void setCheckSuper(boolean checkSuper)
+   {
+      this.checkSuper = checkSuper;
+   }
+
+   /**
+    * Should we check interfaces for annotations as well.
+    *
+    * @param checkInterfaces the check interfaces flag
+    */
+   public void setCheckInterfaces(boolean checkInterfaces)
+   {
+      this.checkInterfaces = checkInterfaces;
+   }
+}
\ No newline at end of file

Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Configuration.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Configuration.java	2009-10-22 20:42:15 UTC (rev 95447)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Configuration.java	2009-10-22 21:19:48 UTC (rev 95448)
@@ -21,27 +21,20 @@
  */
 package org.jboss.mcann.repository;
 
-import org.jboss.classloading.spi.visitor.ResourceFilter;
-import org.jboss.reflect.spi.ClassInfo;
-
 /**
- * Scan configuration.
+ * Configuration.
  * 
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
  */
-public interface Configuration
+public interface Configuration extends Settings
 {
-   boolean isRelevant(ClassInfo classInfo);
-
-   ResourceFilter resourceFilter();
-
-   boolean forceAnnotations();
-
-   boolean keepAnnotations();
-
-   boolean checkInterfaces();
-
-   boolean checkSuper();
-
-   TypeInfoProvider typeInfoProvider();
+   /**
+    * Create type info provider.
+    *
+    * Note: if returned instance is stateful,
+    * we should create new instance every time.
+    *
+    * @return type info provider instance
+    */
+   TypeInfoProvider createTypeInfoProvider();
 }

Deleted: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/ConfigurationCreator.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/ConfigurationCreator.java	2009-10-22 20:42:15 UTC (rev 95447)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/ConfigurationCreator.java	2009-10-22 21:19:48 UTC (rev 95448)
@@ -1,40 +0,0 @@
-/*
- * 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;
-
-/**
- * Create configuration.
- * 
- * This should be used when we're dealing with singletons
- * which are using AnnotationScanner with stateful TypeInfoProvider.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public interface ConfigurationCreator
-{
-   /**
-    * Create new configuration.
-    *
-    * @return new configuration instance
-    */
-   Configuration createConfiguration();
-}
\ No newline at end of file

Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultConfiguration.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultConfiguration.java	2009-10-22 20:42:15 UTC (rev 95447)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultConfiguration.java	2009-10-22 21:19:48 UTC (rev 95448)
@@ -21,141 +21,24 @@
  */
 package org.jboss.mcann.repository;
 
-import org.jboss.classloading.spi.visitor.ResourceFilter;
-import org.jboss.classloading.spi.visitor.ClassFilter;
-import org.jboss.reflect.spi.ClassInfo;
-
 /**
  * Default scan configuration.
  *
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
  */
-public class DefaultConfiguration implements Configuration
+public class DefaultConfiguration extends AbstractSettings implements Configuration
 {
-   private ResourceFilter resourceFilter = ClassFilter.INSTANCE;
-   private boolean forceAnnotations;
-   private boolean keepAnnotations;
-   private boolean checkInterfaces;
-   private boolean checkSuper;
-   private TypeInfoProvider typeInfoProvider = IntrospectionTypeInfoProvider.INSTANCE;
-
    public DefaultConfiguration()
    {
    }
 
    public DefaultConfiguration(Configuration configuration)
    {
-      merge(configuration);
+      super(configuration);
    }
 
-   public void merge(Configuration configuration)
+   public TypeInfoProvider createTypeInfoProvider()
    {
-      if (configuration == null)
-         throw new IllegalArgumentException("Null configuration.");
-
-      setResourceFilter(configuration.resourceFilter());
-      setForceAnnotations(configuration.forceAnnotations());
-      setKeepAnnotations(configuration.keepAnnotations());
-      setCheckSuper(configuration.checkSuper());
-      setCheckInterfaces(configuration.checkInterfaces());
-      setTypeInfoProvider(configuration.typeInfoProvider());
+      return IntrospectionTypeInfoProvider.INSTANCE;
    }
-
-   public boolean isRelevant(ClassInfo classInfo)
-   {
-      return Object.class.getName().equals(classInfo.getName()) == false;
-   }
-
-   public ResourceFilter resourceFilter()
-   {
-      return resourceFilter;
-   }
-
-   public boolean forceAnnotations()
-   {
-      return forceAnnotations;
-   }
-
-   public boolean keepAnnotations()
-   {
-      return keepAnnotations;
-   }
-
-   public boolean checkSuper()
-   {
-      return checkSuper;
-   }
-
-   public boolean checkInterfaces()
-   {
-      return checkInterfaces;
-   }
-
-   public TypeInfoProvider typeInfoProvider()
-   {
-      return typeInfoProvider;
-   }
-
-   /**
-    * Set the resource filter.
-    *
-    * @param resourceFilter the resource filter
-    */
-   public void setResourceFilter(ResourceFilter resourceFilter)
-   {
-      this.resourceFilter = resourceFilter;
-   }
-
-   /**
-    * Should we force all annotations to be available.
-    *
-    * @param forceAnnotations the force annotations flag
-    */
-   public void setForceAnnotations(boolean forceAnnotations)
-   {
-      this.forceAnnotations = forceAnnotations;
-   }
-
-   /**
-    * Set the keep annotations flag.
-    *
-    * @param keepAnnotations the keep annotations flag
-    */
-   public void setKeepAnnotations(boolean keepAnnotations)
-   {
-      this.keepAnnotations = keepAnnotations;
-   }
-
-   /**
-    * Should we check super class for annotations as well.
-    *
-    * @param checkSuper the check super flag
-    */
-   public void setCheckSuper(boolean checkSuper)
-   {
-      this.checkSuper = checkSuper;
-   }
-
-   /**
-    * Should we check interfaces for annotations as well.
-    *
-    * @param checkInterfaces the check interfaces flag
-    */
-   public void setCheckInterfaces(boolean checkInterfaces)
-   {
-      this.checkInterfaces = checkInterfaces;
-   }
-
-   /**
-    * Set type info provider.
-    *
-    * @param typeInfoProvider the type info factory
-    */
-   public void setTypeInfoProvider(TypeInfoProvider typeInfoProvider)
-   {
-      if (typeInfoProvider == null)
-         throw new IllegalArgumentException("Null type info provider.");
-
-      this.typeInfoProvider = typeInfoProvider;
-   }
 }
\ No newline at end of file

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-22 20:42:15 UTC (rev 95447)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/GenericAnnotationResourceVisitor.java	2009-10-22 21:19:48 UTC (rev 95448)
@@ -51,17 +51,21 @@
    private static final Logger log = Logger.getLogger(GenericAnnotationResourceVisitor.class);
 
    private DefaultAnnotationRepository repository;
-   private Configuration configuration;
+   private Settings settings;
+   private TypeInfoProvider typeInfoProvider;
 
-   public GenericAnnotationResourceVisitor(DefaultAnnotationRepository repository, Configuration configuration)
+   public GenericAnnotationResourceVisitor(DefaultAnnotationRepository repository, Settings settings, TypeInfoProvider typeInfoProvider)
    {
       if (repository == null)
          throw new IllegalArgumentException("Null repository.");
-      if (configuration == null)
+      if (settings == null)
          throw new IllegalArgumentException("Null configuration");
+      if (typeInfoProvider == null)
+         throw new IllegalArgumentException("Null type info");
 
       this.repository = repository;
-      this.configuration = configuration;
+      this.settings = settings;
+      this.typeInfoProvider = typeInfoProvider;
    }
 
    @SuppressWarnings("deprecation")
@@ -72,7 +76,6 @@
 
    protected ClassInfo createClassInfo(ResourceContext context) throws Exception
    {
-      TypeInfoProvider typeInfoProvider = configuration.typeInfoProvider();
       TypeInfo typeInfo = typeInfoProvider.createTypeInfo(context);
       if (typeInfo instanceof ClassInfo == false)
          throw new IllegalArgumentException("Can only handle class info: " + typeInfo);
@@ -82,7 +85,7 @@
 
    public ResourceFilter getFilter()
    {
-      return configuration.resourceFilter();
+      return settings.resourceFilter();
    }
 
    public void visit(ResourceContext resource)
@@ -102,7 +105,7 @@
       }
       catch (Throwable t)
       {
-         if (configuration.forceAnnotations())
+         if (settings.failOnError())
             throw new RuntimeException(t);
 
          logThrowable(resource, t);
@@ -116,7 +119,7 @@
     */
    protected List<CommitElement> createCommitList()
    {
-      return configuration.forceAnnotations() ? new RepositoryPutList(repository) : new ArrayList<CommitElement>();
+      return settings.failOnError() ? new RepositoryPutList(repository) : new ArrayList<CommitElement>();
    }
 
    /**
@@ -140,7 +143,7 @@
     */
    protected void handleClass(ClassInfo classInfo, List<CommitElement> commit) throws Exception
    {
-      if (classInfo == null || configuration.isRelevant(classInfo) == false)
+      if (classInfo == null || settings.isRelevant(classInfo) == false)
          return;
 
       String className = classInfo.getName();
@@ -161,8 +164,8 @@
       handleMembers(ElementType.METHOD, classInfo.getDeclaredMethods(), className, commit);
       handleMembers(ElementType.FIELD, classInfo.getDeclaredFields(), className, commit);
 
-      boolean checkInterfaces = configuration.checkInterfaces();
-      boolean checkSuper = configuration.checkSuper();
+      boolean checkInterfaces = settings.checkInterfaces();
+      boolean checkSuper = settings.checkSuper();
       if (checkInterfaces || checkSuper)
       {
          if (checkInterfaces)

Added: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Settings.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Settings.java	                        (rev 0)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/Settings.java	2009-10-22 21:19:48 UTC (rev 95448)
@@ -0,0 +1,79 @@
+/*
+ * 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 org.jboss.reflect.spi.ClassInfo;
+import org.jboss.classloading.spi.visitor.ResourceFilter;
+
+/**
+ * Settings.
+ *
+ * This is what resource visitor should use
+ * to limit it scanning space.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface Settings
+{
+   /**
+    * Is this class relevant for scanning.
+    *
+    * @param classInfo the class info
+    * @return true if we should scan this class, fa;se otherwise
+    */
+   boolean isRelevant(ClassInfo classInfo);
+
+   /**
+    * Resource filter.
+    *
+    * @return the resource filter
+    */
+   ResourceFilter resourceFilter();
+
+   /**
+    * Do we fail on error.
+    *
+    * @return true if we fail on error, false otherwise
+    */
+   boolean failOnError();
+
+   /**
+    * Do we keep annotation instances or just minimal info to read them.
+    *
+    * @return true to keep annotation instances, false otherwise
+    */
+   boolean keepAnnotations();
+
+   /**
+    * Do we check interfaces.
+    *
+    * @return true if we should check interfaces, false otherwise
+    */
+   boolean checkInterfaces();
+
+   /**
+    * Do we check superclass.
+    *
+    * @return true if we should check superclass, false otherwise
+    */
+   boolean checkSuper();
+}

Copied: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/javassist/JavassistConfiguration.java (from rev 95398, projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/DefaultConfiguration.java)
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/javassist/JavassistConfiguration.java	                        (rev 0)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/repository/javassist/JavassistConfiguration.java	2009-10-22 21:19:48 UTC (rev 95448)
@@ -0,0 +1,48 @@
+/*
+ * 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.javassist;
+
+import org.jboss.mcann.repository.AbstractSettings;
+import org.jboss.mcann.repository.Configuration;
+import org.jboss.mcann.repository.TypeInfoProvider;
+
+/**
+ * Javassist scan configuration.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JavassistConfiguration extends AbstractSettings implements Configuration
+{
+   public JavassistConfiguration()
+   {
+   }
+
+   public JavassistConfiguration(Configuration configuration)
+   {
+      super(configuration);
+   }
+
+   public TypeInfoProvider createTypeInfoProvider()
+   {
+      return new JavassistTypeInfoProvider();
+   }
+}
\ No newline at end of file

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-22 20:42:15 UTC (rev 95447)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/DefaultAnnotationScanner.java	2009-10-22 21:19:48 UTC (rev 95448)
@@ -42,7 +42,9 @@
  */
 public class DefaultAnnotationScanner extends AbstractAnnotationScanner<DefaultAnnotationRepository>
 {
-   protected Configuration configuration = new DefaultConfiguration();
+   private Configuration configuration = new DefaultConfiguration();
+   private TypeInfoProvider typeInfoProvider;
+
    protected VirtualFile[] excludedRoots;
    protected ClassFilter included;
    protected ClassFilter excluded;
@@ -55,6 +57,10 @@
 
    protected void rescan(DefaultAnnotationRepository repo, URL[] urls, ClassLoader classLoader) throws Exception
    {
+      typeInfoProvider = configuration.createTypeInfoProvider();
+      if (typeInfoProvider == null)
+         throw new IllegalArgumentException("Null type info provider");
+      
       ResourceVisitor visitor = createResourceVisitor(repo);
       ResourceFilter filter = configuration.resourceFilter();
       if (filter == null)
@@ -73,13 +79,11 @@
 
    protected void beforeVisit(ClassLoader classLoader)
    {
-      TypeInfoProvider typeInfoProvider = configuration.typeInfoProvider();
       typeInfoProvider.beforeVisit(classLoader);
    }
 
    protected void afterVisit(ClassLoader classLoader)
    {
-      TypeInfoProvider typeInfoProvider = configuration.typeInfoProvider();
       typeInfoProvider.afterVisit(classLoader);
    }
 
@@ -96,13 +100,14 @@
 
    protected ResourceVisitor createResourceVisitor(DefaultAnnotationRepository repository)
    {
-      return new GenericAnnotationResourceVisitor(repository, configuration);
+      return new GenericAnnotationResourceVisitor(repository, configuration, typeInfoProvider);
    }
 
    public void setConfiguration(Configuration configuration)
    {
       if (configuration == null)
          throw new IllegalArgumentException("Null configuration");
+
       this.configuration = configuration;
    }
 




More information about the jboss-cvs-commits mailing list