openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r728541 [1/2] - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/ component/xml/ config/ container/ decorator/ decorator/xml/ deployment/ deployment/stereotype/ event/ event/xml/ inject/xml/ interc...
Date Sun, 21 Dec 2008 22:40:57 GMT
Author: gerdogdu
Date: Sun Dec 21 14:40:56 2008
New Revision: 728541

URL: http://svn.apache.org/viewvc?rev=728541&view=rev
Log:
Updating XML configuration of the WebBeans.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java   (with props)
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java   (with props)
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java   (with props)
Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLProducerComponentImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java Sun Dec 21 14:40:56 2008
@@ -18,6 +18,7 @@
 
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -33,6 +34,8 @@
 import org.apache.webbeans.context.DependentContext;
 import org.apache.webbeans.deployment.DeploymentTypeManager;
 import org.apache.webbeans.intercept.InterceptorData;
+import org.apache.webbeans.intercept.InterceptorDataComparator;
+import org.apache.webbeans.intercept.InterceptorDataImpl;
 
 /**
  * 
@@ -52,9 +55,6 @@
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
- * @param <T>
- *            Type of the component instance that this Web Bean Component
- *            produces.
  */
 public abstract class AbstractComponent<T> extends Component<T>
 {
@@ -94,8 +94,10 @@
 	/** Holds decorator stack */
 	protected List<Object> decoratorStack = new ArrayList<Object>();
 	
+	/**The bean is serializable or not*/
 	protected boolean serializable;
 	
+	/**The bean allows nullable object*/
 	protected boolean nullable;
 
 	/**

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java Sun Dec 21 14:40:56 2008
@@ -44,21 +44,7 @@
 	{
 		super(manager);
 	}
-	
-	/**
-	 * Creates the new web beans component instance.
-	 * 
-	 * @return the new web beans component instance
-	 */
-	abstract public T create();
-
-	/**
-	 * Destorys the web beans component instance.
-	 * 
-	 * @param instance web beans component instance
-	 */
-	abstract public void destroy(T instance);
-	
+		
 	abstract public Annotation getType();
 	
 	abstract public void setType(Annotation type);
@@ -71,6 +57,10 @@
 	
 	abstract public void addBindingType(Annotation bindingType);
 	
+	abstract public void addStereoType(Annotation stereoType);
+	
+	abstract public void addApiType(Class<?> apiType);
+	
 	abstract public Set<Annotation> getImplBindingTypes();
 	
 	abstract public Set<Annotation> getStereoTypes();
@@ -90,4 +80,4 @@
 	abstract public void setSerializable(boolean serializable);
 	
 	abstract public void setNullable(boolean nullable);
-}
+}
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLProducerComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLProducerComponentImpl.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLProducerComponentImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLProducerComponentImpl.java Sun Dec 21 14:40:56 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.webbeans.component.xml;
 
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -33,6 +34,8 @@
 	
 	private List<XMLInjectionPointModel> disposalMethodParameters = new ArrayList<XMLInjectionPointModel>();
 	
+	private Type[] actualTypeArguments = new Type[0];
+	
 	public XMLProducerComponentImpl(AbstractComponent<?> parent, Class<T> returnType)
 	{
 		super(parent, returnType);
@@ -51,6 +54,21 @@
 		this.disposalMethodParameters.add(model);
 	}
 	
+	/* (non-Javadoc)
+	 * @see org.apache.webbeans.component.ProducerComponentImpl#getActualTypeArguments()
+	 */
+	@Override
+	public Type[] getActualTypeArguments()
+	{
+		return this.actualTypeArguments; 
+	}
+	
+	public void setActualTypeArguments(Type[] actualTypeArguments)
+	{
+		this.actualTypeArguments = actualTypeArguments;
+	}
+	 
+
 	protected void destroyInstance(T instance)
 	{
 		if(disposalMethod != null)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Sun Dec 21 14:40:56 2008
@@ -42,6 +42,7 @@
 import org.apache.webbeans.annotation.CurrentLiteral;
 import org.apache.webbeans.annotation.DependentScopeLiteral;
 import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.component.Component;
 import org.apache.webbeans.component.ComponentImpl;
 import org.apache.webbeans.component.ObservesMethodsOwner;
 import org.apache.webbeans.component.ProducerComponentImpl;
@@ -102,7 +103,7 @@
 		else
 		{
 			
-			component.setType(WebBeansUtil.getMaxPrecedenceSteroTypeDeploymentType(beanAnnotations));
+			component.setType(WebBeansUtil.getMaxPrecedenceSteroTypeDeploymentType(component));
 		}
 		
 		return component.getDeploymentType();
@@ -218,44 +219,66 @@
 		
 		if(!found)
 		{
-			Annotation[] stereos = AnnotationUtil.getStereotypeMetaAnnotations(annotations);
-			if(stereos.length == 0)
+			defineDefaultScopeType(component, exceptionMessage);
+		}	
+	}
+	
+	public static <T> void defineStereoTypes(Component<?> component, Class<T> clazz)
+	{
+		Annotation[] anns = clazz.getAnnotations();
+		
+		if(AnnotationUtil.isStereoTypeMetaAnnotationExist(anns))
+		{
+			Annotation[] steroAnns = AnnotationUtil.getStereotypeMetaAnnotations(anns);
+			
+			for(Annotation stereo : steroAnns)
 			{
-				component.setImplScopeType(new DependentScopeLiteral());
+				component.addStereoType(stereo);
 			}
-			else
+		}
+	}
+	
+	public static void defineDefaultScopeType(Component<?> component, String exceptionMessage)
+	{		
+		Set<Annotation> stereos = component.getStereoTypes();
+		if(stereos.size() == 0)
+		{
+			component.setImplScopeType(new DependentScopeLiteral());
+		}
+		else
+		{
+			Annotation defined = null;
+			Set<Annotation> anns = component.getStereoTypes();
+			for(Annotation stero : anns)
 			{
-				Annotation defined = null;
-				for(Annotation stero : stereos)
+				if(AnnotationUtil.isMetaAnnotationExist(stero.annotationType().getAnnotations(), ScopeType.class))
 				{
-					if(AnnotationUtil.isMetaAnnotationExist(stero.annotationType().getAnnotations(), ScopeType.class))
+					Annotation next = AnnotationUtil.getMetaAnnotations(stero.annotationType().getAnnotations(), ScopeType.class)[0];
+					
+					if(defined == null)
 					{
-						Annotation next = AnnotationUtil.getMetaAnnotations(stero.annotationType().getAnnotations(), ScopeType.class)[0];
-						
-						if(defined == null)
+						defined = next;
+					}
+					else
+					{
+						if(!defined.equals(next))
 						{
-							defined = next;
+						  throw new WebBeansConfigurationException(exceptionMessage);
 						}
-						else
-						{
-							if(!defined.equals(next))
-							{
-							  throw new WebBeansConfigurationException(exceptionMessage);
-							}
-						}	
-					}
+					}	
 				}
-				
-				if(defined != null)
-				{
-					component.setImplScopeType(defined);
-				}
-				else
-				{
-					component.setImplScopeType(new DependentScopeLiteral());
-				}					
-			}				
-		}	
+			}
+			
+			if(defined != null)
+			{
+				component.setImplScopeType(defined);
+			}
+			else
+			{
+				component.setImplScopeType(new DependentScopeLiteral());
+			}					
+		}				
+		
 	}
 	
 	/**
@@ -280,7 +303,7 @@
 		if(nameAnnot == null) //no @Named
 		{
 			//Check for stereottype
-			if(WebBeansUtil.isNamedExistOnStereoTypes(anns))
+			if(WebBeansUtil.isNamedExistOnStereoTypes(component))
 			{
 				isDefault = true;
 			}
@@ -369,7 +392,7 @@
 		DefinitionUtil.defineBindingTypes(component, methodAnns);
 		DefinitionUtil.defineName(component, methodAnns, WebBeansUtil.getProducerDefaultName(method.getName()));
 		
-		WebBeansUtil.checkSteroTypeRequirements(component.getTypes(), component.getScopeType(), methodAnns , "WebBeans producer method : " + method.getName() + " in class : " + parent.getReturnType().getName());
+		WebBeansUtil.checkSteroTypeRequirements(component, methodAnns , "WebBeans producer method : " + method.getName() + " in class : " + parent.getReturnType().getName());
 		
 		
 		return component;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java Sun Dec 21 14:40:56 2008
@@ -127,7 +127,7 @@
 
 		Annotation[] clazzAnns = clazz.getAnnotations();
 
-		
+		DefinitionUtil.defineStereoTypes(component,clazz);
 		DefinitionUtil.defineApiTypes(component, clazz);
 		DefinitionUtil.defineScopeType(component, clazzAnns, "WebBeans component implementation class : " + clazz.getName() + " must declare default @ScopeType annotation");
 		WebBeansUtil.checkPassivationScope(component, component.getScopeType().getAnnotation(ScopeType.class));
@@ -136,7 +136,7 @@
 		
 		component.setConstructor(WebBeansUtil.defineConstructor(clazz));
 		
-		WebBeansUtil.checkSteroTypeRequirements(component.getTypes(), component.getScopeType(), clazz.getAnnotations(),"WebBeans component  class : " + clazz.getName() );
+		WebBeansUtil.checkSteroTypeRequirements(component, clazz.getAnnotations(),"WebBeans component  class : " + clazz.getName() );
 		
 		Set<ProducerComponentImpl<?>> producerComponents = DefinitionUtil.defineProducerMethods(component);
 		ManagerImpl.getManager().getBeans().addAll(producerComponents);

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java Sun Dec 21 14:40:56 2008
@@ -17,6 +17,7 @@
 package org.apache.webbeans.container;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
 import java.lang.reflect.Type;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -286,4 +287,9 @@
 		
 		return result;
 	}		
+	
+	public static void main(String[] args)
+	{
+		System.out.println(Array.newInstance(Integer.class, 0).getClass());
+	}
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java Sun Dec 21 14:40:56 2008
@@ -39,13 +39,16 @@
 	/**Decorator class*/
 	private Class<?> clazz; 
 	
