openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r883091 - in /incubator/openwebbeans/trunk: webbeans-api/src/main/java/javax/enterprise/inject/spi/ webbeans-ejb/src/main/java/org/apache/webbeans/ejb/util/ webbeans-impl/src/main/java/org/apache/webbeans/component/ webbeans-impl/src/main/j...
Date Sun, 22 Nov 2009 15:45:01 GMT
Author: struberg
Date: Sun Nov 22 15:45:00 2009
New Revision: 883091

URL: http://svn.apache.org/viewvc?rev=883091&view=rev
Log:
OWB-154 remove Bean#getDeploymentType() and DeploymentType in general

DeploymentType has been dropped in favour to Alternatives.

Removed:
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/ComponentTypeExceptionComponent.java
Modified:
    incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/Bean.java
    incubator/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/util/EjbUtility.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanCreator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.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/ManagedBeanConfigurator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.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/WebBeansUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java

Modified: incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/Bean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/Bean.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/Bean.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/Bean.java
Sun Nov 22 15:45:00 2009
@@ -47,18 +47,7 @@
      * 
      * @return qualifiers of a bean
      */
-    public abstract Set<Annotation> getQualifiers();
-
-
-    /**
-     * Returns bean deployment type.
-     * 
-     * @return bean's deployment type.
-     * @deprecated this has been dropped from the spec in favor to 'Alternatives'
-     */
-    @Deprecated
-    public abstract Class<? extends Annotation> getDeploymentType();
-    
+    public abstract Set<Annotation> getQualifiers();    
     
     /**
      * Returns scope of a bean.

Modified: incubator/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/util/EjbUtility.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/util/EjbUtility.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/util/EjbUtility.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/util/EjbUtility.java
Sun Nov 22 15:45:00 2009
@@ -80,7 +80,6 @@
         //Define meta-data
         ejbBeanCreator.defineSerializable();
         ejbBeanCreator.defineStereoTypes();
-        Class<? extends Annotation> deploymentType = ejbBeanCreator.defineDeploymentType("There
are more than one @DeploymentType annotation in Session Bean implementation class : " + ejbBean.getReturnType().getName());
         ejbBeanCreator.defineApiType();
         ejbBeanCreator.defineScopeType("Session Bean implementation class : " + clazz.getName()
+ " stereotypes must declare same @ScopeType annotations");
         ejbBeanCreator.defineQualifier();
@@ -163,22 +162,9 @@
         }
         
         boolean addBeans = true;        
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        if(!useAlternative)
-        {
-            if (!WebBeansUtil.isDeploymentTypeEnabled(deploymentType))
-            {
-                addBeans = false;
-            }
-        }
-        
-        if (addBeans)
-        {                                
-            BeanManagerImpl.getManager().addBean(ejbBean);
-            BeanManagerImpl.getManager().getBeans().addAll(producerMethodBeans);
-            BeanManagerImpl.getManager().getBeans().addAll(producerFieldBeans);
-        }        
+        BeanManagerImpl.getManager().addBean(ejbBean);
+        BeanManagerImpl.getManager().getBeans().addAll(producerMethodBeans);
+        BeanManagerImpl.getManager().getBeans().addAll(producerFieldBeans);
     }
     
     private static void checkProducerMethods(Set<ProducerMethodBean<?>> producerMethodBeans,
EjbBean<?> bean)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
Sun Nov 22 15:45:00 2009
@@ -361,16 +361,6 @@
             throw new UnsupportedOperationException("Component name is not null, is " + this.name);
     }
 
-    /**
-     * Gets predecence of the bean.
-     * 
-     * @return precedence
-     */
-    public int getPrecedence()
-    {
-        return DeploymentTypeManager.getInstance().getPrecedence(getDeploymentType());
-    }
-
     /*
      * (non-Javadoc)
      * @see javax.webbeans.manager.Bean#getQualifiers()
@@ -383,16 +373,6 @@
 
     /*
      * (non-Javadoc)
-     * @see javax.webbeans.manager.Bean#getDeploymentType()
-     */
-    @Override
-    public Class<? extends Annotation> getDeploymentType()
-    {
-        return this.type.annotationType();
-    }
-
-    /*
-     * (non-Javadoc)
      * @see javax.webbeans.manager.Bean#getScope()
      */
     @Override

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
Sun Nov 22 15:45:00 2009
@@ -50,12 +50,7 @@
         super(type, returnType);
         this.ownerComponent = ownerComponent;
         
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        if(useAlternative)
-        {
-            setEnabled(ownerComponent.isEnabled());   
-        }
+        setEnabled(ownerComponent.isEnabled());   
     }
 
     /**

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java
Sun Nov 22 15:45:00 2009
@@ -170,12 +170,6 @@
     public abstract List<InjectionPoint> getInjectionPoint(Member member);
 
     /**
-     * Gets precedence
-     * @return precedence
-     */
-    public abstract int getPrecedence();
-
-    /**
      * Returns bean class type
      * @return bean class type
      */

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
Sun Nov 22 15:45:00 2009
@@ -61,11 +61,7 @@
         this.bean = bean;
         this.beanAnnotations = beanAnnotations;
         
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        if(useAlternative)
-        {
-            WebBeansUtil.setBeanEnableFlag(bean);   
-        }
+        WebBeansUtil.setBeanEnableFlag(bean);   
     }
 
     /**
@@ -123,30 +119,6 @@
      * {@inheritDoc}
      */
     @Override
