openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r732803 [9/17] - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: ./ annotation/ component/ component/ejb/ component/jms/ component/xml/ config/ container/ context/ context/type/ decorator/ decorator/xml/ de...
Date Thu, 08 Jan 2009 19:41:33 GMT
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.intercept;
 
@@ -43,222 +40,207 @@
 
 public final class InterceptorUtil
 {
-	private InterceptorUtil()
-	{
-		
-	}
-
-	public static boolean isWebBeansBusinessMethod(Method method)
-	{
-		Asserts.nullCheckForMethod(method);
-		
-		int modifiers = method.getModifiers();
-		
-		if(ClassUtil.isStatic(modifiers) || ClassUtil.isPrivate(modifiers) || ClassUtil.isFinal(modifiers))
-		{
-			return false;
-		}
-		
-		if(AnnotationUtil.isMethodHasAnnotation(method, Initializer.class))
-		{
-			return false;
-		}
-		
-		if(AnnotationUtil.isMethodHasAnnotation(method, Destructor.class) 
-				|| AnnotationUtil.isMethodHasAnnotation(method, Remove.class))
-		{
-			return false;
-		}
-		
-		if(AnnotationUtil.isMethodHasAnnotation(method, PreDestroy.class) 
-				|| AnnotationUtil.isMethodHasAnnotation(method, PostConstruct.class)
-				|| AnnotationUtil.isMethodHasAnnotation(method, AroundInvoke.class))
-		{
-			return false;
-		}
-		
-		if(AnnotationUtil.isMethodHasAnnotation(method, Produces.class) 
-				|| AnnotationUtil.isMethodParameterAnnotationExist(method, Disposes.class)
-				|| AnnotationUtil.isMethodParameterAnnotationExist(method, Observes.class))
-		{
-			return true;
-		}
-		
-		return true;
-	}
-	
-	public static Class<? extends Annotation> getInterceptorAnnotationClazz(InterceptionType type)
-	{
-		if(type.equals(InterceptionType.AROUND_INVOKE))
-		{
-			return AroundInvoke.class;
-		}
-		else if(type.equals(InterceptionType.POST_ACTIVATE))
-		{
-			return PostActivate.class;
-		}
-		else if(type.equals(InterceptionType.POST_CONSTRUCT))
-		{
-			return PostConstruct.class;
-		}
-		else if(type.equals(InterceptionType.PRE_DESTROY))
-		{
-			return PreDestroy.class;
-		}
-		else if(type.equals(InterceptionType.PRE_PASSIVATE))
-		{
-			return PrePassivate.class;
-		}
-		else
-		{
-			throw new WebBeansException("Undefined interceotion type");
-		}
-	}
-	
-	public static boolean isBusinessMethodInterceptor(Class<?> clazz)
-	{
-		Asserts.nullCheckForClass(clazz);
-		Method[] methods = clazz.getDeclaredMethods();
-		for(Method method : methods)
-		{
-			if (AnnotationUtil.isMethodHasAnnotation(method, AroundInvoke.class))
-			{
-				if (ClassUtil.isMethodHasParameter(method))
-				{
-					Class<?>[] params = ClassUtil.getMethodParameterTypes(method);
-					if (params.length == 1 && params[0].equals(InvocationContext.class))
-					{
-						if (ClassUtil.getReturnType(method).equals(Object.class))
-						{
-							if (ClassUtil.isMethodHasException(method))
-							{
-								if (!ClassUtil.isStatic(method.getModifiers()) && !ClassUtil.isFinal(method.getModifiers()))
-								{
-									return true;
-								}
-							}
-						}
-					}
-					
-				}				
-			}			
-		}
-		
-		return false;
-	}
-	
-	public static boolean isLifecycleMethodInterceptor(Class<?> clazz)
-	{
-		Asserts.nullCheckForClass(clazz);
-		Method[] methods = clazz.getDeclaredMethods();
-		for(Method method : methods)
-		{
-			if (AnnotationUtil.isMethodHasAnnotation(method, PostConstruct.class) ||
-					AnnotationUtil.isMethodHasAnnotation(method, PreDestroy.class) ||
-					AnnotationUtil.isMethodHasAnnotation(method, PostActivate.class) || 
-					AnnotationUtil.isMethodHasAnnotation(method, PrePassivate.class))
-			{
-				if (ClassUtil.isMethodHasParameter(method))
-				{
-					Class<?>[] params = ClassUtil.getMethodParameterTypes(method);
-					if (params.length == 1 && params[0].equals(InvocationContext.class))
-					{
-						if (ClassUtil.getReturnType(method).equals(Void.TYPE))
-						{
-							if (!ClassUtil.isMethodHasCheckedException(method))
-							{
-								if (!ClassUtil.isStatic(method.getModifiers()))
-								{
-									return true;
-								}
-							}
-						}
-					}
-					
-				}				
-			}			
-		}
-		
-		return false;
-	}
-	
-	public static void checkInterceptorConditions(Class<?> clazz)
-	{
-		Asserts.nullCheckForClass(clazz);
-		if(!AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getDeclaredAnnotations()))
-		{
-			throw new WebBeansConfigurationException("WebBeans Interceptor class : " + clazz.getName() + " must have at least one @InterceptorBindingType annotation");
-		}
-		
-		checkLifecycleConditions(clazz, clazz.getDeclaredAnnotations(),"Lifecycle interceptor : " + clazz.getName()+ " interceptor binding type must be defined as @Target{TYPE}");
-	}
-	
-	public static <T> void checkLifecycleConditions(Class<T> clazz, Annotation[] annots, String errorMessage)
-	{
-		Asserts.nullCheckForClass(clazz);
-		
-		if(isLifecycleMethodInterceptor(clazz) && !isBusinessMethodInterceptor(clazz))
-		{
-			Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);
-			
-			for(Annotation annotation : anns)
-			{
-				Target target = annotation.annotationType().getAnnotation(Target.class);
-				ElementType[] elementTypes = target.value();
-				
-				if(!(elementTypes.length == 1 && elementTypes[0].equals(ElementType.TYPE)))
-				{
-					throw new WebBeansConfigurationException(errorMessage);
-				}
-			}
-		}		
-		
-	}
-	
-	public static void checkSimpleWebBeansInterceptorConditions(Class<?> clazz)
-	{
-		Asserts.nullCheckForClass(clazz);
-		Annotation[] anns = clazz.getDeclaredAnnotations();
-		
-		boolean hasClassInterceptors = false;
-		if(AnnotationUtil.getInterceptorBindingMetaAnnotations(anns).length > 0)
-		{
-			hasClassInterceptors = true;
-		}else
-		{
-			Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getAnnotations());
-			for(Annotation stero : stereoTypes)
-			{
-				if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
-				{
-					hasClassInterceptors = true;
-					break;
-				}
-			}
-		}
-		
-		Method[] methods = clazz.getDeclaredMethods();
-		
-		for(Method method : methods)
-		{
-			int modifiers = method.getModifiers();
-			if(!ClassUtil.isStatic(modifiers) && !ClassUtil.isPrivate(modifiers) && ClassUtil.isFinal(modifiers))
-			{
-				if(hasClassInterceptors)
-				{
-					throw new WebBeansConfigurationException("Simple web bean class : " + clazz.getName() + " can not define non-static, non-private final methods. Because it is annotated with at least one @InterceptorBindintType");
-				}
-				else
-				{
-					if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(method.getDeclaredAnnotations()))
-					{
-						throw new WebBeansConfigurationException("Method : "+ method.getName() + "in simple web bean class : " + clazz.getName() + 
-								" can not be defined as non-static, non-private and final . Because it is annotated with at least one @InterceptorBindintType");
-					}
-				}
-			}
-		}
-		
-	}
-	
+    private InterceptorUtil()
+    {
+
+    }
+
+    public static boolean isWebBeansBusinessMethod(Method method)
+    {
+        Asserts.nullCheckForMethod(method);
+
+        int modifiers = method.getModifiers();
+
+        if (ClassUtil.isStatic(modifiers) || ClassUtil.isPrivate(modifiers) || ClassUtil.isFinal(modifiers))
+        {
+            return false;
+        }
+
+        if (AnnotationUtil.isMethodHasAnnotation(method, Initializer.class))
+        {
+            return false;
+        }
+
+        if (AnnotationUtil.isMethodHasAnnotation(method, Destructor.class) || AnnotationUtil.isMethodHasAnnotation(method, Remove.class))
+        {
+            return false;
+        }
+
+        if (AnnotationUtil.isMethodHasAnnotation(method, PreDestroy.class) || AnnotationUtil.isMethodHasAnnotation(method, PostConstruct.class) || AnnotationUtil.isMethodHasAnnotation(method, AroundInvoke.class))
+        {
+            return false;
+        }
+
+        if (AnnotationUtil.isMethodHasAnnotation(method, Produces.class) || AnnotationUtil.isMethodParameterAnnotationExist(method, Disposes.class) || AnnotationUtil.isMethodParameterAnnotationExist(method, Observes.class))
+        {
+            return true;
+        }
+
+        return true;
+    }
+
+    public static Class<? extends Annotation> getInterceptorAnnotationClazz(InterceptionType type)
+    {
+        if (type.equals(InterceptionType.AROUND_INVOKE))
+        {
+            return AroundInvoke.class;
+        } else if (type.equals(InterceptionType.POST_ACTIVATE))
+        {
+            return PostActivate.class;
+        } else if (type.equals(InterceptionType.POST_CONSTRUCT))
+        {
+            return PostConstruct.class;
+        } else if (type.equals(InterceptionType.PRE_DESTROY))
+        {
+            return PreDestroy.class;
+        } else if (type.equals(InterceptionType.PRE_PASSIVATE))
+        {
+            return PrePassivate.class;
+        } else
+        {
+            throw new WebBeansException("Undefined interceotion type");
+        }
+    }
+
+    public static boolean isBusinessMethodInterceptor(Class<?> clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        Method[] methods = clazz.getDeclaredMethods();
+        for (Method method : methods)
+        {
+            if (AnnotationUtil.isMethodHasAnnotation(method, AroundInvoke.class))
+            {
+                if (ClassUtil.isMethodHasParameter(method))
+                {
+                    Class<?>[] params = ClassUtil.getMethodParameterTypes(method);
+                    if (params.length == 1 && params[0].equals(InvocationContext.class))
+                    {
+                        if (ClassUtil.getReturnType(method).equals(Object.class))
+                        {
+                            if (ClassUtil.isMethodHasException(method))
+                            {
+                                if (!ClassUtil.isStatic(method.getModifiers()) && !ClassUtil.isFinal(method.getModifiers()))
+                                {
+                                    return true;
+                                }
+                            }
+                        }
+                    }
+
+                }
+            }
+        }
+
+        return false;
+    }
+
+    public static boolean isLifecycleMethodInterceptor(Class<?> clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        Method[] methods = clazz.getDeclaredMethods();
+        for (Method method : methods)
+        {
+            if (AnnotationUtil.isMethodHasAnnotation(method, PostConstruct.class) || AnnotationUtil.isMethodHasAnnotation(method, PreDestroy.class) || AnnotationUtil.isMethodHasAnnotation(method, PostActivate.class) || AnnotationUtil.isMethodHasAnnotation(method, PrePassivate.class))
+            {
+                if (ClassUtil.isMethodHasParameter(method))
+                {
+                    Class<?>[] params = ClassUtil.getMethodParameterTypes(method);
+                    if (params.length == 1 && params[0].equals(InvocationContext.class))
+                    {
+                        if (ClassUtil.getReturnType(method).equals(Void.TYPE))
+                        {
+                            if (!ClassUtil.isMethodHasCheckedException(method))
+                            {
+                                if (!ClassUtil.isStatic(method.getModifiers()))
+                                {
+                                    return true;
+                                }
+                            }
+                        }
+                    }
+
+                }
+            }
+        }
+
+        return false;
+    }
+
+    public static void checkInterceptorConditions(Class<?> clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        if (!AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getDeclaredAnnotations()))
+        {
+            throw new WebBeansConfigurationException("WebBeans Interceptor class : " + clazz.getName() + " must have at least one @InterceptorBindingType annotation");
+        }
+
+        checkLifecycleConditions(clazz, clazz.getDeclaredAnnotations(), "Lifecycle interceptor : " + clazz.getName() + " interceptor binding type must be defined as @Target{TYPE}");
+    }
+
+    public static <T> void checkLifecycleConditions(Class<T> clazz, Annotation[] annots, String errorMessage)
+    {
+        Asserts.nullCheckForClass(clazz);
+
+        if (isLifecycleMethodInterceptor(clazz) && !isBusinessMethodInterceptor(clazz))
+        {
+            Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);
+
+            for (Annotation annotation : anns)
+            {
+                Target target = annotation.annotationType().getAnnotation(Target.class);
+                ElementType[] elementTypes = target.value();
+
+                if (!(elementTypes.length == 1 && elementTypes[0].equals(ElementType.TYPE)))
+                {
+                    throw new WebBeansConfigurationException(errorMessage);
+                }
+            }
+        }
+
+    }
+
+    public static void checkSimpleWebBeansInterceptorConditions(Class<?> clazz)
+    {
+        Asserts.nullCheckForClass(clazz);
+        Annotation[] anns = clazz.getDeclaredAnnotations();
+
+        boolean hasClassInterceptors = false;
+        if (AnnotationUtil.getInterceptorBindingMetaAnnotations(anns).length > 0)
+        {
+            hasClassInterceptors = true;
+        } else
+        {
+            Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getAnnotations());
+            for (Annotation stero : stereoTypes)
+            {
+                if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
+                {
+                    hasClassInterceptors = true;
+                    break;
+                }
+            }
+        }
+
+        Method[] methods = clazz.getDeclaredMethods();
+
+        for (Method method : methods)
+        {
+            int modifiers = method.getModifiers();
+            if (!ClassUtil.isStatic(modifiers) && !ClassUtil.isPrivate(modifiers) && ClassUtil.isFinal(modifiers))
+            {
+                if (hasClassInterceptors)
+                {
+                    throw new WebBeansConfigurationException("Simple web bean class : " + clazz.getName() + " can not define non-static, non-private final methods. Because it is annotated with at least one @InterceptorBindintType");
+                } else
+                {
+                    if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(method.getDeclaredAnnotations()))
+                    {
+                        throw new WebBeansConfigurationException("Method : " + method.getName() + "in simple web bean class : " + clazz.getName() + " can not be defined as non-static, non-private and final . Because it is annotated with at least one @InterceptorBindintType");
+                    }
+                }
+            }
+        }
+
+    }
+
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.intercept;
 
