[jboss-cvs] JBossAS SVN: r95383 - in projects/jboss-deployers/trunk: deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 22 03:46:02 EDT 2009


Author: alesj
Date: 2009-10-22 03:46:02 -0400 (Thu, 22 Oct 2009)
New Revision: 95383

Modified:
   projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationDeployer.java
   projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationEnvKeepTestCase.java
   projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationEnvTestCase.java
   projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationsTest.java
   projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/AnnotationRepositoryDeployer.java
Log:
Use mcann Configuration.

Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationDeployer.java	2009-10-22 06:54:15 UTC (rev 95382)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/annotations/GenericAnnotationDeployer.java	2009-10-22 07:46:02 UTC (rev 95383)
@@ -27,7 +27,7 @@
 import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.mcann.AnnotationRepository;
-import org.jboss.mcann.repository.TypeInfoProvider;
+import org.jboss.mcann.repository.Configuration;
 import org.jboss.mcann.scanner.DefaultAnnotationScanner;
 import org.jboss.mcann.scanner.ModuleAnnotationScanner;
 
@@ -38,82 +38,21 @@
  */
 public class GenericAnnotationDeployer extends AbstractSimpleRealDeployer<Module>
 {
-   private boolean forceAnnotations;
-   private boolean keepAnnotations;
-   private boolean checkSuper;
-   private boolean checkInterfaces;
-   private TypeInfoProvider typeInfoProvider;
+   private Configuration configuration;
 
    public GenericAnnotationDeployer()
    {
       super(Module.class);
       setStage(DeploymentStages.POST_CLASSLOADER);
       setOutput(AnnotationRepository.class);
-      checkInterfaces = true;
    }
 
-   /**
-    * 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 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 provider
-    */
-   public void setTypeInfoProvider(TypeInfoProvider typeInfoProvider)
-   {
-      this.typeInfoProvider = typeInfoProvider;
-   }
-
    public void deploy(DeploymentUnit unit, Module deployment) throws DeploymentException
    {
       try
       {
          DefaultAnnotationScanner scanner = new ModuleAnnotationScanner(deployment);
-         scanner.setForceAnnotations(forceAnnotations);
-         scanner.setKeepAnnotations(keepAnnotations);
-         scanner.setCheckSuper(checkSuper);
-         scanner.setCheckInterfaces(checkInterfaces);
-         if (typeInfoProvider != null)
-            scanner.setTypeInfoProvider(typeInfoProvider);
-
+         scanner.setConfiguration(configuration);
          AnnotationRepository repository = scanner.scan(unit.getClassLoader());
          unit.addAttachment(AnnotationRepository.class, repository);
       }
@@ -122,4 +61,14 @@
          throw DeploymentException.rethrowAsDeploymentException("Cannot create AR", e);
       }
    }
+
+   /**
+    * Set configuration.
+    *
+    * @param configuration the configuration
+    */
+   public void setConfiguration(Configuration configuration)
+   {
+      this.configuration = configuration;
+   }
 }

Modified: projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationEnvKeepTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationEnvKeepTestCase.java	2009-10-22 06:54:15 UTC (rev 95382)
+++ projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationEnvKeepTestCase.java	2009-10-22 07:46:02 UTC (rev 95383)
@@ -24,6 +24,7 @@
 import junit.framework.Test;
 import org.jboss.deployers.plugins.annotations.GenericAnnotationDeployer;
 import org.jboss.deployers.spi.deployer.Deployer;
+import org.jboss.mcann.repository.DefaultConfiguration;
 
 /**
  * AnnotationEnvKeepTestCase.
@@ -45,8 +46,10 @@
 
    protected Deployer createGenericAnnotationDeployer()
    {
+      DefaultConfiguration configuration = new DefaultConfiguration();
+      configuration.setKeepAnnotations(true);
       GenericAnnotationDeployer deployer = new GenericAnnotationDeployer();
-      deployer.setKeepAnnotations(true);
+      deployer.setConfiguration(configuration);
       return deployer; 
    }
 }
\ No newline at end of file

Modified: projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationEnvTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationEnvTestCase.java	2009-10-22 06:54:15 UTC (rev 95382)
+++ projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationEnvTestCase.java	2009-10-22 07:46:02 UTC (rev 95383)
@@ -21,7 +21,22 @@
 */
 package org.jboss.test.deployers.annotations.test;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Set;
+
 import junit.framework.Test;
