openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r727554 - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/ container/ decorator/ deployment/ deployment/stereotype/ intercept/ intercept/webbeans/ util/ xml/
Date Wed, 17 Dec 2008 22:32:42 GMT
Author: gerdogdu
Date: Wed Dec 17 14:32:42 2008
New Revision: 727554

URL: http://svn.apache.org/viewvc?rev=727554&view=rev
Log:
XML configuration for BindingType, Int.BindingType and Stereotype is updated.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java   (with props)
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java   (with props)
Modified:
    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/WebBeansContainerDeployer.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.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/deployment/StereoTypeManager.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/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/webbeans/WebBeansInterceptor.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.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/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=727554&r1=727553&r2=727554&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 Wed Dec 17 14:32:42 2008
@@ -25,7 +25,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import javax.webbeans.BindingType;
 import javax.webbeans.DeploymentType;
 import javax.webbeans.Destructor;
 import javax.webbeans.Disposes;
@@ -37,7 +36,6 @@
 import javax.webbeans.Produces;
 import javax.webbeans.ScopeType;
 import javax.webbeans.Specializes;
-import javax.webbeans.Stereotype;
 import javax.webbeans.UnsatisfiedDependencyException;
 import javax.webbeans.manager.Bean;
 
@@ -154,10 +152,11 @@
 		boolean find = false;
 		for(Annotation annotation : annotations)
 		{
-			Annotation var = annotation.annotationType().getAnnotation(BindingType.class);
-			if(var != null)
-			{
-				Method[] methods =annotation.annotationType().getDeclaredMethods();
+			Class<? extends Annotation> type = annotation.annotationType();
+			
+			if(AnnotationUtil.isBindingAnnotation(type))
+			{				
+				Method[] methods =type.getDeclaredMethods();
 				
 				for(Method method : methods)
 				{
@@ -176,10 +175,12 @@
 				{
 					find = true;					
 				}
+				
 				component.addBindingType(annotation);
 			}
 		}
 		
+		//No-binding annotation
 		if(!find)
 		{
 			component.addBindingType(new CurrentLiteral());
@@ -217,7 +218,7 @@
 		
 		if(!found)
 		{
-			Annotation[] stereos = AnnotationUtil.getMetaAnnotations(annotations, Stereotype.class);
+			Annotation[] stereos = AnnotationUtil.getStereotypeMetaAnnotations(annotations);
 			if(stereos.length == 0)
 			{
 				component.setImplScopeType(new DependentScopeLiteral());

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java?rev=727554&r1=727553&r2=727554&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java Wed Dec 17 14:32:42 2008
@@ -17,6 +17,7 @@
 package org.apache.webbeans.config;
 
 import java.io.InputStream;
+import java.lang.annotation.Annotation;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
@@ -45,6 +46,7 @@
 import org.apache.webbeans.util.JNDIUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+import org.apache.webbeans.xml.XMLAnnotationTypeManager;
 import org.apache.webbeans.xml.XMLSpecializesManager;
 
 
@@ -311,20 +313,29 @@
 		  
 		Map<String, Set<String>>  stereotypeMap = WebBeansScanner.getScannerInstance().getANNOTATION_DB().getAnnotationIndex();
 		  if(stereotypeMap != null && stereotypeMap.size() > 0)
-		  {
-			  Set<String> stereoClassSet = stereotypeMap.keySet();
-			  Iterator<String> steIterator = stereoClassSet.iterator();
-			  while(steIterator.hasNext())
+		  {	
+			  if(stereotypeMap.containsKey(Stereotype.class.getName()))
 			  {
-				  String steroClassName = steIterator.next();
-				  Class<?> stereoClass = ClassUtil.getClassFromName(steroClassName);
-				  
-				  if(stereoClass.isAnnotationPresent(Stereotype.class))
+				  Set<String> stereoClassSet = stereotypeMap.keySet();
+				  Iterator<String> steIterator = stereoClassSet.iterator();
+				  while(steIterator.hasNext())
 				  {
-					  WebBeansUtil.checkStereoTypeClass(stereoClass);
-					  StereoTypeModel model = new StereoTypeModel(stereoClass);
-					  StereoTypeManager.getInstance().addStereoTypeModel(model);					  
-				  }				  
+					  String steroClassName = steIterator.next();
+					  Set<String> stereoSet = stereotypeMap.get(steroClassName);
+					  
+					  for(String clazz : stereoSet)
+					  {
+						  Class<? extends Annotation> stereoClass = (Class<? extends Annotation>)ClassUtil.getClassFromName(clazz);
+						  
+						  if(!XMLAnnotationTypeManager.getInstance().isStereoTypeExist(stereoClass))
+						  {
+							  WebBeansUtil.checkStereoTypeClass(stereoClass);
+							  StereoTypeModel model = new StereoTypeModel(stereoClass);
+							  StereoTypeManager.getInstance().addStereoTypeModel(model);					  							  
+						  }
+					  }					  
+				  }
+				  
 			  }
 		  }
 		  

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java?rev=727554&r1=727553&r2=727554&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java Wed Dec 17 14:32:42 2008
@@ -63,7 +63,7 @@
 			throw new AmbiguousDependencyException("There is more than one api type with : " + type.getName());
 		}
 		
-		Bean<T> bean = resolvedSet.iterator().next();
+		//Bean<T> bean = resolvedSet.iterator().next();
 		//WebBeansUtil.checkUnproxiableApiType((AbstractComponent<?>), bean.getScopeType().getAnnotation(ScopeType.class));
 		
 	}

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=727554&r1=727553&r2=727554&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 Wed Dec 17 14:32:42 2008
@@ -22,7 +22,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import javax.webbeans.BindingType;
 import javax.webbeans.Decorates;
 import javax.webbeans.manager.Decorator;
 
@@ -82,7 +81,7 @@
 		
 		for(Annotation ann : anns)
 		{
-			if(ann.annotationType().isAnnotationPresent(BindingType.class))
+			if(AnnotationUtil.isBindingAnnotation(ann.annotationType()))
 			{
 				this.delegateBindingTypes.add(ann);
 			}

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java?rev=727554&r1=727553&r2=727554&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java Wed Dec 17 14:32:42 2008
@@ -19,13 +19,14 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
 import org.apache.webbeans.util.Asserts;
 
 public class StereoTypeManager
 {
 	private static StereoTypeManager instance = new StereoTypeManager();
 
-	private Map<String, StereoTypeModel> stereoTypeMap = new ConcurrentHashMap<String, StereoTypeModel>();
+	private Map<String, IStereoTypeModel> stereoTypeMap = new ConcurrentHashMap<String, IStereoTypeModel>();
 	
 	private StereoTypeManager()
 	{
@@ -37,14 +38,14 @@
 		return instance;
 	}
 	
-	public void addStereoTypeModel(StereoTypeModel model)
+	public void addStereoTypeModel(IStereoTypeModel model)
 	{
 		Asserts.assertNotNull(model, "model parameter can not be null");
 		
 		getInstance().stereoTypeMap.put(model.getName(), model);
 	}
 	
-	public StereoTypeModel getStereoTypeModel(String modelName)
+	public IStereoTypeModel getStereoTypeModel(String modelName)
 	{
 		Asserts.assertNotNull(modelName, "modelName parameter can not be null");
 		

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=727554&r1=727553&r2=727554&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 Wed Dec 17 14:32:42 2008
@@ -26,10 +26,11 @@
 import javax.webbeans.ScopeType;
 import javax.webbeans.Stereotype;
 
+import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 
-public class StereoTypeModel
+public class StereoTypeModel implements IStereoTypeModel 
 {
 	private String name;
 	
@@ -37,10 +38,14 @@
 	
 	private Annotation defaultScopeType;
 	
+	private String defaultName = null;
+	
 	private Set<Class<? extends Annotation>> supportedScopes = null;
 	
 	private Set<Class<?>>  restrictedTypes = null;
 	
+	private Annotation interceptorBindingType;
+	
 	
 	public StereoTypeModel(Class<?> clazz)
 	{
@@ -102,6 +107,11 @@
 		return defaultDeploymentType;
 	}
 
+	public String getDefaultName()
+	{
+		return this.defaultName;
+	}
+	
 	/**
 	 * @return the defaultScopeType
 	 */
@@ -110,6 +120,10 @@
 		return defaultScopeType;
 	}
 
+	public Annotation getInterceptorBindingType()
+	{
+		return this.interceptorBindingType;
+	}
 
 	/**
 	 * @return the supportedScopes

Added: 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=727554&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java Wed Dec 17 14:32:42 2008
@@ -0,0 +1,210 @@
+/*
+ *  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.deployment;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.webbeans.DeploymentType;
+import javax.webbeans.Named;
+import javax.webbeans.NonexistentTypeException;
+import javax.webbeans.ScopeType;
+
+import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.proxy.JavassistProxyFactory;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.xml.XMLUtil;
+import org.dom4j.Element;
+
+@SuppressWarnings("unchecked")
+public class XMLStereoTypeModel implements IStereoTypeModel
+{
+	private String name;
+	
+	private Annotation defaultDeploymentType;
+	
+	private Annotation defaultScopeType;
+	
+	private Set<Class<? extends Annotation>> supportedScopes = new HashSet<Class<? extends Annotation>>();
+	
+	private Set<Class<?>>  restrictedTypes = new HashSet<Class<?>>();
+	
+	private Set<Annotation> interceptorBindingTypes = new HashSet<Annotation>();
+	
+	private Annotation defaultName = null;
+
+	
+	public XMLStereoTypeModel(Element stereoTypeDecleration, String name, String errorMessage)
+	{
+		configure(stereoTypeDecleration, errorMessage);
+		setName(name);
+	}
+
+	@SuppressWarnings("unchecked")
+	private void configure(Element stereoTypeDecleration, String errorMessage)
+	{
+		List<Element> childs = stereoTypeDecleration.elements();
+		if(childs != null && childs.size() > 0)
+		{
+			boolean deploymentTypeFound = false;
+			boolean scopeTypeFound = false;
+
+			for(Element child : childs)
+			{
+				Class<?> clazz = XMLUtil.getElementJavaType(child);
+				if(clazz == null)
+				{
+					throw new NonexistentTypeException(errorMessage + "Type is not exist with class name : " + XMLUtil.getElementJavaClassName(child));
+				}
+				
+				Class<? extends Annotation> annClazz = null;
+				if(!clazz.isAnnotation())
+				{
+					throw new WebBeansConfigurationException(errorMessage+ "Type is not annotation type with class name : " + XMLUtil.getElementJavaClassName(child));
+				}
+				
+				annClazz = (Class<? extends Annotation>)clazz;
+				Annotation defaultAnn = JavassistProxyFactory.createNewAnnotationProxy(annClazz);
+				if(clazz.isAnnotationPresent(ScopeType.class))
+				{
+					if(scopeTypeFound)
+					{
+						throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not contain more than one @ScopeType annotation");						
+					}
+					
+					defaultScopeType = defaultAnn;
+					scopeTypeFound = true;
+				}
+				else if(clazz.isAnnotationPresent(DeploymentType.class))
+				{
+					if(deploymentTypeFound)
+					{
+						throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not contain more than one @DeploymentType annotation");
+					}
+					defaultDeploymentType = defaultAnn;
+					deploymentTypeFound = true;
+				}
+				else if(AnnotationUtil.isInterceptorBindingAnnotation(annClazz))
+				{
+					Target target = clazz.getAnnotation(Target.class);
+					ElementType[] type = target.value();
+					
+					if(type.length != 1 && !type[0].equals(ElementType.TYPE))
+					{
+						throw new WebBeansConfigurationException(errorMessage + "Stereotype with @InterceptorBindingType must be defined as @Target{TYPE}");
+					}
+					
+					interceptorBindingTypes.add(defaultAnn);
+				}
+				else if(clazz.equals(Named.class))
+				{
+					defaultName = defaultAnn;
+					Named name = (Named) defaultName;
+					if (!name.value().equals(""))
+					{
+						throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not define @Named annotation with value");
+					}					
+				}
+				else if (AnnotationUtil.isBindingAnnotation(annClazz))
+				{
+					throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not define @BindingType annotation");
+				}
+				
+				else
+				{
+					throw new WebBeansConfigurationException(errorMessage + "Type with class name : " + XMLUtil.getElementJavaClassName(child) + " is not applicable for stereotype");
+				}
+			}
+		}
+	}
+	
+	public Annotation getDefaultDeploymentType()
+	{
+		return this.defaultDeploymentType;
+	}
+
+	public Annotation getDefaultScopeType()
+	{
+		return this.defaultScopeType;
+	}
+	
+	public Set<Annotation> getInterceptorBindingType()
+	{
+		return this.interceptorBindingTypes;
+	}
+	
+	public Annotation getDefaultNamed()
+	{
+		return this.defaultName;
+	}
+	
+
+	public String getName()
+	{
+		return this.name;
+	}
+
+	public Set<Class<?>> getRestrictedTypes()
+	{
+		return this.restrictedTypes;
+	}
+
+	public Set<Class<? extends Annotation>> getSupportedScopes()
+	{
+		return this.supportedScopes;
+	}
+
+	public void setName(String name)
+	{
+		this.name = name;
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj)
+	{
+		if(obj == this)
+		{
+			return true;
+		}
+		
+		if(!(obj instanceof XMLStereoTypeModel))
+			return false;
+		
+		XMLStereoTypeModel model = (XMLStereoTypeModel)obj;
+		
+		return model.name.equals(this.name);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode()
+	{
+		return this.name.hashCode();
+	}
+	
+}

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

Added: 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=727554&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java Wed Dec 17 14:32:42 2008
@@ -0,0 +1,53 @@
+/*
+ *  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.deployment.stereotype;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+public interface IStereoTypeModel
+{
+	/**
+	 * @return the name
+	 */
+	public String getName();
+
+	/**
+	 * @param name the name to set
+	 */
+	public void setName(String name);
+
+	/**
+	 * @return the defaultDeploymentType
+	 */
+	public Annotation getDefaultDeploymentType();
+
+	/**
+	 * @return the defaultScopeType
+	 */
+	public Annotation getDefaultScopeType();
+
+	/**
+	 * @return the supportedScopes
+	 */
+	public Set<Class<? extends Annotation>> getSupportedScopes();
+	/**
+	 * @return the restrictedTypes
+	 */
+	public Set<Class<?>> getRestrictedTypes();
+	
+}

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

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=727554&r1=727553&r2=727554&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 Wed Dec 17 14:32:42 2008
@@ -23,7 +23,6 @@
 
 import javax.interceptor.ExcludeClassInterceptors;
 import javax.interceptor.Interceptors;
-import javax.webbeans.InterceptorBindingType;
 
 import org.apache.webbeans.component.AbstractComponent;
 import org.apache.webbeans.exception.WebBeansException;
@@ -203,11 +202,15 @@
 		boolean isMethodAnnotatedWithInterceptorClass = false;
 		boolean isMethodAnnotatedWithExcludeInterceptorClass = false;
 
-		if(AnnotationUtil.isMetaAnnotationExist(method.getDeclaredAnnotations(), InterceptorBindingType.class))
-			isMethodAnnotatedWithInterceptorClass = true;
+		if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(method.getDeclaredAnnotations()))
+		{
+			isMethodAnnotatedWithInterceptorClass = true;	
+		}
 		
 		if(AnnotationUtil.isMethodHasAnnotation(method, ExcludeClassInterceptors.class))
-			isMethodAnnotatedWithExcludeInterceptorClass = true;
+		{
+			isMethodAnnotatedWithExcludeInterceptorClass = true;	
+		}
 		
 		
 		Iterator<InterceptorData> it = stack.iterator();

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=727554&r1=727553&r2=727554&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 Wed Dec 17 14:32:42 2008
@@ -31,7 +31,6 @@
 import javax.webbeans.Destructor;
 import javax.webbeans.Disposes;
 import javax.webbeans.Initializer;
-import javax.webbeans.InterceptorBindingType;
 import javax.webbeans.Observes;
 import javax.webbeans.Produces;
 import javax.webbeans.manager.InterceptionType;
@@ -187,14 +186,14 @@
 	public static void checkInterceptorConditions(Class<?> clazz)
 	{
 		Asserts.nullCheckForClass(clazz);
-		if(!AnnotationUtil.isMetaAnnotationExist(clazz.getDeclaredAnnotations(), InterceptorBindingType.class))
+		if(!AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getDeclaredAnnotations()))
 		{
 			throw new WebBeansConfigurationException("WebBeans Interceptor class : " + clazz.getName() + " must have at least one @InterceptorBindingType annotation");
 		}
 		
 		if(isLifecycleMethodInterceptor(clazz) && !isBusinessMethodInterceptor(clazz))
 		{
-			Annotation[] anns = AnnotationUtil.getMetaAnnotations(clazz.getDeclaredAnnotations(), InterceptorBindingType.class);
+			Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazz.getDeclaredAnnotations());
 			
 			for(Annotation annotation : anns)
 			{
@@ -215,7 +214,7 @@
 		Annotation[] anns = clazz.getDeclaredAnnotations();
 		
 		boolean hasClassInterceptors = false;
-		if(AnnotationUtil.getMetaAnnotations(anns, InterceptorBindingType.class).length > 0)
+		if(AnnotationUtil.getInterceptorBindingMetaAnnotations(anns).length > 0)
 		{
 			hasClassInterceptors = true;
 		}else
@@ -223,7 +222,7 @@
 			Annotation[] stereoTypes = WebBeansUtil.getComponentStereoTypes(anns);
 			for(Annotation stero : stereoTypes)
 			{
-				if(AnnotationUtil.isMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations(), InterceptorBindingType.class))
+				if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
 				{
 					hasClassInterceptors = true;
 					break;
@@ -244,7 +243,7 @@
 				}
 				else
 				{
-					if(AnnotationUtil.isMetaAnnotationExist(method.getDeclaredAnnotations(), InterceptorBindingType.class))
+					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/WebBeansInterceptorConfig.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=727554&r1=727553&r2=727554&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 Wed Dec 17 14:32:42 2008
@@ -28,7 +28,6 @@
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.interceptor.AroundInvoke;
-import javax.webbeans.InterceptorBindingType;
 import javax.webbeans.manager.Interceptor;
 
 import org.apache.webbeans.component.AbstractComponent;
@@ -70,7 +69,7 @@
 
 		WebBeansInterceptor interceptor = new WebBeansInterceptor(delegate);
 
-		Annotation[] anns = AnnotationUtil.getMetaAnnotations(delegate.getReturnType().getDeclaredAnnotations(), InterceptorBindingType.class);
+		Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(delegate.getReturnType().getDeclaredAnnotations());
 
 		for (Annotation ann : anns)
 		{
@@ -91,12 +90,12 @@
 	 */
 	public static void configure(Class<?> clazz, List<InterceptorData> stack)
 	{
-		if (AnnotationUtil.isMetaAnnotationExist(clazz.getDeclaredAnnotations(), InterceptorBindingType.class))
+		if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getDeclaredAnnotations()))
 		{
 			
 			Set<Annotation> bindingTypeSet = new HashSet<Annotation>();
 			
-			Annotation[] anns = AnnotationUtil.getMetaAnnotations(clazz.getDeclaredAnnotations(), InterceptorBindingType.class);
+			Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazz.getDeclaredAnnotations());
 			
 			for(Annotation ann : anns)
 			{
@@ -106,9 +105,9 @@
 			Annotation[] stereoTypes = WebBeansUtil.getComponentStereoTypes(clazz.getDeclaredAnnotations());
 			for(Annotation stero : stereoTypes)
 			{
-				if(AnnotationUtil.isMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations(), InterceptorBindingType.class))
+				if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
 				{
-					Annotation[] steroInterceptorBindings = AnnotationUtil.getMetaAnnotations(stero.annotationType().getDeclaredAnnotations(), InterceptorBindingType.class);
+					Annotation[] steroInterceptorBindings = AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());
 					
 					for(Annotation ann : steroInterceptorBindings)
 					{
@@ -153,10 +152,10 @@
 
 		for (Method method : methods)
 		{
-			if (AnnotationUtil.isMetaAnnotationExist(method.getAnnotations(), InterceptorBindingType.class))
+			if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(method.getAnnotations()))
 			{
-				Annotation[] anns = AnnotationUtil.getMetaAnnotations(method.getDeclaredAnnotations(), InterceptorBindingType.class);
-				Annotation[] annsClazz = AnnotationUtil.getMetaAnnotations(clazz.getDeclaredAnnotations(), InterceptorBindingType.class);
+				Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(method.getDeclaredAnnotations());
+				Annotation[] annsClazz = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazz.getDeclaredAnnotations());
 				
 
 				Set<Annotation> set = new HashSet<Annotation>();
@@ -174,9 +173,9 @@
 				Annotation[] stereoTypes = WebBeansUtil.getComponentStereoTypes(clazz.getDeclaredAnnotations());
 				for(Annotation stero : stereoTypes)
 				{
-					if(AnnotationUtil.isMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations(), InterceptorBindingType.class))
+					if(AnnotationUtil.isInterceptorBindingMetaAnnotationExist(stero.annotationType().getDeclaredAnnotations()))
 					{
-						Annotation[] steroInterceptorBindings = AnnotationUtil.getMetaAnnotations(stero.annotationType().getDeclaredAnnotations(), InterceptorBindingType.class);
+						Annotation[] steroInterceptorBindings = AnnotationUtil.getInterceptorBindingMetaAnnotations(stero.annotationType().getDeclaredAnnotations());
 						
 						for(Annotation ann : steroInterceptorBindings)
 						{

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=727554&r1=727553&r2=727554&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 Wed Dec 17 14:32:42 2008
@@ -35,8 +35,10 @@
 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;
 
 /**
  * Defines the webbeans specific interceptors.
@@ -166,25 +168,45 @@
 		while(it.hasNext())
 		{
 			Class<? extends Annotation> clazzAnnot = it.next();
-			if(AnnotationUtil.isMetaAnnotationExist(clazzAnnot.getAnnotations(), InterceptorBindingType.class))
+			Set<Class<? extends Annotation>> declared = null; 
+			Annotation[] anns = null;
+			
+			if(XMLAnnotationTypeManager.getInstance().isInterceptorBindingTypeExist(clazzAnnot))
 			{
- 				Annotation[] anns =	AnnotationUtil.getMetaAnnotations(clazzAnnot.getAnnotations(), InterceptorBindingType.class);
- 				
- 				/*
- 				 * For example:
- 				 * 
- 				 * @InterceptorBindingType
- 				 * @Transactional
- 				 * @Action
- 				 * public @interface ActionTransactional
- 				 * 
- 				 * @ActionTransactional @Production
- 				 * {
- 				 * 
- 				 * }
- 				 * 
- 				 */
+				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++;
+				}
+				
+			}
+			
+			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);
@@ -197,8 +219,9 @@
  					metas = WebBeansInterceptorConfig.findDeployedWebBeansInterceptor(simple);
  					set.addAll(metas);
  				}
- 				
+				
 			}
+				 				
 		}
 		
 		return set;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=727554&r1=727553&r2=727554&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java Wed Dec 17 14:32:42 2008
@@ -30,7 +30,9 @@
 
 import javax.webbeans.BindingType;
 import javax.webbeans.DuplicateBindingTypeException;
+import javax.webbeans.InterceptorBindingType;
 import javax.webbeans.NonBinding;
+import javax.webbeans.Stereotype;
 
 import org.apache.webbeans.xml.XMLAnnotationTypeManager;
 
@@ -290,7 +292,7 @@
 					continue;
 				}
 				
-				if(btype.isAnnotationPresent(BindingType.class))
+				if(AnnotationUtil.isBindingAnnotation(btype))
 				{
 					list.add(param);
 				}
@@ -460,7 +462,7 @@
 		
 		for(Annotation annot : annotations)
 		{
-			if(annot.annotationType().isAnnotationPresent(BindingType.class))
+			if(AnnotationUtil.isBindingAnnotation(annot.annotationType()))
 			{
 				set.add(annot);
 			}
@@ -641,7 +643,7 @@
 		
 		for(Annotation ann : bindignTypeAnnots)
 		{
-			if(!ann.annotationType().isAnnotationPresent(BindingType.class))
+			if(!AnnotationUtil.isBindingAnnotation(ann.annotationType()))
 			{
 				throw new IllegalArgumentException("Binding annotations must be annotated with @BindingType");
 			}
@@ -664,23 +666,169 @@
 		}
 	}
 	
+	/**
+	 * Returns true if the annotation is defined in xml or annotated with {@link BindingType}
+	 * false otherwise.
+	 * 
+	 * @param clazz type of the annotation
+	 * 
+	 * @return true if the annotation is defined in xml or annotated with {@link BindingType}
+	 * 		   false otherwise
+	 */
 	public static boolean isBindingAnnotation(Class<? extends Annotation> clazz)
 	{
 		Asserts.assertNotNull(clazz, "clazz parameter can not be null");
-		if(clazz.isAnnotationPresent(BindingType.class))
+		XMLAnnotationTypeManager manager = XMLAnnotationTypeManager.getInstance();
+		if(manager.isBindingTypeExist(clazz))
 		{
 			return true;
 		}
-		else
+		else if(clazz.isAnnotationPresent(BindingType.class))
+		{
+			return true;
+		}
+		
+		return false;
+	}
+	
+	/**
+	 * Returns true if the annotation is defined in xml or annotated with {@link InterceptorBindingType}
+	 * false otherwise.
+	 * 
+	 * @param clazz type of the annotation
+	 * 
+	 * @return true if the annotation is defined in xml or annotated with {@link InterceptorBindingType}
+	 * 		   false otherwise
+	 */
+	public static boolean isInterceptorBindingAnnotation(Class<? extends Annotation> clazz)
+	{
+		Asserts.assertNotNull(clazz, "clazz parameter can not be null");
+		XMLAnnotationTypeManager manager = XMLAnnotationTypeManager.getInstance();
+		if(manager.isInterceptorBindingTypeExist(clazz))
+		{
+			return true;
+		}
+		else if(clazz.isAnnotationPresent(InterceptorBindingType.class))
+		{
+			return true;
+		}
+		
+		return false;
+	}
+	
+	/**
+	 * If candidate class has an interceptor binding annotation type then
+	 * return true, false otherwise.
+	 * 
+	 * @param clazz interceptor candidate class
+	 * 
+	 * @return true if candidate class has an interceptor binding annotation type
+	 * 		   false otherwise
+	 */
+	public static boolean isInterceptorBindingMetaAnnotationExist(Annotation[] anns)
+	{
+		Asserts.assertNotNull(anns, "anns parameter can not be null");
+
+		for(Annotation ann : anns)
+		{
+			if(isInterceptorBindingAnnotation(ann.annotationType()))
+			{
+				return true;
+			}
+			else
+			{
+				continue;
+			}
+		}
+		
+		return false;
+	}
+	
+	public static Annotation[] getInterceptorBindingMetaAnnotations(Annotation[] anns)
+	{
+		Asserts.assertNotNull(anns, "anns parameter can not be null");
+		List<Annotation> interAnns = new ArrayList<Annotation>();
+		
+		for(Annotation ann : anns)
+		{
+			if(isInterceptorBindingAnnotation(ann.annotationType()))
+			{
+				interAnns.add(ann);
+			}
+		}
+		
+		Annotation[] ret = new Annotation[interAnns.size()];
+		ret = interAnns.toArray(ret);
+		
+		return ret;
+	}
+	
+	public static Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
+	{
+		Asserts.assertNotNull(anns, "anns parameter can not be null");
+		List<Annotation> interAnns = new ArrayList<Annotation>();
+		
+		for(Annotation ann : anns)
+		{
+			if(isStereoTypeAnnotation(ann.annotationType()))
+			{
+				interAnns.add(ann);
+			}
+		}
+		
+		Annotation[] ret = new Annotation[interAnns.size()];
+		ret = interAnns.toArray(ret);
+		
+		return ret;
+	}
+	
+	
+	public static boolean isStereoTypeMetaAnnotationExist(Annotation[] anns)
+	{
+		Asserts.assertNotNull(anns, "anns parameter can not be null");
+
+		for(Annotation ann : anns)
 		{
-			XMLAnnotationTypeManager manager = XMLAnnotationTypeManager.getInstance();
-			if(manager.isBindingTypeExist(clazz))
+			if(isStereoTypeAnnotation(ann.annotationType()))
 			{
 				return true;
 			}
+			else
+			{
+				continue;
+			}
 		}
 		
 		return false;
 	}
 	
+	
+	
+	/**
+	 * Returns true if the annotation is defined in xml or annotated with {@link Stereotype}
+	 * false otherwise.
+	 * 
+	 * @param clazz type of the annotation
+	 * 
+	 * @return true if the annotation is defined in xml or annotated with {@link Stereotype}
+	 * 		   false otherwise
+	 */
+	public static boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
+	{
+		Asserts.assertNotNull(clazz, "clazz parameter can not be null");
+		XMLAnnotationTypeManager manager = XMLAnnotationTypeManager.getInstance();
+		if(manager.isStereoTypeExist(clazz))
+		{
+			return true;
+		}
+		else if(clazz.isAnnotationPresent(Stereotype.class))
+		{
+			return true;
+		}
+		
+		return false;
+	}
+	
+	
+	
 }

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=727554&r1=727553&r2=727554&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 Wed Dec 17 14:32:42 2008
@@ -46,7 +46,6 @@
 import javax.servlet.ServletRequestListener;
 import javax.servlet.http.HttpSessionListener;
 import javax.webbeans.ApplicationScoped;
-import javax.webbeans.BindingType;
 import javax.webbeans.Conversation;
 import javax.webbeans.ConversationScoped;
 import javax.webbeans.Decorator;
@@ -56,7 +55,6 @@
 import javax.webbeans.DuplicateBindingTypeException;
 import javax.webbeans.InconsistentSpecializationException;
 import javax.webbeans.Initializer;
-import javax.webbeans.InterceptorBindingType;
 import javax.webbeans.Named;
 import javax.webbeans.New;
 import javax.webbeans.Observable;
@@ -65,7 +63,6 @@
 import javax.webbeans.RequestScoped;
 import javax.webbeans.ScopeType;
 import javax.webbeans.SessionScoped;
-import javax.webbeans.Stereotype;
 import javax.webbeans.UnproxyableDependencyException;
 import javax.webbeans.manager.Bean;
 import javax.webbeans.manager.Manager;
@@ -92,7 +89,7 @@
 import org.apache.webbeans.decorator.WebBeansDecoratorConfig;
 import org.apache.webbeans.deployment.DeploymentTypeManager;
 import org.apache.webbeans.deployment.StereoTypeManager;
-import org.apache.webbeans.deployment.StereoTypeModel;
+import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
 import org.apache.webbeans.ejb.EJBUtil;
 import org.apache.webbeans.ejb.orm.ORMUtil;
 import org.apache.webbeans.event.EventUtil;
@@ -860,7 +857,7 @@
 	{
 		Asserts.assertNotNull(anns, "Anns parameter can not be null");
 
-		if (AnnotationUtil.isMetaAnnotationExist(anns, Stereotype.class))
+		if (AnnotationUtil.isStereoTypeMetaAnnotationExist(anns))
 		{
 			return true;
 		}
@@ -873,7 +870,7 @@
 		Asserts.assertNotNull(anns, "Anns parameter can not be null");
 		if (isComponentHasStereoType(anns))
 		{
-			return AnnotationUtil.getMetaAnnotations(anns, Stereotype.class);
+			return AnnotationUtil.getStereotypeMetaAnnotations(anns);
 		}
 
 		return new Annotation[] {};
@@ -969,35 +966,43 @@
 		boolean scopeTypeFound = false;
 		for (Annotation annotation : annotations)
 		{
-			if (annotation.annotationType().isAnnotationPresent(DeploymentType.class))
+			Class<? extends Annotation> annotType = annotation.annotationType();
+			
+			if (annotType.isAnnotationPresent(DeploymentType.class))
 			{
 				if (deploymentTypeFound == true)
 				{
 					throw new WebBeansConfigurationException("@StereoType annotation can not contain more than one @DeploymentType annotation");
-				} else
+				} 
+				else
 				{
 					deploymentTypeFound = true;
 				}
-			} else if (annotation.annotationType().isAnnotationPresent(ScopeType.class))
+			} 
+			else if (annotType.isAnnotationPresent(ScopeType.class))
 			{
 				if (scopeTypeFound == true)
 				{
 					throw new WebBeansConfigurationException("@StereoType annotation can not contain more than one @ScopeType annotation");
-				} else
+				} 
+				else
 				{
 					scopeTypeFound = true;
 				}
-			} else if (annotation.annotationType().equals(Named.class))
+			} 
+			else if (annotType.equals(Named.class))
 			{
 				Named name = (Named) annotation;
 				if (!name.value().equals(""))
 				{
 					throw new WebBeansConfigurationException("@StereoType annotation can not define @Named annotation with value");
 				}
-			} else if (annotation.annotationType().isAnnotationPresent(BindingType.class))
+			} 
+			else if (AnnotationUtil.isBindingAnnotation(annotType))
 			{
 				throw new WebBeansConfigurationException("@StereoType annotation can not define @BindingType annotation");
-			}else if(annotation.annotationType().isAnnotationPresent(InterceptorBindingType.class))
+			}
+			else if(AnnotationUtil.isInterceptorBindingAnnotation(annotType))
 			{
 				Target target = clazz.getAnnotation(Target.class);
 				ElementType[] type = target.value();
@@ -1060,7 +1065,7 @@
 		Annotation[] stereoTypes = getComponentStereoTypes(anns);
 		for (Annotation stereoType : stereoTypes)
 		{
-			StereoTypeModel model = StereoTypeManager.getInstance().getStereoTypeModel(stereoType.annotationType().getName());
+			IStereoTypeModel model = StereoTypeManager.getInstance().getStereoTypeModel(stereoType.annotationType().getName());
 			Set<Class<?>> rtypes = model.getRestrictedTypes();
 
 			if (rtypes != null)
@@ -1163,10 +1168,12 @@
 					throw new DuplicateBindingTypeException("Manager.resolveInterceptors() method parameter interceptor binding types array argument can not define duplicate binding annotation with name : @" +  old.getClass().getName());
 				}
 				
-				if(!AnnotationUtil.isAnnotationExist(old.annotationType().getDeclaredAnnotations(), InterceptorBindingType.class))
+				if(!AnnotationUtil.isInterceptorBindingAnnotation(interceptorBindingType.annotationType()))
 				{
 					throw new IllegalArgumentException("Manager.resolveInterceptors() method parameter interceptor binding types array can not contain other annotation that is not @InterceptorBindingType"); 
 				}
+				
+				old = interceptorBindingType;
 			}
 		}	
 	}