@@ -24,52 +21,52 @@
 
 public class InterceptorsManager
 {
-	private List<Class<?>> enabledInterceptors = new CopyOnWriteArrayList<Class<?>>();
+    private List<Class<?>> enabledInterceptors = new CopyOnWriteArrayList<Class<?>>();
 
-	public InterceptorsManager()
-	{
+    public InterceptorsManager()
+    {
 
-	}
+    }
 
-	public static InterceptorsManager getInstance()
-	{
-		InterceptorsManager instance = (InterceptorsManager)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_INTERCEPTORS_MANAGER);
-		return instance;
-	}
-
-	public void addNewInterceptor(Class<?> interceptorClazz)
-	{
-		Asserts.nullCheckForClass(interceptorClazz, "interceptorClazz can not be null");
-
-		if (!enabledInterceptors.contains(interceptorClazz))
-			getInstance().enabledInterceptors.add(interceptorClazz);
-	}
-
-	public int compare(Class<?> src, Class<?> target)
-	{
-		Asserts.assertNotNull(src, "src parameter can not be  null");
-		Asserts.assertNotNull(target, "target parameter can not be null");
-
-		int srcIndex = enabledInterceptors.indexOf(src);
-		int targetIndex = enabledInterceptors.indexOf(target);
-
-		if (srcIndex == -1 || targetIndex == -1)
-		{
-			throw new IllegalArgumentException("One of the compare class of the list : [" + src.getName() + "," + target.getName() + "]" + " is not contained in the enabled interceptors list!");
-		}
-
-		if (srcIndex == targetIndex)
-			return 0;
-		else if (srcIndex < targetIndex)
-			return -1;
-		else
-			return 1;
-	}
-
-	public boolean isInterceptorEnabled(Class<?> interceptorClazz)
-	{
-		Asserts.nullCheckForClass(interceptorClazz, "interceptorClazz can not be null");
+    public static InterceptorsManager getInstance()
+    {
+        InterceptorsManager instance = (InterceptorsManager) WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_INTERCEPTORS_MANAGER);
+        return instance;
+    }
+
+    public void addNewInterceptor(Class<?> interceptorClazz)
+    {
+        Asserts.nullCheckForClass(interceptorClazz, "interceptorClazz can not be null");
+
+        if (!enabledInterceptors.contains(interceptorClazz))
+            getInstance().enabledInterceptors.add(interceptorClazz);
+    }
+
+    public int compare(Class<?> src, Class<?> target)
+    {
+        Asserts.assertNotNull(src, "src parameter can not be  null");
+        Asserts.assertNotNull(target, "target parameter can not be null");
+
+        int srcIndex = enabledInterceptors.indexOf(src);
+        int targetIndex = enabledInterceptors.indexOf(target);
+
+        if (srcIndex == -1 || targetIndex == -1)
+        {
+            throw new IllegalArgumentException("One of the compare class of the list : [" + src.getName() + "," + target.getName() + "]" + " is not contained in the enabled interceptors list!");
+        }
+
+        if (srcIndex == targetIndex)
+            return 0;
+        else if (srcIndex < targetIndex)
+            return -1;
+        else
+            return 1;
+    }
+
+    public boolean isInterceptorEnabled(Class<?> interceptorClazz)
+    {
+        Asserts.nullCheckForClass(interceptorClazz, "interceptorClazz can not be null");
 
-		return getInstance().enabledInterceptors.contains(interceptorClazz);
-	}
+        return getInstance().enabledInterceptors.contains(interceptorClazz);
+    }
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.intercept;
 
