[jboss-cvs] JBossAS SVN: r106290 - in projects/interceptors/trunk/jboss-interceptor/src: main/java/org/jboss/interceptor/model and 11 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 25 13:01:19 EDT 2010


Author: marius.bogoevici
Date: 2010-06-25 13:01:17 -0400 (Fri, 25 Jun 2010)
New Revision: 106290

Added:
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/InterceptorMetadata.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/InterceptorMetadataException.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ClassMetadataProvider.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/InterceptorMetadataReader.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/MethodMetadataProvider.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ReflectiveClassMetadataProvider.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ReflectiveMethodMetadataProvider.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/SimpleInterceptorMetadataReader.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/registry/
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/registry/InterceptorMetadataRegistry.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/registry/SimpleInterceptorMetadataRegistry.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/serialization/
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/serialization/AbstractInterceptorMetadataSerializationProxy.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/registry/
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/registry/InterceptionModelRegistry.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/javassist/
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/ArrayIterator.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/ImmutableIteratorWrapper.java
Removed:
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/javassist/
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadata.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadataException.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/SerializationProxyFactory.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/AbstractInterceptorMetadataSerializationProxy.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ArrayIterator.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ClassReference.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ImmutableIteratorWrapper.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/MethodReference.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveClassReference.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveMethodReference.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/ClassMetadataReader.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorMetadataRegistry.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorRegistry.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/SimpleClassMetadataReader.java
Modified:
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionModel.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionTypeRegistry.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/MethodHolder.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/AbstractInterceptorMetadata.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/AbstractClassInterceptionHandler.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandler.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandlerFactory.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorMethodHandler.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreator.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreatorImpl.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/SubclassingInterceptorMethodHandler.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/javassist/CompositeHandler.java
   projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/InterceptionUtils.java
   projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/metadata/InterceptorClassMetadataTestCase.java
   projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/InterceptionTestCase.java
   projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/SubclassingInterceptionTestCase.java
Log:
initial commit on reorganising org.jboss.interceptors

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionModel.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionModel.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionModel.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -23,6 +23,10 @@
 import java.io.Serializable;
 
 /**
+ * Describes the interceptors that apply to a particular entity.
+ *
+ * Interceptors and intercepted entities are parametrized.
+ *
  * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
  */
 public interface InterceptionModel<T, I> extends Serializable
@@ -32,10 +36,10 @@
     * Returns the interceptors applicable for the given interception type and method
     *
     * @param interceptionType
-    * @param method
+    * @param method - null if the interception type is lifecycle
     * @return list of interceptors
     * @throws IllegalArgumentException if interceptionType is business method or around timeout
-    *                                  but method is null, as well as if interceptionType is callback and method is not null
+    * but method is null, as well as if interceptionType is callback and method is not null
     */
    public List<I> getInterceptors(InterceptionType interceptionType, Method method);
 

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionTypeRegistry.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionTypeRegistry.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptionTypeRegistry.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -58,9 +58,9 @@
       return interceptionAnnotationClasses.keySet();
    }
 
-   public static boolean supportsTimeoutMethods()
+   public static boolean isSupported(InterceptionType interceptionType)
    {
-      return interceptionAnnotationClasses.containsKey(InterceptionType.AROUND_TIMEOUT);
+      return interceptionAnnotationClasses.containsKey(interceptionType);
    }
 
    public static Class<? extends Annotation> getAnnotationClass(InterceptionType interceptionType)

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadata.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadata.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadata.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model;
-
-import java.util.List;
-
-import org.jboss.interceptor.model.metadata.ClassReference;
-import org.jboss.interceptor.model.metadata.MethodReference;
-
-/**
- * A 
- * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
- */
-public interface InterceptorMetadata
-{
-   ClassReference getInterceptorClass();
-
-   /**
-    * Returns the list of method references to be invoked on this class when doing
-    * interception (as an interceptor is supposed to invoke the superclass
-    * methods too)
-    *
-    * @param interceptionType
-    * @return a list of methods
-    */
-   List<MethodReference> getInterceptorMethods(InterceptionType interceptionType);
-
-   boolean isInterceptor();
-
-   boolean isTargetClass();
-}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadataException.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadataException.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadataException.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model;
-
-import org.jboss.interceptor.InterceptorException;
-
-/**
- * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
- */
-public class InterceptorMetadataException extends InterceptorException
-{
-   public InterceptorMetadataException()
-   {
-   }
-
-   public InterceptorMetadataException(String s)
-   {
-      super(s);
-   }
-
-   public InterceptorMetadataException(String s, Throwable throwable)
-   {
-      super(s, throwable);
-   }
-
-   public InterceptorMetadataException(Throwable throwable)
-   {
-      super(throwable);
-   }
-}

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/MethodHolder.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/MethodHolder.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/MethodHolder.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -21,7 +21,7 @@
 import java.util.Arrays;
 import java.io.Serializable;
 
-import org.jboss.interceptor.model.metadata.MethodReference;
+import org.jboss.interceptor.model.metadata.reader.MethodMetadataProvider;
 import org.jboss.interceptor.util.ReflectionUtils;
 import org.jboss.interceptor.InterceptorException;
 
@@ -42,7 +42,7 @@
       return new MethodHolder(method, withDeclaringClass);
    }
 
-   public static MethodHolder of(MethodReference method, boolean withDeclaringClass)
+   public static MethodHolder of(MethodMetadataProvider method, boolean withDeclaringClass)
    {
       return new MethodHolder(method.getJavaMethod(), withDeclaringClass);
    }

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/SerializationProxyFactory.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/SerializationProxyFactory.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/SerializationProxyFactory.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model;
-
-import java.io.Serializable;
-
-/**
- * @author Marius Bogoevici
- */
-public interface SerializationProxyFactory
-{
-   public Serializable createSerializableProxy();
-}

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/AbstractInterceptorMetadata.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/AbstractInterceptorMetadata.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/AbstractInterceptorMetadata.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -19,22 +19,13 @@
 
 import java.io.Serializable;
 import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import org.jboss.interceptor.model.InterceptionType;
-import org.jboss.interceptor.model.InterceptionTypeRegistry;
-import org.jboss.interceptor.model.InterceptorMetadata;
-import org.jboss.interceptor.model.InterceptorMetadataException;
-import org.jboss.interceptor.model.MethodHolder;
-import org.jboss.interceptor.model.metadata.ClassReference;
-import org.jboss.interceptor.model.metadata.MethodReference;
+import org.jboss.interceptor.model.metadata.reader.ClassMetadataProvider;
+import org.jboss.interceptor.model.metadata.reader.MethodMetadataProvider;
 import org.jboss.interceptor.util.InterceptionUtils;