@@ -1187,15 +1194,17 @@
 			}
 			else
 			{
-				if(old.equals(bindingType))
+				if(old.annotationType().equals(bindingType.annotationType()))
 				{
 					throw new DuplicateBindingTypeException("Manager.resolveDecorators() method parameter binding types array argument can not define duplicate binding annotation with name : @" +  old.getClass().getName());
 				}
 				
-				if(!AnnotationUtil.isAnnotationExist(old.annotationType().getDeclaredAnnotations(), BindingType.class))
+				if(!AnnotationUtil.isBindingAnnotation(bindingType.annotationType()))
 				{
 					throw new IllegalArgumentException("Manager.resolveDecorators() method parameter binding types array can not contain other annotation that is not @BindingType"); 
 				}
+				
+				old = bindingType;
 			}
 		}
 		

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=727554&r1=727553&r2=727554&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 Wed Dec 17 14:32:42 2008
@@ -39,7 +39,6 @@
 import javax.webbeans.AfterTransactionFailure;
 import javax.webbeans.AfterTransactionSuccess;
 import javax.webbeans.BeforeTransactionCompletion;
-import javax.webbeans.BindingType;
 import javax.webbeans.DefinitionException;
 import javax.webbeans.DeploymentException;
 import javax.webbeans.DeploymentType;
