[webbeans-commits] Webbeans SVN: r2075 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bean/proxy and 5 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Mar 17 14:15:45 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-03-17 14:15:45 -0400 (Tue, 17 Mar 2009)
New Revision: 2075

Added:
   ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java
Removed:
   ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/EjbReference.java
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java
   ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockEjbServices.java
Log:
Update SPI

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java	2009-03-17 17:43:38 UTC (rev 2074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java	2009-03-17 18:15:45 UTC (rev 2075)
@@ -42,7 +42,7 @@
 import org.jboss.webbeans.context.DependentContext;
 import org.jboss.webbeans.context.DependentStorageRequest;
 import org.jboss.webbeans.ejb.InternalEjbDescriptor;
-import org.jboss.webbeans.ejb.api.EjbReference;
+import org.jboss.webbeans.ejb.api.SessionObjectReference;
 import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
 import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.introspector.AnnotatedClass;
@@ -380,7 +380,7 @@
       return false;
    }
    
-   public EjbReference<T> createReference()
+   public SessionObjectReference createReference()
    {
       return manager.getServices().get(EjbServices.class).resolveEJB(getEjbDescriptor(), CurrentManager.rootManager().getServices().get(NamingContext.class));
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java	2009-03-17 17:43:38 UTC (rev 2074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java	2009-03-17 18:15:45 UTC (rev 2075)
@@ -22,7 +22,7 @@
 import javassist.util.proxy.MethodHandler;
 
 import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.ejb.api.EjbReference;
+import org.jboss.webbeans.ejb.api.SessionObjectReference;
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
 import org.jboss.webbeans.util.Reflections;
@@ -57,7 +57,7 @@
       enterpriseBean.set(bean);
    }
 
-   private final EjbReference<?> reference; 
+   private final SessionObjectReference reference; 
    private final Class<?> objectInterface;
    private boolean destroyed;
 
@@ -70,13 +70,12 @@
     */
    public EnterpriseBeanProxyMethodHandler(EnterpriseBean<?> bean)
    {
-      this.reference = bean.createReference();
       this.destroyed = false;
       this.objectInterface = bean.getEjbDescriptor().getObjectInterface();
       try
       {
          setEnterpriseBean(bean);
-         reference.create();
+         this.reference = bean.createReference();
       }
       finally
       {
@@ -132,7 +131,7 @@
       {
          businessInterface = objectInterface;
       }
-      Object proxiedInstance = reference.get(businessInterface);
+      Object proxiedInstance = reference.getReference(businessInterface);
       Method proxiedMethod = Reflections.lookupMethod(method, proxiedInstance);
       Object returnValue = Reflections.invokeAndWrap(proxiedMethod, proxiedInstance, args);
       log.trace("Executed " + method + " on " + proxiedInstance + " with parameters " + args + " and got return value " + returnValue);

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java	2009-03-17 17:43:38 UTC (rev 2074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java	2009-03-17 18:15:45 UTC (rev 2075)
@@ -12,7 +12,7 @@
 import javax.persistence.PersistenceContext;
 
 import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-import org.jboss.webbeans.ejb.api.EjbReference;
+import org.jboss.webbeans.ejb.api.SessionObjectReference;
 import org.jboss.webbeans.ejb.spi.EjbDescriptor;
 import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.resources.spi.NamingContext;
@@ -67,26 +67,23 @@
       return ejbDiscovery.discoverEjbs();
    }
 
-   public <T> EjbReference<T> resolveEJB(EjbDescriptor<T> ejbDescriptor, NamingContext naming)
+   public SessionObjectReference resolveEJB(EjbDescriptor<?> ejbDescriptor, NamingContext naming)
    {
-      return new EjbReference<T>()
+      return new SessionObjectReference()
       {
 
-         public <S> S get(Class<S> businessInterfaceType)
+         public <S> S getReference(Class<S> businessInterfaceType)
          {
+            // TODO Auto-generated method stub
             return null;
          }
 
          public void remove()
          {
-            // No-op
+            // TODO Auto-generated method stub
+            
          }
          
-         public void create()
-         {
-            // No-op
-         }
-         
       };
    }
 }
\ No newline at end of file

Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/EjbReference.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/EjbReference.java	2009-03-17 17:43:38 UTC (rev 2074)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/EjbReference.java	2009-03-17 18:15:45 UTC (rev 2075)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.webbeans.ejb.api;
-
-import java.io.Serializable;
-
-/**
- * A serializable reference to an EJB. For an SFSB the same state must be 
- * returned for each call to {@link #get(Class)}
- * 
- * @author Pete Muir
- * @param <T>
- *           The EJB bean class
- */
-public interface EjbReference<T> extends Serializable
-{
-   
-   /**
-    * Get the reference to the EJB for the given business interfaces
-    * 
-    * The reference may be lazily instantiated; if Web Beans wishes to eagerly
-    * instantiated the bean it will call {@link #create()}.
-    * 
-    * @param <S>
-    *           the type of the business interface
-    * @param businessInterfaceType
-    *           the type of the business interface
-    * @return a reference
-    */
-   public <S> S get(Class<S> businessInterfaceType);
-   
-   /**
-    * Request the SFSB backing this reference is removed
-    * 
-    * @throws UnsupportedOperationException
-    *            if the reference is backed by an SLSB
-    */
-   public void remove();
-   
-   /**
-    * Request that the SFSB backing this reference is instantiated, and any
-    * @PostConstruct lifecycle callbacks are executed
-    * 
-    */
-   public void create();
-   
-}

Copied: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java (from rev 2064, ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/EjbReference.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java	                        (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java	2009-03-17 18:15:45 UTC (rev 2075)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.ejb.api;
+
+import java.io.Serializable;
+
+/**
+ * A serializable reference to a session object in the EJB container
+ * 
+ * @author Pete Muir
+ */
+public interface SessionObjectReference extends Serializable
+{
+   
+   /**
+    * Get the reference from the EJB container to the session object for the 
+    * given business interface
+    * 
+    * @param <S>
+    *           the type of the business interface
+    * @param businessInterfaceType
+    *           the type of the business interface
+    * @return a reference
+    * 
+    * @throws IllegalStateException
+    *           if the session object has already been removed
+    */
+   public <S> S getReference(Class<S> businessInterfaceType);
+   
+   /**
+    * Request the EJB container remove the stateful session object
+    * 
+    * @throws UnsupportedOperationException
+    *            if the reference is not backed by a stateful session object
+    * @throws IllegalStateException
+    *            if the session object has already been removed           
+    */
+   public void remove();
+   
+}


Property changes on: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java	2009-03-17 17:43:38 UTC (rev 2074)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java	2009-03-17 18:15:45 UTC (rev 2075)
@@ -22,7 +22,7 @@
 import javax.inject.manager.InjectionPoint;
 
 import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.ejb.api.EjbReference;
+import org.jboss.webbeans.ejb.api.SessionObjectReference;
 import org.jboss.webbeans.resources.spi.NamingContext;
 
 /**
@@ -87,14 +87,15 @@
    public Object resolveResource(InjectionPoint injectionPoint, NamingContext namingContext);
   
    /**
-    * Request an EJB instance from the container
+    * Request a reference to an EJB session object from the container. If the
+    * EJB being resolved is a stateful session bean, the container should ensure
+    * the session bean is created before this method returns.
     * 
-    * @param <T> the type of the bean class
     * @param ejbDescriptor the ejb to resolve
     * @param namingContext the pluggable Web Beans JNDI lookup facility
-    * @return a reference to the EJB
+    * @return a reference to the session object
     */
-   public <T> EjbReference<T> resolveEJB(EjbDescriptor<T> ejbDescriptor, NamingContext namingContext);
+   public SessionObjectReference resolveEJB(EjbDescriptor<?> ejbDescriptor, NamingContext namingContext);
    
    /**
     * Gets a descriptor for each EJB in the application

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java	2009-03-17 17:43:38 UTC (rev 2074)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java	2009-03-17 18:15:45 UTC (rev 2075)
@@ -4,7 +4,7 @@
 
 import javax.inject.manager.InjectionPoint;
 
-import org.jboss.webbeans.ejb.api.EjbReference;
+import org.jboss.webbeans.ejb.api.SessionObjectReference;
 import org.jboss.webbeans.ejb.spi.EjbDescriptor;
 import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.resources.spi.NamingContext;
@@ -44,7 +44,7 @@
       return delegate().resolveEjb(injectionPoint, namingContext);
    }
    
-   public <T> EjbReference<T> resolveEJB(EjbDescriptor<T> ejbDescriptor, NamingContext namingContext)
+   public SessionObjectReference resolveEJB(EjbDescriptor<?> ejbDescriptor, NamingContext namingContext)
    {
       return delegate().resolveEJB(ejbDescriptor, namingContext);
    }

Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockEjbServices.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockEjbServices.java	2009-03-17 17:43:38 UTC (rev 2074)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockEjbServices.java	2009-03-17 18:15:45 UTC (rev 2075)
@@ -4,7 +4,7 @@
 
 import javax.inject.manager.InjectionPoint;
 
-import org.jboss.webbeans.ejb.api.EjbReference;
+import org.jboss.webbeans.ejb.api.SessionObjectReference;
 import org.jboss.webbeans.ejb.spi.EjbDescriptor;
 import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.resources.spi.NamingContext;
@@ -36,7 +36,7 @@
       return null;
    }
    
-   public <T> EjbReference<T> resolveEJB(EjbDescriptor<T> ejbDescriptor, NamingContext namingContext)
+   public SessionObjectReference resolveEJB(EjbDescriptor<?> ejbDescriptor, NamingContext namingContext)
    {
       // TODO Auto-generated method stub
       return null;




More information about the weld-commits mailing list