+	/**Decorates api types*/
 	private Set<Class<?>> decoratedTypes = new HashSet<Class<?>>();
 	
-	private Class<?> delegateType;
+	/**Delegate field class type*/
+	protected Class<?> delegateType;
 	
-	private Set<Annotation> delegateBindingTypes = new HashSet<Annotation>();
+	/**Delegate field binding types*/
+	protected Set<Annotation> delegateBindingTypes = new HashSet<Annotation>();
 	
-	/**Simple Web Beans component*/
+	/**Delegated component*/
 	private AbstractComponent<Object> delegateComponent;
 	
 	
@@ -59,7 +62,7 @@
 	}
 	
 	
-	private void init()
+	protected void init()
 	{
 		ClassUtil.setInterfaceTypeHierarchy(this.decoratedTypes, this.clazz);
 		
@@ -72,7 +75,7 @@
 	}
 	
 	
-	private void initDelegate()
+	protected void initDelegate()
 	{
 		Field field = ClassUtil.getFieldWithAnnotation(this.clazz, Decorates.class);
 		this.delegateType = field.getType();

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java Sun Dec 21 14:40:56 2008
@@ -29,6 +29,8 @@
 import org.apache.webbeans.annotation.CurrentLiteral;
 import org.apache.webbeans.component.AbstractComponent;
 import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.decorator.xml.WebBeansXMLDecorator;
+import org.apache.webbeans.inject.xml.XMLInjectionPointModel;
 import org.apache.webbeans.logger.WebBeansLogger;
 
 public final class WebBeansDecoratorConfig
@@ -43,11 +45,22 @@
 	
 	public static void configureDecoratorClass(AbstractComponent<Object> delegate)
 	{
-		logger.info("Configuring the Web Beans Interceptor Class : " + delegate.getReturnType().getName() + " started");
+		logger.info("Configuring the Web Beans Annoatated Decorator Class : " + delegate.getReturnType().getName() + " started");
 
 		WebBeansDecorator decorator = new WebBeansDecorator(delegate);
 
-		logger.info("Configuring the Web Beans Interceptor Class : " + delegate.getReturnType() + " ended");
+		logger.info("Configuring the Web Beans Annotated Decorator Class : " + delegate.getReturnType() + " ended");
+
+		ManagerImpl.getManager().addDecorator(decorator);
+	}
+
+	public static void configureXMLDecoratorClass(AbstractComponent<Object> delegate, XMLInjectionPointModel model)
+	{
+		logger.info("Configuring the Web Beans XML based Decorator Class : " + delegate.getReturnType().getName() + " started");
+
+		WebBeansXMLDecorator decorator = new WebBeansXMLDecorator(delegate,model);
+
+		logger.info("Configuring the Web Beans XML based Decorator Class : " + delegate.getReturnType() + " ended");
 
 		ManagerImpl.getManager().addDecorator(decorator);
 	}

Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java?rev=728541&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java Sun Dec 21 14:40:56 2008
@@ -0,0 +1,45 @@
+/*
+ *  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.decorator.xml;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.decorator.WebBeansDecorator;
+import org.apache.webbeans.inject.xml.XMLInjectionPointModel;
+
+public class WebBeansXMLDecorator extends WebBeansDecorator
+{
+	private XMLInjectionPointModel decoratesModel = null;
+	
+	public WebBeansXMLDecorator(AbstractComponent<Object> delegateComponent, XMLInjectionPointModel model)
+	{
+		super(delegateComponent);
+		this.decoratesModel = model;
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.webbeans.decorator.WebBeansDecorator#initDelegate()
+	 */
+	@Override
+	protected void initDelegate()
+	{
+		this.delegateType = decoratesModel.getInjectionClassType();
+		this.delegateBindingTypes = decoratesModel.getBindingTypes();
+	}
+
+	
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java Sun Dec 21 14:40:56 2008
@@ -17,6 +17,8 @@
 package org.apache.webbeans.deployment;
 
 import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
@@ -27,6 +29,7 @@
 import javax.webbeans.Stereotype;
 
 import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 
@@ -44,7 +47,9 @@
 	
 	private Set<Class<?>>  restrictedTypes = null;
 	
-	private Annotation interceptorBindingType;
+	private Set<Annotation> interceptorBindingTypes = new HashSet<Annotation>();
+	
+	private Set<Annotation> inherits = new HashSet<Annotation>();
 	
 	
 	public StereoTypeModel(Class<?> clazz)
@@ -61,6 +66,59 @@
 			this.defaultScopeType = AnnotationUtil.getMetaAnnotations(clazz.getAnnotations(), ScopeType.class)[0];
 		}
 		
+		if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getAnnotations()))
+		{
+			Annotation[] ibs = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazz.getAnnotations());
+			for(Annotation ann : ibs)
+			{
+				this.interceptorBindingTypes.add(ann);
+			}
+		}
+		
+		if(AnnotationUtil.isStereoTypeMetaAnnotationExist(clazz.getAnnotations()))
+		{
+			Annotation[] isy = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getAnnotations());
+			
+			Target outerStereo = clazz.getAnnotation(Target.class);
+			for(Annotation is : isy)
+			{
+				Target innerStereo = is.annotationType().getAnnotation(Target.class);
+				
+				ElementType[] innerValues = innerStereo.value();
+				ElementType[] outerValues = outerStereo.value();
+				
+				for(ElementType innerValue : innerValues)
+				{
+					if(innerValue.equals(ElementType.METHOD))
+					{
+						for(ElementType outerValue : outerValues)
+						{
+							if(outerValue.equals(ElementType.TYPE))
+							{
+								throw new WebBeansConfigurationException("Inherited StereoType with class name : " + clazz.getName() + 
+										" must have compatible @Target annotation with Stereotype class name : " + clazz.getName());
+							}
+						}
+					}
+					else if(innerValue.equals(ElementType.TYPE))
+					{
+						for(ElementType outerValue : outerValues)
+						{
+							if(outerValue.equals(ElementType.METHOD))
+							{
+								throw new WebBeansConfigurationException("Inherited StereoType with class name : " + clazz.getName() + 
+										" must have compatible @Target annotation with Stereotype class name : " + clazz.getName());
+							}
+						}							
+					}
+				}
+				
+				this.inherits.add(is);
+				
+			}
+						
+		}
+		
 		configureScopes(clazz);
 		configureTypes(clazz);
 	}