@@ -47,7 +46,6 @@
 import javax.webbeans.Disposes;
 import javax.webbeans.IfExists;
 import javax.webbeans.Initializer;
-import javax.webbeans.InterceptorBindingType;
 import javax.webbeans.NonexistentConstructorException;
 import javax.webbeans.NonexistentFieldException;
 import javax.webbeans.NonexistentMethodException;
@@ -56,7 +54,6 @@
 import javax.webbeans.Produces;
 import javax.webbeans.Production;
 import javax.webbeans.ScopeType;
-import javax.webbeans.Stereotype;
 
 import org.apache.webbeans.WebBeansConstants;
 import org.apache.webbeans.component.AbstractComponent;
@@ -276,14 +273,9 @@
 			clazzAnnot =  (Class<? extends Annotation>)clazz;
 		}
 		
-		if(clazz.isAnnotationPresent(BindingType.class))
-		{
-			throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Binding type with given class : " + bindingTypeElement.getName() + " is already defined as @BindingType");
-		}
-		
 		if(xmlAnnotTypeManager.isBindingTypeExist(clazzAnnot))
 		{
-			throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Binding type with given class : " + bindingTypeElement.getName() + " is already defined in the XML");
+			throw new DeploymentException(createConfigurationFailedMessage() + "Binding type with given class : " + bindingTypeElement.getName() + " is already defined in the XML");
 		}
 		
 		xmlAnnotTypeManager.addBindingType(clazzAnnot);