-import org.jboss.interceptor.util.ReflectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,75 +37,32 @@
 {
 
    private Logger log = LoggerFactory.getLogger(AbstractInterceptorMetadata.class);
-   private ClassReference interceptorClass;
-   private Map<InterceptionType, List<MethodReference>> methodMap;
+   private ClassMetadataProvider interceptorClass;
+   private Map<InterceptionType, List<MethodMetadataProvider>> methodMap;
    private boolean targetClass;
 
-   protected AbstractInterceptorMetadata(ClassReference interceptorClass, boolean targetClass)
+   protected AbstractInterceptorMetadata(ClassMetadataProvider interceptorClass, boolean targetClass)
    {
       this.interceptorClass = interceptorClass;
-      this.methodMap = buildMethodMap(interceptorClass, targetClass);
+      this.methodMap = InterceptionUtils.buildMethodMap(interceptorClass, targetClass);
       this.targetClass = targetClass;
    }
 
-   private Map<InterceptionType, List<MethodReference>> buildMethodMap(ClassReference interceptorClass, boolean isTargetClass)
+   public ClassMetadataProvider getInterceptorClass()
    {
-      Map<InterceptionType, List<MethodReference>> methodMap = new HashMap<InterceptionType, List<MethodReference>>();
-      ClassReference currentClass = interceptorClass;
-      Set<MethodHolder> foundMethods = new HashSet<MethodHolder>();
-      do
-      {
-         Set<InterceptionType> detectedInterceptorTypes = new HashSet<InterceptionType>();
-
-         for (MethodReference method : currentClass.getDeclaredMethods())
-         {
-            for (InterceptionType interceptionType : InterceptionTypeRegistry.getSupportedInterceptionTypes())
-            {
-               if (InterceptionUtils.isInterceptorMethod(interceptionType, method, isTargetClass))
-               {
-                  if (methodMap.get(interceptionType) == null)
-                  {
-                     methodMap.put(interceptionType, new LinkedList<MethodReference>());
-                  }
-                  if (detectedInterceptorTypes.contains(interceptionType))
-                  {
-                     throw new InterceptorMetadataException("Same interception type cannot be specified twice on the same class");
-                  }
-                  else
-                  {
-                     detectedInterceptorTypes.add(interceptionType);
-                  }
-                  // add method in the list - if it is there already, it means that it has been added by a subclass
-                  ReflectionUtils.ensureAccessible(method.getJavaMethod());
-                  if (!foundMethods.contains(MethodHolder.of(method, false)))
-                  {
-                     methodMap.get(interceptionType).add(0, method);
-                  }
-               }
-            }
-            foundMethods.add(MethodHolder.of(method, false));
-         }
-         currentClass = currentClass.getSuperclass();
-      }
-      while (!Object.class.equals(currentClass.getJavaClass()));
-      return methodMap;
-   }
-
-   public ClassReference getInterceptorClass()
-   {
       return interceptorClass;
    }
 
-   public List<MethodReference> getInterceptorMethods(InterceptionType interceptionType)
+   public List<MethodMetadataProvider> getInterceptorMethods(InterceptionType interceptionType)
    {
       if (methodMap != null)
       {
-         List<MethodReference> methods = methodMap.get(interceptionType);
-         return methods == null ? Collections.<MethodReference>emptyList() : methods;
+         List<MethodMetadataProvider> methods = methodMap.get(interceptionType);
+         return methods == null ? Collections.<MethodMetadataProvider>emptyList() : methods;
       }
       else
       {
-         return Collections.<MethodReference>emptyList();
+         return Collections.<MethodMetadataProvider>emptyList();
       }
    }
 

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/AbstractInterceptorMetadataSerializationProxy.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/AbstractInterceptorMetadataSerializationProxy.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/AbstractInterceptorMetadataSerializationProxy.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model.metadata;
-
-import java.io.Serializable;
-
-import org.jboss.interceptor.InterceptorException;
-import org.jboss.interceptor.model.InterceptorMetadata;
-
-public abstract class AbstractInterceptorMetadataSerializationProxy implements Serializable
-{
-   private String className;
-
-   private boolean interceptionTargetClass;
-
-   protected AbstractInterceptorMetadataSerializationProxy(String className, boolean interceptionTargetClass)
-   {
-      this.className = className;
-      this.interceptionTargetClass = interceptionTargetClass;
-   }
-
-   private Object readResolve()
-   {
-      try
-      {
-         return loadInterceptorMetadata();
-      }
-      catch (ClassNotFoundException e)
-      {
-         throw new InterceptorException("Failed to deserialize the interceptor class metadata", e);
-      }
-   }
-
-   protected String getClassName()
-   {
-      return className;
-   }
-
-   protected boolean isInterceptionTargetClass()
-   {
-      return interceptionTargetClass;
-   }
-
-   protected abstract InterceptorMetadata loadInterceptorMetadata() throws ClassNotFoundException;
-}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ArrayIterator.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ArrayIterator.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ArrayIterator.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model.metadata;
-
-import java.util.Iterator;
-
-import org.jboss.interceptor.InterceptorException;
-
-/**
- * @author Marius Bogoevici
- */
-public class ArrayIterator<T> implements Iterator<T>
-{
-   private T[] array;
-
-   private int currentIndex = 0;
-
-   public ArrayIterator(T[] array)
-   {
-      if (array == null)
-         throw new IllegalArgumentException("Iterated array cannot be null");
-      this.array = array;
-   }
-
-   public boolean hasNext()
-   {
-      return currentIndex < array.length;
-   }
-
-   public T next()
-   {
-      return array[currentIndex++];
-   }
-
-   public void remove()
-   {
-      throw new UnsupportedOperationException("Removal of elements is not supported");
-   }
-}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ClassReference.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ClassReference.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ClassReference.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model.metadata;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * Abstraction of a class reference. Allows for the framework client to configure
- * their own way of providing class metadata, rather than relying exclusively on
- * Java reflection.
- * 
- * @author Marius Bogoevici
- */
-public interface ClassReference extends Serializable
-{
-   Iterable<MethodReference> getDeclaredMethods();
-   
-   Class<?> getJavaClass();
-   
-   String getClassName();
-
-   ClassReference getSuperclass();
-}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ImmutableIteratorWrapper.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ImmutableIteratorWrapper.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ImmutableIteratorWrapper.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model.metadata;
-
-import java.util.Iterator;
-
-/**
-* @author Marius Bogoevici
-*/
-public abstract class ImmutableIteratorWrapper<T> implements Iterator<MethodReference>
-{
-
-   private Iterator<T> originalIterator;
-
-   protected ImmutableIteratorWrapper(Iterator<T> originalIterator)
-   {
-      this.originalIterator = originalIterator;
-   }
-
-
-   public boolean hasNext()
-   {
-      return originalIterator.hasNext();
-   }
-
-   public MethodReference next()
-   {
-      return wrapObject(originalIterator.next());
-   }
-
-   protected abstract MethodReference wrapObject(T t);
-
-   public void remove()
-   {
-      throw new UnsupportedOperationException("Removal not supported");
-   }
-}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/InterceptorMetadata.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadata.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/InterceptorMetadata.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/InterceptorMetadata.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata;
+
+import java.util.List;
+
+import org.jboss.interceptor.model.InterceptionType;
+import org.jboss.interceptor.model.metadata.reader.ClassMetadataProvider;
+import org.jboss.interceptor.model.metadata.reader.MethodMetadataProvider;
+
+/**
+ * A 
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public interface InterceptorMetadata
+{
+   ClassMetadataProvider getInterceptorClass();
+
+   /**
+    * Returns the list of method references to be invoked on this class when doing
+    * interception (as an interceptor is supposed to invoke the superclass
+    * methods too)
+    *
+    * @param interceptionType
+    * @return a list of methods
+    */
+   List<MethodMetadataProvider> getInterceptorMethods(InterceptionType interceptionType);
+
+   boolean isInterceptor();
+
+   boolean isTargetClass();
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/InterceptorMetadataException.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/InterceptorMetadataException.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/InterceptorMetadataException.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/InterceptorMetadataException.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata;
+
+import org.jboss.interceptor.InterceptorException;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class InterceptorMetadataException extends InterceptorException
+{
+   public InterceptorMetadataException()
+   {
+   }
+
+   public InterceptorMetadataException(String s)
+   {
+      super(s);
+   }
+
+   public InterceptorMetadataException(String s, Throwable throwable)
+   {
+      super(s, throwable);
+   }
+
+   public InterceptorMetadataException(Throwable throwable)
+   {
+      super(throwable);
+   }
+}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/MethodReference.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/MethodReference.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/MethodReference.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model.metadata;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-
-/**
- * Abstraction of a method reference. Allows for the framework client to configure
- * their own way of providing method metadata, rather than relying exclusively on
- * Java reflection.
- * 
- * @author Marius Bogoevici
- */
-public interface MethodReference
-{
-   Method getJavaMethod();
-
-   Annotation getAnnotation(Class<? extends Annotation> annotationClass);
-
-   ClassReference getReturnType();
-
-}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveClassReference.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveClassReference.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveClassReference.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model.metadata;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * @author Marius Bogoevici
- */
-public class ReflectiveClassReference implements ClassReference, Serializable
-{
-
-   private Class<?> clazz;
-
-   private ReflectiveClassReference(Class<?> clazz)
-   {
-      this.clazz = clazz;
-   }
-
-   public static ClassReference of(Class<?> clazz)
-   {
-      return new ReflectiveClassReference(clazz);
-   }
-
-   public String getClassName()
-   {
-      return clazz.getName();
-   }
-
-   public Iterable<MethodReference> getDeclaredMethods()
-   {
-      return new Iterable<MethodReference>()
-      {
-         public Iterator<MethodReference> iterator()
-         {
-             return new ImmutableIteratorWrapper<Method>(new ArrayIterator(ReflectiveClassReference.this.clazz.getDeclaredMethods()))
-             {
-                @Override
-                protected MethodReference wrapObject(Method method)
-                {
-                   return ReflectiveMethodReference.of(method);
-                }
-             };
-         }
-      };     
-   }
-
-   public Class<?> getJavaClass()
-   {
-      return clazz;
-   }   
-
-   public ClassReference getSuperclass()
-   {
-      Class<?> superClass = clazz.getSuperclass();
-      return superClass == null? null : new ReflectiveClassReference(superClass);
-   }
-
-}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveMethodReference.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveMethodReference.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveMethodReference.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.model.metadata;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-
-/**
- * @author Marius Bogoevici
- */
-public class ReflectiveMethodReference implements MethodReference, Serializable
-{
-   private Method javaMethod;
-
-   private ReflectiveMethodReference(Method method)
-   {
-      this.javaMethod = method;
-   }
-
-   public static MethodReference of(Method method)
-   {
-      return new ReflectiveMethodReference(method);
-   }
-
-   public Annotation getAnnotation(Class<? extends Annotation> annotationClass)
-   {
-      return javaMethod.getAnnotation(annotationClass);
-   }
-
-   public Method getJavaMethod()
-   {
-      return javaMethod;
-   }
-
-   public ClassReference getReturnType()
-   {
-      return ReflectiveClassReference.of(javaMethod.getReturnType());
-   }
-
-}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ClassMetadataProvider.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ClassReference.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ClassMetadataProvider.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ClassMetadataProvider.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata.reader;
+
+import java.io.Serializable;
+
+/**
+ * Abstraction of a class reference. Allows for the framework client to configure
+ * their own way of providing class metadata, rather than relying exclusively on
+ * Java reflection.
+ * 
+ * @author Marius Bogoevici
+ */
+public interface ClassMetadataProvider extends Serializable
+{
+   Iterable<MethodMetadataProvider> getDeclaredMethods();
+   
+   Class<?> getJavaClass();
+   
+   String getClassName();
+
+   ClassMetadataProvider getSuperclass();
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/InterceptorMetadataReader.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/ClassMetadataReader.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/InterceptorMetadataReader.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/InterceptorMetadataReader.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata.reader;
+
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
+
+/**
+ * Reads interceptor metada
+ * @author Marius Bogoevici
+ */
+public interface InterceptorMetadataReader
+{
+   InterceptorMetadata getInterceptorMetadata(ClassMetadataProvider clazz, boolean isTargetClass);
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/MethodMetadataProvider.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/MethodReference.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/MethodMetadataProvider.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/MethodMetadataProvider.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata.reader;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+/**
+ * Abstraction of a source of metadata information about a method. Allows the framework client to configure
+ * their own way of providing method metadata, rather than relying exclusively on
+ * Java reflection.
+ * 
+ * @author Marius Bogoevici
+ */
+public interface MethodMetadataProvider
+{
+   Method getJavaMethod();
+
+   Annotation getAnnotation(Class<? extends Annotation> annotationClass);
+
+   ClassMetadataProvider getReturnType();
+
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ReflectiveClassMetadataProvider.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveClassReference.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ReflectiveClassMetadataProvider.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ReflectiveClassMetadataProvider.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata.reader;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+
+import org.jboss.interceptor.util.ImmutableIteratorWrapper;
+import org.jboss.interceptor.util.ArrayIterator;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class ReflectiveClassMetadataProvider implements ClassMetadataProvider, Serializable
+{
+
+   private Class<?> clazz;
+
+   private ReflectiveClassMetadataProvider(Class<?> clazz)
+   {
+      this.clazz = clazz;
+   }
+
+   public static ClassMetadataProvider of(Class<?> clazz)
+   {
+      return new ReflectiveClassMetadataProvider(clazz);
+   }
+
+   public String getClassName()
+   {
+      return clazz.getName();
+   }
+
+   public Iterable<MethodMetadataProvider> getDeclaredMethods()
+   {
+      return new Iterable<MethodMetadataProvider>()
+      {
+         public Iterator<MethodMetadataProvider> iterator()
+         {
+             return new ImmutableIteratorWrapper<Method>(new ArrayIterator(ReflectiveClassMetadataProvider.this.clazz.getDeclaredMethods()))
+             {
+                @Override
+                protected MethodMetadataProvider wrapObject(Method method)
+                {
+                   return ReflectiveMethodMetadataProvider.of(method);
+                }
+             };
+         }
+      };     
+   }
+
+   public Class<?> getJavaClass()
+   {
+      return clazz;
+   }   
+
+   public ClassMetadataProvider getSuperclass()
+   {
+      Class<?> superClass = clazz.getSuperclass();
+      return superClass == null? null : new ReflectiveClassMetadataProvider(superClass);
+   }
+
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ReflectiveMethodMetadataProvider.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ReflectiveMethodReference.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ReflectiveMethodMetadataProvider.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/ReflectiveMethodMetadataProvider.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata.reader;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class ReflectiveMethodMetadataProvider implements MethodMetadataProvider, Serializable
+{
+   private Method javaMethod;
+
+   private ReflectiveMethodMetadataProvider(Method method)
+   {
+      this.javaMethod = method;
+   }
+
+   public static MethodMetadataProvider of(Method method)
+   {
+      return new ReflectiveMethodMetadataProvider(method);
+   }
+
+   public Annotation getAnnotation(Class<? extends Annotation> annotationClass)
+   {
+      return javaMethod.getAnnotation(annotationClass);
+   }
+
+   public Method getJavaMethod()
+   {
+      return javaMethod;
+   }
+
+   public ClassMetadataProvider getReturnType()
+   {
+      return ReflectiveClassMetadataProvider.of(javaMethod.getReturnType());
+   }
+
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/SimpleInterceptorMetadataReader.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/SimpleClassMetadataReader.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/SimpleInterceptorMetadataReader.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/reader/SimpleInterceptorMetadataReader.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata.reader;
+
+import org.jboss.interceptor.InterceptorException;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
+import org.jboss.interceptor.model.metadata.AbstractInterceptorMetadata;
+import org.jboss.interceptor.model.metadata.serialization.AbstractInterceptorMetadataSerializationProxy;
+import org.jboss.interceptor.util.ReflectionUtils;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class SimpleInterceptorMetadataReader implements InterceptorMetadataReader
+{
+   private static SimpleInterceptorMetadataReader instance = new SimpleInterceptorMetadataReader();
+
+   public InterceptorMetadata getInterceptorMetadata(ClassMetadataProvider clazz, final boolean isInterceptorTargetClass)
+   {
+      return new AbstractInterceptorMetadata(clazz, isInterceptorTargetClass)
+      {
+         @Override
+         protected Object createSerializableProxy()
+         {
+            return new SimpleInterceptorMetadataSerializationProxy(getInterceptorClass().getClassName(), isTargetClass());
+         }
+
+         private Object writeReplace()
+         {
+            return createSerializableProxy();
+         }
+
+      };
+   }
+
+   public static InterceptorMetadataReader getInstance()
+   {
+      return instance;
+   }
+
+   private static class SimpleInterceptorMetadataSerializationProxy extends AbstractInterceptorMetadataSerializationProxy
+   {
+      public SimpleInterceptorMetadataSerializationProxy(String className, boolean targetClass)
+      {
+         super(className, targetClass);
+      }
+
+      @Override
+      protected InterceptorMetadata loadInterceptorMetadata() throws ClassNotFoundException
+      {
+         Class<?> clazz = ReflectionUtils.classForName(getClassName());
+         return SimpleInterceptorMetadataReader.instance.getInterceptorMetadata(ReflectiveClassMetadataProvider.of(clazz), isInterceptionTargetClass());
+      }
+
+      private Object readResolve()
+      {
+         try
+         {
+            return loadInterceptorMetadata();
+         }
+         catch (ClassNotFoundException e)
+         {
+            throw new InterceptorException("Failed to deserialize the interceptor class metadata", e);
+         }
+      }
+
+   }
+}

Added: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/registry/InterceptorMetadataRegistry.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/registry/InterceptorMetadataRegistry.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/registry/InterceptorMetadataRegistry.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,17 @@
+package org.jboss.interceptor.model.metadata.registry;
+
+import org.jboss.interceptor.model.metadata.reader.ClassMetadataProvider;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
+
+/**
+ * Acts as a repository of
+ * 
+ * @author Marius Bogoevici
+ */
+public interface InterceptorMetadataRegistry
+{
+   InterceptorMetadata getInterceptorClassMetadata(ClassMetadataProvider interceptorClass);
+
+   InterceptorMetadata getInterceptorClassMetadata(ClassMetadataProvider interceptorClass, boolean isInterceptorTargetClass);
+
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/registry/SimpleInterceptorMetadataRegistry.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorMetadataRegistry.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/registry/SimpleInterceptorMetadataRegistry.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/registry/SimpleInterceptorMetadataRegistry.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata.registry;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.jboss.interceptor.model.metadata.reader.ClassMetadataProvider;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
+import org.jboss.interceptor.model.metadata.reader.InterceptorMetadataReader;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class SimpleInterceptorMetadataRegistry implements InterceptorMetadataRegistry
+{
+   private final Map<Key, InterceptorMetadata> interceptorClassMetadataMap = new ConcurrentHashMap<Key, InterceptorMetadata>();
+
+   private InterceptorMetadataReader interceptorMetadataReader;
+
+   private final Lock lock = new ReentrantLock();
+
+   public SimpleInterceptorMetadataRegistry(InterceptorMetadataReader interceptorMetadataReader)
+   {
+      this.interceptorMetadataReader = interceptorMetadataReader;
+   }
+
+   public InterceptorMetadata getInterceptorClassMetadata(ClassMetadataProvider interceptorClass)
+   {
+      return this.getInterceptorClassMetadata(interceptorClass, false);
+   }
+
+   public InterceptorMetadata getInterceptorClassMetadata(ClassMetadataProvider interceptorClass, boolean isInterceptorTargetClass)
+   {
+      Key key = new Key(interceptorClass, isInterceptorTargetClass);
+      if (!interceptorClassMetadataMap.containsKey(key))
+      {
+         try
+         {
+            lock.lock();
+            //verify that metadata hasn't been added while waiting for the lock
+            if (!interceptorClassMetadataMap.containsKey(key))
+            {
+               interceptorClassMetadataMap.put(key, interceptorMetadataReader.getInterceptorMetadata(interceptorClass, isInterceptorTargetClass));
+            }
+         }
+         finally
+         {
+            lock.unlock();
+         }
+      }
+
+      return interceptorClassMetadataMap.get(key);
+
+   }
+
+   public void cleanup()
+   {
+      this.interceptorClassMetadataMap.clear();
+   }
+
+   public static final class Key
+   {
+      private String className;
+
+      private boolean isInterceptorTargetClass;
+
+      private Key(ClassMetadataProvider clazz, boolean interceptorTargetClass)
+      {
+         this.className = clazz.getClassName();
+         isInterceptorTargetClass = interceptorTargetClass;
+      }
+
+      @Override
+      public boolean equals(Object o)
+      {
+         if (this == o)
+         {
+            return true;
+         }
+         if (o == null || getClass() != o.getClass())
+         {
+            return false;
+         }
+
+         Key key = (Key) o;
+
+         if (isInterceptorTargetClass != key.isInterceptorTargetClass)
+         {
+            return false;
+         }
+         if (className != null ? !className.equals(key.className) : key.className != null)
+         {
+            return false;
+         }
+
+         return true;
+      }
+
+      @Override
+      public int hashCode()
+      {
+         int result = className != null ? className.hashCode() : 0;
+         result = 31 * result + (isInterceptorTargetClass ? 1 : 0);
+         return result;
+      }
+   }
+
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/serialization/AbstractInterceptorMetadataSerializationProxy.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/AbstractInterceptorMetadataSerializationProxy.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/serialization/AbstractInterceptorMetadataSerializationProxy.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/serialization/AbstractInterceptorMetadataSerializationProxy.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.metadata.serialization;
+
+import java.io.Serializable;
+
+import org.jboss.interceptor.InterceptorException;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
+
+public abstract class AbstractInterceptorMetadataSerializationProxy implements Serializable
+{
+   private String className;
+
+   private boolean interceptionTargetClass;
+
+   protected AbstractInterceptorMetadataSerializationProxy(String className, boolean interceptionTargetClass)
+   {
+      this.className = className;
+      this.interceptionTargetClass = interceptionTargetClass;
+   }
+
+   private Object readResolve()
+   {
+      try
+      {
+         return loadInterceptorMetadata();
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new InterceptorException("Failed to deserialize the interceptor class metadata", e);
+      }
+   }
+
+   protected String getClassName()
+   {
+      return className;
+   }
+
+   protected boolean isInterceptionTargetClass()
+   {
+      return interceptionTargetClass;
+   }
+
+   protected abstract InterceptorMetadata loadInterceptorMetadata() throws ClassNotFoundException;
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/registry/InterceptionModelRegistry.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorRegistry.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/registry/InterceptionModelRegistry.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/registry/InterceptionModelRegistry.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.model.registry;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.interceptor.model.InterceptionModel;
+
+/**
+ * Metadata store for information on how the an entity of a given type needs to be intercepted.
+ *
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class InterceptionModelRegistry<T, I> implements Serializable
+{
+   private Map<T, InterceptionModel<T, I>> interceptionModelMap = new HashMap<T, InterceptionModel<T, I>>();
+
+   public void registerInterceptionModel(T interceptedEntity, InterceptionModel<T, I> interceptionModel)
+   {
+      this.interceptionModelMap.put(interceptedEntity, interceptionModel);
+   }
+
+   public InterceptionModel<T, I> getInterceptionModel(T interceptedEntity)
+   {
+      return this.interceptionModelMap.get(interceptedEntity);
+   }
+}

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/AbstractClassInterceptionHandler.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/AbstractClassInterceptionHandler.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/AbstractClassInterceptionHandler.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -28,11 +28,11 @@
 
 import javax.interceptor.InvocationContext;
 
-import org.jboss.interceptor.model.metadata.MethodReference;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
+import org.jboss.interceptor.model.metadata.reader.MethodMetadataProvider;
 import org.jboss.interceptor.util.ReflectionUtils;
 import org.jboss.interceptor.InterceptorException;
 import org.jboss.interceptor.model.InterceptionType;
-import org.jboss.interceptor.model.InterceptorMetadata;
 
 /**
  * @author Marius Bogoevici
@@ -51,7 +51,7 @@
 
    public Object invoke(Object target, InterceptionType interceptionType, InvocationContext invocationContext) throws Exception
    {
-      List<MethodReference> methods = interceptorMetadata.getInterceptorMethods(interceptionType);
+      List<MethodMetadataProvider> methods = interceptorMetadata.getInterceptorMethods(interceptionType);
       if (methods != null)
       {
          DelegatingInvocationContext delegatingInvocationContext = new DelegatingInvocationContext(invocationContext, getInterceptorInstance(), methods, interceptionType);
@@ -76,14 +76,14 @@
       private Object targetObject;
       private InterceptionType interceptionType;
 
-      private Queue<MethodReference> invocationQueue;
+      private Queue<MethodMetadataProvider> invocationQueue;
 
-      public DelegatingInvocationContext(InvocationContext delegateInvocationContext, Object targetObject, List<MethodReference> methods, InterceptionType interceptionType)
+      public DelegatingInvocationContext(InvocationContext delegateInvocationContext, Object targetObject, List<MethodMetadataProvider> methods, InterceptionType interceptionType)
       {
          this.delegateInvocationContext = delegateInvocationContext;
          this.targetObject = targetObject;
          this.interceptionType = interceptionType;
-         this.invocationQueue = new ConcurrentLinkedQueue<MethodReference>(methods);
+         this.invocationQueue = new ConcurrentLinkedQueue<MethodMetadataProvider>(methods);
       }
 
       public Map<String, Object> getContextData()
@@ -114,10 +114,10 @@
             {
                if (AbstractClassInterceptionHandler.this.interceptorMetadata.isTargetClass() && interceptionType.isLifecycleCallback())
                {
-                  Iterator<MethodReference> methodIterator = invocationQueue.iterator();
+                  Iterator<MethodMetadataProvider> methodIterator = invocationQueue.iterator();
                   while (methodIterator.hasNext())
                   {
-                     MethodReference interceptorMethod = methodIterator.next();
+                     MethodMetadataProvider interceptorMethod = methodIterator.next();
                      ReflectionUtils.ensureAccessible(interceptorMethod.getJavaMethod());
                      // interceptor methods defined on
                      interceptorMethod.getJavaMethod().invoke(targetObject);
@@ -126,7 +126,7 @@
                }
                else
                {
-                  MethodReference interceptorMethod = invocationQueue.remove();
+                  MethodMetadataProvider interceptorMethod = invocationQueue.remove();
                   ReflectionUtils.ensureAccessible(interceptorMethod.getJavaMethod());
                   if (interceptorMethod.getJavaMethod().getParameterTypes().length == 0)
                   {

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandler.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandler.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandler.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -17,10 +17,8 @@
 
 package org.jboss.interceptor.proxy;
 
-import org.jboss.interceptor.model.metadata.ClassReference;
-import org.jboss.interceptor.model.InterceptorMetadata;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
 import org.jboss.interceptor.InterceptorException;
-import org.jboss.interceptor.util.ReflectionUtils;
 
 /**
  * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandlerFactory.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandlerFactory.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandlerFactory.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -17,9 +17,8 @@
 
 package org.jboss.interceptor.proxy;
 
-import org.jboss.interceptor.model.metadata.ClassReference;
-import org.jboss.interceptor.model.metadata.ReflectiveClassReference;
-import org.jboss.interceptor.registry.InterceptorMetadataRegistry;
+import org.jboss.interceptor.model.metadata.reader.ReflectiveClassMetadataProvider;
+import org.jboss.interceptor.model.metadata.registry.InterceptorMetadataRegistry;
 
 /**
  * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
@@ -35,6 +34,6 @@
 
    public InterceptionHandler createFor(Class<?> clazz)
    {
-      return new DirectClassInterceptionHandler(clazz, interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassReference.of(clazz)));
+      return new DirectClassInterceptionHandler(clazz, interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassMetadataProvider.of(clazz)));
    }
 }

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorMethodHandler.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorMethodHandler.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorMethodHandler.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -10,7 +10,7 @@
 import java.util.ArrayList;
 import java.lang.reflect.Method;
 
-import org.jboss.interceptor.model.InterceptorMetadata;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
 import org.jboss.interceptor.model.InterceptionModel;
 import org.jboss.interceptor.model.InterceptionType;
 import org.jboss.interceptor.model.InterceptionTypeRegistry;
@@ -67,7 +67,7 @@
          {
             return thisMethod.invoke(getTargetInstance(), args);
          }
-         if (InterceptionTypeRegistry.supportsTimeoutMethods() && thisMethod.isAnnotationPresent(InterceptionTypeRegistry.getAnnotationClass(InterceptionType.AROUND_TIMEOUT)))
+         if (InterceptionTypeRegistry.isSupported(InterceptionType.AROUND_TIMEOUT) && thisMethod.isAnnotationPresent(InterceptionTypeRegistry.getAnnotationClass(InterceptionType.AROUND_TIMEOUT)))
          {
             return executeInterception(thisMethod, args, InterceptionType.AROUND_TIMEOUT);
          }

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreator.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreator.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreator.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -18,7 +18,7 @@
 package org.jboss.interceptor.proxy;
 
 import javassist.util.proxy.MethodHandler;
-import org.jboss.interceptor.model.InterceptorMetadata;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
 
 /**
  * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreatorImpl.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreatorImpl.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreatorImpl.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -26,10 +26,10 @@
 import javassist.util.proxy.MethodHandler;
 import javassist.util.proxy.ProxyObject;
 import org.jboss.interceptor.InterceptorException;
-import org.jboss.interceptor.javassist.CompositeHandler;
+import org.jboss.interceptor.proxy.javassist.CompositeHandler;
 import org.jboss.interceptor.model.InterceptionModel;
-import org.jboss.interceptor.model.InterceptorMetadata;
-import org.jboss.interceptor.registry.InterceptorRegistry;
+import org.jboss.interceptor.model.registry.InterceptionModelRegistry;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
 import org.jboss.interceptor.util.InterceptionUtils;
 import sun.reflect.ReflectionFactory;
 
@@ -39,19 +39,19 @@
 public class InterceptorProxyCreatorImpl implements InterceptorProxyCreator
 {
 
-   private List<InterceptorRegistry<Class<?>, ?>> interceptorRegistries;
+   private List<InterceptionModelRegistry<Class<?>, ?>> interceptionModelRegistries;
 
    private List<InterceptionHandlerFactory<?>> interceptionHandlerFactories;
 
-   public InterceptorProxyCreatorImpl(List<InterceptorRegistry<Class<?>, ?>> interceptorRegistries, List<InterceptionHandlerFactory<?>> interceptionHandlerFactories)
+   public InterceptorProxyCreatorImpl(List<InterceptionModelRegistry<Class<?>, ?>> interceptionModelRegistries, List<InterceptionHandlerFactory<?>> interceptionHandlerFactories)
    {
-      this.interceptorRegistries = interceptorRegistries;
+      this.interceptionModelRegistries = interceptionModelRegistries;
       this.interceptionHandlerFactories = interceptionHandlerFactories;
    }
 
-   public InterceptorProxyCreatorImpl(InterceptorRegistry<Class<?>, ?> interceptorRegistries, InterceptionHandlerFactory<?> interceptionHandlerFactories)
+   public InterceptorProxyCreatorImpl(InterceptionModelRegistry<Class<?>, ?> interceptionModelRegistries, InterceptionHandlerFactory<?> interceptionHandlerFactories)
    {
-      this.interceptorRegistries = Collections.<InterceptorRegistry<Class<?>, ?>>singletonList(interceptorRegistries);
+      this.interceptionModelRegistries = Collections.<InterceptionModelRegistry<Class<?>, ?>>singletonList(interceptionModelRegistries);
       this.interceptionHandlerFactories = Collections.<InterceptionHandlerFactory<?>>singletonList(interceptionHandlerFactories);
    }
 
@@ -132,9 +132,9 @@
    private <T> List<InterceptionModel<Class<?>, ?>> getModelsFor(Class<T> proxyClass)
    {
       List<InterceptionModel<Class<?>, ?>> interceptionModels = new ArrayList<InterceptionModel<Class<?>, ?>>();
-      for (InterceptorRegistry interceptorRegistry : interceptorRegistries)
+      for (InterceptionModelRegistry interceptionModelRegistry : interceptionModelRegistries)
       {
-         interceptionModels.add(interceptorRegistry.getInterceptionModel(proxyClass));
+         interceptionModels.add(interceptionModelRegistry.getInterceptionModel(proxyClass));
       }
       return interceptionModels;
    }

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/SubclassingInterceptorMethodHandler.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/SubclassingInterceptorMethodHandler.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/SubclassingInterceptorMethodHandler.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -15,7 +15,7 @@
 import org.jboss.interceptor.model.InterceptionModel;
 import org.jboss.interceptor.model.InterceptionType;
 import org.jboss.interceptor.model.InterceptionTypeRegistry;
-import org.jboss.interceptor.model.InterceptorMetadata;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
 import org.jboss.interceptor.util.InterceptionUtils;
 import org.jboss.interceptor.util.ReflectionUtils;
 
@@ -90,7 +90,7 @@
          {
             return proceed.invoke(self, args);
          }
-         if (InterceptionTypeRegistry.supportsTimeoutMethods() && thisMethod.isAnnotationPresent(InterceptionTypeRegistry.getAnnotationClass(InterceptionType.AROUND_TIMEOUT)))
+         if (InterceptionTypeRegistry.isSupported(InterceptionType.AROUND_TIMEOUT) && thisMethod.isAnnotationPresent(InterceptionTypeRegistry.getAnnotationClass(InterceptionType.AROUND_TIMEOUT)))
          {
             return executeInterception(self, thisMethod, thisMethod, args, InterceptionType.AROUND_TIMEOUT);
          }

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/javassist (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/javassist)

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/javassist/CompositeHandler.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/javassist/CompositeHandler.java	2010-06-06 19:00:33 UTC (rev 105754)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/proxy/javassist/CompositeHandler.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,4 +1,4 @@
-package org.jboss.interceptor.javassist;
+package org.jboss.interceptor.proxy.javassist;
 
 import java.io.Serializable;
 import java.lang.reflect.Method;

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/ClassMetadataReader.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/ClassMetadataReader.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/ClassMetadataReader.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.registry;
-
-import org.jboss.interceptor.model.InterceptorMetadata;
-import org.jboss.interceptor.model.metadata.ClassReference;
-
-/**
- * @author Marius Bogoevici
- */
-public interface ClassMetadataReader
-{
-   InterceptorMetadata getInterceptorMetadata(ClassReference clazz, boolean isTargetClass);
-}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorMetadataRegistry.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorMetadataRegistry.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorMetadataRegistry.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.registry;
-
-import org.jboss.interceptor.model.metadata.AbstractInterceptorMetadata;
-import org.jboss.interceptor.model.InterceptorMetadata;
-import org.jboss.interceptor.model.metadata.ClassReference;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-/**
- * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
- */
-public class InterceptorMetadataRegistry<T>
-{
-   private final Map<Key, InterceptorMetadata> interceptorClassMetadataMap = new ConcurrentHashMap<Key, InterceptorMetadata>();
-
-   private ClassMetadataReader classMetadataReader;
-
-   private final Lock lock = new ReentrantLock();
-
-   public InterceptorMetadataRegistry(ClassMetadataReader classMetadataReader)
-   {
-      this.classMetadataReader = classMetadataReader;
-   }
-
-   public InterceptorMetadata getInterceptorClassMetadata(ClassReference interceptorClass)
-   {
-      return this.getInterceptorClassMetadata(interceptorClass, false);
-   }
-
-   public InterceptorMetadata getInterceptorClassMetadata(ClassReference interceptorClass, boolean isInterceptorTargetClass)
-   {
-      Key key = new Key(interceptorClass, isInterceptorTargetClass);
-      if (!interceptorClassMetadataMap.containsKey(key))
-      {
-         try
-         {
-            lock.lock();
-            //verify that metadata hasn't been added while waiting for the lock
-            if (!interceptorClassMetadataMap.containsKey(key))
-            {
-               interceptorClassMetadataMap.put(key, classMetadataReader.getInterceptorMetadata(interceptorClass, isInterceptorTargetClass));
-            }
-         }
-         finally
-         {
-            lock.unlock();
-         }
-      }
-
-      return interceptorClassMetadataMap.get(key);
-
-   }
-
-   public void cleanup()
-   {
-      this.interceptorClassMetadataMap.clear();
-   }
-
-   public static final class Key
-   {
-      private String className;
-
-      private boolean isInterceptorTargetClass;
-
-      private Key(ClassReference clazz, boolean interceptorTargetClass)
-      {
-         this.className = clazz.getClassName();
-         isInterceptorTargetClass = interceptorTargetClass;
-      }
-
-      @Override
-      public boolean equals(Object o)
-      {
-         if (this == o)
-         {
-            return true;
-         }
-         if (o == null || getClass() != o.getClass())
-         {
-            return false;
-         }
-
-         Key key = (Key) o;
-
-         if (isInterceptorTargetClass != key.isInterceptorTargetClass)
-         {
-            return false;
-         }
-         if (className != null ? !className.equals(key.className) : key.className != null)
-         {
-            return false;
-         }
-
-         return true;
-      }
-
-      @Override
-      public int hashCode()
-      {
-         int result = className != null ? className.hashCode() : 0;
-         result = 31 * result + (isInterceptorTargetClass ? 1 : 0);
-         return result;
-      }
-   }
-
-}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorRegistry.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorRegistry.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/InterceptorRegistry.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.registry;
-
-import org.jboss.interceptor.model.InterceptionModel;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.io.Serializable;
-
-/**
- * Metadata store for information on how the an entity of a given type needs to be intercepted.
- *
- * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
- */
-public class InterceptorRegistry<T, I> implements Serializable
-{
-   private Map<T, InterceptionModel<T, I>> interceptionModelMap = new HashMap<T, InterceptionModel<T, I>>();
-
-   public void registerInterceptionModel(T interceptedEntity, InterceptionModel<T, I> interceptionModel)
-   {
-      this.interceptionModelMap.put(interceptedEntity, interceptionModel);
-   }
-
-   public InterceptionModel<T, I> getInterceptionModel(T interceptedEntity)
-   {
-      return this.interceptionModelMap.get(interceptedEntity);
-   }
-}

Deleted: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/SimpleClassMetadataReader.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/SimpleClassMetadataReader.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/registry/SimpleClassMetadataReader.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.
- */
-
-package org.jboss.interceptor.registry;
-
-import org.jboss.interceptor.InterceptorException;
-import org.jboss.interceptor.model.InterceptorMetadata;
-import org.jboss.interceptor.model.metadata.AbstractInterceptorMetadata;
-import org.jboss.interceptor.model.metadata.AbstractInterceptorMetadataSerializationProxy;
-import org.jboss.interceptor.model.metadata.ClassReference;
-import org.jboss.interceptor.model.metadata.ReflectiveClassReference;
-import org.jboss.interceptor.util.ReflectionUtils;
-
-/**
- * @author Marius Bogoevici
- */
-public class SimpleClassMetadataReader implements ClassMetadataReader
-{
-   private static SimpleClassMetadataReader instance = new SimpleClassMetadataReader();
-
-   public InterceptorMetadata getInterceptorMetadata(ClassReference clazz, final boolean isInterceptorTargetClass)
-   {
-      return new AbstractInterceptorMetadata(clazz, isInterceptorTargetClass)
-      {
-         @Override
-         protected Object createSerializableProxy()
-         {
-            return new SimpleInterceptorMetadataSerializationProxy(getInterceptorClass().getClassName(), isTargetClass());
-         }
-
-         private Object writeReplace()
-         {
-            return createSerializableProxy();
-         }
-
-      };
-   }
-
-   public static ClassMetadataReader getInstance()
-   {
-      return instance;
-   }
-
-   private static class SimpleInterceptorMetadataSerializationProxy extends AbstractInterceptorMetadataSerializationProxy
-   {
-      public SimpleInterceptorMetadataSerializationProxy(String className, boolean targetClass)
-      {
-         super(className, targetClass);
-      }
-
-      @Override
-      protected InterceptorMetadata loadInterceptorMetadata() throws ClassNotFoundException
-      {
-         Class<?> clazz = ReflectionUtils.classForName(getClassName());
-         return SimpleClassMetadataReader.instance.getInterceptorMetadata(ReflectiveClassReference.of(clazz), isInterceptionTargetClass());
-      }
-
-      private Object readResolve()
-      {
-         try
-         {
-            return loadInterceptorMetadata();
-         }
-         catch (ClassNotFoundException e)
-         {
-            throw new InterceptorException("Failed to deserialize the interceptor class metadata", e);
-         }
-      }
-
-   }
-}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/ArrayIterator.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ArrayIterator.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/ArrayIterator.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/ArrayIterator.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.util;
+
+import java.util.Iterator;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class ArrayIterator<T> implements Iterator<T>
+{
+   private T[] array;
+
+   private int currentIndex = 0;
+
+   public ArrayIterator(T[] array)
+   {
+      if (array == null)
+         throw new IllegalArgumentException("Iterated array cannot be null");
+      this.array = array;
+   }
+
+   public boolean hasNext()
+   {
+      return currentIndex < array.length;
+   }
+
+   public T next()
+   {
+      return array[currentIndex++];
+   }
+
+   public void remove()
+   {
+      throw new UnsupportedOperationException("Removal of elements is not supported");
+   }
+}

Copied: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/ImmutableIteratorWrapper.java (from rev 105754, projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/model/metadata/ImmutableIteratorWrapper.java)
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/ImmutableIteratorWrapper.java	                        (rev 0)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/ImmutableIteratorWrapper.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.
+ */
+
+package org.jboss.interceptor.util;
+
+import java.util.Iterator;
+
+import org.jboss.interceptor.model.metadata.reader.MethodMetadataProvider;
+
+/**
+* @author Marius Bogoevici
+*/
+public abstract class ImmutableIteratorWrapper<T> implements Iterator<MethodMetadataProvider>
+{
+
+   private Iterator<T> originalIterator;
+
+   protected ImmutableIteratorWrapper(Iterator<T> originalIterator)
+   {
+      this.originalIterator = originalIterator;
+   }
+
+
+   public boolean hasNext()
+   {
+      return originalIterator.hasNext();
+   }
+
+   public MethodMetadataProvider next()
+   {
+      return wrapObject(originalIterator.next());
+   }
+
+   protected abstract MethodMetadataProvider wrapObject(T t);
+
+   public void remove()
+   {
+      throw new UnsupportedOperationException("Removal not supported");
+   }
+}

Modified: projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/InterceptionUtils.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/InterceptionUtils.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/main/java/org/jboss/interceptor/util/InterceptionUtils.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -17,23 +17,33 @@
 
 package org.jboss.interceptor.util;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+
+import javax.interceptor.InvocationContext;
+
 import javassist.util.proxy.MethodHandler;
 import javassist.util.proxy.ProxyFactory;
 import org.jboss.interceptor.InterceptorException;
 import org.jboss.interceptor.model.InterceptionType;
 import org.jboss.interceptor.model.InterceptionTypeRegistry;
-import org.jboss.interceptor.model.metadata.MethodReference;
+import org.jboss.interceptor.model.MethodHolder;
+import org.jboss.interceptor.model.metadata.InterceptorMetadataException;
+import org.jboss.interceptor.model.metadata.reader.ClassMetadataProvider;
+import org.jboss.interceptor.model.metadata.reader.MethodMetadataProvider;
 import org.jboss.interceptor.proxy.LifecycleMixin;
 import org.jboss.interceptor.util.proxy.TargetInstanceProxy;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.interceptor.InvocationContext;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.concurrent.Callable;
-
 /**
  * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
  */
@@ -140,7 +150,7 @@
     * @param forTargetClass
     * @return
     */
-   public static boolean isInterceptorMethod(InterceptionType interceptionType, MethodReference method, boolean forTargetClass)
+   public static boolean isInterceptorMethod(InterceptionType interceptionType, MethodMetadataProvider method, boolean forTargetClass)
    {
 
       if (method.getAnnotation(InterceptionTypeRegistry.getAnnotationClass(interceptionType)) == null)
@@ -279,4 +289,47 @@
       Class<T> clazz = proxyFactory.createClass();
       return clazz;
    }
+
+   public static Map<InterceptionType, List<MethodMetadataProvider>> buildMethodMap(ClassMetadataProvider interceptorClass, boolean isTargetClass)
+   {
+      Map<InterceptionType, List<MethodMetadataProvider>> methodMap = new HashMap<InterceptionType, List<MethodMetadataProvider>>();
+      ClassMetadataProvider currentClass = interceptorClass;
+      Set<MethodHolder> foundMethods = new HashSet<MethodHolder>();
+      do
+      {
+         Set<InterceptionType> detectedInterceptorTypes = new HashSet<InterceptionType>();
+
+         for (MethodMetadataProvider method : currentClass.getDeclaredMethods())
+         {
+            for (InterceptionType interceptionType : InterceptionTypeRegistry.getSupportedInterceptionTypes())
+            {
+               if (isInterceptorMethod(interceptionType, method, isTargetClass))
+               {
+                  if (methodMap.get(interceptionType) == null)
+                  {
+                     methodMap.put(interceptionType, new LinkedList<MethodMetadataProvider>());
+                  }
+                  if (detectedInterceptorTypes.contains(interceptionType))
+                  {
+                     throw new InterceptorMetadataException("Same interception type cannot be specified twice on the same class");
+                  }
+                  else
+                  {
+                     detectedInterceptorTypes.add(interceptionType);
+                  }
+                  // add method in the list - if it is there already, it means that it has been added by a subclass
+                  ReflectionUtils.ensureAccessible(method.getJavaMethod());
+                  if (!foundMethods.contains(MethodHolder.of(method, false)))
+                  {
+                     methodMap.get(interceptionType).add(0, method);
+                  }
+               }
+            }
+            foundMethods.add(MethodHolder.of(method, false));
+         }
+         currentClass = currentClass.getSuperclass();
+      }
+      while (!Object.class.equals(currentClass.getJavaClass()));
+      return methodMap;
+   }
 }

Modified: projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/metadata/InterceptorClassMetadataTestCase.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/metadata/InterceptorClassMetadataTestCase.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/metadata/InterceptorClassMetadataTestCase.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -17,21 +17,21 @@
 
 package org.jboss.interceptors.metadata;
 
-import org.jboss.interceptor.model.InterceptorMetadata;
-import org.jboss.interceptor.model.metadata.MethodReference;
-import org.jboss.interceptor.model.metadata.ReflectiveClassReference;
-import org.jboss.interceptor.registry.SimpleClassMetadataReader;
-import org.junit.Before;
-import org.junit.Test;
 import static org.junit.Assert.assertEquals;
 
+import java.util.List;
+
 import org.jboss.interceptor.model.InterceptionType;
-import org.jboss.interceptor.model.InterceptorMetadataException;
-import org.jboss.interceptor.registry.InterceptorMetadataRegistry;
+import org.jboss.interceptor.model.metadata.InterceptorMetadata;
+import org.jboss.interceptor.model.metadata.InterceptorMetadataException;
+import org.jboss.interceptor.model.metadata.reader.MethodMetadataProvider;
+import org.jboss.interceptor.model.metadata.reader.ReflectiveClassMetadataProvider;
+import org.jboss.interceptor.model.metadata.reader.SimpleInterceptorMetadataReader;
+import org.jboss.interceptor.model.metadata.registry.InterceptorMetadataRegistry;
+import org.jboss.interceptor.model.metadata.registry.SimpleInterceptorMetadataRegistry;
+import org.junit.Before;
+import org.junit.Test;
 
-import java.lang.reflect.Method;
-import java.util.List;
-
 /**
  * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
  */
@@ -43,31 +43,31 @@
    @Before
    public void setUp()
    {
-      interceptorMetadataRegistry = new InterceptorMetadataRegistry(SimpleClassMetadataReader.getInstance());
+      interceptorMetadataRegistry = new SimpleInterceptorMetadataRegistry(SimpleInterceptorMetadataReader.getInstance());
    }
 
    @Test
    public void testInterceptorWithAllMethods()
    {
-      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassReference.of(InterceptorWithAllMethods.class));
+      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassMetadataProvider.of(InterceptorWithAllMethods.class));
 
-      List<MethodReference> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
+      List<MethodMetadataProvider> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
       assertEquals(true, postConstructMethods.size() == 1);
       assertEquals(postConstructMethods.get(0).getJavaMethod().getName(), "doPostConstruct");
 
-      List<MethodReference> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
+      List<MethodMetadataProvider> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
       assertEquals(true, preDestroyMethods.size() == 1);
       assertEquals(preDestroyMethods.get(0).getJavaMethod().getName(), "doPreDestroy");
 
-      List<MethodReference> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
+      List<MethodMetadataProvider> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
       assertEquals(true, aroundInvokeMethods.size() == 1);
       assertEquals(aroundInvokeMethods.get(0).getJavaMethod().getName(), "doAroundInvoke");
 
-      List<MethodReference> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
+      List<MethodMetadataProvider> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
       assertEquals(true, postActivateMethods.size() == 1);
       assertEquals(postActivateMethods.get(0).getJavaMethod().getName(), "doPostActivate");
 
-      List<MethodReference> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
+      List<MethodMetadataProvider> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
       assertEquals(true, prePassivateMethods.size() == 1);
       assertEquals(prePassivateMethods.get(0).getJavaMethod().getName(), "doPrePassivate");
 
@@ -76,24 +76,24 @@
    @Test
    public void testInterceptorWithSomeMethods()
    {
-      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassReference.of(InterceptorWithSomeMethods.class));
+      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassMetadataProvider.of(InterceptorWithSomeMethods.class));
 
-      List<MethodReference> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
+      List<MethodMetadataProvider> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
       assertEquals(true, postConstructMethods.size() == 0);
 
-      List<MethodReference> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
+      List<MethodMetadataProvider> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
       assertEquals(true, preDestroyMethods.size() == 1);
       assertEquals(preDestroyMethods.get(0).getJavaMethod().getName(), "doPreDestroy");
 
-      List<MethodReference> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
+      List<MethodMetadataProvider> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
       assertEquals(true, aroundInvokeMethods.size() == 1);
       assertEquals(aroundInvokeMethods.get(0).getJavaMethod().getName(), "doAroundInvoke");
 
-      List<MethodReference> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
+      List<MethodMetadataProvider> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
       assertEquals(true, postActivateMethods.size() == 1);
       assertEquals(postActivateMethods.get(0).getJavaMethod().getName(), "doPostActivate");
 
-      List<MethodReference> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
+      List<MethodMetadataProvider> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
       assertEquals(true, prePassivateMethods.size() == 0);
 
    }
@@ -101,23 +101,23 @@
    @Test
    public void testSimpleInheritance()
    {
-      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassReference.of(SimpleInheritanceChildInterceptor.class));
+      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassMetadataProvider.of(SimpleInheritanceChildInterceptor.class));
 
-      List<MethodReference> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
+      List<MethodMetadataProvider> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
       assertEquals(1, postConstructMethods.size());
       assertEquals(postConstructMethods.get(0).getJavaMethod().getName(), "doPostConstruct");
 
-      List<MethodReference> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
+      List<MethodMetadataProvider> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
       assertEquals(true, preDestroyMethods.size() == 0);
 
-      List<MethodReference> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
+      List<MethodMetadataProvider> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
       assertEquals(true, aroundInvokeMethods.size() == 1);
       assertEquals(aroundInvokeMethods.get(0).getJavaMethod().getName(), "doAroundInvoke");
 
-      List<MethodReference> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
+      List<MethodMetadataProvider> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
       assertEquals(true, postActivateMethods.size() == 0);
 
-      List<MethodReference> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
+      List<MethodMetadataProvider> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
       assertEquals(true, prePassivateMethods.size() == 0);
 
    }
@@ -125,25 +125,25 @@
    @Test
    public void testInheritanceWithAndWithoutOverriding()
    {
-      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassReference.of(OverrideChildInterceptor.class));
+      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassMetadataProvider.of(OverrideChildInterceptor.class));
 
-      List<MethodReference> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
+      List<MethodMetadataProvider> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
       assertEquals(true, postConstructMethods.size() == 1);
       assertEquals(postConstructMethods.get(0).getJavaMethod().getName(), "methodOverriddenAndUsedAsInterceptor");
 
-      List<MethodReference> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
+      List<MethodMetadataProvider> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
       assertEquals(true, preDestroyMethods.size() == 0);
 
-      List<MethodReference> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
+      List<MethodMetadataProvider> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
       assertEquals(true, aroundInvokeMethods.size() == 2);
       assertEquals(aroundInvokeMethods.get(0).getJavaMethod().getName(), "methodDefinedOnParentAndUsedAsInterceptor");
       assertEquals(aroundInvokeMethods.get(1).getJavaMethod().getName(), "methodDefinedOnChildAndUsedAsInterceptor");
 
-      List<MethodReference> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
+      List<MethodMetadataProvider> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
       assertEquals(true, postActivateMethods.size() == 0);
 
 
-      List<MethodReference> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
+      List<MethodMetadataProvider> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
       assertEquals(true, prePassivateMethods.size() == 0);
 
    }
@@ -151,7 +151,7 @@
    @Test(expected = InterceptorMetadataException.class)
    public void testDuplicateAnnotations()
    {
-      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassReference.of(InterceptorWithDuplicateAnnotations.class));
+      InterceptorMetadata interceptorClassMetadata = interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassMetadataProvider.of(InterceptorWithDuplicateAnnotations.class));
 
    }
 