@@ -120,9 +178,14 @@
 		return defaultScopeType;
 	}
 
-	public Annotation getInterceptorBindingType()
+	public Set<Annotation> getInterceptorBindingTypes()
+	{
+		return this.interceptorBindingTypes;
+	}
+	
+	public Set<Annotation> getInheritedStereoTypes()
 	{
-		return this.interceptorBindingType;
+		return this.inherits;
 	}
 
 	/**

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java Sun Dec 21 14:40:56 2008
@@ -51,6 +51,8 @@
 	private Set<Annotation> interceptorBindingTypes = new HashSet<Annotation>();
 	
 	private Annotation defaultName = null;
+	
+	private Set<Annotation> inherits = new HashSet<Annotation>();
 
 	
 	public XMLStereoTypeModel(Element stereoTypeDecleration, String name, String errorMessage)
@@ -84,6 +86,7 @@
 				
 				annClazz = (Class<? extends Annotation>)clazz;
 				Annotation defaultAnn = JavassistProxyFactory.createNewAnnotationProxy(annClazz);
+				
 				if(clazz.isAnnotationPresent(ScopeType.class))
 				{
 					if(scopeTypeFound)
@@ -113,7 +116,8 @@
 						throw new WebBeansConfigurationException(errorMessage + "Stereotype with @InterceptorBindingType must be defined as @Target{TYPE}");
 					}
 					
-					interceptorBindingTypes.add(defaultAnn);
+					
+					interceptorBindingTypes.add(XMLUtil.getXMLDefinedAnnotationMember(child, annClazz, errorMessage));
 				}
 				else if(clazz.equals(Named.class))
 				{
@@ -129,6 +133,45 @@
 					throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not define @BindingType annotation");
 				}
 				
+				else if(AnnotationUtil.isStereoTypeAnnotation(annClazz))
+				{
+					Target innerStereo = clazz.getAnnotation(Target.class);
+					Class<?> outerStereoClass = XMLUtil.getElementJavaType(stereoTypeDecleration);
+					Target outerStereo = outerStereoClass.getAnnotation(Target.class);
+					
+					ElementType[] innerValues = innerStereo.value();
+					ElementType[] outerValues = outerStereo.value();
+					
+					for(ElementType innerValue : innerValues)
+					{
+						if(innerValue.equals(ElementType.METHOD))
+						{
+							for(ElementType outerValue : outerValues)
+							{
+								if(outerValue.equals(ElementType.TYPE))
+								{
+									throw new WebBeansConfigurationException(errorMessage + "Inherited StereoType with class name : " + clazz.getName() + 
+											" must have compatible @Target annotation with Stereotype class name : " + outerStereoClass.getName());
+								}
+							}
+						}
+						else if(innerValue.equals(ElementType.TYPE))
+						{
+							for(ElementType outerValue : outerValues)
+							{
+								if(outerValue.equals(ElementType.METHOD))
+								{
+									throw new WebBeansConfigurationException(errorMessage + "Inherited StereoType with class name : " + clazz.getName() + 
+											" must have compatible @Target annotation with Stereotype class name : " + outerStereoClass.getName());
+								}
+							}							
+						}
+					}
+					
+					this.inherits.add(defaultAnn);
+					
+				}
+				
 				else
 				{
 					throw new WebBeansConfigurationException(errorMessage + "Type with class name : " + XMLUtil.getElementJavaClassName(child) + " is not applicable for stereotype");
@@ -147,11 +190,16 @@
 		return this.defaultScopeType;
 	}
 	
-	public Set<Annotation> getInterceptorBindingType()
+	public Set<Annotation> getInterceptorBindingTypes()
 	{
 		return this.interceptorBindingTypes;
 	}
 	
+	public Set<Annotation> getInheritedStereoTypes()
+	{
+		return this.inherits;
+	}
+	
 	public Annotation getDefaultNamed()
 	{
 		return this.defaultName;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java Sun Dec 21 14:40:56 2008
@@ -45,9 +45,22 @@
 	 * @return the supportedScopes
 	 */
 	public Set<Class<? extends Annotation>> getSupportedScopes();
+	
 	/**
 	 * @return the restrictedTypes
 	 */
 	public Set<Class<?>> getRestrictedTypes();
 	
+	/**
+	 * 
+	 * @return
+	 */
+	public Set<Annotation> getInterceptorBindingTypes();
+	
+	/**
+	 * 
+	 * @return
+	 */
+	public Set<Annotation> getInheritedStereoTypes();
+	
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java Sun Dec 21 14:40:56 2008
@@ -135,7 +135,7 @@
 		
 	}
 	
-	private List<Object> getMethodArguments(Object event)
+	protected List<Object> getMethodArguments(Object event)
 	{
 		Type[] types = this.observerMethod.getGenericParameterTypes();
 		Annotation[][] annots = this.observerMethod.getParameterAnnotations();

Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java?rev=728541&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java Sun Dec 21 14:40:56 2008
@@ -0,0 +1,67 @@
+/*
+ *  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.event.xml;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.webbeans.manager.Manager;
+
+import org.apache.webbeans.component.ObservesMethodsOwner;
+import org.apache.webbeans.container.InjectionResolver;
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.event.BeanObserverImpl;
+import org.apache.webbeans.event.TransactionalObserverType;
+import org.apache.webbeans.inject.xml.XMLInjectionPointModel;
+
+public class BeanObserverXMLImpl<T> extends BeanObserverImpl<T>
+{
+	private List<XMLInjectionPointModel> observersParameters = new ArrayList<XMLInjectionPointModel>();
+	
+	public BeanObserverXMLImpl(ObservesMethodsOwner<?> bean, Method observerMethod, boolean ifExist, TransactionalObserverType type)
+	{
+		super(bean, observerMethod, ifExist, type);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.webbeans.event.BeanObserverImpl#getMethodArguments(java.lang.Object)
+	 */
+	@Override
+	protected List<Object> getMethodArguments(Object event)
+	{
+		List<Object> params = new ArrayList<Object>();
+		Manager manager = ManagerImpl.getManager();
+		for(XMLInjectionPointModel model : observersParameters)
+		{
+			Set<Annotation> setBindingTypes = model.getBindingTypes();
+			Annotation[] anns = new Annotation[setBindingTypes.size()];
+			anns = setBindingTypes.toArray(anns);
+			params.add(manager.getInstance(InjectionResolver.getInstance().implResolveByType(model.getInjectionClassType(), model.getActualTypeArguments(), anns).iterator().next()));
+		}
+		
+		return params;
+	}
+	
+	public void addXMLInjectionObservesParameter(XMLInjectionPointModel model)
+	{
+		this.observersParameters.add(model);
+	}
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java Sun Dec 21 14:40:56 2008
@@ -52,6 +52,16 @@
 	/**Injection point binding types*/
 	private Set<Annotation> bindingTypes = new HashSet<Annotation>();
 	
+	/**This injection model is array*/
+	private boolean array;
+	
+	
+	public XMLInjectionPointModel(Class<?> arrayElementType)
+	{
+		this.array = true;
+		this.injectionClassType = arrayElementType;
+	}
+	
 	/**
 	 * Creates new injection point model.
 	 * 
@@ -122,6 +132,14 @@
 	{
 		return Collections.unmodifiableSet(this.bindingTypes);
 	}
+	
+	/**
+	 * @return the array
+	 */
+	public boolean isArray()
+	{
+		return array;
+	}
 
 	/* (non-Javadoc)
 	 * @see java.lang.Object#hashCode()

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java Sun Dec 21 14:40:56 2008
@@ -23,8 +23,9 @@
 import javax.annotation.PreDestroy;
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.Interceptors;
-import javax.webbeans.Interceptor;
+
 import javax.webbeans.InterceptorBindingType;
+import javax.webbeans.manager.Interceptor;
 
 /**
  * Web Beans general interceptor API contract. There are two types of interceptor
@@ -140,4 +141,8 @@
 	 * @return true if interceptor is configured with webbeans interceptor definition
 	 */
 	public boolean isDefinedWithWebBeansInterceptor();
+	
+	public void setWebBeansInterceptor(Interceptor webBeansInterceptor);
+	
+	public Interceptor getWebBeansInterceptor();
 }

Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java?rev=728541&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java Sun Dec 21 14:40:56 2008
@@ -0,0 +1,67 @@
+/*
+ *  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;
+
+import java.util.Comparator;
+
+import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
+
+public class InterceptorDataComparator implements Comparator<InterceptorData>
+{
+
+	/* (non-Javadoc)
+	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+	 */
+	public int compare(InterceptorData o1, InterceptorData o2)
+	{
+		if(o1.equals(o2))
+		{
+			return 0;
+		}
+		else
+		{
+			WebBeansInterceptor interceptorFirst = (WebBeansInterceptor)o1.getWebBeansInterceptor();
+			WebBeansInterceptor interceptorSecond = (WebBeansInterceptor)o2.getWebBeansInterceptor();
+			
+			if(interceptorFirst == null && interceptorSecond == null)
+			{
+				return 0;
+			}
+			
+			if(interceptorFirst == null)
+			{
+				
+				return 1;
+			}
+			else if(interceptorSecond == null)
+			{
+				return -1;
+			}
+			else
+			{
+				Class<?> o1Clazz = interceptorFirst.getClazz();
+				Class<?> o2Clazz = interceptorSecond.getClazz();
+				
+				return InterceptorsManager.getInstance().compare(o1Clazz, o2Clazz);
+			}
+			
+		}
+	}
+			
+
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java Sun Dec 21 14:40:56 2008
@@ -18,10 +18,14 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
+import java.util.Comparator;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.interceptor.AroundInvoke;
+import javax.webbeans.manager.Interceptor;
+
+import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
 
 /**
  * Abstract implementation of the {@link InterceptorData} api
@@ -41,6 +45,8 @@
 	/**Predestroy Method*/
 	private  Method preDestroy = null;
 	
