openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1467808 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/ component/creation/ container/ portable/
Date Sun, 14 Apr 2013 18:10:53 GMT
Author: arne
Date: Sun Apr 14 18:10:53 2013
New Revision: 1467808

URL: http://svn.apache.org/r1467808
Log:
OWB-814: Added InjectionTargetFactory and updated API

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactory.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionProducerFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SimpleProducerFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/FieldProducerFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ProducerFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ExtensionProducer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProxyProducerFactory.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
Sun Apr 14 18:10:53 2013
@@ -51,7 +51,7 @@ public abstract class AbstractProducerBe
                                    WebBeansType webBeansType,
                                    BeanAttributesImpl<T> beanAttributes,
                                    Class<T> returnType,
-                                   ProducerFactory<T> producerFactory)
+                                   ProducerFactory<?> producerFactory)
     {
         super(ownerComponent.getWebBeansContext(), webBeansType, beanAttributes, ownerComponent.getBeanClass());
         this.ownerComponent = ownerComponent;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionProducerFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionProducerFactory.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionProducerFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionProducerFactory.java
Sun Apr 14 18:10:53 2013
@@ -34,7 +34,7 @@ import org.apache.webbeans.portable.Exte
 public class ExtensionProducerFactory<T> implements ProducerFactory<T>
 {
 
-    private AnnotatedType<T> annotatedType;
+    private AnnotatedType<?> annotatedType;
     private WebBeansContext webBeansContext;
 
     public ExtensionProducerFactory(AnnotatedType<T> annotatedType, WebBeansContext
webBeansContext)
@@ -44,8 +44,8 @@ public class ExtensionProducerFactory<T>
     }
 
     @Override
-    public Producer<T> createProducer(Bean<T> bean)
+    public <P> Producer<P> createProducer(Bean<P> bean)
     {
-        return new ExtensionProducer<T>(annotatedType, bean, webBeansContext);
+        return new ExtensionProducer<P>((AnnotatedType<P>)annotatedType, bean,
webBeansContext);
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
Sun Apr 14 18:10:53 2013
@@ -54,7 +54,7 @@ public class ProducerMethodBean<T> exten
     public <P> ProducerMethodBean(InjectionTargetBean<P> ownerComponent,
                                   BeanAttributesImpl<T> beanAttributes,
                                   Class<T> returnType,
-                                  MethodProducerFactory<T, P> producerFactory)
+                                  MethodProducerFactory<P> producerFactory)
     {
         super(ownerComponent, WebBeansType.PRODUCERMETHOD, beanAttributes, returnType, producerFactory);
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SimpleProducerFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SimpleProducerFactory.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SimpleProducerFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SimpleProducerFactory.java
Sun Apr 14 18:10:53 2013
@@ -26,19 +26,19 @@ import org.apache.webbeans.container.Pro
 /**
  * @version $Rev: 1440403 $ $Date: 2013-01-30 14:27:15 +0100 (Mi, 30 Jan 2013) $
  */
-public class SimpleProducerFactory<T> implements ProducerFactory<T>
+public class SimpleProducerFactory<P> implements ProducerFactory<P>
 {
 
-    private Producer<T> producer;
+    private Producer<?> producer;
 
-    public SimpleProducerFactory(Producer<T> producer)
+    public SimpleProducerFactory(Producer<?> producer)
     {
         this.producer = producer;
     }
 
     @Override
-    public Producer<T> createProducer(Bean<T> bean)
+    public <T> Producer<T> createProducer(Bean<T> bean)
     {
-        return producer;
+        return (Producer<T>)producer;
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/FieldProducerFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/FieldProducerFactory.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/FieldProducerFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/FieldProducerFactory.java
Sun Apr 14 18:10:53 2013
@@ -27,7 +27,7 @@ import org.apache.webbeans.container.Pro
 import org.apache.webbeans.portable.ProducerFieldProducer;
 import org.apache.webbeans.util.Asserts;
 
-public class FieldProducerFactory<T, P> implements ProducerFactory<T>
+public class FieldProducerFactory<P> implements ProducerFactory<P>
 {
 
     private AnnotatedField<? super P> producerField;
@@ -44,7 +44,7 @@ public class FieldProducerFactory<T, P> 
     }
 
     @Override
-    public Producer<T> createProducer(Bean<T> bean)
+    public <T> Producer<T> createProducer(Bean<T> bean)
     {
         Producer<T> producer = new ProducerFieldProducer<T, P>(parent, producerField,
webBeansContext);
         return webBeansContext.getWebBeansUtil().fireProcessProducerEvent(producer, producerField);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
Sun Apr 14 18:10:53 2013
@@ -42,7 +42,7 @@ import org.apache.webbeans.portable.Prod
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 
-public class MethodProducerFactory<T, P> implements ProducerFactory<T>
+public class MethodProducerFactory<P> implements ProducerFactory<P>
 {
 
     private AnnotatedMethod<? super P> producerMethod;
@@ -61,7 +61,7 @@ public class MethodProducerFactory<T, P>
     }
 
     @Override
-    public Producer<T> createProducer(Bean<T> bean)
+    public <T> Producer<T> createProducer(Bean<T> bean)
     {
         Producer<T> producer = new ProducerMethodProducer<T, P>(parent, producerMethod,
disposalMethod, createInjectionPoints(bean), webBeansContext);
         return webBeansContext.getWebBeansUtil().fireProcessProducerEvent(producer, producerMethod);
@@ -173,7 +173,7 @@ public class MethodProducerFactory<T, P>
         }        
     }
 
-    protected Set<InjectionPoint> createInjectionPoints(Bean<T> bean)
+    protected Set<InjectionPoint> createInjectionPoints(Bean<?> bean)
     {
         Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>(webBeansContext.getInjectionPointFactory().buildInjectionPoints(bean,
producerMethod));
         if (disposalMethod != null)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
Sun Apr 14 18:10:53 2013
@@ -108,7 +108,7 @@ public class ProducerMethodBeanBuilder<T
     {
         AnnotatedMethod<P> annotatedMethod = (AnnotatedMethod<P>) annotatedMember;
         ProducerMethodBean<T> producerMethodBean
-            = new ProducerMethodBean<T>(parent, beanAttributes, beanClass, new MethodProducerFactory<T,
P>(annotatedMethod, parent, parent.getWebBeansContext()));
+            = new ProducerMethodBean<T>(parent, beanAttributes, beanClass, new MethodProducerFactory<P>(annotatedMethod,
parent, parent.getWebBeansContext()));
         producerMethodBean.setSpecializedBean(specialized);
         return producerMethodBean;
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
Sun Apr 14 18:10:53 2013
@@ -98,7 +98,7 @@ public class ProducerMethodBeansBuilder<
                 {
                     producerMethodBeanCreator.configureProducerSpecialization(producerMethodBean,
(AnnotatedMethod<T>) annotatedMethod);
                 }
-                MethodProducerFactory<T, ?> producerFactory = new MethodProducerFactory(annotatedMethod,
bean, webBeansContext);
+                MethodProducerFactory<?> producerFactory = new MethodProducerFactory(annotatedMethod,
bean, webBeansContext);
                 producerMethodBean.setCreatorMethod(annotatedMethod.getJavaMember());
                 
                 webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(bean,

Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactory.java?rev=1467808&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactory.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactory.java
Sun Apr 14 18:10:53 2013
@@ -0,0 +1,31 @@
+/*
+ * 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.container;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+/**
+ * This is a preview to CDI 1.1
+ * when we implement CDI 1.1 this interface can be removed
+ */
+public interface InjectionTargetFactory<T>
+{
+    public InjectionTarget<T> createInjectionTarget(Bean<T> bean);
+}

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
Sun Apr 14 18:10:53 2013
@@ -34,7 +34,7 @@ import org.apache.webbeans.config.WebBea
 import org.apache.webbeans.portable.InjectionTargetImpl;
 import org.apache.webbeans.util.Asserts;
 
-public class InjectionTargetFactoryImpl<T>
+public class InjectionTargetFactoryImpl<T> implements InjectionTargetFactory<T>
 {
 
     private AnnotatedType<T> annotatedType;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ProducerFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ProducerFactory.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ProducerFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ProducerFactory.java
Sun Apr 14 18:10:53 2013
@@ -25,7 +25,7 @@ import javax.enterprise.inject.spi.Produ
  * This is a preview to CDI 1.1
  * when we implement CDI 1.1 this interface can be removed
  */
-public interface ProducerFactory<T>
+public interface ProducerFactory<X>
 {
-    public Producer<T> createProducer(Bean<T> bean);
+    public <T> Producer<T> createProducer(Bean<T> bean);
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ExtensionProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ExtensionProducer.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ExtensionProducer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ExtensionProducer.java
Sun Apr 14 18:10:53 2013
@@ -26,21 +26,23 @@ import org.apache.webbeans.config.WebBea
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.portable.events.ExtensionLoader;
 
-public class ExtensionProducer<T> extends InjectionTargetImpl<T>
+public class ExtensionProducer<R> extends AbstractProducer<R>
 {
 
-    public ExtensionProducer(AnnotatedType<T> annotatedType,
-                             Bean<T> owner,
-                             WebBeansContext webBeansContext)
+    private WebBeansContext webBeansContext;
+    public <T> ExtensionProducer(AnnotatedType<T> annotatedType,
+                                 Bean<T> owner,
+                                 WebBeansContext webBeansContext)
     {
-        super(annotatedType, webBeansContext.getInjectionPointFactory().buildInjectionPoints(owner,
annotatedType), webBeansContext, null, null);
+        super(webBeansContext.getInjectionPointFactory().buildInjectionPoints(owner, annotatedType));
+        this.webBeansContext = webBeansContext; 
     }
 
     @Override
-    public T produce(CreationalContext<T> creationalContext)
+    public R produce(CreationalContext<R> creationalContext)
     {
         ExtensionLoader loader = webBeansContext.getExtensionLoader();
         
-        return loader.getBeanInstance((Bean<T>)((CreationalContextImpl<T>) creationalContext).getBean());
+        return loader.getBeanInstance((Bean<R>)((CreationalContextImpl<R>) creationalContext).getBean());
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProxyProducerFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProxyProducerFactory.java?rev=1467808&r1=1467807&r2=1467808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProxyProducerFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProxyProducerFactory.java
Sun Apr 14 18:10:53 2013
@@ -26,14 +26,14 @@ import org.apache.webbeans.config.WebBea
 import org.apache.webbeans.container.ProducerFactory;
 import org.apache.webbeans.util.Asserts;
 
-public class ProviderBasedProxyProducerFactory<T> implements ProducerFactory<T>
+public class ProviderBasedProxyProducerFactory<P> implements ProducerFactory<P>
 {
 
-    private Provider<T> provider;
-    private Class<T> providerType;
+    private Provider<?> provider;
+    private Class<?> providerType;
     private WebBeansContext webBeansContext;
     
-    public ProviderBasedProxyProducerFactory(Provider<T> provider, Class<T> providerType,
WebBeansContext context)
+    public ProviderBasedProxyProducerFactory(Provider<?> provider, Class<?> providerType,
WebBeansContext context)
     {
         Asserts.assertNotNull(provider);
         Asserts.assertNotNull(providerType);
@@ -44,8 +44,8 @@ public class ProviderBasedProxyProducerF
     }
 
     @Override
-    public Producer<T> createProducer(Bean<T> bean)
+    public <T> Producer<T> createProducer(Bean<T> bean)
     {
-        return new ProviderBasedProxyProducer<T>(webBeansContext, providerType, provider);
+        return new ProviderBasedProxyProducer<T>(webBeansContext, (Class<T>)providerType,
(Provider<T>)provider);
     }
 }



Mime
View raw message