-    public Class<? extends Annotation> defineDeploymentType(String errorMessage)
-    {
-        Class<? extends Annotation> deploymentType = null;
-        
-        if(isDefaultMetaDataProvider())
-        {
-            boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-            if(!useAlternative)
-            {
-                deploymentType = DefinitionUtil.defineDeploymentType(this.bean, this.beanAnnotations,
errorMessage);   
-            }
-        }
-        else
-        {
-            //TODO Define deployment type
-        }
-        
-        return deploymentType;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
     public void defineName(String defaultName)
     {
         if(isDefaultMetaDataProvider())

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanCreator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanCreator.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanCreator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanCreator.java
Sun Nov 22 15:45:00 2009
@@ -60,14 +60,6 @@
     public void defineStereoTypes();
     
     /**
-     * Defines deployment type.
-     * 
-     * @param errorMessage error messahe
-     * @return deployment type
-     */
-    public Class<? extends Annotation> defineDeploymentType(String errorMessage);
-    
-    /**
      * Define api type.
      */
     public void defineApiType();

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
Sun Nov 22 15:45:00 2009
@@ -48,13 +48,6 @@
     }
 
     @Override
-    public Class<? extends Annotation> getDeploymentType()
-    {
-        
-        return bean.getDeploymentType();
-    }
-
-    @Override
     public Set<InjectionPoint> getInjectionPoints()
     {
         

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Sun Nov 22 15:45:00 2009
@@ -652,7 +652,6 @@
             //Define meta-data
             managedBeanCreator.defineSerializable();
             managedBeanCreator.defineStereoTypes();
-            Class<? extends Annotation> deploymentType = managedBeanCreator.defineDeploymentType("There
are more than one @DeploymentType annotation in ManagedBean implementation class : " + managedBean.getReturnType().getName());
             managedBeanCreator.defineApiType();
             managedBeanCreator.defineScopeType("ManagedBean implementation class : " + clazz.getName()
+ " stereotypes must declare same @Scope annotations");
             managedBeanCreator.defineQualifier();
@@ -734,27 +733,12 @@
                 managedBean.setInjectionTarget(managedBeanCreator.getInjectedTarget()); 
 
             }
             
-            boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-            boolean addBeans = true;
-            if(!useAlternative)
-            {
-                // Check if the deployment type is enabled.
-                if (!WebBeansUtil.isDeploymentTypeEnabled(deploymentType))
-                {
-                    addBeans = false;
-                }
-                
-            }
-            
-            if (addBeans)
-            {                
-                BeanManagerImpl.getManager().addBean(WebBeansUtil.createNewBean(managedBean));
               
-                DecoratorUtil.checkManagedBeanDecoratorConditions(managedBean);
-                BeanManagerImpl.getManager().addBean(managedBean);
-                BeanManagerImpl.getManager().getBeans().addAll(producerMethods);
-                managedBeanCreator.defineDisposalMethods();//Define disposal method after
adding producers
-                BeanManagerImpl.getManager().getBeans().addAll(producerFields);
-            }
+            BeanManagerImpl.getManager().addBean(WebBeansUtil.createNewBean(managedBean));
               
+            DecoratorUtil.checkManagedBeanDecoratorConditions(managedBean);
+            BeanManagerImpl.getManager().addBean(managedBean);
+            BeanManagerImpl.getManager().getBeans().addAll(producerMethods);
+            managedBeanCreator.defineDisposalMethods();//Define disposal method after adding
producers
+            BeanManagerImpl.getManager().getBeans().addAll(producerFields);
         }
     }
 

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=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
Sun Nov 22 15:45:00 2009
@@ -84,81 +84,6 @@
 
     }
     