+	private Interceptor webBeansInterceptor;
+	
 	/**Instance of the method*/
 	private Object interceptorInstance;
 	
@@ -216,6 +222,22 @@
 	{
 		return isDefinedWithWebBeansInterceptor;
 	}
-			
 
+	/**
+	 * @return the webBeansInterceptor
+	 */
+	public Interceptor getWebBeansInterceptor()
+	{
+		return webBeansInterceptor;
+	}
+
+	/**
+	 * @param webBeansInterceptor the webBeansInterceptor to set
+	 */
+	public void setWebBeansInterceptor(Interceptor webBeansInterceptor)
+	{
+		this.webBeansInterceptor = webBeansInterceptor;
+	}
+
+	
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java Sun Dec 21 14:40:56 2008
@@ -18,6 +18,7 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -70,6 +71,8 @@
 			//Run around invoke chain
 			List<InterceptorData> stack = component.getInterceptorStack();
 			
+			Collections.sort(stack, new InterceptorDataComparator());
+			
 			filterEJBInterceptorStackList(stack, method);
 			filterWebBeansInterceptorStackList(stack, method);
 			

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=728541&r1=728540&r2=728541&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 Sun Dec 21 14:40:56 2008
@@ -40,7 +40,6 @@
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
-import org.apache.webbeans.util.WebBeansUtil;
 
 public final class InterceptorUtil
 {
@@ -191,9 +190,16 @@
 			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(clazz.getDeclaredAnnotations());
+			Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);
 			
 			for(Annotation annotation : anns)
 			{
@@ -202,10 +208,11 @@
 				
 				if(!(elementTypes.length == 1 && elementTypes[0].equals(ElementType.TYPE)))
 				{
-					throw new WebBeansConfigurationException("Lifecycle interceptor : " + clazz.getName()+ " interceptor binding type must be defined as @Target{TYPE}");
+					throw new WebBeansConfigurationException(errorMessage);
 				}
 			}
 		}		
+		
 	}
 	
 	public static void checkSimpleWebBeansInterceptorConditions(Class<?> clazz)
@@ -219,7 +226,7 @@
 			hasClassInterceptors = true;
 		}else
 		{
-			Annotation[] stereoTypes = WebBeansUtil.getComponentStereoTypes(anns);
+			Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getAnnotations());
 			for(Annotation stero : stereoTypes)
 			{
 				if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))

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=728541&r1=728540&r2=728541&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 Sun Dec 21 14:40:56 2008
@@ -63,15 +63,13 @@
 	 * @param interceptorClazz
 	 *            interceptor class
 	 */
-	public static void configureInterceptorClass(AbstractComponent<Object> delegate)
+	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);
 
-		Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(delegate.getReturnType().getDeclaredAnnotations());
-
-		for (Annotation ann : anns)
+		for (Annotation ann : interceptorBindingTypes)
 		{
 			interceptor.addInterceptorBindingType(ann.annotationType(), ann);
 		}
@@ -102,7 +100,7 @@
 				bindingTypeSet.add(ann);
 			}
 			
-			Annotation[] stereoTypes = WebBeansUtil.getComponentStereoTypes(clazz.getDeclaredAnnotations());
+			Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
 			for(Annotation stero : stereoTypes)
 			{
 				if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
@@ -122,7 +120,7 @@
 			Set<Interceptor> set = findDeployedWebBeansInterceptor(anns);
 
 			// Adding class interceptors
-			addComponentInterceptors(set, clazz, stack);
+			addComponentInterceptors(set, stack);
 		}
 
 		// Method level interceptors.
@@ -130,7 +128,7 @@
 
 	}
 
-	private static void addComponentInterceptors(Set<Interceptor> set, Class<?> clazz, List<InterceptorData> stack)
+	public static void addComponentInterceptors(Set<Interceptor> set, List<InterceptorData> stack)
 	{
 		Iterator<Interceptor> it = set.iterator();
 		while (it.hasNext())
@@ -138,9 +136,9 @@
 			WebBeansInterceptor interceptor = (WebBeansInterceptor) it.next();
 
 			// interceptor binding
-			WebBeansUtil.configureInterceptorMethods(interceptor.getClazz(), AroundInvoke.class, true, false, stack, null, true);
-			WebBeansUtil.configureInterceptorMethods(interceptor.getClazz(), PostConstruct.class, true, false, stack, null, true);
-			WebBeansUtil.configureInterceptorMethods(interceptor.getClazz(), PreDestroy.class, true, false, stack, null, true);
+			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);
 
 		}
 
@@ -170,7 +168,7 @@
 					set.add(ann);
 				}
 				
-				Annotation[] stereoTypes = WebBeansUtil.getComponentStereoTypes(clazz.getDeclaredAnnotations());
+				Annotation[] stereoTypes = AnnotationUtil.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
 				for(Annotation stero : stereoTypes)
 				{
 					if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
@@ -194,9 +192,9 @@
 				{
 					WebBeansInterceptor interceptor = (WebBeansInterceptor) it.next();
 
-					WebBeansUtil.configureInterceptorMethods(interceptor.getClazz(), AroundInvoke.class, false, true, stack, method, true);
-					WebBeansUtil.configureInterceptorMethods(interceptor.getClazz(), PostConstruct.class, false, true, stack, method, true);
-					WebBeansUtil.configureInterceptorMethods(interceptor.getClazz(), PreDestroy.class, false, true, stack, method, true);
+					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);
 				}
 
 			}

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=728541&r1=728540&r2=728541&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 Sun Dec 21 14:40:56 2008
@@ -86,9 +86,9 @@
 			configureInterceptorAnnots(superClass, stack, false,null);			
 		}
 
-		WebBeansUtil.configureInterceptorMethods(clazz, AroundInvoke.class,true,isMethod,stack,m,false);
-		WebBeansUtil.configureInterceptorMethods(clazz, PostConstruct.class,true,isMethod,stack,m,false);
-		WebBeansUtil.configureInterceptorMethods(clazz, PreDestroy.class,true,isMethod,stack,m,false);
+		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);
 		
 	}
 		
@@ -124,9 +124,9 @@
 		configureBeanSuperClassAnnots(listSuperClazz,stack);
 		
 		//3- Bean itself