Modified: projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/InterceptionTestCase.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/InterceptionTestCase.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/InterceptionTestCase.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -24,14 +24,15 @@
 
 import javassist.util.proxy.MethodHandler;
 import org.jboss.interceptor.model.InterceptionModel;
-import org.jboss.interceptor.model.InterceptionModelBuilder;
-import org.jboss.interceptor.model.metadata.ReflectiveClassReference;
+import org.jboss.interceptor.model.registry.InterceptionModelRegistry;
+import org.jboss.interceptor.model.builder.InterceptionModelBuilder;
+import org.jboss.interceptor.model.metadata.reader.ReflectiveClassMetadataProvider;
+import org.jboss.interceptor.model.metadata.registry.InterceptorMetadataRegistry;
+import org.jboss.interceptor.model.metadata.registry.SimpleInterceptorMetadataRegistry;
 import org.jboss.interceptor.proxy.DirectClassInterceptionHandlerFactory;
 import org.jboss.interceptor.proxy.InterceptorProxyCreator;
 import org.jboss.interceptor.proxy.InterceptorProxyCreatorImpl;
-import org.jboss.interceptor.registry.InterceptorMetadataRegistry;
-import org.jboss.interceptor.registry.InterceptorRegistry;
-import org.jboss.interceptor.registry.SimpleClassMetadataReader;
+import org.jboss.interceptor.model.metadata.reader.SimpleInterceptorMetadataReader;
 import org.jboss.interceptor.util.InterceptionUtils;
 import org.junit.Assert;
 import org.junit.Before;