-    public static <T> Class<? extends Annotation> defineDeploymentType(AbstractBean<T>
component, Annotation[] beanAnnotations, String errorMessage)
-    {
-        boolean found = false;
-        for (Annotation annotation : beanAnnotations)
-        {
-            // Component Type annotation is not null, if Component
-            Annotation ct = annotation.annotationType().getAnnotation(DeploymentType.class);
-
-            if (ct != null)
-            {
-                // Already found component type, too many component type ,throw
-                // exception
-                if (found == true)
-                {
-                    throw new WebBeansConfigurationException(errorMessage);
-                }
-                else
-                {
-                    component.setType(annotation);// component type
-                    found = true;
-                }
-            }
-        }
-
-        if (!found)
-        {
-            // Look inherited meta-data deployment type
-            IBeanInheritedMetaData metadata = component.getInheritedMetaData();
-            if (metadata != null)
-            {
-                if (metadata.getInheritedDeploymentType() != null)
-                {
-                    component.setType(metadata.getInheritedDeploymentType());
-                    found = true;
-                }
-            }
-        }
-
-        // Still not set
-        if (!found)
-        {
-            // Look stereotype
-            Annotation result = WebBeansUtil.getMaxPrecedenceSteroTypeDeploymentType(component);
-
-            if (result == null)
-            {
-                //From parent
-                if (!found && (component instanceof IBeanHasParent))
-                {
-                    IBeanHasParent<T> child = (IBeanHasParent<T>) component;
-                    component.setType(child.getParent().getType());
-                }
-                
-                else
-                {
-                    component.setType(new ProductionLiteral());
-                    found = true;    
-                }
-                
-            }
-            else
-            {
-                component.setType(result);
-                found = true;
-            }
-        }
-                
-        if(component.getDeploymentType().equals(Standard.class))
-        {
-            throw new WebBeansConfigurationException("WebBeans " + component + " may not
declare deployment type @Standard");
-        }
-        
-        return component.getDeploymentType();
-    }
-
     /**
      * Configures the web bean api types.
      * 
@@ -665,19 +590,6 @@
         defineSerializable(component);
         defineStereoTypes(component, method.getDeclaredAnnotations());
 
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        if(!useAlternative)
-        {
-            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))
-            {
-                return null;
-            }            
-        }
-
         Annotation[] methodAnns = method.getDeclaredAnnotations();
 
         DefinitionUtil.defineProducerMethodApiTypes(component, method.getGenericReturnType(),
methodAnns);
@@ -724,19 +636,6 @@
         defineSerializable(component);
         defineStereoTypes(component, field.getDeclaredAnnotations());
 
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        if(!useAlternative)
-        {
-            Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(component,
field.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))
-            {
-                return null;
-            }            
-        }
-        
         Annotation[] fieldAnns = field.getDeclaredAnnotations();
 
         DefinitionUtil.defineProducerMethodApiTypes(component, field.getGenericType(), fieldAnns);
@@ -1204,19 +1103,6 @@
         defineSerializable(bean);
         defineStereoTypes(bean, anns);
 
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        if(!useAlternative)
-        {
-            Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(bean,
anns, "There are more than one @DeploymentType annotation in the bean class : " + bean.getReturnType().getName());
-
-            // Check if the deployment type is enabled.
-            if (!DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(deploymentType))
-            {
-                return null;
-            }            
-        }
-
         DefinitionUtil.defineProducerMethodApiTypes(bean, method.getBaseType(), anns);
         DefinitionUtil.defineScopeType(bean, anns, "Bean producer method : " + method.getJavaMember().getName()
+ " in class " + parent.getReturnType().getName() + " must declare default @Scope annotation");
         WebBeansUtil.checkProducerGenericType(bean,method.getJavaMember());        

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
Sun Nov 22 15:45:00 2009
@@ -112,28 +112,11 @@
 
         ManagedBean<T> component = new ManagedBean<T>(clazz, type);
         
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        if(useAlternative)
-        {
-            WebBeansUtil.setBeanEnableFlag(component);   
-        }
+        WebBeansUtil.setBeanEnableFlag(component);   
         
         DefinitionUtil.defineSerializable(component);
         DefinitionUtil.defineStereoTypes(component, clazz.getDeclaredAnnotations());
-        
-        //Use @DeploymentType instead of using @Alternative
-        if(!useAlternative)
-        {
-            Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(component,
clazz.getDeclaredAnnotations(), "There are more than one @DeploymentType annotation in Simple
WebBean Component implementation class : " + component.getReturnType().getName());
-
-            // Check if the deployment type is enabled.
-            if (!WebBeansUtil.isDeploymentTypeEnabled(deploymentType))
-            {
-                return null;
-            }            
-        }
-        
+                
         Annotation[] clazzAnns = clazz.getDeclaredAnnotations();
 
         DefinitionUtil.defineApiTypes(component, clazz);
@@ -171,31 +154,13 @@
         Class<T> javaClazz = annotatedType.getJavaClass();
         ManagedBean<T> component = new ManagedBean<T>(javaClazz, WebBeansType.MANAGED);
         
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        if(useAlternative)
-        {
-            WebBeansUtil.setBeanEnableFlag(component);   
-        }
+        WebBeansUtil.setBeanEnableFlag(component);   
         
         Annotation[] clazzAnns = annotatedType.getAnnotations().toArray(new Annotation[0]);
         
         DefinitionUtil.defineSerializable(component);
         DefinitionUtil.defineStereoTypes(component, clazzAnns);
         
-        //Use @DeploymentType instead of using @Alternative
-        if(!useAlternative)
-        {
-            Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(component,
clazzAnns, "There are more than one @DeploymentType annotation in Simple WebBean Component
implementation class : " + component.getReturnType().getName());
-
-            // Check if the deployment type is enabled.
-            if (!WebBeansUtil.isDeploymentTypeEnabled(deploymentType))
-            {
-                return null;
-            }            
-        }
-        
-
         DefinitionUtil.defineApiTypes(component, javaClazz);
         DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation
class : " + javaClazz.getName() + " stereotypes must declare same @Scope annotations");
         

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
Sun Nov 22 15:45:00 2009
@@ -51,9 +51,6 @@
     /**Use OWB Specific Field Injection*/
     public static final String USE_OWB_SPECIFIC_FIELD_INJECTION = "org.apache.webbeans.fieldInjection.useOwbSpecificInjection";
   
     
-    /**Use Alternative or DeploymentType*/
-    public static final String USE_INJECTION_RESOLVER_VIA_ALTERNATIVE = "org.apache.webbeans.resolver.useAlternative";
-    
     /**Use EJB Discovery or not*/
     public static final String USE_EJB_DISCOVERY = "org.apache.webbeans.spi.deployer.UseEjbMetaDataDiscoveryService";
     
@@ -157,13 +154,5 @@
         
         return Boolean.valueOf(value);
     }