-		WebBeansUtil.configureInterceptorMethods(clazz, AroundInvoke.class,false,false,stack,null,false);
-		WebBeansUtil.configureInterceptorMethods(clazz, PostConstruct.class,false,false,stack,null,false);
-		WebBeansUtil.configureInterceptorMethods(clazz, PreDestroy.class,false,false,stack,null,false);
+		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);
 		
 	}
 	
@@ -142,9 +142,9 @@
 			Class<?> clazz = list.get(j);
 			if(!clazz.equals(Object.class))
 			{
-				WebBeansUtil.configureInterceptorMethods(clazz, AroundInvoke.class,false,false,stack,null,false);
-				WebBeansUtil.configureInterceptorMethods(clazz, PostConstruct.class,false,false,stack,null,false);
-				WebBeansUtil.configureInterceptorMethods(clazz, PreDestroy.class,false,false,stack,null,false);				
+				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);				
 			}
 		}
 	}

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=728541&r1=728540&r2=728541&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 Sun Dec 21 14:40:56 2008
@@ -35,7 +35,6 @@
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.intercept.InterceptorUtil;
 import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
-import org.apache.webbeans.proxy.JavassistProxyFactory;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 import org.apache.webbeans.xml.XMLAnnotationTypeManager;
@@ -168,21 +167,14 @@
 		while(it.hasNext())
 		{
 			Class<? extends Annotation> clazzAnnot = it.next();
-			Set<Class<? extends Annotation>> declared = null; 
+			Set<Annotation> declared = null; 
 			Annotation[] anns = null;
 			
 			if(XMLAnnotationTypeManager.getInstance().isInterceptorBindingTypeExist(clazzAnnot))
 			{
 				declared = XMLAnnotationTypeManager.getInstance().getInterceptorBindingTypeInherites(clazzAnnot);
 				anns = new Annotation[declared.size()];
-				
-				int i  = 0;
-				for(Class<? extends Annotation> clz : declared)
-				{
-					anns[i] = JavassistProxyFactory.createNewAnnotationProxy(clz);
-					i++;
-				}
-				
+				anns = declared.toArray(anns);
 			}
 			
 			else if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazzAnnot.getAnnotations()))

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Sun Dec 21 14:40:56 2008
@@ -1290,5 +1290,5 @@
 		
 		
 		return found;
-	}		
+	}	
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Sun Dec 21 14:40:56 2008
@@ -65,6 +65,7 @@
 import javax.webbeans.SessionScoped;
 import javax.webbeans.UnproxyableDependencyException;
 import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Interceptor;
 import javax.webbeans.manager.Manager;
 
 import org.apache.webbeans.annotation.CurrentLiteral;
@@ -74,6 +75,7 @@
 import org.apache.webbeans.annotation.RequestedScopeLiteral;
 import org.apache.webbeans.annotation.StandardLiteral;
 import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.component.Component;
 import org.apache.webbeans.component.ComponentImpl;
 import org.apache.webbeans.component.ConversationComponent;
 import org.apache.webbeans.component.ManagerComponentImpl;
@@ -682,7 +684,7 @@
 	 * @param isDefinedWithWebBeans
 	 *            if interceptor is defined with WebBeans spec, not EJB spec
 	 */
