[jboss-cvs] JBossAS SVN: r84633 - in projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop: plugins and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 23 09:36:37 EST 2009


Author: kabir.khan at jboss.com
Date: 2009-02-23 09:36:36 -0500 (Mon, 23 Feb 2009)
New Revision: 84633

Modified:
   projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/AspectManager.java
   projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/Domain.java
   projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/plugins/DefaultManager.java
   projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/spi/Manager.java
Log:
Move array AnnotationIntroductions to new Manager

Modified: projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/AspectManager.java
===================================================================
--- projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/AspectManager.java	2009-02-23 14:36:23 UTC (rev 84632)
+++ projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/AspectManager.java	2009-02-23 14:36:36 UTC (rev 84633)
@@ -98,7 +98,9 @@
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @author adrian at jboss.org
  * @version $Revision$
+ * @deprecated The functionality of this class has been moved to {@link AOPSystem}
  */
+ at Deprecated
 public class AspectManager
         implements Translator
 {
@@ -132,7 +134,8 @@
 //   protected volatile LinkedHashMap<String, InterfaceIntroduction> interfaceIntroductions = UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP;
    //protected volatile LinkedHashMap<String, ArrayReplacement> arrayReplacements = UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP;
    //protected volatile LinkedHashMap<String, ArrayBinding> arrayBindings = UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP;
-   protected volatile LinkedHashMap<String, AnnotationIntroduction> annotationIntroductions =UnmodifiableEmptyCollections. EMPTY_LINKED_HASHMAP;
+   //protected volatile LinkedHashMap<String, AnnotationIntroduction> annotationIntroductions =UnmodifiableEmptyCollections. EMPTY_LINKED_HASHMAP;
+   //Needs to visit sub domains and advisors
    protected volatile LinkedHashMap<String, AnnotationIntroduction> annotationOverrides = UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP;
    @Deprecated
    protected volatile LinkedHashMap<String, AdviceBinding> bindings = UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP;
@@ -148,6 +151,7 @@
 
    protected static AOPLock lock = new AOPLock();
 
+   //Needs to visit sub domains and advisors
    protected volatile LinkedHashMap<String, ClassMetaDataBinding> classMetaData = UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP;
    protected volatile HashMap<String, DomainDefinition> containers = UnmodifiableEmptyCollections.EMPTY_HASHMAP;
    protected volatile LinkedHashMap<String, PrecedenceDef> precedenceDefs = UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP;
@@ -1396,39 +1400,23 @@
    {
       manager.removeArrayBinding(name);
    }
-
-   /**
-    * Register an annotation introduction
-    */
-   public synchronized void addAnnotationIntroduction(AnnotationIntroduction pointcut)
+   
+   @Deprecated
+   public void addAnnotationIntroduction(AnnotationIntroduction pointcut)
    {
-      String name = pointcut.getOriginalAnnotationExpr() + pointcut.getOriginalExpression();
-      removeAnnotationIntroduction(pointcut);
-      initAnnotationIntroductionsMap();
-      synchronized (annotationIntroductions)
-      {
-         annotationIntroductions.put(name, pointcut);
-      }
+      manager.addAnnotationIntroduction(pointcut);
    }
 
-   /**
-    * remove an annotation pointcut
-    */
+   @Deprecated
    public void removeAnnotationIntroduction(AnnotationIntroduction pointcut)
    {
-      String name = pointcut.getOriginalAnnotationExpr() + pointcut.getOriginalExpression();
-      synchronized (annotationIntroductions)
-      {
-         annotationIntroductions.remove(name);
-      }
+      manager.removeAnnotationIntroduction(pointcut);
    }
 
+   @Deprecated
    public List<AnnotationIntroduction> getAnnotationIntroductions()
    {
-      synchronized (annotationIntroductions)
-      {
-         return new ArrayList<AnnotationIntroduction>(annotationIntroductions.values());
-      }
+      return manager.getAnnotationIntroductions();
    }
 
    public synchronized void addDeclare(DeclareDef declare)
@@ -1958,20 +1946,6 @@
       }
    }
 