@@ -89,7 +90,7 @@
          "org.jboss.interceptors.proxy.FootballTeam_getName",
    };
 
-   private InterceptorRegistry<Class<?>, Class<?>> interceptorRegistry;
+   private InterceptionModelRegistry<Class<?>, Class<?>> interceptionModelRegistry;
 
    private DirectClassInterceptionHandlerFactory interceptionHandlerFactory;
 
@@ -98,7 +99,7 @@
    @Before
    public void setUp()
    {
-      interceptorMetadataRegistry = new InterceptorMetadataRegistry(SimpleClassMetadataReader.getInstance());
+      interceptorMetadataRegistry = new SimpleInterceptorMetadataRegistry(SimpleInterceptorMetadataReader.getInstance());
       interceptionHandlerFactory = new DirectClassInterceptionHandlerFactory(interceptorMetadataRegistry);
    }
 
@@ -111,8 +112,8 @@
       builder.interceptPreDestroy().with(SecondInterceptor.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel;      
       interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
    }
 
@@ -125,8 +126,8 @@
       builder.interceptAll().with(FirstInterceptor.class, SecondInterceptor.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel;      
       interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
    }
 
@@ -140,8 +141,8 @@
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("getName")).with(SecondInterceptor.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel;      
       interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
    }
 
