You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2010/09/14 09:43:45 UTC

svn commit: r996774 [3/8] - in /openejb/trunk/openejb3: assembly/openejb-jetty/openejb-jetty-common/src/main/java/org/apache/openejb/jetty/common/ assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/ assembl...

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java Tue Sep 14 07:43:38 2010
@@ -46,14 +46,13 @@ import javax.transaction.TransactionSync
 import javax.transaction.Synchronization;
 
 import org.apache.openejb.ApplicationException;
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.ProxyInfo;
 import org.apache.openejb.RpcContainer;
 import org.apache.openejb.ContainerType;
 import org.apache.openejb.InterfaceType;
 import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.Operation;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.core.ExceptionType;
@@ -79,14 +78,14 @@ public class CmpContainer implements Rpc
     /**
      * Index used for getDeployments() and getDeploymentInfo(deploymentId).
      */
-    protected final Map<Object, DeploymentInfo> deploymentsById = new HashMap<Object, DeploymentInfo>();
+    protected final Map<Object, BeanContext> deploymentsById = new HashMap<Object, BeanContext>();
 
     /**
      * When events are fired from the CMP engine only an entity bean instance is returned.  The type of the bean is used
      * to find the deployment info.  This means that when the same type is used multiple ejb deployments a random deployment
      * will be selected to handle the ejb callback.
      */
-    protected final Map<Class, DeploymentInfo> deploymentsByClass = new HashMap<Class, DeploymentInfo>();
+    protected final Map<Class, BeanContext> beansByClass = new HashMap<Class, BeanContext>();
 
     /**
      * The CmpEngine which performs the actual persistence operations
@@ -135,92 +134,80 @@ public class CmpContainer implements Rpc
         return ContainerType.CMP_ENTITY;
     }
 
-    public synchronized DeploymentInfo[] deployments() {
-        return deploymentsById.values().toArray(new DeploymentInfo[deploymentsById.size()]);
+    public synchronized BeanContext[] getBeanContexts() {
+        return deploymentsById.values().toArray(new BeanContext[deploymentsById.size()]);
     }
 
-    public synchronized DeploymentInfo getDeploymentInfo(Object deploymentID) {
+    public synchronized BeanContext getBeanContext(Object deploymentID) {
         return deploymentsById.get(deploymentID);
     }
 
-    private DeploymentInfo getDeploymentInfoByClass(Class type) {
-        DeploymentInfo deploymentInfo = null;
-        while (type != null && deploymentInfo == null) {
-            deploymentInfo = deploymentsByClass.get(type);
+    private BeanContext getBeanContextByClass(Class type) {
+        BeanContext beanContext = null;
+        while (type != null && beanContext == null) {
+            beanContext = beansByClass.get(type);
             type = type.getSuperclass();
         }
 
-        return deploymentInfo;
+        return beanContext;
     }
 
-    public void deploy(DeploymentInfo deploymentInfo) throws OpenEJBException {
-        deploy((CoreDeploymentInfo) deploymentInfo);
-    }
-
-    public void deploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
+    public void deploy(BeanContext beanContext) throws OpenEJBException {
         synchronized (this) {
-            Object deploymentId = deploymentInfo.getDeploymentID();
+            Object deploymentId = beanContext.getDeploymentID();
 
-            cmpEngine.deploy(deploymentInfo);
-            deploymentInfo.setContainerData(cmpEngine);
+            cmpEngine.deploy(beanContext);
+            beanContext.setContainerData(cmpEngine);
 
             // try to set deploymentInfo static field on bean implementation class
             try {
-                Field field = deploymentInfo.getCmpImplClass().getField("deploymentInfo");
-                field.set(null, deploymentInfo);
+                Field field = beanContext.getCmpImplClass().getField("deploymentInfo");
+                field.set(null, beanContext);
             } catch (Exception e) {
                 // ignore
             }
 
             // add to indexes
-            deploymentsById.put(deploymentId, deploymentInfo);
-            deploymentsByClass.put(deploymentInfo.getCmpImplClass(), deploymentInfo);
-            deploymentInfo.setContainer(this);
+            deploymentsById.put(deploymentId, beanContext);
+            beansByClass.put(beanContext.getCmpImplClass(), beanContext);
+            beanContext.setContainer(this);
         }
 
-        EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+        EjbTimerService timerService = beanContext.getEjbTimerService();
         if (timerService != null) {
             timerService.start();
         }
     }
 
-    public void start(DeploymentInfo deploymentInfo) throws OpenEJBException {        
+    public void start(BeanContext beanContext) throws OpenEJBException {
     }
     
-    public void stop(DeploymentInfo deploymentInfo) throws OpenEJBException {        
+    public void stop(BeanContext beanContext) throws OpenEJBException {
     }
     
-    public void undeploy(DeploymentInfo deploymentInfo) throws OpenEJBException {
-        EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+    public void undeploy(BeanContext beanContext) throws OpenEJBException {
+        EjbTimerService timerService = beanContext.getEjbTimerService();
         if (timerService != null) {
             timerService.stop();
         }
-        undeploy((CoreDeploymentInfo)deploymentInfo);
-    }
-
-    public void undeploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
         synchronized (this) {
-            deploymentsById.remove(deploymentInfo.getDeploymentID());
-            deploymentsByClass.remove(deploymentInfo.getCmpImplClass());
+            deploymentsById.remove(beanContext.getDeploymentID());
+            beansByClass.remove(beanContext.getCmpImplClass());
 
             try {
-                Field field = deploymentInfo.getCmpImplClass().getField("deploymentInfo");
+                Field field = beanContext.getCmpImplClass().getField("deploymentInfo");
                 field.set(null, null);
             } catch (Exception e) {
                 // ignore
             }
 
-            deploymentInfo.setContainer(null);
-            deploymentInfo.setContainerData(null);
+            beanContext.setContainer(null);
+            beanContext.setContainerData(null);
         }
     }
 
-    public Object getEjbInstance(DeploymentInfo deployInfo, Object primaryKey) {
-        return getEjbInstance((CoreDeploymentInfo)deployInfo, primaryKey);
-    }
-    
-    public Object getEjbInstance(CoreDeploymentInfo deployInfo, Object primaryKey) {
-        ThreadContext callContext = new ThreadContext(deployInfo, primaryKey);
+    public Object getEjbInstance(BeanContext beanContext, Object primaryKey) {
+        ThreadContext callContext = new ThreadContext(beanContext, primaryKey);
 
         ThreadContext oldCallContext = ThreadContext.enter(callContext);
         try {
@@ -243,14 +230,14 @@ public class CmpContainer implements Rpc
     }
 
     public Object invoke(Object deployID, InterfaceType type, Class callInterface, Method callMethod, Object[] args, Object primKey) throws OpenEJBException {
-        CoreDeploymentInfo deployInfo = (CoreDeploymentInfo) this.getDeploymentInfo(deployID);
+        BeanContext beanContext = this.getBeanContext(deployID);
 
-        if (deployInfo == null) throw new OpenEJBException("Deployment does not exist in this container. Deployment(id='"+deployID+"'), Container(id='"+containerID+"')");
+        if (beanContext == null) throw new OpenEJBException("Deployment does not exist in this container. Deployment(id='"+deployID+"'), Container(id='"+containerID+"')");
 
         // Use the backup way to determine call type if null was supplied.
-        if (type == null) type = deployInfo.getInterfaceType(callInterface);
+        if (type == null) type = beanContext.getInterfaceType(callInterface);
 
-        ThreadContext callContext = new ThreadContext(deployInfo, primKey);
+        ThreadContext callContext = new ThreadContext(beanContext, primKey);
 
         ThreadContext oldCallContext = ThreadContext.enter(callContext);
         try {
@@ -285,7 +272,7 @@ public class CmpContainer implements Rpc
 
             // business method
             callContext.setCurrentOperation(Operation.BUSINESS);
-            Method runMethod = deployInfo.getMatchingBeanMethod(callMethod);
+            Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
 
             callContext.set(Method.class, runMethod);
 
@@ -298,23 +285,23 @@ public class CmpContainer implements Rpc
     }
 
     private EntityBean createNewInstance(ThreadContext callContext) {
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
         try {
-            EntityBean bean = (EntityBean) deploymentInfo.getCmpImplClass().newInstance();
+            EntityBean bean = (EntityBean) beanContext.getCmpImplClass().newInstance();
             return bean;
         } catch (Exception e) {
-            throw new EJBException("Unable to create new entity bean instance " + deploymentInfo.getCmpImplClass(), e);
+            throw new EJBException("Unable to create new entity bean instance " + beanContext.getCmpImplClass(), e);
         }
     }
 
     private ThreadContext createThreadContext(EntityBean entityBean) {
         if (entityBean == null) throw new NullPointerException("entityBean is null");
 
-        CoreDeploymentInfo deployInfo = (CoreDeploymentInfo) getDeploymentInfoByClass(entityBean.getClass());
-        KeyGenerator keyGenerator = deployInfo.getKeyGenerator();
+        BeanContext beanContext = getBeanContextByClass(entityBean.getClass());
+        KeyGenerator keyGenerator = beanContext.getKeyGenerator();
         Object primaryKey = keyGenerator.getPrimaryKey(entityBean);
 
-        ThreadContext callContext = new ThreadContext(deployInfo, primaryKey);
+        ThreadContext callContext = new ThreadContext(beanContext, primaryKey);
         return callContext;
     }
 
@@ -322,9 +309,9 @@ public class CmpContainer implements Rpc
         if (entityBean == null) throw new NullPointerException("entityBean is null");
 
         // activating entity doen't have a primary key
-        CoreDeploymentInfo deployInfo = (CoreDeploymentInfo) getDeploymentInfoByClass(entityBean.getClass());
+        BeanContext beanContext = getBeanContextByClass(entityBean.getClass());
 
-        ThreadContext callContext = new ThreadContext(deployInfo, null);
+        ThreadContext callContext = new ThreadContext(beanContext, null);
         callContext.setCurrentOperation(Operation.SET_CONTEXT);
 
         ThreadContext oldCallContext = ThreadContext.enter(callContext);
@@ -478,18 +465,18 @@ public class CmpContainer implements Rpc
     }
 
     private Object businessMethod(Method callMethod, Method runMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
-        DeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
 
-        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+        TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
         EntityBean bean;
         Object returnValue = null;
 
-        entrancyTracker.enter(deploymentInfo, callContext.getPrimaryKey());
+        entrancyTracker.enter(beanContext, callContext.getPrimaryKey());
         try {
             bean = (EntityBean) cmpEngine.loadBean(callContext, callContext.getPrimaryKey());
             if (bean == null) {
-                throw new NoSuchObjectException(deploymentInfo.getDeploymentID() + " : " + callContext.getPrimaryKey());
+                throw new NoSuchObjectException(beanContext.getDeploymentID() + " : " + callContext.getPrimaryKey());
             }
 
             returnValue = runMethod.invoke(bean, args);
@@ -503,7 +490,7 @@ public class CmpContainer implements Rpc
                 e = ((InvocationTargetException) e).getTargetException();
             }
 
-            ExceptionType type = callContext.getDeploymentInfo().getExceptionType(e);
+            ExceptionType type = callContext.getBeanContext().getExceptionType(e);
             if (type == ExceptionType.SYSTEM) {
                 /* System Exception ****************************/
                 handleSystemException(txPolicy, e, callContext);
