openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r751152 - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/ config/ container/ context/ decorator/ deployment/ intercept/webbeans/ proxy/ util/ xml/
Date Sat, 07 Mar 2009 00:59:47 GMT
Author: gerdogdu
Date: Sat Mar  7 00:59:46 2009
New Revision: 751152

URL: http://svn.apache.org/viewvc?rev=751152&view=rev
Log:
Updating for TCK tests.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomContextImpl.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/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/config/WebBeansContainerDeployer.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.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/container/ManagerImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.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/DeploymentTypeManager.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/proxy/JavassistProxyFactory.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

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -14,6 +14,8 @@
 package org.apache.webbeans.component;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -29,13 +31,16 @@
 import javax.inject.manager.Bean;
 import javax.inject.manager.InjectionPoint;
 
+import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
 import org.apache.webbeans.container.ManagerImpl;
 import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.DependentContext;
+import org.apache.webbeans.context.WebBeansContext;
 import org.apache.webbeans.context.creational.CreationalContextFactory;
 import org.apache.webbeans.deployment.DeploymentTypeManager;
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.intercept.InterceptorData;
+import org.apache.webbeans.util.WebBeansUtil;
 
 /**
  * Abstract implementation of the {@link Component} contract. There are several
@@ -67,7 +72,7 @@
     protected Set<Annotation> implBindingTypes = new HashSet<Annotation>();
 
     /** Api types of the component */
-    protected Set<Class<?>> apiTypes = new HashSet<Class<?>>();
+    protected Set<Type> apiTypes = new HashSet<Type>();
 
     /** Web Beans type */
     protected WebBeansType webBeansType;
@@ -98,6 +103,8 @@
     
     /**Beans injection points*/
     protected Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