@@ -156,8 +157,8 @@
       builder.ignoreGlobalInterceptors(FootballTeam.class.getMethod("getName"));
       InterceptionModel<Class<?>, Class<?>> interceptionModel;      
       interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
    }
 
@@ -233,8 +234,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echo", String.class)).with(ParameterOverridingInterceptor.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = proxifyInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
       Assert.assertEquals(42, proxy.echo("1"));
@@ -249,8 +250,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoInt", int.class)).with(ParameterOverridingInterceptorWithInteger.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = proxifyInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
       Assert.assertEquals(42, proxy.echoInt(1));
@@ -265,8 +266,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoLongAsObject", Long.class)).with(ParameterOverridingInterceptorWithInteger.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = proxifyInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
       Assert.assertEquals(new Long(42), proxy.echoLongAsObject(1l));
@@ -281,8 +282,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoLongAsObject", Long.class)).with(ParameterOverridingInterceptorWithLong.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = proxifyInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
       Assert.assertEquals(new Long(42), proxy.echoLongAsObject(1l));
@@ -297,8 +298,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoLong", long.class)).with(ParameterOverridingInterceptorWithInteger.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = proxifyInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
       Assert.assertEquals(42, proxy.echoLong(1));
@@ -313,8 +314,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoInt", int.class)).with(ParameterOverridingInterceptorWithLong.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy =proxifyInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
       Assert.assertEquals(42, proxy.echoInt(1));