-	public static void configureInterceptorMethods(Class<?> clazz, Class<? extends Annotation> annotation, boolean definedInInterceptorClass, boolean definedInMethod, List<InterceptorData> stack, Method annotatedInterceptorClassMethod, boolean isDefinedWithWebBeans)
+	public static void configureInterceptorMethods(Interceptor webBeansInterceptor, Class<?> clazz, Class<? extends Annotation> annotation, boolean definedInInterceptorClass, boolean definedInMethod, List<InterceptorData> stack, Method annotatedInterceptorClassMethod, boolean isDefinedWithWebBeans)
 	{
 		InterceptorData intData = null;
 		Method method = null;
@@ -716,6 +718,7 @@
 			intData.setDefinedInInterceptorClass(definedInInterceptorClass);
 			intData.setDefinedInMethod(definedInMethod);
 			intData.setAnnotatedMethod(annotatedInterceptorClassMethod);
+			intData.setWebBeansInterceptor(webBeansInterceptor);
 
 			if (definedInInterceptorClass)
 			{
@@ -725,7 +728,8 @@
 					{
 						throw new WebBeansConfigurationException("Interceptor class : " + clazz.getName() + " must have no-arg constructor");
 					}
-
+					
+					
 					intData.setInterceptorInstance(clazz.newInstance());
 
 				} catch (WebBeansConfigurationException e1)
@@ -854,10 +858,13 @@
 	 *            annotation array
 	 * @return true if array contains the StereoType meta annotation
 	 */
-	public static boolean isComponentHasStereoType(Annotation[] anns)
+	public static boolean isComponentHasStereoType(Component<?> component)
 	{
-		Asserts.assertNotNull(anns, "Anns parameter can not be null");
+		Asserts.assertNotNull(component, "component parameter can not be null");
 
+		Set<Annotation> set = component.getStereoTypes();
+		Annotation[] anns = new Annotation[set.size()];
+		anns = set.toArray(anns);
 		if (AnnotationUtil.isStereoTypeMetaAnnotationExist(anns))
 		{
 			return true;
@@ -866,20 +873,24 @@
 		return false;
 	}
 
-	public static Annotation[] getComponentStereoTypes(Annotation[] anns)
+	public static Annotation[] getComponentStereoTypes(Component<?> component)
 	{
-		Asserts.assertNotNull(anns, "Anns parameter can not be null");
-		if (isComponentHasStereoType(anns))
+		Asserts.assertNotNull(component, "component parameter can not be null");
+		if (isComponentHasStereoType(component))
 		{
+			Set<Annotation> set = component.getStereoTypes();
+			Annotation[] anns = new Annotation[set.size()];
+			anns = set.toArray(anns);
+			
 			return AnnotationUtil.getStereotypeMetaAnnotations(anns);
 		}
 
 		return new Annotation[] {};
 	}
 
-	public static boolean isNamedExistOnStereoTypes(Annotation[] anns)
+	public static boolean isNamedExistOnStereoTypes(Component<?> component)
 	{
-		Annotation[] types = getComponentStereoTypes(anns);
+		Annotation[] types = getComponentStereoTypes(component);
 
 		for (Annotation ann : types)
 		{
@@ -892,9 +903,9 @@
 		return false;
 	}
 
-	public static Annotation getMaxPrecedenceSteroTypeDeploymentType(Annotation[] anns)
+	public static Annotation getMaxPrecedenceSteroTypeDeploymentType(Component<?> component)
 	{
-		Annotation[] deploymentTypes = getComponentStereoTypes(anns);
+		Annotation[] deploymentTypes = getComponentStereoTypes(component);
 		Class<? extends Annotation> maxPrecedDeploymentType = null;
 		Annotation result = null;
 		if (deploymentTypes.length > 0)
@@ -1061,9 +1072,9 @@
 		return null;
 	}
 
-	public static void checkSteroTypeRequirements(Set<Class<?>> apiTypes, Class<? extends Annotation> scope, Annotation[] anns, String errorMessage)
+	public static void checkSteroTypeRequirements(Component<?> component, Annotation[] anns, String errorMessage)
 	{
-		Annotation[] stereoTypes = getComponentStereoTypes(anns);
+		Annotation[] stereoTypes = getComponentStereoTypes(component);
 		for (Annotation stereoType : stereoTypes)
 		{
 			IStereoTypeModel model = StereoTypeManager.getInstance().getStereoTypeModel(stereoType.annotationType().getName());
@@ -1074,7 +1085,7 @@
 				Iterator<Class<?>> itTypes = rtypes.iterator();
 				while (itTypes.hasNext())
 				{
-					if (!apiTypes.contains(itTypes.next()))
+					if (!component.getTypes().contains(itTypes.next()))
 					{
 						throw new WebBeansConfigurationException(errorMessage + " must contains all supported api types in the @Stereotype annotation " + model.getName());
 
@@ -1087,7 +1098,7 @@
 			{
 				if (!suppScopes.isEmpty())
 				{
-					if (!suppScopes.contains(scope))
+					if (!suppScopes.contains(component.getScopeType()))
 					{
 						throw new WebBeansConfigurationException(errorMessage + " must contains all required scope types in the @Stereotype annotation " + model.getName());
 					}
@@ -1254,7 +1265,7 @@
 			
 			if(component != null)
 			{
-				WebBeansInterceptorConfig.configureInterceptorClass((ComponentImpl<Object>)component);	
+				WebBeansInterceptorConfig.configureInterceptorClass((ComponentImpl<Object>)component, clazz.getDeclaredAnnotations());	
 			}			
 		}
 		
@@ -1275,6 +1286,5 @@
 				WebBeansDecoratorConfig.configureDecoratorClass((ComponentImpl<Object>)component);
 			}			
 		}		
-		
 	}
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=728541&r1=728540&r2=728541&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java Sun Dec 21 14:40:56 2008
@@ -39,6 +39,7 @@
 import javax.webbeans.AfterTransactionFailure;
 import javax.webbeans.AfterTransactionSuccess;
 import javax.webbeans.BeforeTransactionCompletion;
+import javax.webbeans.Decorator;
 import javax.webbeans.DefinitionException;
 import javax.webbeans.DeploymentException;
 import javax.webbeans.DeploymentType;
@@ -46,6 +47,7 @@
 import javax.webbeans.Disposes;
 import javax.webbeans.IfExists;
 import javax.webbeans.Initializer;
+import javax.webbeans.Interceptor;
 import javax.webbeans.NonexistentConstructorException;
 import javax.webbeans.NonexistentFieldException;
 import javax.webbeans.NonexistentMethodException;
@@ -56,8 +58,10 @@
 import javax.webbeans.ScopeType;
 
 import org.apache.webbeans.WebBeansConstants;
+import org.apache.webbeans.annotation.CurrentLiteral;
 import org.apache.webbeans.component.AbstractComponent;
 import org.apache.webbeans.component.xml.XMLComponentImpl;
+import org.apache.webbeans.component.xml.XMLProducerComponentImpl;
 import org.apache.webbeans.config.DefinitionUtil;
 import org.apache.webbeans.config.SimpleWebBeansConfigurator;
 import org.apache.webbeans.container.ManagerImpl;
@@ -323,7 +327,8 @@
 				throw new WebBeansConfigurationException(createConfigurationFailedMessage() +"InterceptorBinding type with given class : " + XMLUtil.getElementJavaClassName(child) + " is not interceptor binding annotation type");
 			}
 			
-			xmlAnnotTypeManager.addInterceotorBindingTypeInheritAnnotation(clazzAnnot, (Class<? extends Annotation>)clz);
+			Annotation inherited = XMLUtil.getXMLDefinedAnnotationMember(child, (Class<? extends Annotation>)clz, createConfigurationFailedMessage());
+			xmlAnnotTypeManager.addInterceotorBindingTypeInheritAnnotation(clazzAnnot, inherited);
 		}
 		
 	}
@@ -527,6 +532,24 @@
 		/*Checking XML defined simple webbeans condition check. Spec : 3.2.4*/
 		XMLDefinitionUtil.checkSimpleWebBeansInXML(simpleClass, webBeanDecleration, createConfigurationFailedMessage());
 		
+		/*If interceptor, check this is enabled*/
+		if(XMLUtil.isElementChildExistWithWebBeansNameSpace(webBeanDecleration, WebBeansConstants.WEB_BEANS_XML_INTERCEPTOR_ELEMENT))
+		{
+			if(!InterceptorsManager.getInstance().isInterceptorEnabled(simpleClass))
+			{
+				return null;
+			}
+		}
+		
+		/*If decorator, check this is enabled*/
+		if(XMLUtil.isElementChildExistWithWebBeansNameSpace(webBeanDecleration, WebBeansConstants.WEB_BEANS_XML_DECORATOR_ELEMENT))
+		{
+			if(!DecoratorsManager.getInstance().isDecoratorEnabled(simpleClass))
+			{
+				return null;
+			}
+		}
+		
 		/*Create new XML component with class name*/
 		XMLComponentImpl<T> component = new XMLComponentImpl<T>(simpleClass);
 		
@@ -571,7 +594,10 @@
 		List<Element> constructorParameterElementList = new ArrayList<Element>();
 		
 		/*Annotation set defined for webbeans*/
-		Set<Class<? extends Annotation>> annotationSet = new HashSet<Class<? extends Annotation>>();
+		List<Class<? extends Annotation>> annotationSet = new ArrayList<Class<? extends Annotation>>();
+		
+		/*Annotation defined element list*/
+		List<Element> annotationElementList = new ArrayList<Element>();
 
 		boolean isConstructor = false;
 		String fieldOrMethodName = null;
@@ -580,6 +606,8 @@
 			child = it.next();
 			Class<?> type = XMLUtil.getElementJavaType(child);
 
+			boolean isElementApplicable = false;
+			
 			//Java type then 2 possible outcome, Annotation type meta-data or constructor
 			if (type != null)
 			{
@@ -587,8 +615,10 @@
 				{
 					//Annotation types defined on the webbeans
 					Class<? extends Annotation> annot = (Class<Annotation>) type;
-					
 					annotationSet.add(annot);
+					annotationElementList.add(child);
+					
+					isElementApplicable = true;
 
 				} else
 				{
@@ -597,10 +627,13 @@
 						isConstructor = true;
 					}
 					
+					/*Constructor parameter Element*/
 					constructorParameterElementList.add(child);
 					
 					//Adding constructor parameter class types
 					constTypeList.add(type);
+					
+					isElementApplicable = true;
 
 				}
 			} 
@@ -612,6 +645,7 @@
 				{
 					String name = XMLUtil.getName(child);
 
+					//Duplicate definition for field/method
 					if (fieldOrMethodName != null)
 					{
 						if (fieldOrMethodName.equals(name))
@@ -623,28 +657,37 @@
 						{
 							configureFieldOrMethodMetaData(component, child);
 							fieldOrMethodName = name;
+							
+							isElementApplicable = true;
 						}						
 					}
 					else
 					{
 						configureFieldOrMethodMetaData(component, child);
-						fieldOrMethodName = name;						
+						fieldOrMethodName = name;		
+						
+						isElementApplicable = true;
 					}
 				} 
 				else
 				{
-					throw new WebBeansConfigurationException(createConfigurationFailedMessage());
+					throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Parent and child namespace has to be the same for field/method element decleration");
 				}
-
 			}
-
-		}
+			
+			/*This element netiher constructor, annotation , field or method*/
+			if(!isElementApplicable)
+			{
+				throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Element with name : " + XMLUtil.getName(child) + " is not applicable for child of the simple webbeans class :  " + component.getReturnType().getName());
+			}
+			
+		}//end of while
 
 		//Check Annotation Types
 		XMLDefinitionUtil.checkTypeMetaDataClasses(annotationSet, createConfigurationFailedMessage());
 		
 		// Configure type-level metadata
-		configureTypeLevelMetaData(component, annotationSet, webBeanDecleration);
+		configureTypeLevelMetaData(component, annotationSet, annotationElementList, webBeanDecleration);
 			
 		//Constructor decleration
 		if (isConstructor)
@@ -659,23 +702,50 @@
 		}
 
 	}