@@ -32,230 +29,227 @@
  */
 public class InvocationContextImpl implements InvocationContext
 {
-	/**Context data for passing between interceptors*/
-	private Map<String, Object> contextData = new HashMap<String, Object>();
-	
-	/**Invoked method*/
-	private Method method;
-	
-	/**Method parameters*/
-	private Object[] parameters;
-	
-	/**Interceptor stack*/
-	private List<InterceptorData> interceptorDatas;
-	
-	/**Target object*/
-	private Object target;
-	
-	/**Interceptor type*/
-	private InterceptorType type;
-	
-	/**Used for numbering interceptors*/
-	private int currentMethod = 1;
-	
-	/**
-	 * Initializes the context.
-	 * 
-	 * @param target target object
-	 * @param method method
-	 * @param parameters method parameters
-	 * @param datas interceptor stack
-	 * @param type interceptor type
-	 */
-	public InvocationContextImpl(Object target, Method method, Object[] parameters, List<InterceptorData> datas, InterceptorType type)
-	{
-		this.target = target;
-		this.method = method;
-		this.parameters = parameters;
-		this.interceptorDatas = datas;
-		this.type = type;
-		
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * @see javax.interceptor.InvocationContext#getContextData()
-	 */
-	public Map<String, Object> getContextData()
-	{
-		return this.contextData;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see javax.interceptor.InvocationContext#getMethod()
-	 */
-	public Method getMethod()
-	{
-		return this.method;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see javax.interceptor.InvocationContext#getParameters()
-	 */
-	public Object[] getParameters()
-	{
-		return this.parameters;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see javax.interceptor.InvocationContext#getTarget()
-	 */
-	public Object getTarget()
-	{
-		return this.target;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see javax.interceptor.InvocationContext#proceed()
-	 */
-	public  Object proceed() throws Exception
-	{
-		try
-		{
-			if(type.equals(InterceptorType.AROUND_INVOKE))
-			{
-				return proceedAroundInvokes(this.interceptorDatas);
-			}
-			else
-			{
-				return proceedCommonAnnots(this.interceptorDatas, this.type);
-			} 			
-			
-		}catch(Exception e)
-		{
-			this.target = null; //destroy target instance
-			
-			throw e;
-		}		
-	}
-	
-	/*
-	 * Around invoke chain.
-	 */
-	private Object proceedAroundInvokes(List<InterceptorData> datas) throws Exception
-	{
-		Object result = null;
-				
-		if(currentMethod <= datas.size())
-		{
-			InterceptorData intc = datas.get(currentMethod-1);
-						
-			Method method = intc.getAroundInvoke();
-			
-			if(!method.isAccessible())
-			{
-				method.setAccessible(true);
-			}
-			
-			Object t = intc.getInterceptorInstance();
-			if(t == null)
-			{
-				t = target;
-			}
-			
-			currentMethod++;
-			result = method.invoke(t, new Object[]{this});	
-		}
-		else
-		{
-			result = this.method.invoke(target, parameters);
-		}
-				
-		return result;
-	}
-	
-	/*
-	 * PreDestroy and PostConstruct chain
-	 */
-	private Object proceedCommonAnnots(List<InterceptorData> datas, InterceptorType type) throws Exception
-	{
-		Object result = null;
-						
-		if(currentMethod <= datas.size())
-		{
-			InterceptorData intc = datas.get(currentMethod-1);
-			Method method = null;
-			
-			if(type.equals(InterceptorType.POST_CONSTRUCT))
-			{
-				method = intc.getPostConstruct();
-			}
-			else if(type.equals(InterceptorType.PRE_DESTROY))
-			{
-				method = intc.getPreDestroy();
-			}		
-			
-			if(!method.isAccessible())
-			{
-				method.setAccessible(true);
-			}
-			
-			currentMethod++;
-			
-			Object t = intc.getInterceptorInstance();
-			if(t == null)
-			{
-				t = target;
-				result = method.invoke(t, new Object[]{});
-			}
-			else
-			{
-				result = method.invoke(t, new Object[]{this});
-			}
-			
-				
-		}				
-		
-		return result;
-	}
-
-	
-
-	/*
-	 * (non-Javadoc)
-	 * @see javax.interceptor.InvocationContext#setParameters(java.lang.Object[])
-	 */
-	public void setParameters(Object[] params)
-	{
-		if(getMethod() != null)
-		{
-			if(params == null)
-			{
-				if(this.parameters.length > 0)
-				{
-					throw new IllegalArgumentException("Parameters is null");
-				}
-			}
-			else
-			{
-				List<Class<?>> src = new ArrayList<Class<?>>();
-				
-				if(params.length != this.parameters.length)
-				{
-					throw new IllegalArgumentException("Parameters length not match");
-				}
-				
-				for(Object param : params)
-				{
-					src.add(param.getClass());
-				}
-				
-				
-				for(Class<?> param : this.method.getParameterTypes())
-				{
-					if(!src.contains(param))
-						throw new IllegalArgumentException("Parameters types not match");
-				}
-				
-				System.arraycopy(params, 0, this.parameters, 0, params.length);
-				
-			}
-			
-		}		
-	}
-	
+    /** Context data for passing between interceptors */
+    private Map<String, Object> contextData = new HashMap<String, Object>();
+
+    /** Invoked method */
+    private Method method;
+
+    /** Method parameters */
+    private Object[] parameters;
+
+    /** Interceptor stack */
+    private List<InterceptorData> interceptorDatas;
+
+    /** Target object */
+    private Object target;
+
+    /** Interceptor type */
+    private InterceptorType type;
+
+    /** Used for numbering interceptors */
+    private int currentMethod = 1;
+
+    /**
+     * Initializes the context.
+     * 
+     * @param target target object
+     * @param method method
+     * @param parameters method parameters
+     * @param datas interceptor stack
+     * @param type interceptor type
+     */
+    public InvocationContextImpl(Object target, Method method, Object[] parameters, List<InterceptorData> datas, InterceptorType type)
+    {
+        this.target = target;
+        this.method = method;
+        this.parameters = parameters;
+        this.interceptorDatas = datas;
+        this.type = type;
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.interceptor.InvocationContext#getContextData()
+     */
+    public Map<String, Object> getContextData()
+    {
+        return this.contextData;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.interceptor.InvocationContext#getMethod()
+     */
+    public Method getMethod()
+    {
+        return this.method;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.interceptor.InvocationContext#getParameters()
+     */
+    public Object[] getParameters()
+    {
+        return this.parameters;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.interceptor.InvocationContext#getTarget()
+     */
+    public Object getTarget()
+    {
+        return this.target;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.interceptor.InvocationContext#proceed()
+     */
+    public Object proceed() throws Exception
+    {
+        try
+        {
+            if (type.equals(InterceptorType.AROUND_INVOKE))
+            {
+                return proceedAroundInvokes(this.interceptorDatas);
+            } else
+            {
+                return proceedCommonAnnots(this.interceptorDatas, this.type);
+            }
+
+        } catch (Exception e)
+        {
+            this.target = null; // destroy target instance
+
+            throw e;
+        }
+    }
+
+    /*
+     * Around invoke chain.
+     */
+    private Object proceedAroundInvokes(List<InterceptorData> datas) throws Exception
+    {
+        Object result = null;
+
+        if (currentMethod <= datas.size())
+        {
+            InterceptorData intc = datas.get(currentMethod - 1);
+
+            Method method = intc.getAroundInvoke();
+
+            if (!method.isAccessible())
+            {
+                method.setAccessible(true);
+            }
+
+            Object t = intc.getInterceptorInstance();
+            if (t == null)
+            {
+                t = target;
+            }
+
+            currentMethod++;
+            result = method.invoke(t, new Object[] { this });
+        } else
+        {
+            result = this.method.invoke(target, parameters);
+        }
+
+        return result;
+    }
+
+    /*
+     * PreDestroy and PostConstruct chain
+     */
+    private Object proceedCommonAnnots(List<InterceptorData> datas, InterceptorType type) throws Exception
+    {
+        Object result = null;
+
+        if (currentMethod <= datas.size())
+        {
+            InterceptorData intc = datas.get(currentMethod - 1);
+            Method method = null;
+
+            if (type.equals(InterceptorType.POST_CONSTRUCT))
+            {
+                method = intc.getPostConstruct();
+            } else if (type.equals(InterceptorType.PRE_DESTROY))
+            {
+                method = intc.getPreDestroy();
+            }
+
+            if (!method.isAccessible())
+            {
+                method.setAccessible(true);
+            }
+
+            currentMethod++;
+
+            Object t = intc.getInterceptorInstance();
+            if (t == null)
+            {
+                t = target;
+                result = method.invoke(t, new Object[] {});
+            } else
+            {
+                result = method.invoke(t, new Object[] { this });
+            }
+
+        }
+
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.interceptor.InvocationContext#setParameters(java.lang.Object[])
+     */
+    public void setParameters(Object[] params)
+    {
+        if (getMethod() != null)
+        {
+            if (params == null)
+            {
+                if (this.parameters.length > 0)
+                {
+                    throw new IllegalArgumentException("Parameters is null");
+                }
+            } else
+            {
+                List<Class<?>> src = new ArrayList<Class<?>>();
+
+                if (params.length != this.parameters.length)
+                {
+                    throw new IllegalArgumentException("Parameters length not match");
+                }
+
+                for (Object param : params)
+                {
+                    src.add(param.getClass());
+                }
+
+                for (Class<?> param : this.method.getParameterTypes())
+                {
+                    if (!src.contains(param))
+                        throw new IllegalArgumentException("Parameters types not match");
+                }
+
+                System.arraycopy(params, 0, this.parameters, 0, params.length);
+
+            }
+
+        }
+    }
+
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.intercept;
 
@@ -46,201 +43,198 @@
  */
 public final class WebBeansInterceptorConfig
 {
-	/** Logger instance */
-	private static WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansInterceptorConfig.class);
+    /** Logger instance */
+    private static WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansInterceptorConfig.class);
 
-	/*
-	 * Private
-	 */
-	private WebBeansInterceptorConfig()
-	{
-
-	}
-
-	/**
-	 * Configures WebBeans specific interceptor class.
-	 * 
-	 * @param interceptorClazz
-	 *            interceptor class
-	 */
-	public static void configureInterceptorClass(AbstractComponent<Object> delegate, Annotation[] interceptorBindingTypes)
-	{
-		logger.info("Configuring the Web Beans Interceptor Class : " + delegate.getReturnType().getName() + " started");
-
-		WebBeansInterceptor interceptor = new WebBeansInterceptor(delegate);
-
-		for (Annotation ann : interceptorBindingTypes)
-		{
-			interceptor.addInterceptorBindingType(ann.annotationType(), ann);
-		}
-
-		logger.info("Configuring the Web Beans Interceptor Class : " + delegate.getReturnType() + " ended");
-
-		ManagerImpl.getManager().addInterceptor(interceptor);
-
-	}
-
-	/**
-	 * Configures the given class for applicable interceptors.
-	 * 
-	 * @param clazz
-	 *            configuration interceptors for this
-	 */
-	public static void configure(Class<?> clazz, List<InterceptorData> stack)
-	{
-		if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getDeclaredAnnotations()))
-		{
-			
-			Set<Annotation> bindingTypeSet = new HashSet<Annotation>();
-			
-			Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazz.getDeclaredAnnotations());
-			
-			for(Annotation ann : anns)
-			{
-				bindingTypeSet.add(ann);
-			}
-			
-			Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
-			for(Annotation stero : stereoTypes)
-			{
-				if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
-				{
-					Annotation[] steroInterceptorBindings = AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());
-					
-					for(Annotation ann : steroInterceptorBindings)
-					{
-						bindingTypeSet.add(ann);
-					}
-				}
-			}
-			
-			anns = new Annotation[bindingTypeSet.size()];
-			anns = bindingTypeSet.toArray(anns);
-			
-			Set<Interceptor> set = findDeployedWebBeansInterceptor(anns);
-
-			// Adding class interceptors
-			addComponentInterceptors(set, stack);
-		}
-
-		// Method level interceptors.
-		addMethodInterceptors(clazz, stack);
-
-	}
-
-	public static void addComponentInterceptors(Set<Interceptor> set, List<InterceptorData> stack)
-	{
-		Iterator<Interceptor> it = set.iterator();
-		while (it.hasNext())
-		{
-			WebBeansInterceptor interceptor = (WebBeansInterceptor) it.next();
-
-			// interceptor binding
-			WebBeansUtil.configureInterceptorMethods(interceptor,interceptor.getClazz(), AroundInvoke.class, true, false, stack, null, true);
-			WebBeansUtil.configureInterceptorMethods(interceptor,interceptor.getClazz(), PostConstruct.class, true, false, stack, null, true);
-			WebBeansUtil.configureInterceptorMethods(interceptor,interceptor.getClazz(), PreDestroy.class, true, false, stack, null, true);
-
-		}
-
-	}
-
-	private static void addMethodInterceptors(Class<?> clazz, List<InterceptorData> stack)
-	{
-		Method[] methods = clazz.getDeclaredMethods();
-
-		for (Method method : methods)
-		{
-			if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(method.getAnnotations()))
-			{
-				Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(method.getDeclaredAnnotations());
-				Annotation[] annsClazz = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazz.getDeclaredAnnotations());
-				
-
-				Set<Annotation> set = new HashSet<Annotation>();
-
-				for (Annotation ann : anns)
-				{
-					set.add(ann);
-				}
-
-				for (Annotation ann : annsClazz)
-				{
-					set.add(ann);
-				}
-				
-				Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
-				for(Annotation stero : stereoTypes)
-				{
-					if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
-					{
-						Annotation[] steroInterceptorBindings = AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());
-						
-						for(Annotation ann : steroInterceptorBindings)
-						{
-							set.add(ann);
-						}
-					}
-				}
-				
-				Annotation[] result = new Annotation[set.size()];
-				result = set.toArray(result);
-
-				Set<Interceptor> setInterceptors = findDeployedWebBeansInterceptor(result);
-				Iterator<Interceptor> it = setInterceptors.iterator();
-
-				while (it.hasNext())
-				{
-					WebBeansInterceptor interceptor = (WebBeansInterceptor) it.next();
-
-					WebBeansUtil.configureInterceptorMethods(interceptor,interceptor.getClazz(), AroundInvoke.class, false, true, stack, method, true);
-					WebBeansUtil.configureInterceptorMethods(interceptor,interceptor.getClazz(), PostConstruct.class, false, true, stack, method, true);
-					WebBeansUtil.configureInterceptorMethods(interceptor,interceptor.getClazz(), PreDestroy.class, false, true, stack, method, true);
-				}
-
-			}
-		}
-
-	}
-
-	/**
-	 * Gets the configured webbeans interceptors.
-	 * 
-	 * @return the configured webbeans interceptors
-	 */
-	private static Set<Interceptor> getWebBeansInterceptors()
-	{
-		return Collections.unmodifiableSet(ManagerImpl.getManager().getInterceptors());
-	}
-
-	/*
-	 * Find the deployed interceptors with given interceptor binding types.
-	 */
-	public static Set<Interceptor> findDeployedWebBeansInterceptor(Annotation[] anns)
-	{
-		Set<Interceptor> set = new HashSet<Interceptor>();
-
-		Iterator<Interceptor> it = getWebBeansInterceptors().iterator();
-		WebBeansInterceptor interceptor = null;
-
-		List<Class<? extends Annotation>> bindingTypes = new ArrayList<Class<? extends Annotation>>();
-		List<Annotation> listAnnot = new ArrayList<Annotation>();
-		for (Annotation ann : anns)
-		{
-			bindingTypes.add(ann.annotationType());
-			listAnnot.add(ann);
-		}
-
-		while (it.hasNext())
-		{
-			interceptor = (WebBeansInterceptor) it.next();
-
-			if (interceptor.isBindingTypesExist(bindingTypes, listAnnot))
-			{
-				set.add(interceptor);
-				set.addAll(interceptor.getMetaInceptors());
-			}
-		}
+    /*
+     * Private
+     */
+    private WebBeansInterceptorConfig()
+    {
+
+    }
+
+    /**
+     * Configures WebBeans specific interceptor class.
+     * 
+     * @param interceptorClazz interceptor class
+     */
+    public static void configureInterceptorClass(AbstractComponent<Object> delegate, Annotation[] interceptorBindingTypes)
+    {
+        logger.info("Configuring the Web Beans Interceptor Class : " + delegate.getReturnType().getName() + " started");
+
+        WebBeansInterceptor interceptor = new WebBeansInterceptor(delegate);
+
+        for (Annotation ann : interceptorBindingTypes)
+        {
+            interceptor.addInterceptorBindingType(ann.annotationType(), ann);
+        }
+
+        logger.info("Configuring the Web Beans Interceptor Class : " + delegate.getReturnType() + " ended");
+
+        ManagerImpl.getManager().addInterceptor(interceptor);
+
+    }
+
+    /**
+     * Configures the given class for applicable interceptors.
+     * 
+     * @param clazz configuration interceptors for this
+     */
+    public static void configure(Class<?> clazz, List<InterceptorData> stack)
+    {
+        if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getDeclaredAnnotations()))
+        {
+
+            Set<Annotation> bindingTypeSet = new HashSet<Annotation>();
+
+            Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazz.getDeclaredAnnotations());
+
+            for (Annotation ann : anns)
+            {
+                bindingTypeSet.add(ann);
+            }
+
+            Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
+            for (Annotation stero : stereoTypes)
+            {
+                if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
+                {
+                    Annotation[] steroInterceptorBindings = AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());
+
+                    for (Annotation ann : steroInterceptorBindings)
+                    {
+                        bindingTypeSet.add(ann);
+                    }
+                }
+            }
+
+            anns = new Annotation[bindingTypeSet.size()];
+            anns = bindingTypeSet.toArray(anns);
+
+            Set<Interceptor> set = findDeployedWebBeansInterceptor(anns);
+
+            // Adding class interceptors
+            addComponentInterceptors(set, stack);
+        }
+
+        // Method level interceptors.
+        addMethodInterceptors(clazz, stack);
+
+    }
+
+    public static void addComponentInterceptors(Set<Interceptor> set, List<InterceptorData> stack)
+    {
+        Iterator<Interceptor> it = set.iterator();
+        while (it.hasNext())
+        {
+            WebBeansInterceptor interceptor = (WebBeansInterceptor) it.next();
+
+            // interceptor binding
+            WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), AroundInvoke.class, true, false, stack, null, true);
+            WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PostConstruct.class, true, false, stack, null, true);
+            WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PreDestroy.class, true, false, stack, null, true);
+
+        }
+
+    }
+
+    private static void addMethodInterceptors(Class<?> clazz, List<InterceptorData> stack)
+    {
+        Method[] methods = clazz.getDeclaredMethods();
+
+        for (Method method : methods)
+        {
+            if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(method.getAnnotations()))
+            {
+                Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(method.getDeclaredAnnotations());
+                Annotation[] annsClazz = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazz.getDeclaredAnnotations());
+
+                Set<Annotation> set = new HashSet<Annotation>();
+
+                for (Annotation ann : anns)
+                {
+                    set.add(ann);
+                }
+
+                for (Annotation ann : annsClazz)
+                {
+                    set.add(ann);
+                }
+
+                Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
+                for (Annotation stero : stereoTypes)
+                {
+                    if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
+                    {
+                        Annotation[] steroInterceptorBindings = AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());
+
+                        for (Annotation ann : steroInterceptorBindings)
+                        {
+                            set.add(ann);
+                        }
+                    }
+                }
+
+                Annotation[] result = new Annotation[set.size()];
+                result = set.toArray(result);
+
+                Set<Interceptor> setInterceptors = findDeployedWebBeansInterceptor(result);
+                Iterator<Interceptor> it = setInterceptors.iterator();
+
+                while (it.hasNext())
+                {
+                    WebBeansInterceptor interceptor = (WebBeansInterceptor) it.next();
+
+                    WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), AroundInvoke.class, false, true, stack, method, true);
+                    WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PostConstruct.class, false, true, stack, method, true);
+                    WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PreDestroy.class, false, true, stack, method, true);
+                }
+
+            }
+        }
+
+    }
+
+    /**
+     * Gets the configured webbeans interceptors.
+     * 
+     * @return the configured webbeans interceptors
+     */
+    private static Set<Interceptor> getWebBeansInterceptors()
+    {
+        return Collections.unmodifiableSet(ManagerImpl.getManager().getInterceptors());
+    }
+
+    /*
+     * Find the deployed interceptors with given interceptor binding types.
+     */
+    public static Set<Interceptor> findDeployedWebBeansInterceptor(Annotation[] anns)
+    {
+        Set<Interceptor> set = new HashSet<Interceptor>();
+
+        Iterator<Interceptor> it = getWebBeansInterceptors().iterator();
+        WebBeansInterceptor interceptor = null;
+
+        List<Class<? extends Annotation>> bindingTypes = new ArrayList<Class<? extends Annotation>>();
+        List<Annotation> listAnnot = new ArrayList<Annotation>();
+        for (Annotation ann : anns)
+        {
+            bindingTypes.add(ann.annotationType());
+            listAnnot.add(ann);
+        }
+
+        while (it.hasNext())
+        {
+            interceptor = (WebBeansInterceptor) it.next();
+
+            if (interceptor.isBindingTypesExist(bindingTypes, listAnnot))
+            {
+                set.add(interceptor);
+                set.addAll(interceptor.getMetaInceptors());
+            }
+        }
 
-		return set;
-	}
+        return set;
+    }
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.intercept.ejb;
 