@@ -329,8 +330,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoObjectArray", Object[].class)).with(ParameterOverridingInterceptorWithLongArray.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = proxifyInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
       Assert.assertEquals(new Long[]{42l}, proxy.echoObjectArray(new Object[]{}));
@@ -345,8 +346,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoStringArray", String[].class)).with(ParameterOverridingInterceptorWithLongArray.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = proxifyInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
       Assert.assertEquals(new Long[]{42l}, proxy.echoStringArray(new String[]{}));
@@ -362,8 +363,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echo2", ValueBearer.class)).with(ParameterOverridingInterceptor2.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
       
       FootballTeam proxy = proxifyInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
       proxy.doNothing();
@@ -384,8 +385,8 @@
 
    private <T> T proxifyInstance(T instance, Class<? extends T> targetClass)
    {
-      InterceptorProxyCreator ipc = new InterceptorProxyCreatorImpl(interceptorRegistry, interceptionHandlerFactory);
-      MethodHandler methodHandler = ipc.createMethodHandler(instance, targetClass, interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassReference.of(targetClass), true));
+      InterceptorProxyCreator ipc = new InterceptorProxyCreatorImpl(interceptionModelRegistry, interceptionHandlerFactory);
+      MethodHandler methodHandler = ipc.createMethodHandler(instance, targetClass, interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassMetadataProvider.of(targetClass), true));
       return ipc.createProxyInstance(InterceptionUtils.createProxyClassWithHandler(targetClass, methodHandler), methodHandler);
    }
 }