@@ -311,20 +303,29 @@
 		{
 			clazzAnnot =  (Class<? extends Annotation>)clazz;
 		}
-		
-		if(clazz.isAnnotationPresent(InterceptorBindingType.class))
+				
+		if(xmlAnnotTypeManager.isInterceptorBindingTypeExist(clazzAnnot))
 		{
-			throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "InterceptorBinding type with given class : " + interceptorBindingTypeElement.getName() + " is already defined as @InterceptorBindingType");
+			throw new DeploymentException(createConfigurationFailedMessage() + "InterceptorBinding type with given class : " + interceptorBindingTypeElement.getName() + " is already defined in the XML");
 		}
 		
-		
-		if(xmlAnnotTypeManager.isInterceptorBindingTypeExist(clazzAnnot))
+		List<Element> childs = interceptorBindingTypeElement.elements();
+		for(Element child : childs)
 		{
-			throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "InterceptorBinding type with given class : " + interceptorBindingTypeElement.getName() + " is already defined in the XML");
+			Class<?> clz = XMLUtil.getElementJavaType(child);
+			if(clz == null)
+			{
+				throw new NonexistentTypeException(createConfigurationFailedMessage() +"InterceptorBinding type with given class : " + XMLUtil.getElementJavaClassName(child) + " not found");
+			}
+			
+			if(!clz.isAnnotation() || !AnnotationUtil.isInterceptorBindingAnnotation((Class<? extends Annotation>)clz))
+			{
+				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);
 		}
 		