@@ -39,114 +36,112 @@
  */
 public final class EJBInterceptorConfig
 {
-	/*
-	 * Private constructor
-	 */
-	private EJBInterceptorConfig()
-	{
-		
-	}
-	
-	/**
-	 * Configures the given class for applicable interceptors.
-	 * 
-	 * @param clazz configuration interceptors for this
-	 */
-	public static void configure(Class<?> clazz, List<InterceptorData> stack)
-	{
-		Asserts.assertNotNull(clazz, "Clazz argument can not be null");
-		
-		
-		if(AnnotationUtil.isAnnotationExistOnClass(clazz, Interceptors.class))
-		{
-			Interceptors incs = clazz.getAnnotation(Interceptors.class);
-			Class<?>[] intClasses = incs.value();
-			
-			for(Class<?> intClass : intClasses)
-			{
-				configureInterceptorAnnots(intClass, stack, false,null);	
-			}
-			
-		}
-		
-		
-		configureBeanAnnots(clazz, stack);
-	}
-	
-	/*
-	 * Configure interceptor class 
-	 */
-	private static void configureInterceptorAnnots(Class<?> clazz,List<InterceptorData> stack, boolean isMethod, Method m)
-	{
-		//1- Look interceptor class super class
-		//2- Look interceptor class
-		Class<?> superClass = clazz.getSuperclass();
-		if(superClass != null && !superClass.equals(Object.class))
-		{
-			configureInterceptorAnnots(superClass, stack, false,null);			
-		}
-
-		WebBeansUtil.configureInterceptorMethods(null,clazz, AroundInvoke.class,true,isMethod,stack,m,false);
-		WebBeansUtil.configureInterceptorMethods(null,clazz, PostConstruct.class,true,isMethod,stack,m,false);
-		WebBeansUtil.configureInterceptorMethods(null,clazz, PreDestroy.class,true,isMethod,stack,m,false);
-		
-	}
-		
-	/*
-	 * Configure bean class
-	 */
-	private static void configureBeanAnnots(Class<?> clazz,List<InterceptorData> stack)
-	{
-		//1- Look method intercepor class annotations
-		//2- Look super class around invoke
-		//3- Look bean around invoke
-		
-		//1-
-		Method[] methods = clazz.getDeclaredMethods();
-		
-		for(Method method : methods)
-		{
-			Interceptors incs = method.getAnnotation(Interceptors.class);
-			if(incs != null)
-			{
-				Class<?>[] intClasses = incs.value();
-				
-				for(Class<?> intClass : intClasses)
-				{
-					configureInterceptorAnnots(intClass, stack, true,method);
-				}		
-				
-			}
-		} 
-		
-		//2- Super clazz
-		List<Class<?>> listSuperClazz = ClassUtil.getSuperClasses(clazz, new ArrayList<Class<?>>());
-		configureBeanSuperClassAnnots(listSuperClazz,stack);
-		
-		//3- Bean itself
-		WebBeansUtil.configureInterceptorMethods(null,clazz, AroundInvoke.class,false,false,stack,null,false);
-		WebBeansUtil.configureInterceptorMethods(null,clazz, PostConstruct.class,false,false,stack,null,false);
-		WebBeansUtil.configureInterceptorMethods(null,clazz, PreDestroy.class,false,false,stack,null,false);
-		
-	}
-	
-	/*
-	 * Super class annots.
-	 */
-	private static void configureBeanSuperClassAnnots(List<Class<?>> list, List<InterceptorData> stack)
-	{
-		int i = list.size();
-		
-		for(int j = i-1; j>=0;j--)
-		{
-			Class<?> clazz = list.get(j);
-			if(!clazz.equals(Object.class))
-			{
-				WebBeansUtil.configureInterceptorMethods(null,clazz, AroundInvoke.class,false,false,stack,null,false);
-				WebBeansUtil.configureInterceptorMethods(null,clazz, PostConstruct.class,false,false,stack,null,false);
-				WebBeansUtil.configureInterceptorMethods(null,clazz, PreDestroy.class,false,false,stack,null,false);				
-			}
-		}
-	}
-		
+    /*
+     * Private constructor
+     */
+    private EJBInterceptorConfig()
+    {
+
+    }
+
+    /**
+     * Configures the given class for applicable interceptors.
+     * 
+     * @param clazz configuration interceptors for this
+     */
+    public static void configure(Class<?> clazz, List<InterceptorData> stack)
+    {
+        Asserts.assertNotNull(clazz, "Clazz argument can not be null");
+
+        if (AnnotationUtil.isAnnotationExistOnClass(clazz, Interceptors.class))
+        {
+            Interceptors incs = clazz.getAnnotation(Interceptors.class);
+            Class<?>[] intClasses = incs.value();
+
+            for (Class<?> intClass : intClasses)
+            {
+                configureInterceptorAnnots(intClass, stack, false, null);
+            }
+
+        }
+
+        configureBeanAnnots(clazz, stack);
+    }
+
+    /*
+     * Configure interceptor class
+     */
+    private static void configureInterceptorAnnots(Class<?> clazz, List<InterceptorData> stack, boolean isMethod, Method m)
+    {
+        // 1- Look interceptor class super class
+        // 2- Look interceptor class
+        Class<?> superClass = clazz.getSuperclass();
+        if (superClass != null && !superClass.equals(Object.class))
+        {
+            configureInterceptorAnnots(superClass, stack, false, null);
+        }
+
+        WebBeansUtil.configureInterceptorMethods(null, clazz, AroundInvoke.class, true, isMethod, stack, m, false);
+        WebBeansUtil.configureInterceptorMethods(null, clazz, PostConstruct.class, true, isMethod, stack, m, false);
+        WebBeansUtil.configureInterceptorMethods(null, clazz, PreDestroy.class, true, isMethod, stack, m, false);
+
+    }
+
+    /*
+     * Configure bean class
+     */
+    private static void configureBeanAnnots(Class<?> clazz, List<InterceptorData> stack)
+    {
+        // 1- Look method intercepor class annotations
+        // 2- Look super class around invoke
+        // 3- Look bean around invoke
+
+        // 1-
+        Method[] methods = clazz.getDeclaredMethods();
+
+        for (Method method : methods)
+        {
+            Interceptors incs = method.getAnnotation(Interceptors.class);
+            if (incs != null)
+            {
+                Class<?>[] intClasses = incs.value();
+
+                for (Class<?> intClass : intClasses)
+                {
+                    configureInterceptorAnnots(intClass, stack, true, method);
+                }
+
+            }
+        }
+
+        // 2- Super clazz
+        List<Class<?>> listSuperClazz = ClassUtil.getSuperClasses(clazz, new ArrayList<Class<?>>());
+        configureBeanSuperClassAnnots(listSuperClazz, stack);
+
+        // 3- Bean itself
+        WebBeansUtil.configureInterceptorMethods(null, clazz, AroundInvoke.class, false, false, stack, null, false);
+        WebBeansUtil.configureInterceptorMethods(null, clazz, PostConstruct.class, false, false, stack, null, false);
+        WebBeansUtil.configureInterceptorMethods(null, clazz, PreDestroy.class, false, false, stack, null, false);
+
+    }
+
+    /*
+     * Super class annots.
+     */
+    private static void configureBeanSuperClassAnnots(List<Class<?>> list, List<InterceptorData> stack)
+    {
+        int i = list.size();
+
+        for (int j = i - 1; j >= 0; j--)
+        {
+            Class<?> clazz = list.get(j);
+            if (!clazz.equals(Object.class))
+            {
+                WebBeansUtil.configureInterceptorMethods(null, clazz, AroundInvoke.class, false, false, stack, null, false);
+                WebBeansUtil.configureInterceptorMethods(null, clazz, PostConstruct.class, false, false, stack, null, false);
+                WebBeansUtil.configureInterceptorMethods(null, clazz, PreDestroy.class, false, false, stack, null, false);
+            }
+        }
+    }
+
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java Thu Jan  8 11:41:30 2009
@@ -56,315 +56,315 @@
  */
 public class WebBeansInterceptor extends Interceptor
 {
-	/** InterceptorBindingTypes exist on the interceptor class */
-	private Map<Class<? extends Annotation>, Annotation> interceptorBindingSet = new HashMap<Class<? extends Annotation>, Annotation>();
+    /** InterceptorBindingTypes exist on the interceptor class */
+    private Map<Class<? extends Annotation>, Annotation> interceptorBindingSet = new HashMap<Class<? extends Annotation>, Annotation>();
 
-	/** Interceptor class */
-	private Class<?> clazz;
+    /** Interceptor class */
+    private Class<?> clazz;
 
-	/** Simple Web Beans component */
-	private AbstractComponent<Object> delegateComponent;
+    /** Simple Web Beans component */
+    private AbstractComponent<Object> delegateComponent;
 
-	public WebBeansInterceptor(AbstractComponent<Object> delegateComponent)
-	{
-		super(ManagerImpl.getManager());
-		this.delegateComponent = delegateComponent;
-		this.clazz = getDelegate().getReturnType();
-
-	}
-
-	public AbstractComponent<Object> getDelegate()
-	{
-		return this.delegateComponent;
-	}
-
-	/**
-	 * Add new binding type to the interceptor.
-	 * 
-	 * @param bindingType interceptor binding type annot. class
-	 * @param annot binding type annotation
-	 */
-	public void addInterceptorBindingType(Class<? extends Annotation> bindingType, Annotation annot)
-	{
-		Method[] methods = bindingType.getDeclaredMethods();
-
-		for (Method method : methods)
-		{
-			Class<?> clazz = method.getReturnType();
-			if (clazz.isArray() || clazz.isAnnotation())
-			{
-				if (!AnnotationUtil.isAnnotationExist(method.getAnnotations(), NonBinding.class))
-				{
-					throw new WebBeansConfigurationException("Interceptor definition class : " + getClazz().getName() + " @InterceptorBindingType : " + bindingType.getName() + " must have @NonBinding valued members for its array-valued and annotation valued members");
-				}
-			}
-		}
-
-		interceptorBindingSet.put(bindingType, annot);
-	}
-
-	/**
-	 * Checks whether this interceptor has given binding types with
-	 * {@link NonBinding} member values.
-	 * 
-	 * @param bindingTypes binding types
-	 * @param annots binding types annots.
-	 * @return true if binding types exist ow false
-	 */
-	public boolean isBindingTypesExist(List<Class<? extends Annotation>> bindingTypes, List<Annotation> annots)
-	{
-		boolean result = false;
-
-		if (bindingTypes != null && annots != null && (bindingTypes.size() == annots.size()))
-		{
-			int i = 0;
-			for (Class<? extends Annotation> bindingType : bindingTypes)
-			{
-				if (this.interceptorBindingSet.containsKey(bindingType))
-				{
-					Annotation target = this.interceptorBindingSet.get(bindingType);
-					if (AnnotationUtil.isAnnotationMemberExist(bindingType, annots.get(i), target))
-					{
-						result = true;
-					} else
-					{
-						return false;
-					}
-				} else
-				{
-					return false;
-				}
-
-				i++;
-			}
-		}
-
-		return result;
-	}
-
-	/**
-	 * Gets the interceptor class.
-	 * 
-	 * @return interceptor class
-	 */
-	public Class<?> getClazz()
-	{
-		return clazz;
-	}
-
-	public Set<Interceptor> getMetaInceptors()
-	{
-		Set<Interceptor> set = new HashSet<Interceptor>();
-
-		Set<Class<? extends Annotation>> keys = interceptorBindingSet.keySet();
-		Iterator<Class<? extends Annotation>> it = keys.iterator();
-
-		while (it.hasNext())
-		{
-			Class<? extends Annotation> clazzAnnot = it.next();
-			Set<Annotation> declared = null;
-			Annotation[] anns = null;
-
-			if (XMLAnnotationTypeManager.getInstance().isInterceptorBindingTypeExist(clazzAnnot))
-			{
-				declared = XMLAnnotationTypeManager.getInstance().getInterceptorBindingTypeInherites(clazzAnnot);
-				anns = new Annotation[declared.size()];
-				anns = declared.toArray(anns);
-			}
-
-			else if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazzAnnot.getAnnotations()))
-			{
-				anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazzAnnot.getAnnotations());
-			}
-
-			/*
-			 * For example: @InterceptorBindingType @Transactional @Action
-			 * public @interface ActionTransactional @ActionTransactional
-			 * @Production { }
-			 */
-
-			if (anns != null && anns.length > 0)
-			{
-				// For example : @Transactional @Action Interceptor
-				Set<Interceptor> metas = WebBeansInterceptorConfig.findDeployedWebBeansInterceptor(anns);
-				set.addAll(metas);
-
-				// For each @Transactional and @Action Interceptor
-				for (Annotation ann : anns)
-				{
-					Annotation[] simple = new Annotation[1];
-					simple[0] = ann;
-					metas = WebBeansInterceptorConfig.findDeployedWebBeansInterceptor(simple);
-					set.addAll(metas);
-				}
-
-			}
-
-		}
-
-		return set;
-	}
-
-	/**
-	 * Sets interceptor class.
-	 * 
-	 * @param clazz class instance
-	 */
-	public void setClazz(Class<?> clazz)
-	{
-		this.clazz = clazz;
-	}
-
-	@Override
-	public Set<Annotation> getInterceptorBindingTypes()
-	{
-		Set<Annotation> set = new HashSet<Annotation>();
-		Set<Class<? extends Annotation>> keySet = this.interceptorBindingSet.keySet();
-		Iterator<Class<? extends Annotation>> itSet = keySet.iterator();
-
-		while (itSet.hasNext())
-		{
-			set.add(this.interceptorBindingSet.get(itSet.next()));
-		}
-
-		return set;
-	}
-
-	@Override
-	public Method getMethod(InterceptionType type)
-	{
-		Class<? extends Annotation> interceptorTypeAnnotationClazz = InterceptorUtil.getInterceptorAnnotationClazz(type);
-		Method method = WebBeansUtil.checkCommonAnnotationCriterias(getClazz(), interceptorTypeAnnotationClazz, true);
-
-		return method;
-	}
-
-	@Override
-	public Object create()
-	{
-		Object proxy = JavassistProxyFactory.createNewProxyInstance(this);
-
-		return proxy;
-
-		// return delegateComponent.create();
-	}
-
-	public void setInjections(Object proxy)
-	{
-		// Set injected fields
-		ComponentImpl<Object> delegate = (ComponentImpl<Object>) this.delegateComponent;
-
-		Set<Field> injectedFields = delegate.getInjectedFields();
-		for (Field injectedField : injectedFields)
-		{
-			InjectableField ife = new InjectableField(injectedField, proxy, this.delegateComponent);
-			ife.doInjection();
-		}
-
-		Set<Method> injectedMethods = delegate.getInjectedMethods();
-		for (Method injectedMethod : injectedMethods)
-		{
-			@SuppressWarnings("unchecked")
-			InjectableMethods<?> ife = new InjectableMethods(injectedMethod, proxy, this.delegateComponent);
-			ife.doInjection();
-		}
-
-	}
-
-	@Override
-	public void destroy(Object instance)
-	{
-		delegateComponent.destroy(instance);
-	}
-
-	@Override
-	public Set<Annotation> getBindingTypes()
-	{
-		return delegateComponent.getBindingTypes();
-	}
-
-	@Override
-	public Class<? extends Annotation> getDeploymentType()
-	{
-		return delegateComponent.getDeploymentType();
-	}
-
-	@Override
-	public String getName()
-	{
-		return delegateComponent.getName();
-	}
-
-	@Override
-	public Class<? extends Annotation> getScopeType()
-	{
-		return delegateComponent.getScopeType();
-	}
-
-	@Override
-	public Set<Class<?>> getTypes()
-	{
-		return delegateComponent.getTypes();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	@Override
-	public boolean equals(Object obj)
-	{
-		if (this == obj)
-			return true;
-
-		WebBeansInterceptor o = null;
-
-		if (obj instanceof WebBeansInterceptor)
-		{
-			o = (WebBeansInterceptor) obj;
-
-			if (o.clazz != null && this.clazz != null)
-			{
-				return o.clazz.equals(this.clazz);
-			}
-
-		}
-
-		return false;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#hashCode()
-	 */
-	@Override
-	public int hashCode()
-	{
-		return this.clazz != null ? clazz.hashCode() : 0;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString()
-	{
-		return "WebBeans Interceptor with class : " + "[" + this.clazz.getName() + "]";
-	}
-
-	@Override
-	public boolean isNullable()
-	{
-		return delegateComponent.isNullable();
-	}
-
-	@Override
-	public boolean isSerializable()
-	{
-		return delegateComponent.isSerializable();
-	}
+    public WebBeansInterceptor(AbstractComponent<Object> delegateComponent)
+    {
+        super(ManagerImpl.getManager());
+        this.delegateComponent = delegateComponent;
+        this.clazz = getDelegate().getReturnType();
+
+    }
+
+    public AbstractComponent<Object> getDelegate()
+    {
+        return this.delegateComponent;
+    }
+
+    /**
+     * Add new binding type to the interceptor.
+     * 
+     * @param bindingType interceptor binding type annot. class
+     * @param annot binding type annotation
+     */
+    public void addInterceptorBindingType(Class<? extends Annotation> bindingType, Annotation annot)
+    {
+        Method[] methods = bindingType.getDeclaredMethods();
+
+        for (Method method : methods)
+        {
+            Class<?> clazz = method.getReturnType();
+            if (clazz.isArray() || clazz.isAnnotation())
+            {
+                if (!AnnotationUtil.isAnnotationExist(method.getAnnotations(), NonBinding.class))
+                {
+                    throw new WebBeansConfigurationException("Interceptor definition class : " + getClazz().getName() + " @InterceptorBindingType : " + bindingType.getName() + " must have @NonBinding valued members for its array-valued and annotation valued members");
+                }
+            }
+        }
+
+        interceptorBindingSet.put(bindingType, annot);
+    }
+
+    /**
+     * Checks whether this interceptor has given binding types with
+     * {@link NonBinding} member values.
+     * 
+     * @param bindingTypes binding types
+     * @param annots binding types annots.
+     * @return true if binding types exist ow false
+     */
+    public boolean isBindingTypesExist(List<Class<? extends Annotation>> bindingTypes, List<Annotation> annots)
+    {
+        boolean result = false;
+
+        if (bindingTypes != null && annots != null && (bindingTypes.size() == annots.size()))
+        {
+            int i = 0;
+            for (Class<? extends Annotation> bindingType : bindingTypes)
+            {
+                if (this.interceptorBindingSet.containsKey(bindingType))
+                {
+                    Annotation target = this.interceptorBindingSet.get(bindingType);
+                    if (AnnotationUtil.isAnnotationMemberExist(bindingType, annots.get(i), target))
+                    {
+                        result = true;
+                    } else
+                    {
+                        return false;
+                    }
+                } else
+                {
+                    return false;
+                }
+
+                i++;
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * Gets the interceptor class.
+     * 
+     * @return interceptor class
+     */
+    public Class<?> getClazz()
+    {
+        return clazz;
+    }
+
+    public Set<Interceptor> getMetaInceptors()
+    {
+        Set<Interceptor> set = new HashSet<Interceptor>();
+
+        Set<Class<? extends Annotation>> keys = interceptorBindingSet.keySet();
+        Iterator<Class<? extends Annotation>> it = keys.iterator();
+
+        while (it.hasNext())
+        {
+            Class<? extends Annotation> clazzAnnot = it.next();
+            Set<Annotation> declared = null;
+            Annotation[] anns = null;
+
+            if (XMLAnnotationTypeManager.getInstance().isInterceptorBindingTypeExist(clazzAnnot))
+            {
+                declared = XMLAnnotationTypeManager.getInstance().getInterceptorBindingTypeInherites(clazzAnnot);
+                anns = new Annotation[declared.size()];
+                anns = declared.toArray(anns);
+            }
+
+            else if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazzAnnot.getAnnotations()))
+            {
+                anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazzAnnot.getAnnotations());
+            }
+
+            /*
+             * For example: @InterceptorBindingType @Transactional @Action
+             * public @interface ActionTransactional @ActionTransactional
+             * @Production { }
+             */
+
+            if (anns != null && anns.length > 0)
+            {
+                // For example : @Transactional @Action Interceptor
+                Set<Interceptor> metas = WebBeansInterceptorConfig.findDeployedWebBeansInterceptor(anns);
+                set.addAll(metas);
+
+                // For each @Transactional and @Action Interceptor
+                for (Annotation ann : anns)
+                {
+                    Annotation[] simple = new Annotation[1];
+                    simple[0] = ann;
+                    metas = WebBeansInterceptorConfig.findDeployedWebBeansInterceptor(simple);
+                    set.addAll(metas);
+                }
+
+            }
+
+        }
+
+        return set;
+    }
+
+    /**
+     * Sets interceptor class.
+     * 
+     * @param clazz class instance
+     */
+    public void setClazz(Class<?> clazz)
+    {
+        this.clazz = clazz;
+    }
+
+    @Override
+    public Set<Annotation> getInterceptorBindingTypes()
+    {
+        Set<Annotation> set = new HashSet<Annotation>();
+        Set<Class<? extends Annotation>> keySet = this.interceptorBindingSet.keySet();
+        Iterator<Class<? extends Annotation>> itSet = keySet.iterator();
+
+        while (itSet.hasNext())
+        {
+            set.add(this.interceptorBindingSet.get(itSet.next()));
+        }
+
+        return set;
+    }
+
+    @Override
+    public Method getMethod(InterceptionType type)
+    {
+        Class<? extends Annotation> interceptorTypeAnnotationClazz = InterceptorUtil.getInterceptorAnnotationClazz(type);
+        Method method = WebBeansUtil.checkCommonAnnotationCriterias(getClazz(), interceptorTypeAnnotationClazz, true);
+
+        return method;
+    }
+
+    @Override
+    public Object create()
+    {
+        Object proxy = JavassistProxyFactory.createNewProxyInstance(this);
+
+        return proxy;
+
+        // return delegateComponent.create();
+    }
+
+    public void setInjections(Object proxy)
+    {
+        // Set injected fields
+        ComponentImpl<Object> delegate = (ComponentImpl<Object>) this.delegateComponent;
+
+        Set<Field> injectedFields = delegate.getInjectedFields();
+        for (Field injectedField : injectedFields)
+        {
+            InjectableField ife = new InjectableField(injectedField, proxy, this.delegateComponent);
+            ife.doInjection();
+        }
+
+        Set<Method> injectedMethods = delegate.getInjectedMethods();
+        for (Method injectedMethod : injectedMethods)
+        {
+            @SuppressWarnings("unchecked")
+            InjectableMethods<?> ife = new InjectableMethods(injectedMethod, proxy, this.delegateComponent);
+            ife.doInjection();
+        }
+
+    }
+
+    @Override
+    public void destroy(Object instance)
+    {
+        delegateComponent.destroy(instance);
+    }
+
+    @Override
+    public Set<Annotation> getBindingTypes()
+    {
+        return delegateComponent.getBindingTypes();
+    }
+
+    @Override
+    public Class<? extends Annotation> getDeploymentType()
+    {
+        return delegateComponent.getDeploymentType();
+    }
+
+    @Override
+    public String getName()
+    {
+        return delegateComponent.getName();
+    }
+
+    @Override
+    public Class<? extends Annotation> getScopeType()
+    {
+        return delegateComponent.getScopeType();
+    }
+
+    @Override
+    public Set<Class<?>> getTypes()
+    {
+        return delegateComponent.getTypes();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
+            return true;
+
+        WebBeansInterceptor o = null;
+
+        if (obj instanceof WebBeansInterceptor)
+        {
+            o = (WebBeansInterceptor) obj;
+
+            if (o.clazz != null && this.clazz != null)
+            {
+                return o.clazz.equals(this.clazz);
+            }
+
+        }
+
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode()
+    {
+        return this.clazz != null ? clazz.hashCode() : 0;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString()
+    {
+        return "WebBeans Interceptor with class : " + "[" + this.clazz.getName() + "]";
+    }
+
+    @Override
+    public boolean isNullable()
+    {
+        return delegateComponent.isNullable();
+    }
+
+    @Override
+    public boolean isSerializable()
+    {
+        return delegateComponent.isSerializable();
+    }
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSUtil.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSUtil.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.jms;
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jpa/JPAUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jpa/JPAUtil.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jpa/JPAUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jpa/JPAUtil.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You 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.apache.webbeans.jpa;
 



Mime
View raw message