-
-	private static <T> void configureTypeLevelMetaData(XMLComponentImpl<T> component, Set<Class<? extends Annotation>> annotationSet, Element webBeanDecleration)
+	
+	/**
+	 * Configures the type level meta data of the webbeans
+	 * component.
+	 * 
+	 * @param component xml webbeans component
+	 * @param annotationSet type level annotation set
+	 * @param webBeanDecleration webbeans decleration element
+	 */
+	public static <T> void configureTypeLevelMetaData(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList, Element webBeanDecleration)
 	{
+		boolean isInterceptor = false;
+		boolean isDecorator   = false;
+		
+		/*Check this is an Interceptor*/
+		if(annotationSet.contains(Interceptor.class))
+		{
+			isInterceptor = true;
+		}
+		
+		/*Check this is a Decorator*/
+		if(annotationSet.contains(Decorator.class))
+		{
+			isDecorator = true;
+		}
+		
+		
+		//StereoType
+		configureStereoType(component, annotationSet, annotationElementList);
+
 		//Deployment Type
-		configureDeploymentType(component, annotationSet);
+		configureDeploymentType(component, annotationSet, annotationElementList);
 		
 		//Scope Type
-		configureScopeType(component, annotationSet);
+		configureScopeType(component, annotationSet, annotationElementList);
 		
 		//Binding Type
-		configureBindingType(component, annotationSet);
+		configureBindingType(component, annotationSet, annotationElementList);
 		
-		//InterceptorBinding Type
-		configureInterceptorBindingType(component, annotationSet);
-		
-		//StereoType
-		configureStereoType(component, annotationSet);
+		if(!isInterceptor && !isDecorator)
+		{
+			//InterceptorBinding Type
+			configureInterceptorBindingType(component, annotationSet, annotationElementList);	
+		}				
 		
 		//Name configuration
 		configureNamed(component, annotationSet, webBeanDecleration);
@@ -683,15 +753,43 @@
 		//Specializations
 		configureSpecializes(component, annotationSet);
 		
-		//Interceptors
-		configureInterceptor(component, annotationSet);
-		
-		//Decorators
-		configureDecorator(component, annotationSet);
+		/*Interceptor Definition*/
+		if(isInterceptor)
+		{
+			configureInterceptor(component, annotationSet, annotationElementList);	
+		}		
 		
+		/*Decorator Definition*/
+		if(isDecorator)
+		{
+			configureDecorator(component, annotationSet, annotationElementList, webBeanDecleration);	
+		}		
 	}
 
 	/**
+	 * Configures the type level meta data of the webbeans
+	 * component.
+	 * 
+	 * @param component xml webbeans component
+	 * @param annotationSet type level annotation set
+	 * @param webBeanDecleration webbeans decleration element
+	 */
+	public static <T> void configureProducerTypeLevelMetaData(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList, Element webBeanDecleration)
+	{
+		//StereoType
+		configureStereoType(component, annotationSet, annotationElementList);
+
+		//Deployment Type
+		configureDeploymentType(component, annotationSet, annotationElementList);
+		
+		//Scope Type
+		configureScopeType(component, annotationSet, annotationElementList);
+		
+		//Name configuration
+		configureNamed(component, annotationSet, webBeanDecleration);		
+	}
+	
+	/**
 	 * Configures the component constructor. When resolution
 	 * dependency of the constructor injection points, constructor
 	 * parameter type defined in the xml is used.
@@ -818,11 +916,13 @@
 		
 		boolean isValueElement = false;
 
+		boolean isApplicable = false;
 		if (child.isTextOnly())
 		{
 			if (!isValueElement)
 			{
 				isValueElement = true;
+				isApplicable = true;
 			}
 		}
 
@@ -840,33 +940,40 @@
 				if (!isValueElement)
 				{
 					isValueElement = true;
+					isApplicable = true;
 				}
 
-			} else
+			} 
+			else
 			{
 				Class<?> directChildType = XMLUtil.getElementJavaType(directChild);
 				if (!ClassUtil.isAssignable(field.getType(), directChildType))
 				{
 					throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Declared field type is not assignable to class field type");
-				} else
+				} 
+				else
 				{
-//					if (!directChildType.equals(field.getType()))
-//					{
-//						component.addFieldApiType(directChildType, fieldName);
-//
-//					}
-
+					XMLInjectionPointModel injectionPointModel = XMLUtil.getInjectionPointModel(directChild, createConfigurationFailedMessage());
+					component.addFieldInjectionPoint(field, injectionPointModel);
+					
 					isTypeElement = true;
+					isApplicable = true;
 				}
 			}
 		}
+		
+		if(!isApplicable)
+		{
+			throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Field with name : " + fieldName + " element is not correctly defined");
+		}
 
 		if (directChilds.size() > 1)
 		{
 			if (!isValueElement)
 			{
 				throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "One of the direct childs of the field must be element <value>");
-			} else
+			} 
+			else
 			{
 				if (isValueElement && isTypeElement)
 				{
@@ -912,7 +1019,10 @@
 		*/
 		int type = 0;
 		
+		/*Method parameters classes*/
 		List<Class<?>> methodParameters = new ArrayList<Class<?>>();
+		
+		/*Method parameter xml elements*/
 		List<Element> methodParameterElements = new ArrayList<Element>();
 		
 		Element methodChild = null;
@@ -1079,28 +1189,29 @@
 	
 	private static <T> void configureMethodDestructorAnnotation(XMLComponentImpl<T> component, Method destructorMethod, Element annotChild)
 	{
-		//TODO
+		//TODO for EJB Stateful Session Bean
 	}
 
-	private static <T> void configureMethodProducesAnnotation(XMLComponentImpl<T> component, Method producesMethod, Element annotChild)
+	private static <T> void configureMethodProducesAnnotation(XMLComponentImpl<T> component, Method producesMethod,  Element annotChild)
 	{
-		
-		
+		XMLProducerComponentImpl<T> producer = XMLDefinitionUtil.defineXMLProducerMethod(component, producesMethod, annotChild, createConfigurationFailedMessage());
+		ManagerImpl.getManager().addBean(producer);
 	}
 
-	private static <T> void configureMethodDisposesAnnotation(XMLComponentImpl<T> component, Method disposesMethod, Element annotChild)
+	private static <T> void configureMethodDisposesAnnotation(XMLComponentImpl<T> component, Method disposalMethod, Element annotChild)
 	{
+		XMLDefinitionUtil.defineXMLDisposalMethod(component, disposalMethod, annotChild, createConfigurationFailedMessage());
 		
 	}
 
 	private static <T> void configureMethodObservesAnnotation(XMLComponentImpl<T> component, Method observesMethod, Element annotChild)
 	{
-		
+		XMLDefinitionUtil.defineXMLObservesMethod(component, observesMethod, annotChild, createConfigurationFailedMessage());
 	}
 	
 	private static <T> void configureMethodInterceptorBindingTypeAnnotation(XMLComponentImpl<T> component, Method interceptorMethod, Element annotChild)
 	{
-		
+		XMLDefinitionUtil.defineXMLMethodLevelInterceptorType(component, interceptorMethod, annotChild, createConfigurationFailedMessage());
 	}
 	
 	
@@ -1129,13 +1240,6 @@
 			throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "More than one method : " + XMLUtil.getName(child) + " is found in the class : " + component.getReturnType().getName());
 		} 
 		
-//		else
-//		{
-//			for (Class<?> paramClazz : methodParameters)
-//			{
-//				component.addMethodParametersApiType(paramClazz, XMLUtil.getName(child));
-//			}
-//		}
 		
 		return definedMethods.get(0);
 	}
@@ -1181,9 +1285,9 @@
 			Element child = observesChilds.iterator().next();
 			Class<?> clazz = XMLUtil.getElementJavaType(child);
 
-			if ((clazz == null) || !clazz.equals(IfExists.class) || !clazz.equals(AfterTransactionCompletion.class) || !clazz.equals(AfterTransactionSuccess.class) || !clazz.equals(AfterTransactionFailure.class) || !clazz.equals(BeforeTransactionCompletion.class))
+			if ((clazz == null) || clazz.equals(IfExists.class) || clazz.equals(AfterTransactionCompletion.class) || clazz.equals(AfterTransactionSuccess.class) || clazz.equals(AfterTransactionFailure.class) || clazz.equals(BeforeTransactionCompletion.class))
 			{
-				throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Observes element : " + XMLUtil.getName(observes) + " must have one of the {<IfExists>, <AfterTransactionCompletion>, <AfterTransactionSuccess>, <AfterTransactionFailure>, <BeforeTransactionCompletion>} as a direct child.");
+				throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Observes element : " + XMLUtil.getName(observes) + " must not have one of the {<IfExists>, <AfterTransactionCompletion>, <AfterTransactionSuccess>, <AfterTransactionFailure>, <BeforeTransactionCompletion>} as a direct child.");
 			}
 		}
 
@@ -1192,32 +1296,41 @@
 	/**
 	 * Configures the deployment type of the XML component.
 	 * 
-	 * @param component xml defined simple web beans component
+	 * @param component xml defined web beans component
 	 * @param annotationSet all annotation defined in XML
 	 */