-    
-    public boolean useAlternativeOrDeploymentType()
-    {
-        String value = getProperty(USE_INJECTION_RESOLVER_VIA_ALTERNATIVE);
         
-        return Boolean.valueOf(value);
-    }
-    
-    
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Sun Nov 22 15:45:00 2009
@@ -831,16 +831,7 @@
             set.add(obj);
         }
         
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        if(useAlternative)
-        {
-            set = this.injectionResolver.findByAlternatives(set);
-        }        
-        else
-        {
-            set = this.injectionResolver.findByPrecedence(set);   
-        }
+        set = this.injectionResolver.findByAlternatives(set);
         
         if(set.size() > 1)
         {

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=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Sun Nov 22 15:45:00 2009
@@ -243,21 +243,9 @@
             }
         }
         
-        //check for alternative
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        //Check for enable/disable status of bean
-        if(useAlternative)
-        {
-            //Look for enable/disable
-            resolvedComponents = findByEnabled(resolvedComponents);
-        }
-        else
-        {
-            //Look for precedence
-            resolvedComponents = findByPrecedence(resolvedComponents);   
-        }                
-        
+        //Look for enable/disable
+        resolvedComponents = findByEnabled(resolvedComponents);
+
         //Still Ambigious, check for specialization
         if(resolvedComponents.size() > 1)
         {
@@ -382,18 +370,8 @@
         //Look for qualifiers
         results = findByQualifier(results, qualifier);
         
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
-        if(useAlternative)
-        {
-            //Look for alternative
-            results = findByAlternatives(results);
-        }
-        else
-        {
-            //Look for precedence
-            results = findByPrecedence(results);   
-        }        
+        //Look for alternative
+        results = findByAlternatives(results);
 
         //Ambigious resulotion, check for specialization
         if(results.size() > 1)
@@ -433,54 +411,7 @@
         
         return result;
     }