-		xmlAnnotTypeManager.addInterceotorBindingType(clazzAnnot);
-		
 	}
 	
 	/**
@@ -349,19 +350,13 @@
 		{
 			clazzAnnot =  (Class<? extends Annotation>)clazz;
 		}
-		
-		if(clazz.isAnnotationPresent(Stereotype.class))
-		{
-			throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Stereotype with given class : " + stereoTypeElement.getName() + " is already defined as @StereoType");
-		}
-		
-		
+				
 		if(xmlAnnotTypeManager.isStereoTypeExist(clazzAnnot))
 		{
-			throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Stereotype with given class : " + stereoTypeElement.getName() + " is already defined in the XML");
+			throw new DeploymentException(createConfigurationFailedMessage() + "Stereotype with given class : " + stereoTypeElement.getName() + " is already defined in the XML");
 		}
 		
-		xmlAnnotTypeManager.addStereoType(clazzAnnot);
+		xmlAnnotTypeManager.addStereoType(clazzAnnot,stereoTypeElement,clazzAnnot.getName(),createConfigurationFailedMessage());
 		
 	}
 	
@@ -384,9 +379,10 @@
 			if (clazz == null)
 			{
 				throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Interceptor class : " + XMLUtil.getName(child) + " not found");
-			} else
+			} 
+			else
 			{
-				if (!AnnotationUtil.isMetaAnnotationExist(clazz.getAnnotations(), InterceptorBindingType.class))
+				if (!AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getDeclaredAnnotations()))
 				{
 					throw new WebBeansConfigurationException(createConfigurationFailedMessage() +"Interceptor class : " + XMLUtil.getName(child) + " must have at least one @InterceptorBindingType");
 				}
@@ -503,16 +499,12 @@
 		} 
 		else
 		{
-			if (ClassUtil.isConcrete(clazz) && !ClassUtil.isParametrized(clazz))
-			{	
-				/*Simple WebBeans*/
-				if (SimpleWebBeansConfigurator.isSimpleWebBean(clazz))
-				{
-					// Configure Simple WebBean
-					configureSimpleWebBean(clazz, webBeanElement);
-					ok = true;
-				}
-
+			/*Simple WebBeans*/
+			if (SimpleWebBeansConfigurator.isSimpleWebBean(clazz))
+			{
+				// Configure Simple WebBean
+				configureSimpleWebBean(clazz, webBeanElement);
+				ok = true;
 			}
 		}
 
