openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r752650 - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/ component/third/ config/ container/ inject/ inject/impl/ util/
Date Wed, 11 Mar 2009 22:04:50 GMT
Author: gerdogdu
Date: Wed Mar 11 22:04:50 2009
New Revision: 752650

URL: http://svn.apache.org/viewvc?rev=752650&view=rev
Log:
Adding InjectionPoint injection support. Moreover, update for TCK tests.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointComponentImpl.java
  (with props)
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
  (with props)
Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/Component.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethods.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.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=752650&r1=752649&r2=752650&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
Wed Mar 11 22:04:50 2009
@@ -14,6 +14,8 @@
 package org.apache.webbeans.component;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
@@ -42,6 +44,7 @@
 import org.apache.webbeans.deployment.DeploymentTypeManager;
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.intercept.InterceptorData;
+import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
 /**
@@ -122,6 +125,13 @@
         this.returnType = returnType;
     }
     
+    protected AbstractComponent(WebBeansType webBeanType)
+    {
+        super(ManagerImpl.getManager());
+        this.webBeansType = webBeanType;
+        
+    }
+    
     
     public IBeanInheritedMetaData getInheritedMetaData()
     {
@@ -416,12 +426,28 @@
      * @return the dependent component instance
      */
     @SuppressWarnings("unchecked")