-	private static <T> void configureDeploymentType(XMLComponentImpl<T> component, Set<Class<? extends Annotation>> annotationSet)
+	private static <T> void configureDeploymentType(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
-		Class<? extends Annotation> deploymentType = XMLDefinitionUtil.defineXMLTypeMetaData(component, annotationSet, DeploymentType.class ,createConfigurationFailedMessage() + "@DeploymentType annotation is not configured correctly");
+		Class<? extends Annotation> deploymentType = XMLDefinitionUtil.defineXMLTypeMetaData(component, annotationSet, DeploymentType.class ,createConfigurationFailedMessage() + "@DeploymentType annotation is not configured correctly for class : " + component.getReturnType().getName());
 
 		if (deploymentType == null)
 		{
-			DefinitionUtil.defineDeploymentType(component, component.getReturnType().getAnnotations(), createConfigurationFailedMessage() + "@DeploymentType annotation is not configured correctly");
+			//Check from stereotype
+			Annotation stereoTypeDeploymentType = WebBeansUtil.getMaxPrecedenceSteroTypeDeploymentType(component);
+			
+			//Default deployment type
+			component.setType(stereoTypeDeploymentType);
 		}
 		else
 		{
 			component.setType(JavassistProxyFactory.createNewAnnotationProxy(deploymentType));
 		}
 	}
-
-	private static <T> void configureScopeType(XMLComponentImpl<T> component,  Set<Class<? extends Annotation>> annotationSet)
+	
+	/**
+	 * Configures the webbeans scope type. 
+	 * 
+	 * @param component xml defined web beans component
+	 * @param annotationSet all annotation defined in XML
+	 */
+	private static <T> void configureScopeType(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
 		Class<? extends Annotation> scopeType = XMLDefinitionUtil.defineXMLTypeMetaData(component, annotationSet, ScopeType.class ,createConfigurationFailedMessage() + "@ScopeType annotation is not configured correctly");
 		
 		if(scopeType == null)
 		{
-			//TODO XML Stereotype Check
-			
-			DefinitionUtil.defineScopeType(component, component.getReturnType().getAnnotations(), createConfigurationFailedMessage() + "@ScopeType annotation is not configured correctly");
+			//From stereotype
+			DefinitionUtil.defineDefaultScopeType(component, createConfigurationFailedMessage() + "@ScopeType annotation is not configured correctly");
 		}
 		else
 		{
@@ -1232,33 +1345,47 @@
 	 * @param component web beans xml component
 	 * @param anns annotations defined in the xml documents
 	 */
-	private static <T> void configureBindingType(XMLComponentImpl<T> component, Set<Class<? extends Annotation>> annotationSet)
+	private static <T> void configureBindingType(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
-		boolean isDefined = XMLDefinitionUtil.defineXMLBindingType(component, annotationSet);
+		boolean isDefined = XMLDefinitionUtil.defineXMLBindingType(component, annotationSet, annotationElementList, createConfigurationFailedMessage());
 		
 		if(!isDefined)
 		{
-			DefinitionUtil.defineBindingTypes(component, component.getReturnType().getAnnotations());
+			component.addBindingType(new CurrentLiteral());
 		}
-
+		
 	}
 
-	private static <T> void configureInterceptorBindingType(XMLComponentImpl<T> component, Set<Class<? extends Annotation>> annotationSet)
+	/**
+	 * Configures the class level interceptor binding types.
+	 * 
+	 * @param component web beans xml component
+	 * @param anns annotations defined in the xml documents
+	 */
+	private static <T> void configureInterceptorBindingType(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
-		boolean isDefined = XMLDefinitionUtil.defineXMLInterceptorType(component, annotationSet);
-		
-		if(!isDefined)
-		{
-			DefinitionUtil.defineSimpleWebBeanInterceptorStack(component);
-		}
+		XMLDefinitionUtil.defineXMLClassLevelInterceptorType(component, annotationSet, annotationElementList, createConfigurationFailedMessage());
 	}
 
-	private static <T> void configureStereoType(XMLComponentImpl<T> component, Set<Class<? extends Annotation>> annotationSet)
+	/**
+	 * Defines the component stereotypes.
+	 * 
+	 * @param component webbeans component
+	 * @param annotationSet type-level metadata annotation set
+	 */
+	private static <T> void configureStereoType(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
 		XMLDefinitionUtil.defineXMLStereoType(component, annotationSet);
 	}
 
-	private static <T> void configureNamed(XMLComponentImpl<T> component, Set<Class<? extends Annotation>> annotationSet, Element webBeanDecleration)
+	/**
+	 * Configures the webbeans name.
+	 *
+	 * @param component webbeans component
+	 * @param annotationSet type-level metadata annotation set
+	 * @param webBeanDecleration webbeans decleration element
+	 */
+	private static <T> void configureNamed(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, Element webBeanDecleration)
 	{
 		boolean isDefined = XMLDefinitionUtil.defineXMLName(component, annotationSet);
 		if(isDefined)
@@ -1281,20 +1408,38 @@
 		}
 	}
 
-	private static <T> void configureSpecializes(XMLComponentImpl<T> component, Set<Class<? extends Annotation>> annotationSet)
+	/**
+	 * Configures the webbeans specializations.
+	 * 
+	 * @param component webbeans component
+	 * @param annotationSet type-level metadata annotation set
+	 */
+	private static <T> void configureSpecializes(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet)
 	{
 		XMLDefinitionUtil.defineXMLSpecializes(component, annotationSet);
 	}
 
-	private static <T> void configureInterceptor(XMLComponentImpl<T> component, Set<Class<? extends Annotation>> annotationSet)
+	/**
+	 * Configures the interceptors simple webbeans.
+	 * 
+	 * @param component webbeans component
+	 * @param annotationSet type-level metadata annotation set
+	 */
+	private static <T> void configureInterceptor(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
-		XMLDefinitionUtil.defineXMLInterceptors(component, annotationSet, createConfigurationFailedMessage() + "More than one <Interceptor> element exist");
+		XMLDefinitionUtil.defineXMLInterceptors(component, annotationSet, annotationElementList, createConfigurationFailedMessage());
 
 	}
 
-	private static <T> void configureDecorator(XMLComponentImpl<T> component, Set<Class<? extends Annotation>> annotationSet)
+	/**
+	 * Configures the decorators simple webbeans.
+	 * 
+	 * @param component webbeans component
+	 * @param annotationSet type-level metadata annotation set
+	 */
+	private static <T> void configureDecorator(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList, Element webBeanDecleration)
 	{
-		XMLDefinitionUtil.defineXMLDecorators(component, annotationSet, createConfigurationFailedMessage() + "More than one <Decorator> element exist");
+		XMLDefinitionUtil.defineXMLDecorators(component, annotationSet, webBeanDecleration, createConfigurationFailedMessage());
 	}
 
 	/**
@@ -1333,7 +1478,8 @@
 		{
 			String errorMessage = createConfigurationFailedMessage() + "Field value of field name : " + field.getName() + " is not applicable for initial value assignment";
 			
-			Class<?> fieldType = field.getType(); /*Field type*/
+			/*Field type*/
+			Class<?> fieldType = field.getType();
 			
 			if (!ClassUtil.isInValueTypes(fieldType))
 			{
@@ -1386,7 +1532,8 @@
 				if (date == null)
 				{
 					throw new WebBeansConfigurationException(errorMessage);
-				} else
+				} 
+				else
 				{
 					component.addFieldValue(field.getName(), value);
 				}
@@ -1400,7 +1547,8 @@
 				if (bigValue == null)
 				{
 					throw new WebBeansConfigurationException(errorMessage);
-				} else
+				} 
+				else
 				{
 					component.addFieldValue(field.getName(), bigValue);
 				}
@@ -1414,7 +1562,8 @@
 				if (clazz == null)
 				{
 					throw new WebBeansConfigurationException(errorMessage);
-				} else
+				} 
+				else
 				{
 					component.addFieldValue(field.getName(), value);
 				}
@@ -1518,9 +1667,8 @@
 				}						
 			}
 		}
-
-		component.addFieldValue(field.getName(), list);
 		
+		component.addFieldValue(field.getName(), list);	
 	}
 	
 	/**
@@ -1613,7 +1761,6 @@
 		}
 
 		component.addFieldValue(field.getName(), set);
-		
 	}
 	
 	/**



Mime
View raw message