Modified: projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/SubclassingInterceptionTestCase.java
===================================================================
--- projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/SubclassingInterceptionTestCase.java	2010-06-25 16:49:35 UTC (rev 106289)
+++ projects/interceptors/trunk/jboss-interceptor/src/test/java/org/jboss/interceptors/proxy/SubclassingInterceptionTestCase.java	2010-06-25 17:01:17 UTC (rev 106290)
@@ -23,16 +23,17 @@
 import java.io.ObjectOutputStream;
 
 import javassist.util.proxy.ProxyObject;
-import org.jboss.interceptor.javassist.CompositeHandler;
+import org.jboss.interceptor.model.metadata.reader.ReflectiveClassMetadataProvider;
+import org.jboss.interceptor.model.metadata.reader.SimpleInterceptorMetadataReader;
+import org.jboss.interceptor.proxy.javassist.CompositeHandler;
 import org.jboss.interceptor.model.InterceptionModel;
 import org.jboss.interceptor.model.builder.InterceptionModelBuilder;
-import org.jboss.interceptor.model.metadata.ReflectiveClassReference;
+import org.jboss.interceptor.model.metadata.registry.InterceptorMetadataRegistry;
+import org.jboss.interceptor.model.metadata.registry.SimpleInterceptorMetadataRegistry;
+import org.jboss.interceptor.model.registry.InterceptionModelRegistry;
 import org.jboss.interceptor.proxy.DirectClassInterceptionHandlerFactory;
 import org.jboss.interceptor.proxy.InterceptorProxyCreator;
 import org.jboss.interceptor.proxy.InterceptorProxyCreatorImpl;