-    public Object getDependent(Bean<?> dependentComponent)
+    public Object getDependent(Bean<?> dependentComponent, InjectionPoint injectionPoint)
     {
         Object object = null;
         
         DependentContext context = (DependentContext) getManager().getContext(Dependent.class);
-        object = context.get((Contextual<T>)dependentComponent,(CreationalContext<T>)CreationalContextFactory.getInstance().getCreationalContext(dependentComponent));
   
+        object = context.get((Contextual<T>)dependentComponent,(CreationalContext<T>)CreationalContextFactory.getInstance().getCreationalContext(dependentComponent));
+        
+        //Inject the InjectionPoints
+        Set<InjectionPoint> injectionPoints = dependentComponent.getInjectionPoints();
+        for(InjectionPoint points : injectionPoints)
+        {
+            if(points.getType().equals(InjectionPoint.class))
+            {
+                Member member = points.getMember();
+                if(member instanceof Field)
+                {
+                    Field field = (Field) member;
+                    ClassUtil.setField(object, field, getManager().getInstance(new InjectionPointComponentImpl(injectionPoint)));
+                }
+            }
+            
+        }
         
         this.dependentObjects.put(object, dependentComponent);
 

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=752650&r1=752649&r2=752650&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
Wed Mar 11 22:04:50 2009
@@ -72,7 +72,7 @@
 
     abstract public Class<T> getReturnType();
 
-    abstract public Object getDependent(Bean<?> dependentComponent);
+    abstract public Object getDependent(Bean<?> dependentComponent,InjectionPoint injectionPoint);
 
     abstract public List<InterceptorData> getInterceptorStack();
 

Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointComponentImpl.java?rev=752650&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointComponentImpl.java
(added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointComponentImpl.java
Wed Mar 11 22:04:50 2009
@@ -0,0 +1,56 @@
+/*
+ *  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.component;
+
+import javax.context.CreationalContext;
+import javax.inject.manager.InjectionPoint;
+
+import org.apache.webbeans.annotation.CurrentLiteral;
+import org.apache.webbeans.annotation.DependentScopeLiteral;
+import org.apache.webbeans.annotation.StandardLiteral;
+
+
+public class InjectionPointComponentImpl extends AbstractComponent<InjectionPoint>
+{
+    private InjectionPoint injectionPoint = null;
+    
+    public InjectionPointComponentImpl(InjectionPoint injectionPoint)
+    {
+        super(WebBeansType.INJECTIONPOINT,InjectionPoint.class);
+        this.injectionPoint = injectionPoint;
+        
+        addBindingType(new CurrentLiteral());
+        setImplScopeType(new DependentScopeLiteral());
+        setType(new StandardLiteral());
+        addApiType(InjectionPoint.class);
+        addApiType(Object.class);
+    }
+
+    @Override
+    protected InjectionPoint createInstance(CreationalContext<InjectionPoint> creationalContext)
+    {
+        return injectionPoint;
+    }
+
+    @Override
+    protected void destroyInstance(InjectionPoint instance)
+    {
+        this.injectionPoint = null;
+    }
+    
+    
+}

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

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java?rev=752650&r1=752649&r2=752650&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
Wed Mar 11 22:04:50 2009
@@ -55,5 +55,7 @@
     OBSERVABLE, 
     MANAGER, 
     CONVERSATION,
-    INSTANCE
+    INSTANCE,
+    INJECTIONPOINT,
+    THIRDPARTY
 }

Added: 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=752650&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
(added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
Wed Mar 11 22:04:50 2009
@@ -0,0 +1,127 @@
+/*
+ *  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.component.third;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.context.CreationalContext;
+import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
+
+import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.component.WebBeansType;
+
+public class ThirdpartyBeanImpl<T> extends AbstractComponent<T>
+{
+    private Bean<T> bean = null;
+    
+    
+    public ThirdpartyBeanImpl(Bean<T> bean)
+    {
+        super(WebBeansType.THIRDPARTY);
+    }
+
+    
+    
+    @Override
+    public Set<Annotation> getBindings()
+    {
+        
+        return bean.getBindings();
+    }
+
+    @Override
+    public Class<? extends Annotation> getDeploymentType()
+    {
+        
+        return bean.getDeploymentType();
+    }
+
+    @Override
+    public Set<InjectionPoint> getInjectionPoints()
+    {
+        
+        return bean.getInjectionPoints();
+    }
+
+    @Override
+    public String getName()
+    {
+        
+        return bean.getName();
+    }
+
+    @Override
+    public Class<? extends Annotation> getScopeType()
+    {
+        
+        return bean.getScopeType();
+    }
+
+    @Override
+    public Set<Type> getTypes()
+    {
+        
+        return bean.getTypes();
+    }
+
+    @Override
+    public boolean isNullable()
+    {
+        
+        return bean.isNullable();
+    }
+
+    @Override
+    public boolean isSerializable()
+    {
+        
+        return bean.isSerializable();
+    }
+
+    public T create(CreationalContext<T> context)
+    {
+        
+        return bean.create(context);
+    }
+
+    public void destroy(T instance)
+    {
+        bean.destroy(instance);
+        
+    }
+
+
+
+    @Override
+    protected T createInstance(CreationalContext<T> creationalContext)
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+
+    @Override
+    protected void destroyInstance(T instance)
+    {
+        throw new UnsupportedOperationException();
+        
+    }
+
+}

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

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=752650&r1=752649&r2=752650&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
Wed Mar 11 22:04:50 2009
@@ -19,8 +19,10 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.context.Dependent;
 import javax.context.ScopeType;
 import javax.decorator.Decorator;
+import javax.inject.Current;
 import javax.inject.InconsistentSpecializationException;
 import javax.inject.Specializes;
 import javax.inject.manager.Bean;
@@ -86,6 +88,9 @@
 
                 // Register Conversation built-in component
                 ManagerImpl.getManager().addBean(WebBeansUtil.getConversationComponent());
+                
+                // Register InjectionPoint bean
+                ManagerImpl.getManager().addBean(WebBeansUtil.getInjectionPointComponent());
 
                 // JNDI bind
                 //X TODO JNDIUtil.bind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME, ManagerImpl.getManager());
@@ -157,7 +162,21 @@
                 Set<InjectionPoint> injectionPoints = bean.getInjectionPoints();
                 for(InjectionPoint injectionPoint : injectionPoints)
                 {
-                    resolver.checkInjectionPoints(injectionPoint);
+                    //check for InjectionPoint injection
+                    if(injectionPoint.getType().equals(InjectionPoint.class))
+                    {
+                        if(injectionPoint.getAnnotations().length == 1 && injectionPoint.getAnnotations()[0].annotationType().equals(Current.class))
+                        {
+                            if(!bean.getScopeType().equals(Dependent.class))
+                            {
+                                throw new WebBeansConfigurationException("Bean " + bean +
"scope can not define other scope except @Dependent to inject InjectionPoint");
+                            }
+                        }
+                    }
+                    else
+                    {
+                        resolver.checkInjectionPoints(injectionPoint);   
+                    }                    
                 }
             }
         }

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=752650&r1=752649&r2=752650&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
Wed Mar 11 22:04:50 2009
@@ -46,6 +46,7 @@
 import javax.naming.StringRefAddr;
 
 import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.component.third.ThirdpartyBeanImpl;
 import org.apache.webbeans.container.activity.ActivityManager;
 import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.creational.CreationalContextFactory;
@@ -159,7 +160,16 @@
 
     public Manager addBean(Bean<?> component)
     {
-        getManager().components.add(component);
+        if(component instanceof AbstractComponent)
+        {
+            getManager().components.add(component);    
+        }
+        else
+        {
+            ThirdpartyBeanImpl<?> bean = new ThirdpartyBeanImpl(component);
+            getManager().components.add(bean);
+        }
+        
 
         return this;
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=752650&r1=752649&r2=752650&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
Wed Mar 11 22:04:50 2009
@@ -14,6 +14,7 @@
 package org.apache.webbeans.inject;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 
@@ -54,6 +55,10 @@
     private AbstractComponent<?> injectionOwnerComponent;
     
     private CreationalContext<?> creationalContext;
+    
+    protected Member injectionMember;
+    
+    protected Annotation[] injectionAnnotations = new Annotation[0];
 
     protected AbstractInjectable(AbstractComponent<?> component, CreationalContext<?>
creaitonalContext)
     {
@@ -72,6 +77,11 @@
     {
         boolean dependentContext = false;
         
+        if(type.equals(InjectionPoint.class))
+        {
+            return null;
+        }
+        
         if(!ContextFactory.checkDependentContextActive())
         {
             ContextFactory.activateDependentContext();
@@ -101,8 +111,7 @@
                 return injectForObtains(type, args, annotations);
             }
             
-            InjectionPoint injectionPoint = InjectionPointFactory.getPartialInjectionPoint(this.injectionOwnerComponent,
type, annotations);
-            
+            InjectionPoint injectionPoint = InjectionPointFactory.getPartialInjectionPoint(this.injectionOwnerComponent,
type, this.injectionMember, this.injectionAnnotations, annotations);                     
  
             Bean<?> component = InjectionResolver.getInstance().getInjectionPointBean(injectionPoint);
             
 
@@ -110,7 +119,7 @@
             {
                 if(WebBeansUtil.isSimpleWebBeans(this.injectionOwnerComponent))
                 {
-                    return injectForDependent(component);   
+                    return injectForDependent(component,injectionPoint);   
                 }                
                 
                 else
@@ -231,28 +240,28 @@
             clazz = (Class<?>) type;
         }
 
-        return injectForDependent(WebBeansUtil.createNewComponent(clazz));
+        return injectForDependent(WebBeansUtil.createNewComponent(clazz),null);
     }
 
     private Object injectForObservable(Type[] args, Annotation... annotations)
     {
         Class<?> eventType = (Class<?>) args[0];
 
-        return injectForDependent(WebBeansUtil.createObservableImplicitComponent(EventImpl.class,
eventType, annotations));
+        return injectForDependent(WebBeansUtil.createObservableImplicitComponent(EventImpl.class,
eventType, annotations),null);
     }
     
     private <T> Object injectForObtains(Class<T> instanceType, Type[] args, Annotation...annotations)
     {   
         @SuppressWarnings("unchecked")
         Class<Instance<T>> clazz = (Class<Instance<T>>)instanceType;
-        return injectForDependent(WebBeansUtil.createInstanceComponent(clazz, args[0] , annotations));
+        return injectForDependent(WebBeansUtil.createInstanceComponent(clazz, args[0] , annotations),null);
         
     }
 
-    private Object injectForDependent(Bean<?> component)
+    private Object injectForDependent(Bean<?> component, InjectionPoint injectionPoint)
     {
         Object object = null;
-        object = this.injectionOwnerComponent.getDependent(component);
+        object = this.injectionOwnerComponent.getDependent(component,injectionPoint);
 
         return object;
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java?rev=752650&r1=752649&r2=752650&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
Wed Mar 11 22:04:50 2009
@@ -51,6 +51,7 @@
     {
         super(owner,creationalContext);
         this.con = cons;
+        this.injectionMember = con;
     }
 
     /**

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java?rev=752650&r1=752649&r2=752650&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
Wed Mar 11 22:04:50 2009
@@ -42,6 +42,7 @@
         super(owner,creationalContext);
         this.field = field;
         this.instance = instance;
+        this.injectionMember = field;
     }
 
     /*
@@ -53,6 +54,8 @@
         Type type = field.getGenericType();
 
         Annotation[] annots = field.getAnnotations();
+        
+        this.injectionAnnotations = annots;
 
         Annotation[] bindingAnnos = AnnotationUtil.getBindingAnnotations(annots);
         
@@ -93,7 +96,7 @@
                 field.setAccessible(true);
             }
 
-            field.set(instance, inject(clazz, args, annots));
+            field.set(instance, inject(clazz, args, bindingAnnos));
 
         }
         catch (IllegalAccessException e)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethods.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethods.java?rev=752650&r1=752649&r2=752650&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethods.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethods.java
Wed Mar 11 22:04:50 2009
@@ -52,6 +52,7 @@
         super(owner,creationalContext);
         this.m = m;
         this.instance = instance;
+        this.injectionMember = m;
     }
 
     /*

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java?rev=752650&r1=752649&r2=752650&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
Wed Mar 11 22:04:50 2009
@@ -167,15 +167,21 @@
         
     }
 
-    public static InjectionPoint getPartialInjectionPoint(Bean<?> owner,Type type,
Annotation...bindings)
+    public static InjectionPoint getPartialInjectionPoint(Bean<?> owner,Type type,
Member member, Annotation[] anns, Annotation...bindings)
     {
-        InjectionPointImpl impl = new InjectionPointImpl(owner,type,null);
+        InjectionPointImpl impl = new InjectionPointImpl(owner,type,member);
+        
         
         for(Annotation annot : bindings)
         {
             impl.addBindingAnnotation(annot);
         }
         
+        for(Annotation annot : anns)
+        {
+            impl.addAnnotation(annot);
+        }
+        
         return impl;
         
     }
@@ -227,5 +233,6 @@
             }
         }
     }
+    
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=752650&r1=752649&r2=752650&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
Wed Mar 11 22:04:50 2009
@@ -38,6 +38,7 @@
 import javax.inject.Realizes;
 import javax.interceptor.InterceptorBindingType;
 
+import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.xml.XMLAnnotationTypeManager;
 
 /**
@@ -422,7 +423,7 @@
      */
     private static boolean checkEquality(String src, String member, List<String> arguments)
     {
-        if ((checkEquBuffer(src, arguments).toString().equals(checkEquBuffer(member, arguments).toString())))
+        if ((checkEquBuffer(src, arguments).toString().trim().equals(checkEquBuffer(member,
arguments).toString().trim())))
             return true;
         return false;
     }
@@ -689,6 +690,21 @@
 
         for (Annotation ann : bindignTypeAnnots)
         {
+            Method[] methods = ann.annotationType().getDeclaredMethods();
+
+            for (Method method : methods)
+            {
+                Class<?> clazz = method.getReturnType();
+                if (clazz.isArray() || clazz.isAnnotation())
+                {
+                    if (!AnnotationUtil.isAnnotationExist(method.getDeclaredAnnotations(),
NonBinding.class))
+                    {
+                        throw new WebBeansConfigurationException("@BindingType : " + ann.annotationType().getName()
+ " must have @NonBinding valued members for its array-valued and annotation valued members");
+                    }
+                }
+            }
+            
+            
             if (!AnnotationUtil.isBindingAnnotation(ann.annotationType()))
             {
                 throw new IllegalArgumentException("Binding annotations must be annotated
with @BindingType");

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=752650&r1=752649&r2=752650&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
Wed Mar 11 22:04:50 2009
@@ -1327,4 +1327,29 @@
         return found;
     }
     
+    public static void setField(Object instance, Field field, Object value)
+    {
+        Asserts.assertNotNull(instance);
+        Asserts.assertNotNull(field);
+        
+        if(!field.isAccessible())
+        {
+            field.setAccessible(true);
+        }
+        
+        try
+        {
+            field.set(instance, value);
+        }
+        catch (IllegalArgumentException e)
+        {
+            throw new WebBeansException(e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new WebBeansException(e);
+        }
+        
+    }
+    
 }

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=752650&r1=752649&r2=752650&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Wed Mar 11 22:04:50 2009
@@ -87,6 +87,7 @@
 import org.apache.webbeans.component.Component;
 import org.apache.webbeans.component.ComponentImpl;
 import org.apache.webbeans.component.ConversationComponent;
+import org.apache.webbeans.component.InjectionPointComponentImpl;
 import org.apache.webbeans.component.InstanceComponentImpl;
 import org.apache.webbeans.component.ManagerComponentImpl;
 import org.apache.webbeans.component.NewComponentImpl;
@@ -631,6 +632,11 @@
 
         return conversationComp;
     }
+    
+    public static InjectionPointComponentImpl getInjectionPointComponent()
+    {
+        return new InjectionPointComponentImpl(null);
+    }
 
     /**
      * Check the {@link PostConstruct} or {@link PreDestroy} annotated method



Mime
View raw message