@@ -512,7 +499,7 @@ public class CmpContainer implements Rpc
                 handleApplicationException(txPolicy, e, type == ExceptionType.APPLICATION_ROLLBACK);
             }
         } finally {
-            entrancyTracker.exit(deploymentInfo, callContext.getPrimaryKey());
+            entrancyTracker.exit(beanContext, callContext.getPrimaryKey());
             afterInvoke(txPolicy, callContext);
         }
 
@@ -520,9 +507,9 @@ public class CmpContainer implements Rpc
     }
 
     private Object homeMethod(Method callMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
-        DeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
 
-        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+        TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
         EntityBean bean;
         Object returnValue = null;
@@ -538,7 +525,7 @@ public class CmpContainer implements Rpc
             try {
                 callContext.setCurrentOperation(Operation.HOME);
 
-                Method runMethod = ((CoreDeploymentInfo)deploymentInfo).getMatchingBeanMethod(callMethod);
+                Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
 
                 try {
                     returnValue = runMethod.invoke(bean, args);
@@ -558,7 +545,7 @@ public class CmpContainer implements Rpc
                 e = ((InvocationTargetException) e).getTargetException();
             }
 
-            ExceptionType type = callContext.getDeploymentInfo().getExceptionType(e);
+            ExceptionType type = callContext.getBeanContext().getExceptionType(e);
             if (type == ExceptionType.SYSTEM) {
                 /* System Exception ****************************/
                 handleSystemException(txPolicy, e, callContext);
@@ -575,9 +562,9 @@ public class CmpContainer implements Rpc
     }
 
     private ProxyInfo createEJBObject(Method callMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
 
-        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+        TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
         EntityBean bean;
         Object primaryKey = null;
@@ -590,7 +577,7 @@ public class CmpContainer implements Rpc
             setEntityContext(bean);
 
             // Obtain the proper ejbCreate() method
-            Method ejbCreateMethod = deploymentInfo.getMatchingBeanMethod(callMethod);
+            Method ejbCreateMethod = beanContext.getMatchingBeanMethod(callMethod);
 
             // Set current operation for allowed operations
             callContext.setCurrentOperation(Operation.CREATE);
@@ -602,10 +589,10 @@ public class CmpContainer implements Rpc
             primaryKey = cmpEngine.createBean(bean, callContext);
 
             // determine post create callback method
-            Method ejbPostCreateMethod = deploymentInfo.getMatchingPostCreateMethod(ejbCreateMethod);
+            Method ejbPostCreateMethod = beanContext.getMatchingPostCreateMethod(ejbCreateMethod);
 
             // create a new context containing the pk for the post create call
-            ThreadContext postCreateContext = new ThreadContext(deploymentInfo, primaryKey);
+            ThreadContext postCreateContext = new ThreadContext(beanContext, primaryKey);
             postCreateContext.setCurrentOperation(Operation.POST_CREATE);
 
             ThreadContext oldContext = ThreadContext.enter(postCreateContext);
@@ -630,7 +617,7 @@ public class CmpContainer implements Rpc
                 e = ((InvocationTargetException) e).getTargetException();
             }
 
-            ExceptionType type = callContext.getDeploymentInfo().getExceptionType(e);
+            ExceptionType type = callContext.getBeanContext().getExceptionType(e);
             if (type == ExceptionType.SYSTEM) {
                 /* System Exception ****************************/
                 handleSystemException(txPolicy, e, callContext);
@@ -642,26 +629,26 @@ public class CmpContainer implements Rpc
             afterInvoke(txPolicy, callContext);
         }
 
-        return new ProxyInfo(deploymentInfo, primaryKey);
+        return new ProxyInfo(beanContext, primaryKey);
     }
 
     private Object findByPrimaryKey(Method callMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
-        DeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
 
-        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+        TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
         try {
             EntityBean bean = (EntityBean) cmpEngine.loadBean(callContext, args[0]);
             if (bean == null) {
-                throw new ObjectNotFoundException(deploymentInfo.getDeploymentID() + " : " + args[0]);
+                throw new ObjectNotFoundException(beanContext.getDeploymentID() + " : " + args[0]);
             }
 
             // rebuild the primary key
-            KeyGenerator kg = ((CoreDeploymentInfo)deploymentInfo).getKeyGenerator();
+            KeyGenerator kg = beanContext.getKeyGenerator();
             Object primaryKey = kg.getPrimaryKey(bean);
 
             // create a new ProxyInfo based on the deployment info and primary key
-            return new ProxyInfo(deploymentInfo, primaryKey);
+            return new ProxyInfo(beanContext, primaryKey);
         } catch (javax.ejb.FinderException fe) {
             handleApplicationException(txPolicy, fe, false);
         } catch (Throwable e) {// handle reflection exception
@@ -673,14 +660,14 @@ public class CmpContainer implements Rpc
     }
 
     private Object findEJBObject(Method callMethod, Object[] args, ThreadContext callContext) throws OpenEJBException {
-        DeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
 
-        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+        TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
         try {
             List<Object> results = cmpEngine.queryBeans(callContext, callMethod, args);
 
-            KeyGenerator kg = ((CoreDeploymentInfo)deploymentInfo).getKeyGenerator();
+            KeyGenerator kg = beanContext.getKeyGenerator();
 
             // The following block of code is responsible for returning ProxyInfo object(s) for each
             // matching entity bean found by the query.  If its a multi-value find operation a Vector
@@ -698,7 +685,7 @@ public class CmpContainer implements Rpc
                         Object primaryKey = kg.getPrimaryKey(bean);
 
                         // create a new ProxyInfo based on the deployment info and primary key and add it to the vector
-                        proxies.add(new ProxyInfo(deploymentInfo, primaryKey));
+                        proxies.add(new ProxyInfo(beanContext, primaryKey));
                     }
                 }
                 if (callMethod.getReturnType() == Enumeration.class) {
@@ -708,7 +695,7 @@ public class CmpContainer implements Rpc
                 }
             } else {
                 if (results.size() != 1) {
-                    throw new ObjectNotFoundException("A Enteprise bean with deployment_id = " + deploymentInfo.getDeploymentID() + " and primarykey = " + args[0] + " Does not exist");
+                    throw new ObjectNotFoundException("A Enteprise bean with deployment_id = " + beanContext.getDeploymentID() + " and primarykey = " + args[0] + " Does not exist");
                 }
 
                 // create a new ProxyInfo based on the deployment info and primary key
@@ -717,7 +704,7 @@ public class CmpContainer implements Rpc
                     return null;
                 } else {
                     Object primaryKey = kg.getPrimaryKey(bean);
-                    return new ProxyInfo(deploymentInfo, primaryKey);
+                    return new ProxyInfo(beanContext, primaryKey);
                 }
             }
         } catch (javax.ejb.FinderException fe) {
@@ -730,13 +717,12 @@ public class CmpContainer implements Rpc
         throw new AssertionError("Should not get here");
     }
 