+import org.jboss.classloader.plugins.ClassLoaderUtils;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.mcann.AnnotationRepository;
+import org.jboss.mcann.Element;
+import org.jboss.test.deployers.annotations.support.AnnotationsHolder;
+import org.jboss.test.deployers.annotations.support.TestAnnotation;
 
 /**
  * AnnotationEnvTestCase.
@@ -40,12 +55,6 @@
       return suite(AnnotationEnvTestCase.class);
    }
 
-   public void testX()
-   {
-      // FIXME
-   }
-
-/*
    @SuppressWarnings("unchecked")
    public void testDirectClassUsage() throws Exception
    {
@@ -143,8 +152,8 @@
          String annotationName = "org.jboss.test.deployers.annotations.support.TestAnnotation";
 
          assertNotLoaded(unit, "org.jboss.test.deployers.annotations.support.AnnotationsHolder");
-         // annotations are loaded, OK?
-         assertLoaded(unit, "org.jboss.test.deployers.annotations.support.TestAnnotation");
+         // annotations are not loaded, OK?
+         assertNotLoaded(unit, "org.jboss.test.deployers.annotations.support.TestAnnotation");
 
          AnnotationRepository env = getAnnotationRepository(unit);
          Set<Element<Annotation, Class<?>>> classes = env.classIsAnnotatedWith(annotationName);
@@ -198,5 +207,4 @@
          assertUndeploy(deployer, deployment);
       }
    }
-*/
 }

Modified: projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationsTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationsTest.java	2009-10-22 06:54:15 UTC (rev 95382)
+++ projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/annotations/test/AnnotationsTest.java	2009-10-22 07:46:02 UTC (rev 95383)
@@ -154,7 +154,7 @@
       InterceptionClassLoader icl = (InterceptionClassLoader)cl;
       Set<String> loaded = icl.getLoaded();
       assertNotNull(loaded);
-      assertEquals(loaded.contains(className), checkFlag);
+      assertEquals(checkFlag, loaded.contains(className));
    }
 
    protected DeployerClient getMainDeployer(Deployer... deployers)
@@ -187,6 +187,8 @@
 
    protected Deployer createGenericAnnotationDeployer()
    {
-      return new GenericAnnotationDeployer();
+      GenericAnnotationDeployer deployer = new GenericAnnotationDeployer();
+      //deployer.setTypeInfoProvider(new JavassistTypeInfoProvider());
+      return deployer;
    }
 }

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/AnnotationRepositoryDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/AnnotationRepositoryDeployer.java	2009-10-22 06:54:15 UTC (rev 95382)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/AnnotationRepositoryDeployer.java	2009-10-22 07:46:02 UTC (rev 95383)
@@ -32,6 +32,7 @@
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnitFilter;
 import org.jboss.mcann.AnnotationRepository;
+import org.jboss.mcann.repository.Configuration;
 import org.jboss.mcann.scanner.DefaultAnnotationScanner;
 import org.jboss.mcann.scanner.ModuleAnnotationScanner;
 
@@ -42,11 +43,7 @@
  */
 public class AnnotationRepositoryDeployer extends AbstractOptionalVFSRealDeployer<Module>
 {
-   private boolean forceAnnotations;
-   private boolean keepAnnotations;
-   private boolean checkSuper;
-   private boolean checkInterfaces;
-
+   private Configuration configuration;
    private VFSDeploymentUnitFilter filter;
 
    public AnnotationRepositoryDeployer()
@@ -56,50 +53,19 @@
       addInput(ScanningMetaData.class);
       addInput(AnnotationRepository.class);
       setOutput(AnnotationRepository.class);
-      checkInterfaces = true;
    }
 
    /**
-    * Should we force all annotations to be available.
+    * Set configuration.
     *
-    * @param forceAnnotations the force annotations flag
+    * @param configuration the configuration
     */
-   public void setForceAnnotations(boolean forceAnnotations)
+   public void setConfiguration(Configuration configuration)
    {
-      this.forceAnnotations = forceAnnotations;
+      this.configuration = configuration;
    }
 
    /**
-    * 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 vfs deployment filter.
     *
     * @param filter the vfs deployment filter.
@@ -143,10 +109,7 @@
     */
    protected void configureScanner(VFSDeploymentUnit unit, DefaultAnnotationScanner scanner)
    {
-      scanner.setForceAnnotations(forceAnnotations);
-      scanner.setKeepAnnotations(keepAnnotations);
-      scanner.setCheckSuper(checkSuper);
-      scanner.setCheckInterfaces(checkInterfaces);
+      scanner.setConfiguration(configuration);
    }
 
    public void deploy(VFSDeploymentUnit unit, Module module) throws DeploymentException
@@ -172,7 +135,7 @@
       }
 
       if (log.isTraceEnabled())
-         log.trace("Creating AnnotationRepository for " + unit.getName() + ", module: " + module + ", force annotations: " + forceAnnotations);
+         log.trace("Creating AnnotationRepository for " + unit.getName() + ", module: " + module + ", configuration: " + configuration);
 
       visitModule(unit, module);
    }




More information about the jboss-cvs-commits mailing list