-import org.jboss.interceptor.registry.InterceptorMetadataRegistry;
-import org.jboss.interceptor.registry.InterceptorRegistry;
-import org.jboss.interceptor.registry.SimpleClassMetadataReader;
 import org.jboss.interceptor.util.InterceptionUtils;
 import org.junit.Assert;
 import org.junit.Before;
@@ -91,7 +92,7 @@
          "org.jboss.interceptors.proxy.FootballTeam_getName",
    };
 
-   private InterceptorRegistry<Class<?>, Class<?>> interceptorRegistry;
+   private InterceptionModelRegistry<Class<?>, Class<?>> interceptionModelRegistry;
 
    private DirectClassInterceptionHandlerFactory interceptionHandlerFactory;
 
@@ -100,7 +101,7 @@
    @Before
    public void setUp()
    {
-      interceptorMetadataRegistry = new InterceptorMetadataRegistry(SimpleClassMetadataReader.getInstance());
+      interceptorMetadataRegistry = new SimpleInterceptorMetadataRegistry(SimpleInterceptorMetadataReader.getInstance());
       interceptionHandlerFactory = new DirectClassInterceptionHandlerFactory(interceptorMetadataRegistry);
    }
 
@@ -113,8 +114,8 @@
       builder.interceptPreDestroy().with(SecondInterceptor.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel;
       interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
    }
 
@@ -127,8 +128,8 @@
       builder.interceptAll().with(FirstInterceptor.class, SecondInterceptor.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel;
       interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
    }
 
@@ -142,8 +143,8 @@
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("getName")).with(SecondInterceptor.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel;
       interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
    }
 
@@ -158,8 +159,8 @@
       builder.ignoreGlobalInterceptors(FootballTeam.class.getMethod("getName"));
       InterceptionModel<Class<?>, Class<?>> interceptionModel;
       interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
    }
 
@@ -253,8 +254,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echo", String.class)).with(ParameterOverridingInterceptor.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = createAdvisedInstance(FootballTeam.class, TEAM_NAME);
       Assert.assertEquals(42, proxy.echo("1"));
@@ -269,8 +270,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoInt", int.class)).with(ParameterOverridingInterceptorWithInteger.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = createAdvisedInstance(FootballTeam.class, TEAM_NAME);
       Assert.assertEquals(42, proxy.echoInt(1));
@@ -285,8 +286,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoLongAsObject", Long.class)).with(ParameterOverridingInterceptorWithInteger.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = createAdvisedInstance(FootballTeam.class, TEAM_NAME);
       Assert.assertEquals(new Long(42), proxy.echoLongAsObject(1l));
@@ -301,8 +302,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoLongAsObject", Long.class)).with(ParameterOverridingInterceptorWithLong.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = createAdvisedInstance(FootballTeam.class, TEAM_NAME);
       Assert.assertEquals(new Long(42), proxy.echoLongAsObject(1l));
@@ -317,8 +318,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoLong", long.class)).with(ParameterOverridingInterceptorWithInteger.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = createAdvisedInstance(FootballTeam.class, TEAM_NAME);
       Assert.assertEquals(42, proxy.echoLong(1));
@@ -333,8 +334,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoInt", int.class)).with(ParameterOverridingInterceptorWithLong.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = createAdvisedInstance(FootballTeam.class, TEAM_NAME);
       Assert.assertEquals(42, proxy.echoInt(1));
@@ -349,8 +350,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoObjectArray", Object[].class)).with(ParameterOverridingInterceptorWithLongArray.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = createAdvisedInstance(FootballTeam.class, TEAM_NAME);
       Assert.assertEquals(new Long[]{42l}, proxy.echoObjectArray(new Object[]{}));
@@ -365,8 +366,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echoStringArray", String[].class)).with(ParameterOverridingInterceptorWithLongArray.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      this.interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      this.interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = createAdvisedInstance(FootballTeam.class, TEAM_NAME);
       Assert.assertEquals(new Long[]{42l}, proxy.echoStringArray(new String[]{}));
@@ -382,8 +383,8 @@
 
       builder.interceptAroundInvoke(FootballTeam.class.getMethod("echo2", ValueBearer.class)).with(ParameterOverridingInterceptor2.class);
       InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
-      this.interceptorRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-      interceptorRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
+      this.interceptionModelRegistry = new InterceptionModelRegistry<Class<?>, Class<?>>();
+      interceptionModelRegistry.registerInterceptionModel(FootballTeam.class, interceptionModel);
 
       FootballTeam proxy = createAdvisedInstance(FootballTeam.class, TEAM_NAME);
       proxy.doNothing();
@@ -416,8 +417,8 @@
 
    private <T> T createAdvisedSubclassedInstance(Class<? extends T> targetClass, Object... args)
    {
-      InterceptorProxyCreator ipc = new InterceptorProxyCreatorImpl(interceptorRegistry, interceptionHandlerFactory);
-      return ipc.createProxyFromClass(targetClass, new Class<?>[]{String.class},args, interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassReference.of(targetClass), true));
+      InterceptorProxyCreator ipc = new InterceptorProxyCreatorImpl(interceptionModelRegistry, interceptionHandlerFactory);
+      return ipc.createProxyFromClass(targetClass, new Class<?>[]{String.class},args, interceptorMetadataRegistry.getInterceptorClassMetadata(ReflectiveClassMetadataProvider.of(targetClass), true));
    }
 
 }
\ No newline at end of file



More information about the jboss-cvs-commits mailing list