-    public Object select(DeploymentInfo di, String methodSignature, String returnType, Object... args) throws FinderException {
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) di;
-        String signature = deploymentInfo.getAbstractSchemaName() + "." + methodSignature;
+    public Object select(BeanContext beanContext, String methodSignature, String returnType, Object... args) throws FinderException {
+        String signature = beanContext.getAbstractSchemaName() + "." + methodSignature;
 
         try {
             // execute the select query
-            Collection<Object> results = cmpEngine.queryBeans(deploymentInfo, signature, args);
+            Collection<Object> results = cmpEngine.queryBeans(beanContext, signature, args);
 
             //
             // process the results
@@ -764,14 +750,14 @@ public class CmpContainer implements Rpc
                 if (value instanceof EntityBean) {
                     EntityBean entityBean = (EntityBean) value;
                     if (proxyFactory == null) {
-                        CoreDeploymentInfo resultInfo = (CoreDeploymentInfo) getDeploymentInfoByClass(entityBean.getClass());
-                        if (resultInfo != null) {
-                            proxyFactory = new ProxyFactory(resultInfo);
+                        BeanContext result = getBeanContextByClass(entityBean.getClass());
+                        if (result != null) {
+                            proxyFactory = new ProxyFactory(result);
                         }
                     }
 
                     if (proxyFactory != null) {
-                        if (deploymentInfo.isRemoteQueryResults(methodSignature)) {
+                        if (beanContext.isRemoteQueryResults(methodSignature)) {
                             value = proxyFactory.createRemoteProxy(entityBean, this);
                         } else {
                             value = proxyFactory.createLocalProxy(entityBean, this);
@@ -799,24 +785,23 @@ public class CmpContainer implements Rpc
         }
     }
 
-    public int update(DeploymentInfo di, String methodSignature, Object... args) throws FinderException {
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) di;
-        String signature = deploymentInfo.getAbstractSchemaName() + "." + methodSignature;
+    public int update(BeanContext beanContext, String methodSignature, Object... args) throws FinderException {
+        String signature = beanContext.getAbstractSchemaName() + "." + methodSignature;
 
         // exectue the update query
-        int result = cmpEngine.executeUpdateQuery(deploymentInfo, signature, args);
+        int result = cmpEngine.executeUpdateQuery(beanContext, signature, args);
         return result;
     }
 
     private void removeEJBObject(Method callMethod, ThreadContext callContext) throws OpenEJBException {
-        DeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
 
-        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+        TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
         try {
             EntityBean entityBean = (EntityBean) cmpEngine.loadBean(callContext, callContext.getPrimaryKey());
             if (entityBean == null) {
-                throw new NoSuchObjectException(callContext.getDeploymentInfo().getDeploymentID() + " " + callContext.getPrimaryKey());
+                throw new NoSuchObjectException(callContext.getBeanContext().getDeploymentID() + " " + callContext.getPrimaryKey());
             }
             ejbRemove(entityBean);
             cmpEngine.removeBean(callContext);
@@ -830,14 +815,14 @@ public class CmpContainer implements Rpc
     }
 
     private void cancelTimers(ThreadContext threadContext) {
-        DeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
+        BeanContext beanContext = threadContext.getBeanContext();
         Object primaryKey = threadContext.getPrimaryKey();
 
         // stop timers
-        if (primaryKey != null && deploymentInfo.getEjbTimerService() != null) {
-            EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+        if (primaryKey != null && beanContext.getEjbTimerService() != null) {
+            EjbTimerService timerService = beanContext.getEjbTimerService();
             if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
-                for (Timer timer : deploymentInfo.getEjbTimerService().getTimers(primaryKey)) {
+                for (Timer timer : beanContext.getEjbTimerService().getTimers(primaryKey)) {
                     timer.cancel();
                 }
             }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpEngine.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpEngine.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpEngine.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpEngine.java Tue Sep 14 07:43:38 2010
@@ -17,8 +17,8 @@
  */
 package org.apache.openejb.core.cmp;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.OpenEJBException;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.ThreadContext;
 
 import javax.ejb.CreateException;
@@ -39,11 +39,11 @@ public interface CmpEngine {
 
     List<Object> queryBeans(ThreadContext callContext, Method queryMethod, Object[] args) throws FinderException;
 
-    List<Object> queryBeans(CoreDeploymentInfo deploymentInfo, String signature, Object[] args) throws FinderException;
+    List<Object> queryBeans(BeanContext beanContext, String signature, Object[] args) throws FinderException;
 
-    int executeUpdateQuery(CoreDeploymentInfo deploymentInfo, String signature, Object[] args) throws FinderException;
+    int executeUpdateQuery(BeanContext beanContext, String signature, Object[] args) throws FinderException;
 
-    void deploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException;
+    void deploy(BeanContext beanContext) throws OpenEJBException;
 
-    void undeploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException;
+    void undeploy(BeanContext beanContext) throws OpenEJBException;
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/ProxyFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/ProxyFactory.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/ProxyFactory.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/ProxyFactory.java Tue Sep 14 07:43:38 2010
@@ -18,7 +18,7 @@
 package org.apache.openejb.core.cmp;
 
 import org.apache.openejb.RpcContainer;
-import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.core.entity.EntityEjbHomeHandler;
 import org.apache.openejb.util.proxy.ProxyManager;
 
@@ -27,28 +27,28 @@ import javax.ejb.EJBLocalHome;
 import javax.ejb.EntityBean;
 
 public class ProxyFactory {
-    private final CoreDeploymentInfo deploymentInfo;
+    private final BeanContext beanContext;
     private final KeyGenerator keyGenerator;
     private final Class remoteInterface;
     private final EntityEjbHomeHandler remoteHandler;
     private final Class localInterface;
     private final EntityEjbHomeHandler localHandler;
 
-    public ProxyFactory(CoreDeploymentInfo deploymentInfo) {
-        this.deploymentInfo = deploymentInfo;
-        keyGenerator = deploymentInfo.getKeyGenerator();
+    public ProxyFactory(BeanContext beanContext) {
+        this.beanContext = beanContext;
+        keyGenerator = beanContext.getKeyGenerator();
 
-        remoteInterface = deploymentInfo.getRemoteInterface();
+        remoteInterface = beanContext.getRemoteInterface();
         if (remoteInterface != null) {
-            EJBHome homeProxy = deploymentInfo.getEJBHome();
+            EJBHome homeProxy = beanContext.getEJBHome();
             remoteHandler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(homeProxy);
         } else {
             remoteHandler = null;
         }
 
-        localInterface = deploymentInfo.getLocalInterface();
+        localInterface = beanContext.getLocalInterface();
         if (localInterface != null) {
-            EJBLocalHome localHomeProxy = deploymentInfo.getEJBLocalHome();
+            EJBLocalHome localHomeProxy = beanContext.getEJBLocalHome();
             localHandler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(localHomeProxy);
         } else {
             localHandler = null;
@@ -61,7 +61,7 @@ public class ProxyFactory {
         Object primaryKey = keyGenerator.getPrimaryKey(bean);
 
         // create the proxy
-        Object proxy = remoteHandler.createProxy(primaryKey, deploymentInfo.getRemoteInterface());
+        Object proxy = remoteHandler.createProxy(primaryKey, beanContext.getRemoteInterface());
         return proxy;
     }
 
@@ -71,7 +71,7 @@ public class ProxyFactory {
         Object primaryKey = keyGenerator.getPrimaryKey(bean);
 
         // create the proxy
-        Object proxy = localHandler.createProxy(primaryKey, deploymentInfo.getLocalInterface());
+        Object proxy = localHandler.createProxy(primaryKey, beanContext.getLocalInterface());
         return proxy;
 
     }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Util.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Util.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Util.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Util.java Tue Sep 14 07:43:38 2010
@@ -17,8 +17,8 @@
  */
 package org.apache.openejb.core.cmp.cmp2;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.cmp.CmpContainer;
 import org.apache.openejb.core.cmp.KeyGenerator;
 import org.apache.openejb.util.proxy.ProxyManager;
@@ -30,11 +30,11 @@ import javax.ejb.EJBObject;
 import java.lang.reflect.Field;
 
 public class Cmp2Util {
-    public static Object getPrimaryKey(CoreDeploymentInfo deploymentInfo, EntityBean entity){
+    public static Object getPrimaryKey(BeanContext beanContext, EntityBean entity){
         if (entity == null) return null;
 
         // build the primary key
-        KeyGenerator kg = deploymentInfo.getKeyGenerator();
+        KeyGenerator kg = beanContext.getKeyGenerator();
         Object primaryKey = kg.getPrimaryKey(entity);
         return primaryKey;
     }
@@ -50,7 +50,7 @@ public class Cmp2Util {
             throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName());
         }
         CmpContainer container = (CmpContainer) handler.container;
-        Bean entity = (Bean) container.getEjbInstance(handler.getDeploymentInfo(), handler.primaryKey);
+        Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
         return entity;
     }
 
@@ -65,34 +65,34 @@ public class Cmp2Util {
             throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName());
         }
         CmpContainer container = (CmpContainer) handler.container;
-        Bean entity = (Bean) container.getEjbInstance(handler.getDeploymentInfo(), handler.primaryKey);
+        Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
         return entity;
     }
 
-    public static <Proxy extends EJBLocalObject> Proxy getEjbProxy(CoreDeploymentInfo deploymentInfo, EntityBean entity){
+    public static <Proxy extends EJBLocalObject> Proxy getEjbProxy(BeanContext beanContext, EntityBean entity){
         if (entity == null) return null;
 
         // build the primary key
-        Object primaryKey = getPrimaryKey(deploymentInfo, entity);
+        Object primaryKey = getPrimaryKey(beanContext, entity);
 
         // get the cmp container
-        if (!(deploymentInfo.getContainer() instanceof CmpContainer)) {
-            throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + deploymentInfo.getContainer().getClass().getName());
+        if (!(beanContext.getContainer() instanceof CmpContainer)) {
+            throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + beanContext.getContainer().getClass().getName());
         }
 
-        Proxy proxy = (Proxy) EjbObjectProxyHandler.createProxy(deploymentInfo, primaryKey, InterfaceType.EJB_LOCAL_HOME, deploymentInfo.getLocalInterface());
+        Proxy proxy = (Proxy) EjbObjectProxyHandler.createProxy(beanContext, primaryKey, InterfaceType.EJB_LOCAL_HOME, beanContext.getLocalInterface());
         return proxy;
     }
 
-    public static CoreDeploymentInfo getDeploymentInfo(Class type) {
-        CoreDeploymentInfo deploymentInfo;
+    public static BeanContext getBeanContext(Class type) {
+        BeanContext beanContext;
         try {
             Field deploymentInfoField = type.getField("deploymentInfo");
-            deploymentInfo = (CoreDeploymentInfo) deploymentInfoField.get(null);
+            beanContext = (BeanContext) deploymentInfoField.get(null);
         } catch (Exception e) {
             throw new IllegalArgumentException("EntityBean class " + type.getName() +
                     " does not contain a deploymentInfo field.  Is this a generated CMP 2 entity implementation?", e);
         }
-        return deploymentInfo;
+        return beanContext;
     }
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java Tue Sep 14 07:43:38 2010
@@ -17,7 +17,7 @@
  */
 package org.apache.openejb.core.cmp.cmp2;
 
-import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.loader.SystemInstance;
 
 import javax.ejb.EJBException;
@@ -36,13 +36,13 @@ import java.util.ConcurrentModificationE
 public class CmrSet<Bean extends EntityBean, Proxy extends EJBLocalObject> extends AbstractSet {
     private final EntityBean source;
     private final String sourceProperty;
-    private final CoreDeploymentInfo relatedInfo;
+    private final BeanContext relatedInfo;
     private final String relatedProperty;
     private final Class relatedLocal;
     private boolean mutable = true;
     private Collection<Bean> relatedBeans;
 
-    public CmrSet(EntityBean source, String sourceProperty, CoreDeploymentInfo relatedInfo, String relatedProperty, Collection<Bean> relatedBeans) {
+    public CmrSet(EntityBean source, String sourceProperty, BeanContext relatedInfo, String relatedProperty, Collection<Bean> relatedBeans) {
         this.source = source;
         this.sourceProperty = sourceProperty;
         this.relatedInfo = relatedInfo;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java Tue Sep 14 07:43:38 2010
@@ -18,13 +18,12 @@
 package org.apache.openejb.core.cmp.cmp2;
 
 import java.lang.reflect.Method;
-import java.util.HashMap; 
-import java.util.Map; 
+import java.util.HashMap;
 
 import javax.ejb.FinderException;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.Container;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.core.cmp.CmpContainer;
 
 /**
@@ -89,7 +88,7 @@ public class EjbSelect {
      * update() rather than a select() because there's 
      * no value to return. 
      * 
-     * @param di     The ejb object we're executing on behalf of.
+     * @param obj     The ejb object we're executing on behalf of.
      * @param methodSignature
      *               The signature of the selectxxxx method being invoked.
      * @param args   The arguments to the select.  These need to match
@@ -97,15 +96,15 @@ public class EjbSelect {
      * 
      * @exception FinderException
      */
-    public static void execute_void(Object di, String methodSignature, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static void execute_void(Object obj, String methodSignature, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        cmpContainer.update(deploymentInfo, methodSignature, args);
+        cmpContainer.update(beanContext, methodSignature, args);
     }
     
     
@@ -115,7 +114,7 @@ public class EjbSelect {
      * returnType parameter used to instantiate the return 
      * value. 
      * 
-     * @param di         The EJB object we're operating against.
+     * @param obj         The EJB object we're operating against.
      * @param methodSignature
      *                   The signature of the ejbSelectxxxx method.
      * @param returnType The return type signature of the method.
@@ -125,118 +124,118 @@ public class EjbSelect {
      *         one of the collection types.
      * @exception FinderException
      */
-    public static Object execute_Object(Object di, String methodSignature, String returnType, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static Object execute_Object(Object obj, String methodSignature, String returnType, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        return cmpContainer.select(deploymentInfo, methodSignature, returnType, args);
+        return cmpContainer.select(beanContext, methodSignature, returnType, args);
     }
     
     
-    public static char execute_char(Object di, String methodSignature, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static char execute_char(Object obj, String methodSignature, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        Character result = (Character)cmpContainer.select(deploymentInfo, methodSignature, "char", args);
+        Character result = (Character)cmpContainer.select(beanContext, methodSignature, "char", args);
         return result.charValue(); 
     }
     
     
-    public static byte execute_byte(Object di, String methodSignature, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static byte execute_byte(Object  obj, String methodSignature, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(deploymentInfo, methodSignature, "byte", args);
+        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "byte", args);
         return result.byteValue(); 
     }
     
     
-    public static boolean execute_boolean(Object di, String methodSignature, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static boolean execute_boolean(Object obj, String methodSignature, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        Boolean result = (Boolean)cmpContainer.select(deploymentInfo, methodSignature, "byte", args);
+        Boolean result = (Boolean)cmpContainer.select(beanContext, methodSignature, "byte", args);
         return result.booleanValue(); 
     }
     
     
-    public static short execute_short(Object di, String methodSignature, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static short execute_short(Object obj, String methodSignature, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(deploymentInfo, methodSignature, "short", args);
+        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "short", args);
         return result.shortValue(); 
     }
     
     
-    public static int execute_int(Object di, String methodSignature, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static int execute_int(Object obj, String methodSignature, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(deploymentInfo, methodSignature, "int", args);
+        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "int", args);
         return result.intValue(); 
     }
     
     
-    public static long execute_long(Object di, String methodSignature, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static long execute_long(Object obj, String methodSignature, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(deploymentInfo, methodSignature, "long", args);
+        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "long", args);
         return result.longValue(); 
     }
     
     
-    public static float execute_float(Object di, String methodSignature, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static float execute_float(Object obj, String methodSignature, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(deploymentInfo, methodSignature, "float", args);
+        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "float", args);
         return result.floatValue(); 
     }
     
     
-    public static double execute_double(Object di, String methodSignature, Object... args) throws FinderException {
-        DeploymentInfo deploymentInfo = (DeploymentInfo) di;
-        Container container = deploymentInfo.getContainer();
+    public static double execute_double(Object obj, String methodSignature, Object... args) throws FinderException {
+        BeanContext beanContext = (BeanContext) obj;
+        Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
-            throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+            throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
         CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(deploymentInfo, methodSignature, "double", args);
+        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "double", args);
         return result.doubleValue(); 
     }
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java Tue Sep 14 07:43:38 2010
@@ -26,7 +26,7 @@ import java.util.Iterator;
 import java.util.Collection;
 import java.util.ArrayList;
 
-import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.loader.SystemInstance;
 
 //
@@ -36,7 +36,7 @@ public class SetValuedCmr<Bean extends E
     private final EntityBean source;
     private final String sourceProperty;
     private final String relatedProperty;
-    private final CoreDeploymentInfo relatedInfo;
+    private final BeanContext relatedInfo;
     private final TransactionSynchronizationRegistry transactionRegistry;
 
     public SetValuedCmr(EntityBean source, String sourceProperty, Class<Bean> relatedType, String relatedProperty) {
@@ -47,7 +47,7 @@ public class SetValuedCmr<Bean extends E
         this.sourceProperty = sourceProperty;
         this.relatedProperty = relatedProperty;
 
-        this.relatedInfo = Cmp2Util.getDeploymentInfo(relatedType);
+        this.relatedInfo = Cmp2Util.getBeanContext(relatedType);
 
         transactionRegistry = SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class);
     }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SingleValuedCmr.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SingleValuedCmr.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SingleValuedCmr.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SingleValuedCmr.java Tue Sep 14 07:43:38 2010
@@ -17,7 +17,7 @@
  */
 package org.apache.openejb.core.cmp.cmp2;
 
-import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.BeanContext;
 
 import javax.ejb.EJBException;
 import javax.ejb.EJBLocalObject;
@@ -30,7 +30,7 @@ public class SingleValuedCmr<Bean extend
     private final EntityBean source;
     private final String sourceProperty;
     private final String relatedProperty;
-    private final CoreDeploymentInfo relatedInfo;
+    private final BeanContext relatedInfo;
 
     public SingleValuedCmr(EntityBean source, String sourceProperty, Class<Bean> relatedType, String relatedProperty) {
         if (source == null) throw new NullPointerException("source is null");
@@ -39,7 +39,7 @@ public class SingleValuedCmr<Bean extend
         this.sourceProperty = sourceProperty;
         this.relatedProperty = relatedProperty;
 
-        this.relatedInfo = Cmp2Util.getDeploymentInfo(relatedType);
+        this.relatedInfo = Cmp2Util.getBeanContext(relatedType);
     }
 
     public Proxy get(Bean entity) throws EJBException {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java Tue Sep 14 07:43:38 2010
@@ -34,8 +34,8 @@ import javax.persistence.EntityManager;
 import javax.persistence.PersistenceException;
 import javax.persistence.Query;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.OpenEJBException;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.core.cmp.CmpCallback;
 import org.apache.openejb.core.cmp.CmpEngine;
@@ -80,18 +80,18 @@ public class JpaCmpEngine implements Cmp
         this.cmpCallback = cmpCallback;
     }
 
-    public synchronized void deploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
-        configureKeyGenerator(deploymentInfo);
+    public synchronized void deploy(BeanContext beanContext) throws OpenEJBException {
+        configureKeyGenerator(beanContext);
     }
 
-    public synchronized void undeploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
-        deploymentInfo.setKeyGenerator(null);
+    public synchronized void undeploy(BeanContext beanContext) throws OpenEJBException {
+        beanContext.setKeyGenerator(null);
     }
 
-    private EntityManager getEntityManager(CoreDeploymentInfo deploymentInfo) {
+    private EntityManager getEntityManager(BeanContext beanContext) {
         EntityManager entityManager = null;
         try {
-            entityManager = (EntityManager) deploymentInfo.getJndiEnc().lookup(CMP_PERSISTENCE_CONTEXT_REF_NAME);
+            entityManager = (EntityManager) beanContext.getJndiEnc().lookup(CMP_PERSISTENCE_CONTEXT_REF_NAME);
         } catch (NamingException ignored) {
             //TODO see OPENEJB-1259 temporary hack until geronimo jndi integration works better
             try {
@@ -102,7 +102,7 @@ public class JpaCmpEngine implements Cmp
         }
 
         if (entityManager == null) {
-            throw new EJBException("Entity manager not found at \"openejb/cmp\" in jndi ejb " + deploymentInfo.getDeploymentID());
+            throw new EJBException("Entity manager not found at \"openejb/cmp\" in jndi ejb " + beanContext.getDeploymentID());
         }
 
         registerListener(entityManager);
@@ -133,15 +133,15 @@ public class JpaCmpEngine implements Cmp
         TransactionPolicy txPolicy = startTransaction("persist", callContext);
         creating.get().add(bean);
         try {
-            CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) callContext.getDeploymentInfo();
-            EntityManager entityManager = getEntityManager(deploymentInfo);
+            BeanContext beanContext = callContext.getBeanContext();
+            EntityManager entityManager = getEntityManager(beanContext);
 
             entityManager.persist(bean);
             entityManager.flush();
             bean = entityManager.merge(bean);
 
             // extract the primary key from the bean
-            KeyGenerator kg = deploymentInfo.getKeyGenerator();
+            KeyGenerator kg = beanContext.getKeyGenerator();
             Object primaryKey = kg.getPrimaryKey(bean);
 
             return primaryKey;
@@ -154,11 +154,11 @@ public class JpaCmpEngine implements Cmp
     public Object loadBean(ThreadContext callContext, Object primaryKey) {
         TransactionPolicy txPolicy = startTransaction("load", callContext);
         try {
-            CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) callContext.getDeploymentInfo();
-            Class<?> beanClass = deploymentInfo.getCmpImplClass();
+            BeanContext beanContext = callContext.getBeanContext();
+            Class<?> beanClass = beanContext.getCmpImplClass();
 
             // Try to load it from the entity manager
-            EntityManager entityManager = getEntityManager(deploymentInfo);
+            EntityManager entityManager = getEntityManager(beanContext);
             return entityManager.find(beanClass, primaryKey);
         } finally {
             commitTransaction("load", callContext, txPolicy);
@@ -175,7 +175,7 @@ public class JpaCmpEngine implements Cmp
         try {
             // only store if we started a new transaction
             if (txPolicy.isNewTransaction()) {
-                EntityManager entityManager = getEntityManager(callContext.getDeploymentInfo());
+                EntityManager entityManager = getEntityManager(callContext.getBeanContext());
                 entityManager.merge(bean);
             }
         } finally {
@@ -186,7 +186,7 @@ public class JpaCmpEngine implements Cmp
     public void removeBean(ThreadContext callContext) {
         TransactionPolicy txPolicy = startTransaction("remove", callContext);
         try {
-            CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+            BeanContext deploymentInfo = callContext.getBeanContext();
             Class<?> beanClass = deploymentInfo.getCmpImplClass();
 
             EntityManager entityManager = getEntityManager(deploymentInfo);
@@ -202,7 +202,7 @@ public class JpaCmpEngine implements Cmp
     }
 
     public List<Object> queryBeans(ThreadContext callContext, Method queryMethod, Object[] args) throws FinderException {
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext deploymentInfo = callContext.getBeanContext();
         EntityManager entityManager = getEntityManager(deploymentInfo);
 
         StringBuilder queryName = new StringBuilder();
@@ -231,8 +231,8 @@ public class JpaCmpEngine implements Cmp
         return executeSelectQuery(query, args);
     }
 
-    public List<Object> queryBeans(CoreDeploymentInfo deploymentInfo, String signature, Object[] args) throws FinderException {
-        EntityManager entityManager = getEntityManager(deploymentInfo);
+    public List<Object> queryBeans(BeanContext beanContext, String signature, Object[] args) throws FinderException {
+        EntityManager entityManager = getEntityManager(beanContext);
 
         Query query = createNamedQuery(entityManager, signature);
         if (query == null) {
@@ -280,8 +280,8 @@ public class JpaCmpEngine implements Cmp
         return results;
     }
 
-    public int executeUpdateQuery(CoreDeploymentInfo deploymentInfo, String signature, Object[] args) throws FinderException {
-        EntityManager entityManager = getEntityManager(deploymentInfo);
+    public int executeUpdateQuery(BeanContext beanContext, String signature, Object[] args) throws FinderException {
+        EntityManager entityManager = getEntityManager(beanContext);
 
         Query query = createNamedQuery(entityManager, signature);
         if (query == null) {
@@ -342,7 +342,7 @@ public class JpaCmpEngine implements Cmp
         }
     }
 
-    private void configureKeyGenerator(CoreDeploymentInfo di) throws OpenEJBException {
+    private void configureKeyGenerator(BeanContext di) throws OpenEJBException {
         if (di.isCmp2()) {
             di.setKeyGenerator(new Cmp2KeyGenerator());
         } else {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java Tue Sep 14 07:43:38 2010
@@ -36,15 +36,13 @@ import javax.ejb.Timer;
 import javax.transaction.TransactionSynchronizationRegistry;
 
 import org.apache.openejb.ApplicationException;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.ContainerType;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.ProxyInfo;
 import org.apache.openejb.SystemException;
 import org.apache.openejb.RpcContainer;
 import org.apache.openejb.InterfaceType;
-import org.apache.openejb.core.BaseContext;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.ExceptionType;
 import org.apache.openejb.core.Operation;
 import org.apache.openejb.core.ThreadContext;
@@ -68,7 +66,7 @@ public class EntityContainer implements 
 
     private EntityInstanceManager instanceManager;
 
-    private Map<String,CoreDeploymentInfo> deploymentRegistry  = new HashMap<String,CoreDeploymentInfo>();
+    private Map<String, BeanContext> deploymentRegistry  = new HashMap<String, BeanContext>();
 
     private Object containerID = null;
 
@@ -88,11 +86,11 @@ public class EntityContainer implements 
         instanceManager = new EntityInstanceManager(this, securityService, poolSize);
     }
 
-    public synchronized DeploymentInfo [] deployments() {
-        return deploymentRegistry.values().toArray(new DeploymentInfo[deploymentRegistry.size()]);
+    public synchronized BeanContext[] getBeanContexts() {
+        return deploymentRegistry.values().toArray(new BeanContext[deploymentRegistry.size()]);
     }
 
-    public synchronized DeploymentInfo getDeploymentInfo(Object deploymentID) {
+    public synchronized BeanContext getBeanContext(Object deploymentID) {
         String id = (String) deploymentID;
         return deploymentRegistry.get(id);
     }
@@ -105,27 +103,26 @@ public class EntityContainer implements 
         return containerID;
     }
 
-    public void deploy(DeploymentInfo info) throws OpenEJBException {
+    public void deploy(BeanContext beanContext) throws OpenEJBException {
         synchronized (this) {
-            CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) info;
-            deploymentRegistry.put((String)deploymentInfo.getDeploymentID(), deploymentInfo);
-            deploymentInfo.setContainer(this);
+            deploymentRegistry.put((String) beanContext.getDeploymentID(), beanContext);
+            beanContext.setContainer(this);
         }
-        instanceManager.deploy(info);
+        instanceManager.deploy(beanContext);
 
-        EjbTimerService timerService = info.getEjbTimerService();
+        EjbTimerService timerService = beanContext.getEjbTimerService();
         if (timerService != null) {
             timerService.start();
         }
     }
 
-    public void start(DeploymentInfo info) throws OpenEJBException {        
+    public void start(BeanContext info) throws OpenEJBException {
     }
     
-    public void stop(DeploymentInfo info) throws OpenEJBException {        
+    public void stop(BeanContext info) throws OpenEJBException {
     }
     
-    public void undeploy(DeploymentInfo info) throws OpenEJBException {
+    public void undeploy(BeanContext info) throws OpenEJBException {
         EjbTimerService timerService = info.getEjbTimerService();
         if (timerService != null) {
             timerService.stop();
@@ -152,14 +149,14 @@ public class EntityContainer implements 
     }
 
     public Object invoke(Object deployID, InterfaceType type, Class callInterface, Method callMethod, Object[] args, Object primKey) throws OpenEJBException {
-        CoreDeploymentInfo deployInfo = (CoreDeploymentInfo) this.getDeploymentInfo(deployID);
+        BeanContext beanContext = this.getBeanContext(deployID);
 
-        if (deployInfo == null) throw new OpenEJBException("Deployment does not exist in this container. Deployment(id='"+deployID+"'), Container(id='"+containerID+"')");
+        if (beanContext == null) throw new OpenEJBException("Deployment does not exist in this container. Deployment(id='"+deployID+"'), Container(id='"+containerID+"')");
 
         // Use the backup way to determine call type if null was supplied.
-        if (type == null) type = deployInfo.getInterfaceType(callInterface);
+        if (type == null) type = beanContext.getInterfaceType(callInterface);
 
-        ThreadContext callContext = new ThreadContext(deployInfo, primKey);
+        ThreadContext callContext = new ThreadContext(beanContext, primKey);
         ThreadContext oldCallContext = ThreadContext.enter(callContext);
         try {
             boolean authorized = type == InterfaceType.TIMEOUT || getSecurityService().isCallerAuthorized(callMethod, type);
@@ -192,7 +189,7 @@ public class EntityContainer implements 
             }
 
             callContext.setCurrentOperation(type == InterfaceType.TIMEOUT ? Operation.TIMEOUT : Operation.BUSINESS);
-            Method runMethod = deployInfo.getMatchingBeanMethod(callMethod);
+            Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
 
             callContext.set(Method.class, runMethod);
 
@@ -214,13 +211,13 @@ public class EntityContainer implements 
     }
 
     protected Object invoke(Method callMethod, Method runMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
-        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+        BeanContext beanContext = callContext.getBeanContext();
+        TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
         EntityBean bean = null;
 
         Object returnValue = null;
-        entrancyTracker.enter(callContext.getDeploymentInfo(), callContext.getPrimaryKey());
+        entrancyTracker.enter(callContext.getBeanContext(), callContext.getPrimaryKey());
         try {
             bean = instanceManager.obtainInstance(callContext);
 
@@ -231,7 +228,7 @@ public class EntityContainer implements 
         } catch (Throwable e) {
             handleException(txPolicy, e, callContext, bean);
         } finally {
-            entrancyTracker.exit(callContext.getDeploymentInfo(), callContext.getPrimaryKey());
+            entrancyTracker.exit(callContext.getBeanContext(), callContext.getPrimaryKey());
             afterInvoke(txPolicy, callContext);
         }
 
@@ -247,8 +244,8 @@ public class EntityContainer implements 
                 return;
             }
 
-            CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
-            TransactionPolicy txPolicy = deploymentInfo.getTransactionPolicyFactory().createTransactionPolicy(TransactionType.Supports);
+            BeanContext beanContext = callContext.getBeanContext();
+            TransactionPolicy txPolicy = beanContext.getTransactionPolicyFactory().createTransactionPolicy(TransactionType.Supports);
             try {
                 // double check we don't have an active transaction
                 if (!txPolicy.isTransactionActive()) {
@@ -278,8 +275,8 @@ public class EntityContainer implements 
                 return;
             }
 
-            CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
-            TransactionPolicy txPolicy = deploymentInfo.getTransactionPolicyFactory().createTransactionPolicy(TransactionType.Supports);
+            BeanContext beanContext = callContext.getBeanContext();
+            TransactionPolicy txPolicy = beanContext.getTransactionPolicyFactory().createTransactionPolicy(TransactionType.Supports);
             try {
                 // double check we don't have an active transaction
                 if (!txPolicy.isTransactionActive()) {
@@ -300,7 +297,7 @@ public class EntityContainer implements 
     }
 
     protected ProxyInfo createEJBObject(Method callMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
 
         callContext.setCurrentOperation(Operation.CREATE);
 
@@ -318,7 +315,7 @@ public class EntityContainer implements 
         * super classes afterInvoke( ) method will be executed committing the transaction if its a CMT.
         */
 
-        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+        TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
         EntityBean bean = null;
         Object primaryKey = null;
@@ -327,7 +324,7 @@ public class EntityContainer implements 
             bean = instanceManager.obtainInstance(callContext);
 
             // Obtain the proper ejbCreate() method
-            Method ejbCreateMethod = deploymentInfo.getMatchingBeanMethod(callMethod);
+            Method ejbCreateMethod = beanContext.getMatchingBeanMethod(callMethod);
 
             // invoke the ejbCreate which returns the primary key
             primaryKey = ejbCreateMethod.invoke(bean, args);
@@ -335,10 +332,10 @@ public class EntityContainer implements 
             didCreateBean(callContext, bean);
 
             // determine post create callback method
-            Method ejbPostCreateMethod = deploymentInfo.getMatchingPostCreateMethod(ejbCreateMethod);
+            Method ejbPostCreateMethod = beanContext.getMatchingPostCreateMethod(ejbCreateMethod);
 
             // create a new context containing the pk for the post create call
-            ThreadContext postCreateContext = new ThreadContext(deploymentInfo, primaryKey);
+            ThreadContext postCreateContext = new ThreadContext(beanContext, primaryKey);
             postCreateContext.setCurrentOperation(Operation.POST_CREATE);
 
             ThreadContext oldContext = ThreadContext.enter(postCreateContext);
@@ -364,14 +361,14 @@ public class EntityContainer implements 
             afterInvoke(txPolicy, callContext);
         }
 
-        return new ProxyInfo(deploymentInfo, primaryKey);
+        return new ProxyInfo(beanContext, primaryKey);
 
     }
 
     protected Object findMethod(Method callMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
         callContext.setCurrentOperation(Operation.FIND);
-        Method runMethod = deploymentInfo.getMatchingBeanMethod(callMethod);
+        Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
         Object returnValue = invoke(callMethod, runMethod, args, callContext);
 
         /*
@@ -383,7 +380,7 @@ public class EntityContainer implements 
             Vector<ProxyInfo> proxies = new Vector<ProxyInfo>();
             while (keys.hasNext()) {
                 Object primaryKey = keys.next();
-                proxies.addElement(new ProxyInfo(deploymentInfo, primaryKey));
+                proxies.addElement(new ProxyInfo(beanContext, primaryKey));
             }
             returnValue = proxies;
         } else if (returnValue instanceof java.util.Enumeration) {
@@ -391,19 +388,19 @@ public class EntityContainer implements 
             Vector<ProxyInfo> proxies = new Vector<ProxyInfo>();
             while (keys.hasMoreElements()) {
                 Object primaryKey = keys.nextElement();
-                proxies.addElement(new ProxyInfo(deploymentInfo, primaryKey));
+                proxies.addElement(new ProxyInfo(beanContext, primaryKey));
             }
             returnValue = new org.apache.openejb.util.ArrayEnumeration(proxies);
         } else
-            returnValue = new ProxyInfo(deploymentInfo, returnValue);
+            returnValue = new ProxyInfo(beanContext, returnValue);
 
         return returnValue;
     }
 
     protected Object homeMethod(Method callMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
-        org.apache.openejb.core.CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
         callContext.setCurrentOperation(Operation.HOME);
-        Method runMethod = deploymentInfo.getMatchingBeanMethod(callMethod);
+        Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
         return invoke(callMethod, runMethod, args, callContext);
     }
 
@@ -412,14 +409,14 @@ public class EntityContainer implements 
     }
 
     private void cancelTimers(ThreadContext threadContext) {
-        CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
+        BeanContext beanContext = threadContext.getBeanContext();
         Object primaryKey = threadContext.getPrimaryKey();
 
         // if we have a real timerservice, stop all timers. Otherwise, ignore...
         if (primaryKey != null) {
-            EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+            EjbTimerService timerService = beanContext.getEjbTimerService();
             if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
-                for (Timer timer : deploymentInfo.getEjbTimerService().getTimers(primaryKey)) {
+                for (Timer timer : beanContext.getEjbTimerService().getTimers(primaryKey)) {
                     timer.cancel();
                 }
             }
@@ -429,8 +426,8 @@ public class EntityContainer implements 
     protected void removeEJBObject(Method callMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
         callContext.setCurrentOperation(Operation.REMOVE);
 
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
-        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+        BeanContext beanContext = callContext.getBeanContext();
+        TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
         EntityBean bean = null;
         try {
@@ -452,7 +449,7 @@ public class EntityContainer implements 
         ExceptionType type;
         if (e instanceof InvocationTargetException) {
             e = ((InvocationTargetException) e).getTargetException();
-            type = callContext.getDeploymentInfo().getExceptionType(e);
+            type = callContext.getBeanContext().getExceptionType(e);
         } else if (e instanceof ApplicationException) {
             e = ((ApplicationException) e).getRootCause();
             type = ExceptionType.APPLICATION;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java Tue Sep 14 07:43:38 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.openejb.core.entity;
 
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.InterfaceType;
 import org.apache.openejb.InternalErrorException;
 import org.apache.openejb.core.BaseContext;
@@ -44,7 +44,7 @@ public class EntityContext extends BaseC
         check(Call.getEJBLocalObject);
 
         ThreadContext threadContext = ThreadContext.getThreadContext();
-        DeploymentInfo di = threadContext.getDeploymentInfo();
+        BeanContext di = threadContext.getBeanContext();
 
         if (di.getLocalInterface() == null) {
             throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a local interface");
@@ -64,13 +64,13 @@ public class EntityContext extends BaseC
         check(Call.getEJBObject);
 
         ThreadContext threadContext = ThreadContext.getThreadContext();
-        DeploymentInfo di = threadContext.getDeploymentInfo();
+        BeanContext di = threadContext.getBeanContext();
 
         if (di.getRemoteInterface() == null) {
             throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface");
         }
 
-        EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getDeploymentInfo(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>(), di.getRemoteInterface());
+        EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getBeanContext(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>(), di.getRemoteInterface());
         try {
             Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class};
             return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler);

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityEjbHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityEjbHomeHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityEjbHomeHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityEjbHomeHandler.java Tue Sep 14 07:43:38 2010
@@ -20,10 +20,10 @@ import java.lang.reflect.Method;
 import java.util.Vector;
 import java.util.List;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.ProxyInfo;
 import org.apache.openejb.InterfaceType;
 import org.apache.openejb.OpenEJBException;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.core.ivm.EjbHomeProxyHandler;
 import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
 import org.apache.openejb.util.proxy.ProxyManager;
@@ -35,8 +35,8 @@ import javax.ejb.EJBObject;
 
 public class EntityEjbHomeHandler extends EjbHomeProxyHandler {
 
-    public EntityEjbHomeHandler(DeploymentInfo deploymentInfo, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        super(deploymentInfo, interfaceType, interfaces, mainInterface);
+    public EntityEjbHomeHandler(BeanContext beanContext, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        super(beanContext, interfaceType, interfaces, mainInterface);
     }
 
     public Object createProxy(Object primaryKey, Class mainInterface) {
@@ -146,8 +146,8 @@ public class EntityEjbHomeHandler extend
         return sb.toString();
     }
 
-    protected EjbObjectProxyHandler newEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        return new EntityEjbObjectHandler(getDeploymentInfo(), pk, interfaceType, interfaces, mainInterface);
+    protected EjbObjectProxyHandler newEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        return new EntityEjbObjectHandler(getBeanContext(), pk, interfaceType, interfaces, mainInterface);
     }
 
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityEjbObjectHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityEjbObjectHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityEjbObjectHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityEjbObjectHandler.java Tue Sep 14 07:43:38 2010
@@ -20,9 +20,9 @@ import java.lang.reflect.Method;
 import java.util.List;
 import java.io.Serializable;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.Container;
 import org.apache.openejb.InterfaceType;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
 import org.apache.openejb.util.proxy.ProxyManager;
 
@@ -39,8 +39,8 @@ public class EntityEjbObjectHandler exte
     */
     private Object registryId;
 
-    public EntityEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        super(deploymentInfo, pk, interfaceType, interfaces, mainInterface);
+    public EntityEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        super(beanContext, pk, interfaceType, interfaces, mainInterface);
     }
 
     /*