-   protected void initAnnotationIntroductionsMap()
-   {
-      if (annotationIntroductions == UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP)
-      {
-         synchronized(lazyCollectionLock)
-         {
-            if (annotationIntroductions == UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP)
-            {
-               annotationIntroductions = new LinkedHashMap<String, AnnotationIntroduction>();
-            }
-         }
-      }
-   }
-
    protected void initAnnotationOverridesMap()
    {
       if (annotationOverrides == UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP)

Modified: projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/Domain.java
===================================================================
--- projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/Domain.java	2009-02-23 14:36:23 UTC (rev 84632)
+++ projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/Domain.java	2009-02-23 14:36:36 UTC (rev 84633)
@@ -279,17 +279,17 @@
          {
             // when child first, parent bindings go in first so that they can be overridden by child.
             result.addAll(parent.getAnnotationIntroductions());
-            synchronized (annotationIntroductions)
+            synchronized (super.getAnnotationIntroductions())
             {
-               result = new ArrayList<AnnotationIntroduction>(annotationIntroductions.values());
+               result = new ArrayList<AnnotationIntroduction>(super.getAnnotationIntroductions());
             }
             return result;
          }
          else
          {
-            synchronized (annotationIntroductions)
+            synchronized (super.getAnnotationIntroductions())
             {
-               result = new ArrayList<AnnotationIntroduction>(annotationIntroductions.values());
+               result = new ArrayList<AnnotationIntroduction>(super.getAnnotationIntroductions());
             }
             result.addAll(parent.getAnnotationIntroductions());
             return result;
@@ -345,7 +345,7 @@
    public void removeAnnotationIntroduction(AnnotationIntroduction pointcut)
    {
       super.removeAnnotationIntroduction(pointcut);
-      hasOwnAnnotationIntroductions = annotationIntroductions.size() > 0;
+      hasOwnAnnotationIntroductions =  super.getAnnotationIntroductions().size() > 0;
    }
    
    @Override

Modified: projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/plugins/DefaultManager.java
===================================================================
--- projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/plugins/DefaultManager.java	2009-02-23 14:36:23 UTC (rev 84632)
+++ projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/plugins/DefaultManager.java	2009-02-23 14:36:36 UTC (rev 84633)
@@ -21,9 +21,11 @@
 */ 
 package org.jboss.aop.plugins;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -33,6 +35,7 @@
 import org.jboss.aop.array.ArrayAdvisor;
 import org.jboss.aop.array.ArrayBinding;
 import org.jboss.aop.array.ArrayReplacement;
+import org.jboss.aop.introduction.AnnotationIntroduction;
 import org.jboss.aop.introduction.InterfaceIntroduction;
 import org.jboss.aop.metadata.ClassMetaDataLoader;
 import org.jboss.aop.metadata.SimpleClassMetaDataLoader;
@@ -72,8 +75,10 @@
    private volatile Map<String, ArrayReplacement> arrayReplacements = UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP;
    
    private volatile Map<String, ArrayBinding> arrayBindings = UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP;
-
+   
    private  LifecycleManager lifecycleManager = new LifecycleManager(this);
+   
+   private volatile LinkedHashMap<String, AnnotationIntroduction> annotationIntroductions =UnmodifiableEmptyCollections. EMPTY_LINKED_HASHMAP;
 
    protected DefaultManager(Configuration configuration)
    {
@@ -321,6 +326,40 @@
       return arrayReplacements;
    }
 
+   /**
+    * Register an annotation introduction
+    */
+   public synchronized void addAnnotationIntroduction(AnnotationIntroduction introduction)
+   {
+      String name = introduction.getOriginalAnnotationExpr() + introduction.getOriginalExpression();
+      removeAnnotationIntroduction(introduction);
+      initAnnotationIntroductionsMap();
+      synchronized (annotationIntroductions)
+      {
+         annotationIntroductions.put(name, introduction);
+      }
+   }
+
+   /**
+    * remove an annotation pointcut
+    */
+   public void removeAnnotationIntroduction(AnnotationIntroduction introduction)
+   {
+      String name = introduction.getOriginalAnnotationExpr() + introduction.getOriginalExpression();
+      synchronized (annotationIntroductions)
+      {
+         annotationIntroductions.remove(name);
+      }
+   }
+
+   public List<AnnotationIntroduction> getAnnotationIntroductions()
+   {
+      synchronized (annotationIntroductions)
+      {
+         return new ArrayList<AnnotationIntroduction>(annotationIntroductions.values());
+      }
+   }
+
    protected void initCFlowStacksMap()
    {
       if (cflowStacks == UnmodifiableEmptyCollections.EMPTY_CONCURRENT_HASHMAP)
@@ -432,4 +471,18 @@
          }
       }
    }
+
+   protected void initAnnotationIntroductionsMap()
+   {
+      if (annotationIntroductions == UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP)
+      {
+         synchronized(lazyCollectionLock)
+         {
+            if (annotationIntroductions == UnmodifiableEmptyCollections.EMPTY_LINKED_HASHMAP)
+            {
+               annotationIntroductions = new LinkedHashMap<String, AnnotationIntroduction>();
+            }
+         }
+      }
+   }
 }

Modified: projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/spi/Manager.java
===================================================================
--- projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/spi/Manager.java	2009-02-23 14:36:23 UTC (rev 84632)
+++ projects/aop/branches/createspi/aop/src/main/java/org/jboss/aop/spi/Manager.java	2009-02-23 14:36:36 UTC (rev 84633)
@@ -21,6 +21,7 @@
 */ 
 package org.jboss.aop.spi;
 
+import java.util.List;
 import java.util.Map;
 
 import org.jboss.aop.advice.AspectDefinition;
@@ -28,6 +29,7 @@
 import org.jboss.aop.advice.InterceptorFactory;
 import org.jboss.aop.array.ArrayBinding;
 import org.jboss.aop.array.ArrayReplacement;
+import org.jboss.aop.introduction.AnnotationIntroduction;
 import org.jboss.aop.introduction.InterfaceIntroduction;
 import org.jboss.aop.metadata.ClassMetaDataLoader;
 import org.jboss.aop.microcontainer.lifecycle.LifecycleCallbackBinding;
@@ -270,8 +272,30 @@
     */
    void removeArrayBinding(String name);
    
+   /**
+    * Gets all the array replacements in this manager and its parent
+    * @return all the array replacements indexed by name
+    */
    Map<String, ArrayReplacement> getArrayReplacements();
 
+   /**
+    * Adds an annotation introduction
+    * @param introduction
+    */
+   void addAnnotationIntroduction(AnnotationIntroduction introduction);
+
+   /**
+    * Removes an annotation introduction
+    * @param introduction The introduction to remove
+    */
+   void removeAnnotationIntroduction(AnnotationIntroduction introduction);
+
+   /**
+    * Get all the annotation introductions in this manager and its parent
+    * @return All the annotation introduction
+    */
+   List<AnnotationIntroduction> getAnnotationIntroductions();
+
 //   InterceptionMarkers getInterceptionMarkers(ClassLoader loader);
 //
 //   Map<String, Pointcut> getPointcuts();




More information about the jboss-cvs-commits mailing list