-    
-    /**
-     * Return filtered beans according to the deployment type precedence.
-     * 
-     * @param <T> bean class
-     * @param result resulted beans
-     * @return filtered beans according to the deployment type precedence
-     */
-    public Set<Bean<?>> findByPrecedence(Set<Bean<?>> result)
-    {
-        Bean<?> resolvedComponent = null;
-        Iterator<Bean<?>> it = result.iterator();
-        Set<Bean<?>> res = new HashSet<Bean<?>>();
-
-        while (it.hasNext())
-        {
-            Bean<?> component = it.next();
-
-            if (resolvedComponent == null)
-            {
-                resolvedComponent = component;
-                res.add(resolvedComponent);
-            }
-            else
-            {
-                DeploymentTypeManager typeManager = DeploymentTypeManager.getInstance();
-
-                if (typeManager.comparePrecedences(component.getDeploymentType(), resolvedComponent.getDeploymentType())
< 0)
-                {
-                    continue;
-                }
-                else if (typeManager.comparePrecedences(component.getDeploymentType(), resolvedComponent.getDeploymentType())
> 0)
-                {
-                    res.clear();
-                    resolvedComponent = component;
-                    res.add(resolvedComponent);
-
-                }
-                else
-                {
-                    res.add(component);
-                }
-            }
-        }
-
-        return res;
-    }
-    
+        
     /**
      * Gets alternatives from set.
      * @param result resolved set

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=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
Sun Nov 22 15:45:00 2009
@@ -308,12 +308,6 @@
     }
 
     @Override
-    public Class<? extends Annotation> getDeploymentType()
-    {
-        return wrappedBean.getDeploymentType();
-    }
-
-    @Override
     public String getName()
     {
         return wrappedBean.getName();

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=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
Sun Nov 22 15:45:00 2009
@@ -92,6 +92,7 @@
 //        {
 //            return PrePassivate.class;
 //        }
+        //X TODO also add handling of AROUND_TIMEOUT somewhere
         else
         {
             throw new WebBeansException("Undefined interceotion type");

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=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
Sun Nov 22 15:45:00 2009
@@ -315,13 +315,6 @@
     {
         return delegateComponent.getQualifiers();
     }
-    
-
-    @Override
-    public Class<? extends Annotation> getDeploymentType()
-    {
-        return delegateComponent.getDeploymentType();
-    }
 
     @Override
     public String getName()

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=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Sun Nov 22 15:45:00 2009
@@ -1370,21 +1370,7 @@
                         
             if (superBean != null)
             {
-                //check for alternative
-                boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-                
-                if(!useAlternative)
-                {
-                    int res = DeploymentTypeManager.getInstance().comparePrecedences(specialized.getDeploymentType(),
superBean.getDeploymentType());
-                    if (res <= 0)
-                    {
-                        throw new InconsistentSpecializationException("@Specializes exception.
Class : " + specializedClass.getName() + " must have higher deployment type precedence from
the class : " + superClass.getName());
-                    }    
-                }
-                else
-                {
-                    ((AbstractBean<?>)superBean).setEnabled(false);
-                }
+                ((AbstractBean<?>)superBean).setEnabled(false);
                                 
                 AbstractBean<?> comp = (AbstractBean<?>)specialized;
 
@@ -1419,8 +1405,6 @@
         Set<Bean<?>> components = BeanManagerImpl.getManager().getComponents();
         Iterator<Bean<?>> it = components.iterator();
         
-        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
-        
         while (it.hasNext())
         {
             AbstractBean<?> bean = (AbstractBean<?>)it.next();
@@ -1433,34 +1417,13 @@
                     {
                         if(!(bean instanceof NewBean))
                         {
-                            if(!useAlternative)
-                            {
-                                if(DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(bean.getDeploymentType()))
-                                {
-                                    beans.add(bean);    
-                                }                                                       
    
-                            }
-                            
-                            else
-                            {
-                                beans.add(bean);
-                            }
+                            beans.add(bean);
                         }                           
                     }                                    
                 }
                 else
                 {
-                    if(!useAlternative)
-                    {
-                        if(DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(bean.getDeploymentType()))
-                        {
-                            beans.add(bean);   
-                        }                        
-                    }
-                    else
-                    {
-                        beans.add(bean);
-                    }
+                    beans.add(bean);
                 }
             }
         }

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=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
Sun Nov 22 15:45:00 2009
@@ -858,17 +858,7 @@
         /* Configures child elements of this webbeans decleration element */
         configureWebBeanDeclerationChilds(component, webBeanDecleration);
 
