[webbeans-commits] Webbeans SVN: r2332 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/injection and 2 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Tue Apr 7 12:36:21 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-04-07 12:36:21 -0400 (Tue, 07 Apr 2009)
New Revision: 2332
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java
ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml
ri/trunk/version-matrix/pom.xml
Log:
fix failing test, fix non contexual injector, fix simple bean to use individual services
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-04-07 14:52:57 UTC (rev 2331)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-04-07 16:36:21 UTC (rev 2332)
@@ -308,7 +308,13 @@
if (getManager().getServices().contains(EjbServices.class))
{
initEjbInjectionPoints();
+ }
+ if (getManager().getServices().contains(JpaServices.class))
+ {
initPersistenceUnitInjectionPoints();
+ }
+ if (getManager().getServices().contains(ResourceServices.class))
+ {
initResourceInjectionPoints();
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-04-07 14:52:57 UTC (rev 2331)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-04-07 16:36:21 UTC (rev 2332)
@@ -1,9 +1,20 @@
package org.jboss.webbeans.injection;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
import java.util.Set;
import java.util.concurrent.Callable;
+import javax.context.CreationalContext;
+import javax.context.Dependent;
+import javax.inject.Standard;
+import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
+
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.context.ApplicationContext;
+import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.collections.ConcurrentCache;
@@ -11,6 +22,8 @@
public class NonContextualInjector
{
+ private final Bean<?> nonContextualBean;
+
private final ConcurrentCache<Class<?>, Set<FieldInjectionPoint<?>>> instances;
private final ManagerImpl manager;
@@ -18,24 +31,91 @@
{
this.instances = new ConcurrentCache<Class<?>, Set<FieldInjectionPoint<?>>>();
this.manager = manager;
+ nonContextualBean = new Bean<Object>(manager)
+ {
+
+ @Override
+ public Set<Annotation> getBindings()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return Standard.class;
+ }
+
+ @Override
+ public Set<? extends InjectionPoint> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public Set<? extends Type> getTypes()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return true;
+ }
+
+ public Object create(CreationalContext<Object> creationalContext)
+ {
+ return null;
+ }
+
+ public void destroy(Object instance)
+ {
+ }
+ };
}
public void inject(final Object instance)
{
- Set<FieldInjectionPoint<?>> injectionPoints = instances.putIfAbsent(instance.getClass(), new Callable<Set<FieldInjectionPoint<?>>>()
+ if (DependentContext.INSTANCE != null && ApplicationContext.INSTANCE != null)
{
-
- public Set<FieldInjectionPoint<?>> call() throws Exception
+ DependentContext.INSTANCE.setActive(true);
+ ApplicationContext.INSTANCE.setActive(true);
+ Set<FieldInjectionPoint<?>> injectionPoints = instances.putIfAbsent(instance.getClass(), new Callable<Set<FieldInjectionPoint<?>>>()
{
- return Beans.getFieldInjectionPoints(manager.getServices().get(ClassTransformer.class).classForName(instance.getClass()), null);
+
+ public Set<FieldInjectionPoint<?>> call() throws Exception
+ {
+ return Beans.getFieldInjectionPoints(manager.getServices().get(ClassTransformer.class).classForName(instance.getClass()), nonContextualBean);
+ }
+
}
-
+ );
+ for (FieldInjectionPoint<?> injectionPoint : injectionPoints)
+ {
+ injectionPoint.inject(instance, manager, null);
+ }
+ DependentContext.INSTANCE.setActive(false);
+ ApplicationContext.INSTANCE.setActive(false);
}
- );
- for (FieldInjectionPoint<?> injectionPoint : injectionPoints)
- {
- injectionPoint.inject(instance, manager, null);
- }
}
}
Modified: ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml
===================================================================
--- ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml 2009-04-07 14:52:57 UTC (rev 2331)
+++ ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml 2009-04-07 16:36:21 UTC (rev 2332)
@@ -12,8 +12,5 @@
</myapp:PaymentProcessor>
<myapp:User />
</myapp:Order>
- <myapp:Login>
- <ConversationScoped />
- <BindingType />
- </myapp:Login>
+
</Beans>
\ No newline at end of file
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-04-07 14:52:57 UTC (rev 2331)
+++ ri/trunk/version-matrix/pom.xml 2009-04-07 16:36:21 UTC (rev 2332)
@@ -338,6 +338,11 @@
<type>pom</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.18</version>
+ </dependency>
</dependencies>
</dependencyManagement>
More information about the weld-commits
mailing list