@@ -935,7 +927,7 @@
 			else
 			{
 				if (childClazz.isAnnotation())
-				{
+				{	
 					if (childClazz.equals(Disposes.class))
 					{
 						if (isDefineType)
@@ -998,7 +990,7 @@
 							type = 1;
 						}
 					}
-					else if(childClazz.isAnnotationPresent(InterceptorBindingType.class))
+					else if(AnnotationUtil.isInterceptorBindingAnnotation((Class<? extends Annotation>)childClazz))
 					{
 						//InterceptorBindingType with method
 						type = 5;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java?rev=727554&r1=727553&r2=727554&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java Wed Dec 17 14:32:42 2008
@@ -18,16 +18,25 @@
 
 import java.lang.annotation.Annotation;
 import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArraySet;
 
+import org.apache.webbeans.deployment.StereoTypeManager;
+import org.apache.webbeans.deployment.XMLStereoTypeModel;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.dom4j.Element;
+
+
 public class XMLAnnotationTypeManager
 {
 	private static XMLAnnotationTypeManager manager = null;
 	
 	private Set<Class<? extends Annotation>> xmlBindingTypes = new CopyOnWriteArraySet<Class<? extends Annotation>>();
 	
-	private Set<Class<? extends Annotation>> xmlInterceptorBindingTypes = new CopyOnWriteArraySet<Class<? extends Annotation>>();
+	private Map<Class<? extends Annotation>, Set<Class<? extends Annotation>>> xmlInterceptorBindingTypes = new ConcurrentHashMap<Class<? extends Annotation>, Set<Class<? extends Annotation>>>();
 	
 	private Set<Class<? extends Annotation>> xmlStereoTypes = new CopyOnWriteArraySet<Class<? extends Annotation>>();
 	
@@ -61,8 +70,16 @@
 		return false;
 	}
 	
-	public void addStereoType(Class<? extends Annotation> bindingType)
+	public void addStereoType(Class<? extends Annotation> bindingType, Element decleration, String name, String errorMessage)
 	{
+		WebBeansUtil.checkStereoTypeClass(bindingType);
+		
+		StereoTypeManager manager = StereoTypeManager.getInstance();
+		
+		XMLStereoTypeModel model = new XMLStereoTypeModel(decleration,name,errorMessage);
+		manager.addStereoTypeModel(model);
+		
+		
 		xmlStereoTypes.add(bindingType);
 	}
 	
@@ -76,14 +93,24 @@
 		return false;
 	}
 
-	public void addInterceotorBindingType(Class<? extends Annotation> bindingType)
+	public void addInterceotorBindingTypeInheritAnnotation(Class<? extends Annotation> bindingType, Class<? extends Annotation> inherit)
 	{
-		xmlInterceptorBindingTypes.add(bindingType);
+		Set<Class<? extends Annotation>> inherits =  xmlInterceptorBindingTypes.get(bindingType);
+		if(inherits == null)
+		{
+			inherits = new HashSet<Class<? extends Annotation>>();
+			inherits.add(inherit);
+			xmlInterceptorBindingTypes.put(bindingType, inherits);
+		}
+		else
+		{
+			inherits.add(inherit);
+		}
 	}
 	
 	public boolean isInterceptorBindingTypeExist(Class<? extends Annotation> bindingType)
 	{
-		if(xmlInterceptorBindingTypes.contains(bindingType))
+		if(xmlInterceptorBindingTypes.keySet().contains(bindingType))
 		{
 			return true;
 		}
@@ -96,10 +123,16 @@
 		return Collections.unmodifiableSet(xmlBindingTypes);
 	}
 	
+	public Set<Class<? extends Annotation>> getInterceptorBindingTypeInherites(Class<? extends Annotation> interceptorBindingType)
+	{
+		return Collections.unmodifiableSet(xmlInterceptorBindingTypes.get(interceptorBindingType));
+	}
+	
 	public Set<Class<? extends Annotation>> getInterceptorBindingTypes()
 	{
-		return Collections.unmodifiableSet(xmlInterceptorBindingTypes);
+		return Collections.unmodifiableSet(xmlInterceptorBindingTypes.keySet());
 	}
+	
 
 	public Set<Class<? extends Annotation>> getStereotypes()
 	{

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java?rev=727554&r1=727553&r2=727554&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java Wed Dec 17 14:32:42 2008
@@ -22,16 +22,13 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.webbeans.BindingType;
 import javax.webbeans.Decorator;
 import javax.webbeans.DeploymentType;
 import javax.webbeans.Interceptor;
-import javax.webbeans.InterceptorBindingType;
 import javax.webbeans.Named;
 import javax.webbeans.NonexistentTypeException;
 import javax.webbeans.ScopeType;
 import javax.webbeans.Specializes;
-import javax.webbeans.Stereotype;
 
 import org.apache.webbeans.WebBeansConstants;
 import org.apache.webbeans.component.xml.XMLComponentImpl;
@@ -40,6 +37,7 @@
 import org.apache.webbeans.deployment.StereoTypeModel;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.proxy.JavassistProxyFactory;
+import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 import org.dom4j.Element;
 
@@ -61,9 +59,9 @@
 				Class<? extends Annotation> clazz = it.next();
 				if(clazz.isAnnotationPresent(DeploymentType.class) ||
 						clazz.isAnnotationPresent(ScopeType.class) ||
-						clazz.isAnnotationPresent(BindingType.class) ||
-						clazz.isAnnotationPresent(InterceptorBindingType.class) ||
-						clazz.isAnnotationPresent(Stereotype.class) ||
+						AnnotationUtil.isBindingAnnotation(clazz) ||
+						AnnotationUtil.isInterceptorBindingAnnotation(clazz) ||
+						AnnotationUtil.isStereoTypeAnnotation(clazz) ||
 						clazz.equals(Named.class) ||
 						clazz.equals(Specializes.class) ||
 						clazz.equals(Interceptor.class) ||
@@ -113,7 +111,7 @@
 		while(it.hasNext())
 		{
 			Class<? extends Annotation> temp = it.next();
-			if(temp.isAnnotationPresent(BindingType.class))
+			if(AnnotationUtil.isBindingAnnotation(temp))
 			{
 				if(!found)
 				{
@@ -134,7 +132,7 @@
 		while(it.hasNext())
 		{
 			Class<? extends Annotation> temp = it.next();
-			if(temp.isAnnotationPresent(InterceptorBindingType.class))
+			if(AnnotationUtil.isInterceptorBindingAnnotation(temp))
 			{
 				if(!found)
 				{
@@ -155,7 +153,7 @@
 		while(it.hasNext())
 		{
 			Class<? extends Annotation> temp = it.next();
-			if(temp.isAnnotationPresent(Stereotype.class))
+			if(AnnotationUtil.isStereoTypeAnnotation(temp))
 			{
 				if(!found)
 				{

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java?rev=727554&r1=727553&r2=727554&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java Wed Dec 17 14:32:42 2008
@@ -26,7 +26,6 @@
 import java.util.List;
 
 import javax.webbeans.DuplicateBindingTypeException;
-import javax.webbeans.InterceptorBindingType;
 import javax.webbeans.NonexistentTypeException;
 
 import org.apache.log4j.LogManager;
@@ -210,23 +209,39 @@
 		
 	}
 	
+	/**
+	 * Returns true if element has a bindingtype child element in webbeans namespace
+	 * false otherwise.
+	 * 
+	 * @param element parent element
+	 * 
+	 * @return true if element has a bindingtype child element in webbeans namespace
+	 */
 	public static boolean isElementBindingTypeDecleration(Element element)
 	{
 		nullCheckForElement(element);
 		
-		if(isElementChildExist(element, WebBeansConstants.WEB_BEANS_XML_BINDING_TYPE))
+		if(isElementChildExistWithWebBeansNameSpace(element, WebBeansConstants.WEB_BEANS_XML_BINDING_TYPE))
 		{
 			return true;
 		}
 		
 		return false;	
 	}
-	
+
+	/**
+	 * Returns true if element has a interceptor bindingtype child element in webbeans namespace
+	 * false otherwise.
+	 * 
+	 * @param element parent element
+	 * 
+	 * @return true if element has a interceptor bindingtype child element in webbeans namespace
+	 */	
 	public static boolean isElementInterceptorBindingTypeDecleration(Element element)
 	{
 		nullCheckForElement(element);
 		
-		if(isElementChildExist(element, WebBeansConstants.WEB_BEANS_XML_INTERCEPTOR_BINDING_TYPE))
+		if(isElementChildExistWithWebBeansNameSpace(element, WebBeansConstants.WEB_BEANS_XML_INTERCEPTOR_BINDING_TYPE))
 		{
 			return true;
 		}
@@ -234,11 +249,19 @@
 		return false;	
 	}
 	
+	/**
+	 * Returns true if element has a stereotype child element in webbeans namespace
+	 * false otherwise.
+	 * 
+	 * @param element parent element
+	 * 
+	 * @return true if element has a stereotype child element in webbeans namespace
+	 */		
 	public static boolean isElementStereoTypeDecleration(Element element)
 	{
 		nullCheckForElement(element);
 		
-		if(isElementChildExist(element, WebBeansConstants.WEB_BEANS_XML_STEREOTYPE))
+		if(isElementChildExistWithWebBeansNameSpace(element, WebBeansConstants.WEB_BEANS_XML_STEREOTYPE))
 		{
 			return true;
 		}
@@ -324,7 +347,7 @@
 				{
 					if(clazz.isAnnotation())
 					{
-						if(clazz.getAnnotation(InterceptorBindingType.class) != null)
+						if(AnnotationUtil.isInterceptorBindingAnnotation((Class<? extends Annotation>)clazz))
 						{
 							return false;
 						}
@@ -375,7 +398,7 @@
 				{
 					if(clazz.isAnnotation())
 					{
-						if(clazz.getAnnotation(InterceptorBindingType.class) != null)
+						if(AnnotationUtil.isInterceptorBindingAnnotation((Class<? extends Annotation>)clazz))
 						{
 							return true;
 						}
@@ -435,6 +458,32 @@
 		return parent.element(childName) != null ? true : false;
 	}
 	
+	/**
+	 * Return child element within webbeans namespace with given child name.
+	 * 
+	 * @param parent parent element
+	 * @param childName child element name
+	 * 
+	 * @return if child element exist within webbeans namespace with given child name
+	 */
+	public static boolean isElementChildExistWithWebBeansNameSpace(Element parent, String childName)
+	{
+		Asserts.assertNotNull(parent, "parent parameter can not be null");
+		Asserts.assertNotNull(childName, "childName parameter can not be null");
+		
+		Element child = parent.element(childName);
+		if(child == null)
+		{
+			return false;
+		}
+		else
+		{
+			return isElementInWebBeansNameSpace(child);
+		}
+		
+	}
+	
+	
 	
 	
 	/**
@@ -745,4 +794,5 @@
 		
 		return model;
 	}
+	
 }
\ No newline at end of file



Mime
View raw message