geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1607765 - /geronimo/specs/trunk/geronimo-jcdi_1.1_spec/src/main/java/javax/enterprise/inject/spi/CDI.java
Date Thu, 03 Jul 2014 23:11:21 GMT
Author: rmannibucau
Date: Thu Jul  3 23:11:20 2014
New Revision: 1607765

URL: http://svn.apache.org/r1607765
Log:
basic impl of CDI class, will surely change but having null calling current() prevent usages

Modified:
    geronimo/specs/trunk/geronimo-jcdi_1.1_spec/src/main/java/javax/enterprise/inject/spi/CDI.java

Modified: geronimo/specs/trunk/geronimo-jcdi_1.1_spec/src/main/java/javax/enterprise/inject/spi/CDI.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_1.1_spec/src/main/java/javax/enterprise/inject/spi/CDI.java?rev=1607765&r1=1607764&r2=1607765&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jcdi_1.1_spec/src/main/java/javax/enterprise/inject/spi/CDI.java
(original)
+++ geronimo/specs/trunk/geronimo-jcdi_1.1_spec/src/main/java/javax/enterprise/inject/spi/CDI.java
Thu Jul  3 23:11:20 2014
@@ -1,6 +1,7 @@
 package javax.enterprise.inject.spi;
 
 import javax.enterprise.inject.Instance;
+import java.util.ServiceLoader;
 
 /**
  * <p>Static helper class to access the {@link BeanManager}</p>
@@ -18,10 +19,15 @@ import javax.enterprise.inject.Instance;
  */
 public abstract class CDI<T> implements Instance<T>
 {
+    private static volatile CDI INSTANCE; // temporary implementation
 
     public static CDI<Object> current()
     {
-        return null; //X TODO implement!
+        if (INSTANCE == null)
+        {
+            INSTANCE = ServiceLoader.load(CDIProvider.class).iterator().next().getCDI();
+        }
+        return INSTANCE; //X TODO implement!
     }
 
     /**
@@ -36,6 +42,7 @@ public abstract class CDI<T> implements 
     public static void setCDIProvider(CDIProvider provider)
     {
         //X TODO implement!
+        INSTANCE = provider.getCDI();
     }
 
     public abstract BeanManager getBeanManager();



Mime
View raw message