-        /* Check if the deployment type is enabled. */
-        if (!DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(component.getDeploymentType()))
// Maybe
-        {
-            component = null;
-
-        }
-        /* Add to the manager */
-        else
-        {
-            BeanManagerImpl.getManager().addBean(component);
-        }
+        BeanManagerImpl.getManager().addBean(component);
 
         return component;
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java?rev=883091&r1=883090&r2=883091&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
Sun Nov 22 15:45:00 2009
@@ -30,7 +30,6 @@
 import org.apache.webbeans.test.component.exception.AroundInvokeWithoutExceptionComponent;
 import org.apache.webbeans.test.component.exception.AroundInvokeWithoutParameterComponent;
 import org.apache.webbeans.test.component.exception.AroundInvokeWithoutReturnTypeComponent;
-import org.apache.webbeans.test.component.exception.ComponentTypeExceptionComponent;
 import org.apache.webbeans.test.component.exception.FinalComponent;
 import org.apache.webbeans.test.component.exception.HasFinalMethodComponent;
 import org.apache.webbeans.test.component.exception.MoreThanOneAroundInvokeComponent;
@@ -73,52 +72,6 @@
 
     }
 
-    //X @Test DeploymentTypes have been removed from the spec
-    @Deprecated
-    public void testComponentTypeException()
-    {
-        try
-        {
-            OpenWebBeansConfiguration.getInstance().setProperty(OpenWebBeansConfiguration.USE_INJECTION_RESOLVER_VIA_ALTERNATIVE,
"false");
-            clear();
-            defineManagedBean(ComponentTypeExceptionComponent.class);
-        }
-        catch (WebBeansConfigurationException e)
-        {
-            System.out.println(e.getMessage());
-            return; // all ok!
-        }
-        finally
-        {
-            OpenWebBeansConfiguration.getInstance().setProperty(OpenWebBeansConfiguration.USE_INJECTION_RESOLVER_VIA_ALTERNATIVE,
"true");
-        }
-        Assert.fail("expecting an exception!");
-    }
-
-    //X @Test 
-    @Deprecated /** DeploymentTypes got dropped from the spec! */ 
-    public void testProducerMethodComponentTypeException()
-    {
-        WebBeansConfigurationException exc = null;
-        try
-        {
-            OpenWebBeansConfiguration.getInstance().setProperty(OpenWebBeansConfiguration.USE_INJECTION_RESOLVER_VIA_ALTERNATIVE,
"false");
-            clear();
-            defineManagedBean(ProducerTypeExceptionComponent.class);
-
-        }
-        catch (WebBeansConfigurationException e)
-        {
-            System.out.println("got expected exception: " + e.getMessage());
-            return; // all ok!
-        }
-        finally
-        {
-            OpenWebBeansConfiguration.getInstance().setProperty(OpenWebBeansConfiguration.USE_INJECTION_RESOLVER_VIA_ALTERNATIVE,
"true");
-        }
-        Assert.fail("expecting an exception!");
-    }
-
     @Test
     public void testFinal()
     {



Mime
View raw message