+    
+    protected IBeanInheritedMetaData inheritedMetaData;
 
     /**
      * Constructor definiton. Each subclass redefines its own constructor with
@@ -187,6 +194,12 @@
             {
                 ContextFactory.passivateDependentContext();
             }
+            
+            if(WebBeansUtil.isScopeTypeNormal(getScopeType()))
+            {
+                WebBeansContext context = (WebBeansContext)getManager().getContext(getScopeType());
+                context.remove(this);   
+            }                        
         }
 
     }
@@ -362,13 +375,9 @@
         return this.implScopeType.annotationType();
     }
 
-    /*
-     * (non-Javadoc)
-     * @see javax.webbeans.manager.Bean#getTypes()
-     */
-    @Override
-    public Set<Class<?>> getTypes()
-    {
+    
+    public Set<Type> getTypes()
+    {        
         return this.apiTypes;
     }
 
@@ -491,9 +500,18 @@
         builder.append("\tAPI Types:\n");
         builder.append("\t[\n");
         
-        for(Class<?> clazz : this.apiTypes)
+        for(Type clazz : this.apiTypes)
         {
-            builder.append("\t\t\t"+clazz.getName()+ "\n");            
+            if(clazz instanceof Class)
+            {
+                builder.append("\t\t\t"+((Class<?>)clazz).getName()+ "\n");    
+            }
+            else
+            {
+                Class<?> rawType = (Class<?>)((ParameterizedType)clazz).getRawType();
+                builder.append("\t\t\t"+rawType.getName()+ "\n");
+            }
+                        
         }
         
         builder.append("\t]\n");

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -17,7 +17,6 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.context.CreationalContext;
 import javax.inject.manager.Bean;
 import javax.inject.manager.InjectionPoint;
 import javax.inject.manager.Manager;
@@ -41,7 +40,7 @@
     {
         super(manager);
     }
-
+    
     abstract public Annotation getType();
 
     abstract public void setType(Annotation type);

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -135,7 +135,7 @@
      */
     public static <T> void defineProducerMethodApiTypes(AbstractComponent<T>
component, Class<T> clazz)
     {
-        Set<Class<?>> types = component.getTypes();
+        Set<Type> types = component.getTypes();
         
         if (clazz.isPrimitive() || clazz.isArray())
         {
@@ -548,7 +548,7 @@
 
         defineSerializable(component);
 
-        Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(component,
method.getAnnotations(), "There are more than one @DeploymentType annotation in the component
class : " + component.getReturnType().getName());
+        Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(component,
method.getDeclaredAnnotations(), "There are more than one @DeploymentType annotation in the
component class : " + component.getReturnType().getName());
 
         // Check if the deployment type is enabled.
         if (!DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(deploymentType))

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -59,7 +59,8 @@
     public static void checkSimpleWebBeanCondition(Class<?> clazz) throws WebBeansConfigurationException
     {
         int modifier = clazz.getModifiers();
-
+                
+        
         if (AnnotationUtil.isAnnotationExistOnClass(clazz, Decorator.class) && AnnotationUtil.isAnnotationExistOnClass(clazz,
Interceptor.class))
         {
             throw new WebBeansConfigurationException("WebBeans component implementation class
: " + clazz.getName() + " can not annotated with both @Interceptor and @Decorator annotations");
  
@@ -116,8 +117,9 @@
         ComponentImpl<T> component = new ComponentImpl<T>(clazz, type);
 
         DefinitionUtil.defineSerializable(component);
-
-        Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(component,
clazz.getAnnotations(), "There are more than one @DeploymentType annotation in the component
class : " + component.getReturnType().getName());
+        DefinitionUtil.defineStereoTypes(component, clazz);
+        
+        Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(component,
clazz.getDeclaredAnnotations(), "There are more than one @DeploymentType annotation in the
component class : " + component.getReturnType().getName());
 
         // Check if the deployment type is enabled.
         if (!DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(deploymentType))
@@ -127,7 +129,6 @@
 
         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));

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -37,6 +37,7 @@
 import org.apache.webbeans.decorator.DecoratorUtil;
 import org.apache.webbeans.deployment.StereoTypeManager;
 import org.apache.webbeans.deployment.StereoTypeModel;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.exception.WebBeansDeploymentException;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.spi.deployer.MetaDataDiscoveryService;
@@ -74,7 +75,7 @@
      * 
      * @throws WebBeansDeploymentException if any deployment exception occurs
      */
-    public void deploy(MetaDataDiscoveryService scanner) throws WebBeansDeploymentException
+    public void deploy(MetaDataDiscoveryService scanner)
     {
         try
         {
@@ -94,6 +95,7 @@
                 configureInterceptors(scanner);
                 configureDecorators(scanner);
                 deployFromClassPath(scanner);
+                
                 checkSpecializations(scanner);
                 
                 //Fire @Initialized Event
@@ -109,9 +111,20 @@
             }
 
         }
-        catch (Exception e)
+        catch (WebBeansConfigurationException e)
         {
-            throw new WebBeansDeploymentException(e);
+            throw e;
+        }
+        catch(Exception e)
+        {
+            if(e instanceof WebBeansDeploymentException)
+            {
+                throw  (WebBeansDeploymentException)e;
+            }
+            else
+            {
+                throw new WebBeansDeploymentException(e);
+            }
         }
     }
     
@@ -252,40 +265,48 @@
     protected void checkSpecializations(MetaDataDiscoveryService scanner)
     {
         logger.info("Checking Specialization constraints is started");
-
-        Map<String, Set<String>> specialMap = scanner.getANNOTATION_DB().getAnnotationIndex();
-        if (specialMap != null && specialMap.size() > 0)
+        
+        try
         {
-            if (specialMap.containsKey(Specializes.class.getName()))
+            Map<String, Set<String>> specialMap = scanner.getANNOTATION_DB().getAnnotationIndex();
+            if (specialMap != null && specialMap.size() > 0)
             {
-                Set<String> specialClassSet = specialMap.get(Specializes.class.getName());
-                Iterator<String> specialIterator = specialClassSet.iterator();
-
-                Class<?> superClass = null;
-                while (specialIterator.hasNext())
+                if (specialMap.containsKey(Specializes.class.getName()))
                 {
-                    String specialClassName = specialIterator.next();
-                    Class<?> specialClass = ClassUtil.getClassFromName(specialClassName);
+                    Set<String> specialClassSet = specialMap.get(Specializes.class.getName());
+                    Iterator<String> specialIterator = specialClassSet.iterator();
 
-                    if (superClass == null)
-                    {
-                        superClass = specialClass.getSuperclass();
-                    }
-                    else
+                    Class<?> superClass = null;
+                    while (specialIterator.hasNext())
                     {
-                        if (superClass.equals(specialClass.getSuperclass()))
+                        String specialClassName = specialIterator.next();
+                        Class<?> specialClass = ClassUtil.getClassFromName(specialClassName);
+
+                        if (superClass == null)
+                        {
+                            superClass = specialClass.getSuperclass();
+                        }
+                        else
                         {
-                            throw new InconsistentSpecializationException("More than one
class that specialized the same super class : " + superClass.getName());
+                            if (superClass.equals(specialClass.getSuperclass()))
+                            {
+                                throw new InconsistentSpecializationException("More than
one class that specialized the same super class : " + superClass.getName());
+                            }
                         }
+                        
+                        WebBeansUtil.configureSpecializations(specialClass);
                     }
-                    
-                    WebBeansUtil.configureSpecializations(specialClass);
                 }
             }
-        }
 
-        // XML Defined Specializations
-        checkXMLSpecializations();
+            // XML Defined Specializations
+            checkXMLSpecializations();            
+        }
+        catch(Exception e)
+        {
+            throw new WebBeansDeploymentException(e);
+        }
+        
 
         logger.info("Checking Specialization constraints is ended");
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java?rev=751152&r1=751151&r2=751152&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java
Sat Mar  7 00:59:46 2009
@@ -95,7 +95,9 @@
      */
     public static void clearInstances()
     {
-        singletonMap.clear();
-        singletonMap = null;
+        if(singletonMap != null)
+        {
+            singletonMap.clear();   
+        }
     }
 }
\ No newline at end of file

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -200,11 +200,11 @@
 
             else
             {
-                Set<Class<?>> componentApiTypes = component.getTypes();
-                Iterator<Class<?>> itComponentApiTypes = componentApiTypes.iterator();
+                Set<Type> componentApiTypes = component.getTypes();
+                Iterator<Type> itComponentApiTypes = componentApiTypes.iterator();
                 while (itComponentApiTypes.hasNext())
                 {
-                    Class<?> componentApiType = itComponentApiTypes.next();
+                    Class<?> componentApiType = (Class<?>)itComponentApiTypes.next();
 
                     if (actualTypeArguments.length > 0)
                     {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java?rev=751152&r1=751151&r2=751152&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
Sat Mar  7 00:59:46 2009
@@ -167,7 +167,7 @@
 
     public Manager addContext(Context context)
     {
-        addContext(context.getScopeType(), context);
+        addContext(context.getScopeType(), ContextFactory.getCustomContext(context));
 
         return this;
 
@@ -206,7 +206,7 @@
         return object;
     }
     
-    public <T> T getInstanceToInject(InjectionPoint injectionPoint, CreationalContext<T>
context)
+    public <T> T getInstanceToInject(InjectionPoint injectionPoint, CreationalContext<?>
context)
     {
         T instance = null;
         
@@ -237,7 +237,7 @@
         return instance;
     }
     
-    public Object getInstanceToInject(InjectionPoint injectionPoint)
+    public <T> T getInstanceToInject(InjectionPoint injectionPoint)
     {        
         return getInstanceToInject(injectionPoint, null);
     }
@@ -377,7 +377,7 @@
         return this;
     }
 
-    public List<Decorator> resolveDecorators(Set<Class<?>> types, Annotation...
bindingTypes)
+    public List<Decorator> resolveDecorators(Set<Type> types, Annotation... bindingTypes)
     {
         WebBeansUtil.checkDecoratorResolverParams(types, bindingTypes);
         Set<Decorator> intsSet = WebBeansDecoratorConfig.findDeployedWebBeansDecorator(types,
bindingTypes);
@@ -496,6 +496,19 @@
         return false;
     }
     
+    public Manager createActivity()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Manager setCurrent(Class<? extends Annotation> scopeType)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    
     public void clear()
     {
         this.components.clear();

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java?rev=751152&r1=751151&r2=751152&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
Sat Mar  7 00:59:46 2009
@@ -31,7 +31,6 @@
 import javax.inject.manager.Manager;
 
 import org.apache.webbeans.context.type.ContextTypes;
-import org.apache.webbeans.exception.ContextRemoveException;
 
 /**
  * Abstract implementation of the {@link WebBeansContext} interfaces.
@@ -185,11 +184,6 @@
             componentInstanceMap.remove(component);
             removeInstance(component);
         }
-        else
-        {
-            throw new ContextRemoveException("Given component with " + component + " is not
found in the current context with type : " + getType().getTypeName());
-        }
-
     }
 
     /**
@@ -235,7 +229,7 @@
 
     public <T> void remove(Manager container, Bean<T> component)
     {
-        remove((Bean<T>) component);
+        remove(component);
     }
 
     public abstract void setComponentInstanceMap();

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java?rev=751152&r1=751151&r2=751152&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
Sat Mar  7 00:59:46 2009
@@ -18,6 +18,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import javax.context.ApplicationScoped;
+import javax.context.Context;
 import javax.context.ContextNotActiveException;
 import javax.context.ConversationScoped;
 import javax.context.Dependent;
@@ -101,6 +102,11 @@
         }
     }
 
+    public static Context getCustomContext(Context context)
+    {
+        return new CustomContextImpl(context);
+    }
+    
     /**
      * Destroys the request context and all of its components.
      * 

Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomContextImpl.java?rev=751152&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomContextImpl.java
(added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomContextImpl.java
Sat Mar  7 00:59:46 2009
@@ -0,0 +1,65 @@
+/*
+ *  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.context;
+
+import java.lang.annotation.Annotation;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.context.Context;
+import javax.context.Contextual;
+import javax.context.CreationalContext;
+
+class CustomContextImpl extends AbstractContext
+{
+    private Context context;
+    
+    CustomContextImpl(Context context)
+    {
+        this.context = context;
+        setComponentInstanceMap();
+    }
+    
+    public Class<? extends Annotation> getScopeType()
+    {
+        return this.context.getScopeType();
+    }
+
+    public <T> T get(Contextual<T> component, CreationalContext<T> crreationalContext)
+    {
+        return this.context.get(component, crreationalContext);
+    }
+
+    public <T> T get(Contextual<T> component)
+    {
+        return this.context.get(component);
+    }
+
+    public boolean isActive()
+    {
+        return this.context.isActive();
+    }
+    
+
+    @Override
+    public void setComponentInstanceMap()
+    {
+        this.componentInstanceMap = new ConcurrentHashMap<Contextual<?>, Object>();
+        
+        
+    }
+
+}

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

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java?rev=751152&r1=751151&r2=751152&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
Sat Mar  7 00:59:46 2009
@@ -16,6 +16,7 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.lang.reflect.Type;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -44,7 +45,7 @@
 
     public static void checkDecoratorConditions(Class<?> decoratorClazz)
     {       
-        Set<Class<?>> decoratorSet = new HashSet<Class<?>>();
+        Set<Type> decoratorSet = new HashSet<Type>();
         ClassUtil.setInterfaceTypeHierarchy(decoratorSet, decoratorClazz);
         
         //No-Decorates found, check from super class
@@ -59,7 +60,7 @@
         }
     }
     
-    private static boolean checkInternalDecoratorConditionsRecursivley(Class<?> decoratorClazz,Set<Class<?>>
decoratorSet)
+    private static boolean checkInternalDecoratorConditionsRecursivley(Class<?> decoratorClazz,Set<Type>
decoratorSet)
     {
         Class<?> superClazz = decoratorClazz.getSuperclass();
         if(!superClazz.equals(Object.class))
@@ -78,7 +79,7 @@
         return false;
     }
     
-    private static boolean checkInternalDecoratorConditions(Class<?> decoratorClazz,Set<Class<?>>
decoratorSet)
+    private static boolean checkInternalDecoratorConditions(Class<?> decoratorClazz,Set<Type>
decoratorSet)
     {
         Field[] fields = decoratorClazz.getDeclaredFields();
         boolean found = false;
@@ -98,9 +99,9 @@
                         throw new WebBeansConfigurationException("Decorator class : " + decoratorClazz.getName()
+ " delegate attribute type must be interface");
                     }
 
-                    for (Class<?> decType : decoratorSet)
+                    for (Type decType : decoratorSet)
                     {
-                        if (!fieldType.isAssignableFrom(decType))
+                        if (!fieldType.isAssignableFrom((Class<?>)decType))
                         {
                             throw new WebBeansConfigurationException("Decorator class : "
+ decoratorClazz.getName() + " delegate attribute must implement all of the decorator decorated
types.");
                         }

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -17,6 +17,7 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.lang.reflect.Type;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -44,7 +45,7 @@
     private Class<?> clazz;
 
     /** Decorates api types */
-    private Set<Class<?>> decoratedTypes = new HashSet<Class<?>>();
+    private Set<Type> decoratedTypes = new HashSet<Type>();
 
     /** Delegate field class type */
     protected Class<?> delegateType;
@@ -125,11 +126,12 @@
         
     }
 
-    public boolean isDecoratorMatch(Set<Class<?>> apiType, Set<Annotation>
annotation)
+    public boolean isDecoratorMatch(Set<Type> apiType, Set<Annotation> annotation)
     {
         boolean foundApi = false;
-        for (Class<?> clazz : apiType)
+        for (Type t : apiType)
         {
+            Class<?> clazz = (Class<?>)t;
             if (this.delegateType.equals(clazz))
             {
                 foundApi = true;
@@ -273,8 +275,8 @@
         return delegateComponent.getScopeType();
     }
 
-    @Override
-    public Set<Class<?>> getTypes()
+    
+    public Set<Type> getTypes()
     {
         return delegateComponent.getTypes();
     }

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -14,6 +14,7 @@
 package org.apache.webbeans.decorator;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -88,7 +89,7 @@
         return Collections.unmodifiableSet(ManagerImpl.getManager().getDecorators());
     }
 
-    public static Set<Decorator> findDeployedWebBeansDecorator(Set<Class<?>>
apiType, Annotation... anns)
+    public static Set<Decorator> findDeployedWebBeansDecorator(Set<Type> apiType,
Annotation... anns)
     {
         Set<Decorator> set = new HashSet<Decorator>();
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java?rev=751152&r1=751151&r2=751152&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java
Sat Mar  7 00:59:46 2009
@@ -15,10 +15,15 @@
 
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import javax.inject.Production;
 import javax.inject.Standard;
 
 import org.apache.webbeans.config.WebBeansFinder;
@@ -36,10 +41,17 @@
     public static DeploymentTypeManager getInstance()
     {
         DeploymentTypeManager instance = (DeploymentTypeManager) WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_DEPLOYMENT_TYPE_MANAGER);
+        
         if (!instance.deploymentTypeMap.containsKey(Standard.class)) 
         {
             instance.deploymentTypeMap.put(Standard.class, Integer.valueOf(0));
         }
+        
+        if (!instance.deploymentTypeMap.containsKey(Production.class)) 
+        {
+            instance.deploymentTypeMap.put(Production.class, Integer.valueOf(1));
+        }
+        
         return instance;
     }
 
@@ -56,6 +68,11 @@
             }
         }
     }
+    
+    public void removeProduction()
+    {
+        this.deploymentTypeMap.remove(Production.class);
+    }
 
     public int getPrecedence(Class<? extends Annotation> deploymentType)
     {
@@ -94,11 +111,96 @@
         return deploymentTypeMap.containsKey(deploymentType);
     }
     
+    private static class DeploymentComparator implements Comparator<DeploymentTypeObject>
+    {
+
+        public int compare(DeploymentTypeObject o1, DeploymentTypeObject o2)
+        {
+            if(o1.getPrecedence() < o2.getPrecedence())
+            {
+                return -1;
+            }
+            else if(o1.getPrecedence() > o2.getPrecedence())
+            {
+                return 1;
+            }
+            
+            return 0;
+        }
+
+        
+    }
+    
+    private static class DeploymentTypeObject
+    {
+        private int precedence;
+        private Class<? extends Annotation> type;
+        
+        public DeploymentTypeObject(Class<? extends Annotation> clazz, int precedence)
+        {
+            this.precedence = precedence;
+            this.type = clazz;
+        }
+
+        /**
+         * @return the precedence
+         */
+        protected int getPrecedence()
+        {
+            return precedence;
+        }
+
+        /**
+         * @param precedence the precedence to set
+         */
+        protected void setPrecedence(int precedence)
+        {
+            this.precedence = precedence;
+        }
+
+        /**
+         * @return the type
+         */
+        protected Class<? extends Annotation> getType()
+        {
+            return type;
+        }
+
+        /**
+         * @param type the type to set
+         */
+        protected void setType(Class<? extends Annotation> type)
+        {
+            this.type = type;
+        }
+        
+        
+    }
+    
     public List<Class<? extends Annotation>> getEnabledDeploymentTypes()
     {
-        ArrayList<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<?
extends Annotation>>();
+        List<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<?
extends Annotation>>();
+        
+        List<DeploymentTypeObject> objects = new ArrayList<DeploymentTypeObject>();
+        
+        Set<Class<? extends Annotation>> keys = this.deploymentTypeMap.keySet();
+        Iterator<Class<? extends Annotation>> it = keys.iterator();       
+        while(it.hasNext())
+        {
+            Class<? extends Annotation> key = it.next();
+            Integer value = this.deploymentTypeMap.get(key);
+            
+            objects.add(new DeploymentTypeObject(key,value));
+       }
+        
+        
+        Collections.sort(objects, new DeploymentComparator());
+        
+        for(DeploymentTypeObject obj : objects)
+        {
+            enabledDeploymentTypes.add(obj.getType());
+        }
         
-        enabledDeploymentTypes.addAll(deploymentTypeMap.keySet());
         return enabledDeploymentTypes;
     }
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -16,6 +16,7 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.lang.reflect.Type;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -307,13 +308,11 @@
         return delegateComponent.getScopeType();
     }
 
-    @Override
-    public Set<Class<?>> getTypes()
+    public Set<Type> getTypes()
     {
         return delegateComponent.getTypes();
     }
     
-    
     public Set<InjectionPoint> getInjectionPoints()
     {
         return delegateComponent.getInjectionPoints();

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java?rev=751152&r1=751151&r2=751152&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
Sat Mar  7 00:59:46 2009
@@ -15,6 +15,7 @@
 
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -42,11 +43,12 @@
         Object result = null;
         try
         {
-            Set<Class<?>> types = bean.getTypes();
+            Set<Type> types = bean.getTypes();
             List<Class<?>> interfaceList = new ArrayList<Class<?>>();
             Class<?> superClass = null;
-            for (Class<?> type : types)
+            for (Type t : types)
             {
+                Class<?> type = (Class<?>)t;
                 if (type.isInterface())
                 {
                     interfaceList.add(type);

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -1127,7 +1127,7 @@
         return (Class<?>) type;
     }
 
-    public static Set<Class<?>> setTypeHierarchy(Set<Class<?>> set,
Class<?> clazz)
+    public static Set<Type> setTypeHierarchy(Set<Type> set, Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz);
 
@@ -1149,7 +1149,7 @@
         return set;
     }
 
-    public static Set<Class<?>> setInterfaceTypeHierarchy(Set<Class<?>>
set, Class<?> clazz)
+    public static Set<Type> setInterfaceTypeHierarchy(Set<Type> set, Class<?>
clazz)
     {
         Asserts.nullCheckForClass(clazz);
 

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -1034,7 +1034,7 @@
                 {
                     Annotation result2[] = AnnotationUtil.getMetaAnnotations(dt.annotationType().getAnnotations(),
DeploymentType.class);
 
-                    Class<? extends Annotation> dtAnnot = result2[0].getClass();
+                    Class<? extends Annotation> dtAnnot = result2[0].annotationType();
                     if (maxPrecedDeploymentType == null)
                     {
                         maxPrecedDeploymentType = dtAnnot;
@@ -1272,10 +1272,12 @@
         Asserts.assertNotNull("bean", "bean parameter can not be null");
         Asserts.assertNotNull(scopeType, "scopeType parameter can not be null");
 
-        Set<Class<?>> types = bean.getTypes();
+        Set<Type> types = bean.getTypes();
         Class<?> superClass = null;
-        for (Class<?> type : types)
+        for (Type t : types)
         {
+            Class<?> type = (Class<?>)t;
+            
             if (!type.isInterface())
             {
                 if ((superClass == null) || (superClass.isAssignableFrom(type) &&
type != Object.class))
@@ -1450,7 +1452,7 @@
         }
     }
 
-    public static void checkDecoratorResolverParams(Set<Class<?>> apiTypes, Annotation...
bindingTypes)
+    public static void checkDecoratorResolverParams(Set<Type> apiTypes, Annotation...
bindingTypes)
     {
         if (apiTypes == null || apiTypes.size() == 0)
         {

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=751152&r1=751151&r2=751152&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
Sat Mar  7 00:59:46 2009
@@ -189,7 +189,9 @@
                     {
                         throw new DeploymentException("<Deploy> element must have <Standard/>
deployment type in the web-beans.xml");
                     }
-
+                    
+                    DeploymentTypeManager.getInstance().removeProduction();
+                    
                     configureDeploymentTypes(child);
                     DEPLOY_IS_DEFINED = true;
 



Mime
View raw message