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 [4/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/entity/EntityInstanceManager.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java Tue Sep 14 07:43:38 2010
@@ -17,12 +17,11 @@
 package org.apache.openejb.core.entity;
 
 import org.apache.openejb.ApplicationException;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.SystemException;
 import org.apache.openejb.InvalidateReferenceException;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.spi.SecurityService;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.Operation;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.core.NoSuchObjectException;
@@ -62,18 +61,18 @@ public class EntityInstanceManager {
         this.poolsize = poolSize;
         poolMap = new HashMap<Object,LinkedListStack>();// put size in later
 
-        DeploymentInfo[] deploymentInfos = container.deployments();
-        for (DeploymentInfo deploymentInfo : deploymentInfos) {
-            deploy(deploymentInfo);
+        BeanContext[] beanContexts = container.getBeanContexts();
+        for (BeanContext beanContext : beanContexts) {
+            deploy(beanContext);
         }
     }
 
-    public void deploy(DeploymentInfo deploymentInfo) {
-        poolMap.put(deploymentInfo.getDeploymentID(), new LinkedListStack(poolsize / 2));
+    public void deploy(BeanContext beanContext) {
+        poolMap.put(beanContext.getDeploymentID(), new LinkedListStack(poolsize / 2));
     }
 
-    public void undeploy(DeploymentInfo deploymentInfo) {
-        poolMap.remove(deploymentInfo.getDeploymentID());
+    public void undeploy(BeanContext beanContext) {
+        poolMap.remove(beanContext.getDeploymentID());
     }
 
     public EntityBean obtainInstance(ThreadContext callContext) throws OpenEJBException {
@@ -82,7 +81,7 @@ public class EntityInstanceManager {
         TransactionPolicy txPolicy = callContext.getTransactionPolicy();
         if (callContext.getPrimaryKey() != null && txPolicy != null && txPolicy.isTransactionActive()) {
 
-            Key key = new Key(callContext.getDeploymentInfo().getDeploymentID(), primaryKey);
+            Key key = new Key(callContext.getBeanContext().getDeploymentID(), primaryKey);
             SynchronizationWrapper wrapper = (SynchronizationWrapper) txPolicy.getResource(key);
 
             if (wrapper != null) {// if true, the requested bean instance is already enrolled in a transaction
@@ -129,7 +128,7 @@ public class EntityInstanceManager {
                 * so it needs to be enrolled in the transaction.
                 */
                 EntityBean bean = getPooledInstance(callContext);
-                wrapper = new SynchronizationWrapper(callContext.getDeploymentInfo(), primaryKey, bean, false, key, txPolicy);
+                wrapper = new SynchronizationWrapper(callContext.getBeanContext(), primaryKey, bean, false, key, txPolicy);
 
                 if (callContext.getCurrentOperation() == Operation.REMOVE) {
                     /*
@@ -181,16 +180,16 @@ public class EntityInstanceManager {
     }
 
     protected EntityBean getPooledInstance(ThreadContext callContext) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
-        Stack methodReadyPool = poolMap.get(deploymentInfo.getDeploymentID());
-        if (methodReadyPool == null) throw new SystemException("Invalid deployment id " + deploymentInfo.getDeploymentID() + " for this container");
+        BeanContext beanContext = callContext.getBeanContext();
+        Stack methodReadyPool = poolMap.get(beanContext.getDeploymentID());
+        if (methodReadyPool == null) throw new SystemException("Invalid deployment id " + beanContext.getDeploymentID() + " for this container");
 
         EntityBean bean = (EntityBean) methodReadyPool.pop();
         if (bean == null) {
             try {
-                bean = (EntityBean) deploymentInfo.getBeanClass().newInstance();
+                bean = (EntityBean) beanContext.getBeanClass().newInstance();
             } catch (Exception e) {
-                logger.error("Bean instantiation failed for class " + deploymentInfo.getBeanClass(), e);
+                logger.error("Bean instantiation failed for class " + beanContext.getBeanClass(), e);
                 throw new SystemException(e);
             }
 
@@ -274,7 +273,7 @@ public class EntityInstanceManager {
         TransactionPolicy txPolicy = callContext.getTransactionPolicy();
         if (primaryKey != null && txPolicy != null && txPolicy.isTransactionActive()) {
 
-            Key key = new Key(callContext.getDeploymentInfo().getDeploymentID(), primaryKey);
+            Key key = new Key(callContext.getBeanContext().getDeploymentID(), primaryKey);
             SynchronizationWrapper wrapper = (SynchronizationWrapper) txPolicy.getResource(key);
 
             if (wrapper != null) {
@@ -290,7 +289,7 @@ public class EntityInstanceManager {
                     * If the bean has been removed then the bean instance is no longer needed and can return to the methodReadyPool
                     * to service another identity.
                     */
-                    Stack methodReadyPool = poolMap.get(callContext.getDeploymentInfo().getDeploymentID());
+                    Stack methodReadyPool = poolMap.get(callContext.getBeanContext().getDeploymentID());
                     methodReadyPool.push(bean);
                 } else {
                     if (callContext.getCurrentOperation() == Operation.CREATE) {
@@ -307,7 +306,7 @@ public class EntityInstanceManager {
                 tx ready pool
                 */
 
-                wrapper = new SynchronizationWrapper(callContext.getDeploymentInfo(), primaryKey, bean, true, key, txPolicy);
+                wrapper = new SynchronizationWrapper(callContext.getBeanContext(), primaryKey, bean, true, key, txPolicy);
 
                 txPolicy.registerSynchronization(wrapper);
 
@@ -354,7 +353,7 @@ public class EntityInstanceManager {
             * method and is not still part of a tx.  While in the method ready pool the bean instance is not associated with a
             * primary key and may be used to service a request for any bean of the same class.
             */
-            Stack methodReadyPool = poolMap.get(callContext.getDeploymentInfo().getDeploymentID());
+            Stack methodReadyPool = poolMap.get(callContext.getBeanContext().getDeploymentID());
             methodReadyPool.push(bean);
         }
 
@@ -404,7 +403,7 @@ public class EntityInstanceManager {
         // especially important in the obtainInstance( ) method where a disassociated wrapper
         // in the txReadyPool is indicative of an entity bean that has been removed via
         // ejbRemove() rather than freed because of an error condition as is the case here.
-        Key key = new Key(callContext.getDeploymentInfo().getDeploymentID(), primaryKey);
+        Key key = new Key(callContext.getBeanContext().getDeploymentID(), primaryKey);
         SynchronizationWrapper wrapper = (SynchronizationWrapper) txPolicy.getResource(key);
         if (wrapper != null) {
             /*
@@ -474,18 +473,18 @@ public class EntityInstanceManager {
         private boolean available;
         private boolean associated;
         private final Key readyPoolKey;
-        private final CoreDeploymentInfo deploymentInfo;
+        private final BeanContext beanContext;
         private final Object primaryKey;
         private final TransactionPolicy txPolicy;
 
-        public SynchronizationWrapper(CoreDeploymentInfo deploymentInfo, Object primaryKey, EntityBean bean, boolean available, Key readyPoolKey, TransactionPolicy txPolicy) {
+        public SynchronizationWrapper(BeanContext beanContext, Object primaryKey, EntityBean bean, boolean available, Key readyPoolKey, TransactionPolicy txPolicy) {
             if (bean == null) throw new IllegalArgumentException("bean is null");
             if (readyPoolKey == null) throw new IllegalArgumentException("key is null");
-            if (deploymentInfo == null) throw new IllegalArgumentException("deploymentInfo is null");
+            if (beanContext == null) throw new IllegalArgumentException("deploymentInfo is null");
             if (primaryKey == null) throw new IllegalArgumentException("primaryKey is null");
             if (txPolicy == null) throw new IllegalArgumentException("txEnv is null");
 
-            this.deploymentInfo = deploymentInfo;
+            this.beanContext = beanContext;
             this.bean = bean;
             this.primaryKey = primaryKey;
             this.available = available;
@@ -527,7 +526,7 @@ public class EntityInstanceManager {
                     bean = this.bean;
                 }
 
-                ThreadContext callContext = new ThreadContext(deploymentInfo, primaryKey);
+                ThreadContext callContext = new ThreadContext(beanContext, primaryKey);
                 callContext.setCurrentOperation(Operation.STORE);
 
                 ThreadContext oldCallContext = ThreadContext.enter(callContext);

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntrancyTracker.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntrancyTracker.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntrancyTracker.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntrancyTracker.java Tue Sep 14 07:43:38 2010
@@ -17,7 +17,7 @@
  */
 package org.apache.openejb.core.entity;
 
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.ApplicationException;
 
 import javax.transaction.TransactionSynchronizationRegistry;
@@ -42,12 +42,12 @@ public class EntrancyTracker {
         this.synchronizationRegistry = synchronizationRegistry;
     }
 
-    public void enter(DeploymentInfo deploymentInfo, Object primaryKey) throws ApplicationException {
-        if (primaryKey == null || deploymentInfo.isReentrant()) {
+    public void enter(BeanContext beanContext, Object primaryKey) throws ApplicationException {
+        if (primaryKey == null || beanContext.isReentrant()) {
             return;
         }
 
-        Object deploymentId = deploymentInfo.getDeploymentID();
+        Object deploymentId = beanContext.getDeploymentID();
         InstanceKey key = new InstanceKey(deploymentId, primaryKey);
 
 
@@ -71,12 +71,12 @@ public class EntrancyTracker {
 
     }
 
-    public void exit(DeploymentInfo deploymentInfo, Object primaryKey) throws ApplicationException {
-        if (primaryKey == null || deploymentInfo.isReentrant()) {
+    public void exit(BeanContext beanContext, Object primaryKey) throws ApplicationException {
+        if (primaryKey == null || beanContext.isReentrant()) {
             return;
         }
 
-        Object deploymentId = deploymentInfo.getDeploymentID();
+        Object deploymentId = beanContext.getDeploymentID();
         InstanceKey key = new InstanceKey(deploymentId, primaryKey);
 
         Set<InstanceKey> inCall = null;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorStack.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorStack.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorStack.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorStack.java Tue Sep 14 07:43:38 2010
@@ -86,7 +86,7 @@ public class InterceptorStack {
                 StringBuilder sb = new StringBuilder();
                 ThreadContext threadContext = ThreadContext.getThreadContext();
                 String txPolicy = threadContext.getTransactionPolicy().getClass().getSimpleName();
-                String ejbName = threadContext.getDeploymentInfo().getEjbName();
+                String ejbName = threadContext.getBeanContext().getEjbName();
                 String methodName = targetMethod.getName() + "(" + join(", ", Classes.getSimpleNames(targetMethod.getParameterTypes())) + ")";
                 sb.append(join("", stack()));
                 sb.append(ejbName).append(".");

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java Tue Sep 14 07:43:38 2010
@@ -52,9 +52,9 @@ import javax.ejb.AccessLocalException;
 import javax.transaction.TransactionRequiredException;
 import javax.transaction.TransactionRolledbackException;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.InterfaceType;
 import org.apache.openejb.RpcContainer;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.ContainerSystem;
@@ -77,7 +77,7 @@ public abstract class BaseEjbProxyHandle
 
     public boolean inProxyMap = false;
 
-    private transient WeakReference<DeploymentInfo> deploymentInfo;
+    private transient WeakReference<BeanContext> beanContextRef;
 
     public transient RpcContainer container;
 
@@ -105,16 +105,16 @@ public abstract class BaseEjbProxyHandle
     private transient WeakHashMap<Class,Object> interfaces;
     private transient WeakReference<Class> mainInterface;
 
-    public BaseEjbProxyHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        this.container = (RpcContainer) deploymentInfo.getContainer();
-        this.deploymentID = deploymentInfo.getDeploymentID();
+    public BaseEjbProxyHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        this.container = (RpcContainer) beanContext.getContainer();
+        this.deploymentID = beanContext.getDeploymentID();
         this.interfaceType = interfaceType;
         this.primaryKey = pk;
-        this.setDeploymentInfo(deploymentInfo);
+        this.setBeanContext(beanContext);
 
         if (interfaces == null || interfaces.size() == 0) {
             InterfaceType objectInterfaceType = (interfaceType.isHome()) ? interfaceType.getCounterpart() : interfaceType;
-            interfaces = new ArrayList<Class>(deploymentInfo.getInterfaces(objectInterfaceType));
+            interfaces = new ArrayList<Class>(beanContext.getInterfaces(objectInterfaceType));
             if (mainInterface == null && interfaces.size() == 1) {
                 mainInterface = interfaces.get(0);
             }
@@ -122,7 +122,7 @@ public abstract class BaseEjbProxyHandle
         setInterfaces(interfaces);
         setMainInterface(mainInterface);
         if (mainInterface == null) {
-            throw new IllegalArgumentException("No mainInterface: otherwise di: " + deploymentInfo + " InterfaceType: " + interfaceType + " interfaces: " + interfaces );
+            throw new IllegalArgumentException("No mainInterface: otherwise di: " + beanContext + " InterfaceType: " + interfaceType + " interfaces: " + interfaces );
         }
         this.setDoIntraVmCopy(REMOTE_COPY_ENABLED && !interfaceType.isLocal() && !interfaceType.isLocalBean());
     }
@@ -249,7 +249,7 @@ public abstract class BaseEjbProxyHandle
 
                 IntraVmCopyMonitor.pre(strategy);
                 ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
-                Thread.currentThread().setContextClassLoader(getDeploymentInfo().getClassLoader());
+                Thread.currentThread().setContextClassLoader(getBeanContext().getClassLoader());
                 try {
                     args = copyArgs(args);
                     method = copyMethod(method);
@@ -307,7 +307,7 @@ public abstract class BaseEjbProxyHandle
                 throw new NoSuchEJBException("reference is invalid");
             }
         }
-        getDeploymentInfo(); // will throw an exception if app has been undeployed.
+        getBeanContext(); // will throw an exception if app has been undeployed.
     }
 
     /**
@@ -513,7 +513,7 @@ public abstract class BaseEjbProxyHandle
 
     public void invalidateReference() {
         this.container = null;
-        this.setDeploymentInfo(null);
+        this.setBeanContext(null);
         this.isInvalidReference = true;
     }
 
@@ -544,25 +544,25 @@ public abstract class BaseEjbProxyHandle
 
     public abstract org.apache.openejb.ProxyInfo getProxyInfo();
 
-    public DeploymentInfo getDeploymentInfo() {
-        DeploymentInfo info = deploymentInfo.get();
-        if (info == null|| info.isDestroyed()){
+    public BeanContext getBeanContext() {
+        BeanContext beanContext = beanContextRef.get();
+        if (beanContext == null|| beanContext.isDestroyed()){
             invalidateReference();
             throw new IllegalStateException("Bean '"+deploymentID+"' has been undeployed.");
         }
-        return info;
+        return beanContext;
     }
 
-    public void setDeploymentInfo(DeploymentInfo deploymentInfo) {
-        this.deploymentInfo = new WeakReference<DeploymentInfo>(deploymentInfo);
+    public void setBeanContext(BeanContext beanContext) {
+        this.beanContextRef = new WeakReference<BeanContext>(beanContext);
     }
 
     public Hashtable getLiveHandleRegistry() {
-        DeploymentInfo deploymentInfo = getDeploymentInfo();
-        ProxyRegistry proxyRegistry = deploymentInfo.get(ProxyRegistry.class);
+        BeanContext beanContext = getBeanContext();
+        ProxyRegistry proxyRegistry = beanContext.get(ProxyRegistry.class);
         if (proxyRegistry == null){
             proxyRegistry = new ProxyRegistry();
-            deploymentInfo.set(ProxyRegistry.class, proxyRegistry);
+            beanContext.set(ProxyRegistry.class, proxyRegistry);
         }
         return proxyRegistry.liveHandleRegistry;
     }
@@ -579,8 +579,8 @@ public abstract class BaseEjbProxyHandle
         in.defaultReadObject();
 
         ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
-        setDeploymentInfo(containerSystem.getDeploymentInfo(deploymentID));
-        container = (RpcContainer) getDeploymentInfo().getContainer();
+        setBeanContext(containerSystem.getBeanContext(deploymentID));
+        container = (RpcContainer) getBeanContext().getContainer();
 
         if (IntraVmCopyMonitor.isCrossClassLoaderOperation()) {
             setDoCrossClassLoaderCopy(true);

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java Tue Sep 14 07:43:38 2010
@@ -30,7 +30,7 @@ import javax.ejb.EJBAccessException;
 import javax.ejb.EJBException;
 import javax.ejb.EJBHome;
 
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.InterfaceType;
 import org.apache.openejb.ProxyInfo;
 import org.apache.openejb.core.ServerFederation;
@@ -58,8 +58,8 @@ public abstract class EjbHomeProxyHandle
         REMOVE
     }
 
-    public EjbHomeProxyHandler(DeploymentInfo deploymentInfo, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        super(deploymentInfo, null, interfaceType, interfaces, mainInterface);
+    public EjbHomeProxyHandler(BeanContext beanContext, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        super(beanContext, null, interfaceType, interfaces, mainInterface);
         dispatchTable = new HashMap<String, MethodType>();
         dispatchTable.put("create", MethodType.CREATE);
         dispatchTable.put("getEJBMetaData", MethodType.META_DATA);
@@ -67,7 +67,7 @@ public abstract class EjbHomeProxyHandle
         dispatchTable.put("remove", MethodType.REMOVE);
 
         if (interfaceType.isHome()) {
-            Class homeInterface = deploymentInfo.getInterface(interfaceType);
+            Class homeInterface = beanContext.getInterface(interfaceType);
             Method[] methods = homeInterface.getMethods();
             for (Method method : methods) {
                 if (method.getName().startsWith("create")) {
@@ -84,36 +84,36 @@ public abstract class EjbHomeProxyHandle
         throw new IllegalStateException("A home reference must never be invalidated!");
     }
 
-    protected static EjbHomeProxyHandler createHomeHandler(DeploymentInfo deploymentInfo, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        switch (deploymentInfo.getComponentType()) {
+    protected static EjbHomeProxyHandler createHomeHandler(BeanContext beanContext, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        switch (beanContext.getComponentType()) {
             case STATEFUL:
-                return new StatefulEjbHomeHandler(deploymentInfo, interfaceType, interfaces, mainInterface);
+                return new StatefulEjbHomeHandler(beanContext, interfaceType, interfaces, mainInterface);
             case STATELESS:
-                return  new StatelessEjbHomeHandler(deploymentInfo, interfaceType, interfaces, mainInterface);
+                return  new StatelessEjbHomeHandler(beanContext, interfaceType, interfaces, mainInterface);
             case SINGLETON:
-                return  new SingletonEjbHomeHandler(deploymentInfo, interfaceType, interfaces, mainInterface);
+                return  new SingletonEjbHomeHandler(beanContext, interfaceType, interfaces, mainInterface);
             case MANAGED:
-                return  new ManagedHomeHandler(deploymentInfo, interfaceType, interfaces, mainInterface);
+                return  new ManagedHomeHandler(beanContext, interfaceType, interfaces, mainInterface);
             case CMP_ENTITY:
             case BMP_ENTITY:
-                return  new EntityEjbHomeHandler(deploymentInfo, interfaceType, interfaces, mainInterface);
-            default: throw new IllegalStateException("Component type does not support rpc interfaces: " + deploymentInfo.getComponentType());
+                return  new EntityEjbHomeHandler(beanContext, interfaceType, interfaces, mainInterface);
+            default: throw new IllegalStateException("Component type does not support rpc interfaces: " + beanContext.getComponentType());
         }
     }
 
-    public static Object createHomeProxy(DeploymentInfo deploymentInfo, InterfaceType interfaceType) {
-        return createHomeProxy(deploymentInfo, interfaceType, null, interfaceType.isRemote()? deploymentInfo.getRemoteInterface(): deploymentInfo.getLocalInterface());
+    public static Object createHomeProxy(BeanContext beanContext, InterfaceType interfaceType) {
+        return createHomeProxy(beanContext, interfaceType, null, interfaceType.isRemote()? beanContext.getRemoteInterface(): beanContext.getLocalInterface());
     }
 
-    public static Object createHomeProxy(DeploymentInfo deploymentInfo, InterfaceType interfaceType, List<Class> objectInterfaces, Class mainInterface) {
+    public static Object createHomeProxy(BeanContext beanContext, InterfaceType interfaceType, List<Class> objectInterfaces, Class mainInterface) {
         if (!interfaceType.isHome()) throw new IllegalArgumentException("InterfaceType is not a Home type: " + interfaceType);
 
         try {
-            EjbHomeProxyHandler handler = createHomeHandler(deploymentInfo, interfaceType, objectInterfaces, mainInterface);
+            EjbHomeProxyHandler handler = createHomeHandler(beanContext, interfaceType, objectInterfaces, mainInterface);
 
             List<Class> proxyInterfaces = new ArrayList<Class>(2);
 
-            Class homeInterface = deploymentInfo.getInterface(interfaceType);
+            Class homeInterface = beanContext.getInterface(interfaceType);
             proxyInterfaces.add(homeInterface);
             proxyInterfaces.add(IntraVmProxy.class);
 
@@ -128,10 +128,10 @@ public abstract class EjbHomeProxyHandle
 
             InterfaceType objectInterfaceType = this.interfaceType.getCounterpart();
 
-            EjbObjectProxyHandler handler = newEjbObjectHandler(getDeploymentInfo(), primaryKey, objectInterfaceType, this.getInterfaces(), mainInterface);
+            EjbObjectProxyHandler handler = newEjbObjectHandler(getBeanContext(), primaryKey, objectInterfaceType, this.getInterfaces(), mainInterface);
 
             if (InterfaceType.LOCALBEAN.equals(objectInterfaceType)) {
-                return LocalBeanProxyFactory.newProxyInstance(handler.getDeploymentInfo().getClassLoader(), handler.getDeploymentInfo().getBeanClass(), handler);
+                return LocalBeanProxyFactory.newProxyInstance(handler.getBeanContext().getClassLoader(), handler.getBeanContext().getBeanClass(), handler);
             } else {
                 List<Class> proxyInterfaces = new ArrayList<Class>(handler.getInterfaces().size() + 1);
                 proxyInterfaces.addAll(handler.getInterfaces());
@@ -144,7 +144,7 @@ public abstract class EjbHomeProxyHandle
         }
     }
 
-    protected abstract EjbObjectProxyHandler newEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface);
+    protected abstract EjbObjectProxyHandler newEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface);
 
     protected Object _invoke(Object proxy, Class interfce, Method method, Object[] args) throws Throwable {
 
@@ -292,7 +292,7 @@ public abstract class EjbHomeProxyHandle
 
     protected Object getEJBMetaData(Method method, Object[] args, Object proxy) throws Throwable {
         checkAuthorization(method);
-        IntraVmMetaData metaData = new IntraVmMetaData(getDeploymentInfo().getHomeInterface(), getDeploymentInfo().getRemoteInterface(), getDeploymentInfo().getPrimaryKeyClass(), getDeploymentInfo().getComponentType());
+        IntraVmMetaData metaData = new IntraVmMetaData(getBeanContext().getHomeInterface(), getBeanContext().getRemoteInterface(), getBeanContext().getPrimaryKeyClass(), getBeanContext().getComponentType());
         metaData.setEJBHome((EJBHome) proxy);
         return metaData;
     }
@@ -306,7 +306,7 @@ public abstract class EjbHomeProxyHandle
         if (getMainInterface() == null) {
             throw new IllegalStateException("no main interface");
         }
-        return new org.apache.openejb.ProxyInfo(getDeploymentInfo(), null, getDeploymentInfo().getInterfaces(interfaceType), interfaceType, getMainInterface());
+        return new org.apache.openejb.ProxyInfo(getBeanContext(), null, getBeanContext().getInterfaces(interfaceType), interfaceType, getMainInterface());
     }
 
     protected Object _writeReplace(Object proxy) throws ObjectStreamException {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java Tue Sep 14 07:43:38 2010
@@ -38,10 +38,9 @@ import javax.ejb.EJBException;
 import javax.ejb.EJBLocalObject;
 import javax.ejb.EJBObject;
 
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.AppContext;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.InterfaceType;
-import org.apache.openejb.core.AppContext;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.ServerFederation;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.spi.ApplicationServer;
@@ -62,8 +61,8 @@ public abstract class EjbObjectProxyHand
         dispatchTable.put("getEJBLocalHome", Integer.valueOf(6));
     }
 
-    public EjbObjectProxyHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        super(deploymentInfo, pk, interfaceType, interfaces, mainInterface);
+    public EjbObjectProxyHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        super(beanContext, pk, interfaceType, interfaces, mainInterface);
     }
 
     public abstract Object getRegistryId();
@@ -169,12 +168,12 @@ public abstract class EjbObjectProxyHand
 
     protected Object getEJBHome(Method method, Object[] args, Object proxy) throws Throwable {
         checkAuthorization(method);
-        return getDeploymentInfo().getEJBHome();
+        return getBeanContext().getEJBHome();
     }
 
     protected Object getEJBLocalHome(Method method, Object[] args, Object proxy) throws Throwable {
         checkAuthorization(method);
-        return getDeploymentInfo().getEJBLocalHome();
+        return getBeanContext().getEJBLocalHome();
     }
 
     protected Object getHandle(Method method, Object[] args, Object proxy) throws Throwable {
@@ -183,7 +182,7 @@ public abstract class EjbObjectProxyHand
     }
 
     public org.apache.openejb.ProxyInfo getProxyInfo() {
-        return new org.apache.openejb.ProxyInfo(getDeploymentInfo(), primaryKey, getInterfaces(), interfaceType, getMainInterface());
+        return new org.apache.openejb.ProxyInfo(getBeanContext(), primaryKey, getInterfaces(), interfaceType, getMainInterface());
     }
 
     protected Object _writeReplace(Object proxy) throws ObjectStreamException {
@@ -226,8 +225,8 @@ public abstract class EjbObjectProxyHand
     protected abstract Object remove(Class interfce, Method method, Object[] args, Object proxy) throws Throwable;
 
     protected Object businessMethod(Class<?> interfce, Method method, Object[] args, Object proxy) throws Throwable {
-        CoreDeploymentInfo coreDeploymentInfo = (CoreDeploymentInfo) getDeploymentInfo();
-        if (coreDeploymentInfo.isAsynchronous(method)) {
+        BeanContext beanContext = getBeanContext();
+        if (beanContext.isAsynchronous(method)) {
             return asynchronizedBusinessMethod(interfce, method, args, proxy);
         } else {
             return synchronizedBusinessMethod(interfce, method, args, proxy);
@@ -235,12 +234,12 @@ public abstract class EjbObjectProxyHand
     }
 
     protected Object asynchronizedBusinessMethod(Class<?> interfce, Method method, Object[] args, Object proxy) throws Throwable {
-        CoreDeploymentInfo coreDeploymentInfo = (CoreDeploymentInfo) getDeploymentInfo();
+        BeanContext beanContext = getBeanContext();
         AtomicBoolean asynchronousCancelled = new AtomicBoolean(false);
         AsynchronousCall asynchronousCall = new AsynchronousCall(interfce, method, args, asynchronousCancelled);
         try {
-            Future<Object> retValue = coreDeploymentInfo.getModuleContext().getAppContext().submitTask(asynchronousCall);
-            return new FutureAdapter<Object>(retValue, asynchronousCancelled, coreDeploymentInfo.getModuleContext().getAppContext());
+            Future<Object> retValue = beanContext.getModuleContext().getAppContext().submitTask(asynchronousCall);
+            return new FutureAdapter<Object>(retValue, asynchronousCancelled, beanContext.getModuleContext().getAppContext());
         } catch (RejectedExecutionException e) {
             throw new EJBException("fail to allocate internal resource to execute the target task", e);
         }
@@ -250,15 +249,15 @@ public abstract class EjbObjectProxyHand
         return container.invoke(deploymentID, interfaceType, interfce, method, args, primaryKey);
     }
 
-    public static Object createProxy(DeploymentInfo deploymentInfo, Object primaryKey, InterfaceType interfaceType, Class mainInterface) {
-        return createProxy(deploymentInfo, primaryKey, interfaceType, null, mainInterface);
+    public static Object createProxy(BeanContext beanContext, Object primaryKey, InterfaceType interfaceType, Class mainInterface) {
+        return createProxy(beanContext, primaryKey, interfaceType, null, mainInterface);
     }
 
-    public static Object createProxy(DeploymentInfo deploymentInfo, Object primaryKey, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+    public static Object createProxy(BeanContext beanContext, Object primaryKey, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
         if (!interfaceType.isHome()){
             interfaceType = interfaceType.getCounterpart();
         }
-        EjbHomeProxyHandler homeHandler = EjbHomeProxyHandler.createHomeHandler(deploymentInfo, interfaceType, interfaces, mainInterface);
+        EjbHomeProxyHandler homeHandler = EjbHomeProxyHandler.createHomeHandler(beanContext, interfaceType, interfaces, mainInterface);
         return homeHandler.createProxy(primaryKey, mainInterface);
     }
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmMetaData.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmMetaData.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmMetaData.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmMetaData.java Tue Sep 14 07:43:38 2010
@@ -20,7 +20,6 @@ import java.io.ObjectStreamException;
 
 import javax.ejb.EJBHome;
 
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.BeanType;
 import org.apache.openejb.core.ServerFederation;
 import org.apache.openejb.spi.ApplicationServer;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmServer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmServer.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmServer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmServer.java Tue Sep 14 07:43:38 2010
@@ -22,13 +22,14 @@ import javax.ejb.EJBObject;
 import javax.ejb.Handle;
 import javax.ejb.HomeHandle;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.ProxyInfo;
 
 public class IntraVmServer implements org.apache.openejb.spi.ApplicationServer {
 
     public EJBMetaData getEJBMetaData(ProxyInfo pi) {
-        org.apache.openejb.DeploymentInfo di = pi.getDeploymentInfo();
-        IntraVmMetaData metaData = new IntraVmMetaData(di.getHomeInterface(), di.getRemoteInterface(), di.getComponentType());
+        BeanContext beanContext = pi.getBeanContext();
+        IntraVmMetaData metaData = new IntraVmMetaData(beanContext.getHomeInterface(), beanContext.getRemoteInterface(), beanContext.getComponentType());
 
         metaData.setEJBHome(getEJBHome(pi));
         return metaData;
@@ -43,15 +44,15 @@ public class IntraVmServer implements or
     }
 
     public EJBObject getEJBObject(ProxyInfo pi) {
-        return (EJBObject) EjbObjectProxyHandler.createProxy(pi.getDeploymentInfo(), pi.getPrimaryKey(), pi.getInterfaceType(), pi.getInterfaces(), pi.getInterface());
+        return (EJBObject) EjbObjectProxyHandler.createProxy(pi.getBeanContext(), pi.getPrimaryKey(), pi.getInterfaceType(), pi.getInterfaces(), pi.getInterface());
     }
 
     public Object getBusinessObject(ProxyInfo pi) {
-        return EjbObjectProxyHandler.createProxy(pi.getDeploymentInfo(), pi.getPrimaryKey(), pi.getInterfaceType(), pi.getInterfaces(), pi.getInterface());
+        return EjbObjectProxyHandler.createProxy(pi.getBeanContext(), pi.getPrimaryKey(), pi.getInterfaceType(), pi.getInterfaces(), pi.getInterface());
     }
 
     public EJBHome getEJBHome(ProxyInfo pi) {
-        return (EJBHome) EjbHomeProxyHandler.createHomeProxy(pi.getDeploymentInfo(), pi.getInterfaceType());
+        return (EJBHome) EjbHomeProxyHandler.createHomeProxy(pi.getBeanContext(), pi.getInterfaceType());
     }
 
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessLocalBeanReference.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessLocalBeanReference.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessLocalBeanReference.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessLocalBeanReference.java Tue Sep 14 07:43:38 2010
@@ -16,17 +16,16 @@
  */
 package org.apache.openejb.core.ivm.naming;
 
-import org.apache.openejb.DeploymentInfo;
-import org.apache.openejb.core.ivm.naming.Reference;
+import org.apache.openejb.BeanContext;
 
 /**
  * @version $Rev$ $Date$
  */
 public class BusinessLocalBeanReference extends Reference {
 
-    private final DeploymentInfo.BusinessLocalBeanHome businessHome;
+    private final BeanContext.BusinessLocalBeanHome businessHome;
 
-    public BusinessLocalBeanReference(DeploymentInfo.BusinessLocalBeanHome localBeanHome) {
+    public BusinessLocalBeanReference(BeanContext.BusinessLocalBeanHome localBeanHome) {
         this.businessHome = localBeanHome;
     }
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessLocalReference.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessLocalReference.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessLocalReference.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessLocalReference.java Tue Sep 14 07:43:38 2010
@@ -16,16 +16,16 @@
  */
 package org.apache.openejb.core.ivm.naming;
 
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
 
 /**
  * @version $Rev$ $Date$
  */
 public class BusinessLocalReference extends Reference {
 
-    private final DeploymentInfo.BusinessLocalHome businessHome;
+    private final BeanContext.BusinessLocalHome businessHome;
 
-    public BusinessLocalReference(DeploymentInfo.BusinessLocalHome businessHome) {
+    public BusinessLocalReference(BeanContext.BusinessLocalHome businessHome) {
         this.businessHome = businessHome;
     }
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessRemoteReference.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessRemoteReference.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessRemoteReference.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/BusinessRemoteReference.java Tue Sep 14 07:43:38 2010
@@ -16,16 +16,16 @@
  */
 package org.apache.openejb.core.ivm.naming;
 
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
 
 /**
  * @version $Rev$ $Date$
  */
 public class    BusinessRemoteReference extends Reference {
 
-    private final DeploymentInfo.BusinessRemoteHome businessHome;
+    private final BeanContext.BusinessRemoteHome businessHome;
 
-    public BusinessRemoteReference(DeploymentInfo.BusinessRemoteHome businessHome) {
+    public BusinessRemoteReference(BeanContext.BusinessRemoteHome businessHome) {
         this.businessHome = businessHome;
     }
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/JndiEncArtifact.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/JndiEncArtifact.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/JndiEncArtifact.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/JndiEncArtifact.java Tue Sep 14 07:43:38 2010
@@ -16,15 +16,15 @@
  */
 package org.apache.openejb.core.ivm.naming;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.core.ThreadContext;
-import org.apache.openejb.DeploymentInfo;
 /*
   This class is used as a replacement when a IvmContext referenced by a stateful bean 
   is being serialized for passivation along with the bean.  It ensures that the entire
   JNDI ENC graph is not serialized with the bean and returns a reference to the correct
   IvmContext when its deserialized.
 
-  Stateful beans are activated by a thread with the relavent DeploymentInfo object in the 
+  Stateful beans are activated by a thread with the relavent BeanContext object in the 
   ThreadContext which makes it possible to lookup the correct IvmContext and swap in place of 
   this object.
 */
@@ -42,7 +42,7 @@ public class JndiEncArtifact implements 
 
     public Object readResolve() throws java.io.ObjectStreamException {
         ThreadContext thrdCntx = ThreadContext.getThreadContext();
-        DeploymentInfo deployment = thrdCntx.getDeploymentInfo();
+        BeanContext deployment = thrdCntx.getBeanContext();
         javax.naming.Context cntx = deployment.getJndiEnc();
         try {
             Object obj = cntx.lookup(path);

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/java/javaURLContextFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/java/javaURLContextFactory.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/java/javaURLContextFactory.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/java/javaURLContextFactory.java Tue Sep 14 07:43:38 2010
@@ -23,10 +23,10 @@ import javax.naming.Name;
 import javax.naming.NamingException;
 import javax.naming.spi.ObjectFactory;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.spi.ContainerSystem;
 import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.DeploymentInfo;
 
 public class javaURLContextFactory implements ObjectFactory {
 
@@ -41,7 +41,7 @@ public class javaURLContextFactory imple
             return containerSystem.getJNDIContext();
         }
 
-        DeploymentInfo di = callContext.getDeploymentInfo();
+        BeanContext di = callContext.getBeanContext();
         if (di != null) {
             return di.getJndiEnc();
         } else {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/Instance.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/Instance.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/Instance.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/Instance.java Tue Sep 14 07:43:38 2010
@@ -28,7 +28,7 @@ import javax.persistence.EntityManagerFa
 import javax.persistence.EntityManager;
 import javax.transaction.Transaction;
 
-import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.core.transaction.BeanTransactionPolicy.SuspendedTransaction;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.ContainerSystem;
@@ -37,7 +37,7 @@ import org.apache.openejb.util.PojoSeria
 
 public class Instance implements Serializable {
     private static final long serialVersionUID = 2862563626506556542L;
-    public final CoreDeploymentInfo deploymentInfo;
+    public final BeanContext beanContext;
     public final Object primaryKey;
     public final Object bean;
     public final Map<String, Object> interceptors;
@@ -53,8 +53,8 @@ public class Instance implements Seriali
     private Map<EntityManagerFactory, EntityManager> entityManagers;
     private final EntityManager[] entityManagerArray;
 
-    public Instance(CoreDeploymentInfo deploymentInfo, Object primaryKey, Object bean, Map<String, Object> interceptors, Map<EntityManagerFactory, EntityManager> entityManagers) {
-        this.deploymentInfo = deploymentInfo;
+    public Instance(BeanContext beanContext, Object primaryKey, Object bean, Map<String, Object> interceptors, Map<EntityManagerFactory, EntityManager> entityManagers) {
+        this.beanContext = beanContext;
         this.primaryKey = primaryKey;
         this.bean = bean;
         this.interceptors = interceptors;
@@ -63,8 +63,8 @@ public class Instance implements Seriali
     }
 
     public Instance(Object deploymentId, Object primaryKey, Object bean, Map<String, Object> interceptors, EntityManager[] entityManagerArray) {
-        this.deploymentInfo = (CoreDeploymentInfo) SystemInstance.get().getComponent(ContainerSystem.class).getDeploymentInfo(deploymentId);
-        if (deploymentInfo == null) {
+        this.beanContext = SystemInstance.get().getComponent(ContainerSystem.class).getBeanContext(deploymentId);
+        if (beanContext == null) {
             throw new IllegalArgumentException("Unknown deployment " + deploymentId);
         }
         this.primaryKey = primaryKey;
@@ -141,7 +141,7 @@ public class Instance implements Seriali
         public final EntityManager[] entityManagerArray;
 
         public Serialization(Instance i) {
-            deploymentId = i.deploymentInfo.getDeploymentID();
+            deploymentId = i.beanContext.getDeploymentID();
             primaryKey = i.primaryKey;
             if (i.bean instanceof Serializable) {
                 bean = i.bean;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java Tue Sep 14 07:43:38 2010
@@ -43,8 +43,8 @@ import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.apache.openejb.ApplicationException;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.ContainerType;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.InterfaceType;
 import org.apache.openejb.InvalidateReferenceException;
 import org.apache.openejb.OpenEJBException;
@@ -54,7 +54,6 @@ import org.apache.openejb.SystemExceptio
 import org.apache.openejb.monitoring.StatsInterceptor;
 import org.apache.openejb.monitoring.ObjectNameBuilder;
 import org.apache.openejb.monitoring.ManagedMBean;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.ExceptionType;
 import static org.apache.openejb.core.ExceptionType.APPLICATION_ROLLBACK;
 import static org.apache.openejb.core.ExceptionType.SYSTEM;
@@ -96,7 +95,7 @@ public class ManagedContainer implements
     /**
      * 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>();
 
     protected final Cache<Object, Instance> cache;
     private final ConcurrentHashMap<Object, Instance> checkedOutInstances = new ConcurrentHashMap<Object, Instance>();
@@ -110,14 +109,14 @@ public class ManagedContainer implements
         sessionContext = new ManagedContext(securityService, new ManagedUserTransaction(new EjbUserTransaction(), entityManagerRegistry));
     }
 
-    private Map<Method, MethodType> getLifecycleMethodsOfInterface(CoreDeploymentInfo deploymentInfo) {
+    private Map<Method, MethodType> getLifecycleMethodsOfInterface(BeanContext beanContext) {
         Map<Method, MethodType> methods = new HashMap<Method, MethodType>();
 
-        List<Method> removeMethods = deploymentInfo.getRemoveMethods();
+        List<Method> removeMethods = beanContext.getRemoveMethods();
         for (Method removeMethod : removeMethods) {
             methods.put(removeMethod, MethodType.REMOVE);
 
-            for (Class businessLocal : deploymentInfo.getBusinessLocalInterfaces()) {
+            for (Class businessLocal : beanContext.getBusinessLocalInterfaces()) {
                 try {
                     Method method = businessLocal.getMethod(removeMethod.getName());
                     methods.put(method, MethodType.REMOVE);
@@ -125,7 +124,7 @@ public class ManagedContainer implements
                 }
             }
 
-            for (Class businessRemote : deploymentInfo.getBusinessRemoteInterfaces()) {
+            for (Class businessRemote : beanContext.getBusinessRemoteInterfaces()) {
                 try {
                     Method method = businessRemote.getMethod(removeMethod.getName());
                     methods.put(method, MethodType.REMOVE);
@@ -134,7 +133,7 @@ public class ManagedContainer implements
             }
         }
 
-        Class legacyRemote = deploymentInfo.getRemoteInterface();
+        Class legacyRemote = beanContext.getRemoteInterface();
         if (legacyRemote != null) {
             try {
                 Method method = legacyRemote.getMethod("remove");
@@ -143,7 +142,7 @@ public class ManagedContainer implements
             }
         }
 
-        Class legacyLocal = deploymentInfo.getLocalInterface();
+        Class legacyLocal = beanContext.getLocalInterface();
         if (legacyLocal != null) {
             try {
                 Method method = legacyLocal.getMethod("remove");
@@ -152,9 +151,9 @@ public class ManagedContainer implements
             }
         }
 
-        Class businessLocalHomeInterface = deploymentInfo.getBusinessLocalInterface();
+        Class businessLocalHomeInterface = beanContext.getBusinessLocalInterface();
         if (businessLocalHomeInterface != null) {
-            for (Method method : DeploymentInfo.BusinessLocalHome.class.getMethods()) {
+            for (Method method : BeanContext.BusinessLocalHome.class.getMethods()) {
                 if (method.getName().startsWith("create")) {
                     methods.put(method, MethodType.CREATE);
                 } else if (method.getName().equals("remove")) {
@@ -163,9 +162,9 @@ public class ManagedContainer implements
             }
         }
 
-        Class businessLocalBeanHomeInterface = deploymentInfo.getBusinessLocalBeanInterface();
+        Class businessLocalBeanHomeInterface = beanContext.getBusinessLocalBeanInterface();
         if (businessLocalBeanHomeInterface != null) {
-            for (Method method : DeploymentInfo.BusinessLocalBeanHome.class.getMethods()) {
+            for (Method method : BeanContext.BusinessLocalBeanHome.class.getMethods()) {
                 if (method.getName().startsWith("create")) {
                     methods.put(method, MethodType.CREATE);
                 } else if (method.getName().equals("remove")) {
@@ -174,9 +173,9 @@ public class ManagedContainer implements
             }
         }
 
-        Class businessRemoteHomeInterface = deploymentInfo.getBusinessRemoteInterface();
+        Class businessRemoteHomeInterface = beanContext.getBusinessRemoteInterface();
         if (businessRemoteHomeInterface != null) {
-            for (Method method : DeploymentInfo.BusinessRemoteHome.class.getMethods()) {
+            for (Method method : BeanContext.BusinessRemoteHome.class.getMethods()) {
                 if (method.getName().startsWith("create")) {
                     methods.put(method, MethodType.CREATE);
                 } else if (method.getName().equals("remove")) {
@@ -185,7 +184,7 @@ public class ManagedContainer implements
             }
         }
 
-        Class homeInterface = deploymentInfo.getHomeInterface();
+        Class homeInterface = beanContext.getHomeInterface();
         if (homeInterface != null) {
             for (Method method : homeInterface.getMethods()) {
                 if (method.getName().startsWith("create")) {
@@ -196,7 +195,7 @@ public class ManagedContainer implements
             }
         }
 
-        Class localHomeInterface = deploymentInfo.getLocalHomeInterface();
+        Class localHomeInterface = beanContext.getLocalHomeInterface();
         if (localHomeInterface != null) {
             for (Method method : localHomeInterface.getMethods()) {
                 if (method.getName().startsWith("create")) {
@@ -221,30 +220,22 @@ public class ManagedContainer implements
         return containerID;
     }
 
-    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);
     }
 
-    public void deploy(DeploymentInfo deploymentInfo) throws OpenEJBException {
-        deploy((CoreDeploymentInfo) deploymentInfo);
-    }
-
-    public void start(DeploymentInfo deploymentInfo) throws OpenEJBException {        
-    }
-    
-    public void stop(DeploymentInfo deploymentInfo) throws OpenEJBException {        
+    public void start(BeanContext beanContext) throws OpenEJBException {
     }
     
-    public void undeploy(DeploymentInfo deploymentInfo) throws OpenEJBException {
-        undeploy((CoreDeploymentInfo) deploymentInfo);
+    public void stop(BeanContext beanContext) throws OpenEJBException {
     }
 
-    private synchronized void undeploy(final CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
-        Data data = (Data) deploymentInfo.getContainerData();
+    public synchronized void undeploy(final BeanContext bean) throws OpenEJBException {
+        Data data = (Data) bean.getContainerData();
 
         MBeanServer server = ManagementFactory.getPlatformMBeanServer();
         for (ObjectName objectName : data.jmxNames) {
@@ -255,38 +246,38 @@ public class ManagedContainer implements
             }
         }
 
-        deploymentsById.remove(deploymentInfo.getDeploymentID());
-        deploymentInfo.setContainer(null);
-        deploymentInfo.setContainerData(null);
+        deploymentsById.remove(bean.getDeploymentID());
+        bean.setContainer(null);
+        bean.setContainerData(null);
 
         cache.removeAll(new CacheFilter<Instance>() {
             public boolean matches(Instance instance) {
-                return deploymentInfo == instance.deploymentInfo;
+                return bean == instance.beanContext;
             }
         });
     }
 
-    private synchronized void deploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
-        Map<Method, MethodType> methods = getLifecycleMethodsOfInterface(deploymentInfo);
+    public synchronized void deploy(BeanContext beanContext) throws OpenEJBException {
+        Map<Method, MethodType> methods = getLifecycleMethodsOfInterface(beanContext);
 
-        deploymentsById.put(deploymentInfo.getDeploymentID(), deploymentInfo);
-        deploymentInfo.setContainer(this);
+        deploymentsById.put(beanContext.getDeploymentID(), beanContext);
+        beanContext.setContainer(this);
         Data data = new Data(new Index<Method, MethodType>(methods));
-        deploymentInfo.setContainerData(data);
+        beanContext.setContainerData(data);
 
         // Create stats interceptor
-        StatsInterceptor stats = new StatsInterceptor(deploymentInfo.getBeanClass());
-        deploymentInfo.addSystemInterceptor(stats);
+        StatsInterceptor stats = new StatsInterceptor(beanContext.getBeanClass());
+        beanContext.addSystemInterceptor(stats);
 
         MBeanServer server = ManagementFactory.getPlatformMBeanServer();
 
         ObjectNameBuilder jmxName = new ObjectNameBuilder("openejb.management");
         jmxName.set("J2EEServer", "openejb");
         jmxName.set("J2EEApplication", null);
-        jmxName.set("EJBModule", deploymentInfo.getModuleID());
-        jmxName.set("StatelessSessionBean", deploymentInfo.getEjbName());
+        jmxName.set("EJBModule", beanContext.getModuleID());
+        jmxName.set("StatelessSessionBean", beanContext.getEjbName());
         jmxName.set("j2eeType", "");
-        jmxName.set("name", deploymentInfo.getEjbName());
+        jmxName.set("name", beanContext.getEjbName());
 
         // register the invocation stats interceptor
         try {
@@ -298,13 +289,13 @@ public class ManagedContainer implements
         }
 
         try {
-            final Context context = deploymentInfo.getJndiEnc();
+            final Context context = beanContext.getJndiEnc();
             context.bind("comp/EJBContext", sessionContext);
         } catch (NamingException e) {
             throw new OpenEJBException("Failed to bind EJBContext", e);
         }
 
-        deploymentInfo.set(EJBContext.class, this.sessionContext);
+        beanContext.set(EJBContext.class, this.sessionContext);
     }
 
     /**
@@ -319,45 +310,45 @@ public class ManagedContainer 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);
 
-        Data data = (Data) deployInfo.getContainerData();
+        Data data = (Data) beanContext.getContainerData();
         MethodType methodType = data.getMethodIndex().get(callMethod);
         methodType = (methodType != null) ? methodType : MethodType.BUSINESS;
 
         switch (methodType) {
             case CREATE:
-                return createEJBObject(deployInfo, callMethod, args, type);
+                return createEJBObject(beanContext, callMethod, args, type);
             case REMOVE:
-                return removeEJBObject(deployInfo, primKey, callInterface, callMethod, args, type);
+                return removeEJBObject(beanContext, primKey, callInterface, callMethod, args, type);
             default:
-                return businessMethod(deployInfo, primKey, callInterface, callMethod, args, type);
+                return businessMethod(beanContext, primKey, callInterface, callMethod, args, type);
         }
     }
 
-    protected ProxyInfo createEJBObject(CoreDeploymentInfo deploymentInfo, Method callMethod, Object[] args, InterfaceType interfaceType) throws OpenEJBException {
+    protected ProxyInfo createEJBObject(BeanContext beanContext, Method callMethod, Object[] args, InterfaceType interfaceType) throws OpenEJBException {
         // generate a new primary key
         Object primaryKey = newPrimaryKey();
 
 
-        ThreadContext createContext = new ThreadContext(deploymentInfo, primaryKey);
+        ThreadContext createContext = new ThreadContext(beanContext, primaryKey);
         ThreadContext oldCallContext = ThreadContext.enter(createContext);
         try {
             // Security check
             checkAuthorization(callMethod, interfaceType);
 
             // Create the extended entity managers for this instance
-            Index<EntityManagerFactory, EntityManager> entityManagers = createEntityManagers(deploymentInfo);
+            Index<EntityManagerFactory, EntityManager> entityManagers = createEntityManagers(beanContext);
 
             // Register the newly created entity managers
             if (entityManagers != null) {
                 try {
-                    entityManagerRegistry.addEntityManagers((String) deploymentInfo.getDeploymentID(), primaryKey, entityManagers);
+                    entityManagerRegistry.addEntityManagers((String) beanContext.getDeploymentID(), primaryKey, entityManagers);
                 } catch (EntityManagerAlreadyRegisteredException e) {
                     throw new EJBException(e);
                 }
@@ -367,17 +358,17 @@ public class ManagedContainer implements
             createContext.setCurrentAllowedStates(null);
 
             // Start transaction
-            TransactionPolicy txPolicy = createTransactionPolicy(createContext.getDeploymentInfo().getTransactionType(callMethod), createContext);
+            TransactionPolicy txPolicy = createTransactionPolicy(createContext.getBeanContext().getTransactionType(callMethod), createContext);
 
             Instance instance = null;
             try {
                 // Create new instance
 
                 try {
-                    final InstanceContext context = deploymentInfo.newInstance();
+                    final InstanceContext context = beanContext.newInstance();
 
                     // Wrap-up everthing into a object
-                    instance = new Instance(deploymentInfo, primaryKey, context.getBean(), context.getInterceptors(), entityManagers);
+                    instance = new Instance(beanContext, primaryKey, context.getBean(), context.getInterceptors(), entityManagers);
 
                 } catch (Throwable throwable) {
                     ThreadContext callContext = ThreadContext.getThreadContext();
@@ -395,12 +386,12 @@ public class ManagedContainer implements
                 registerSessionSynchronization(instance, createContext);
 
                 // Invoke create for legacy beans
-                if (!callMethod.getDeclaringClass().equals(DeploymentInfo.BusinessLocalHome.class) &&
-                        !callMethod.getDeclaringClass().equals(DeploymentInfo.BusinessRemoteHome.class) &&
-                        !callMethod.getDeclaringClass().equals(DeploymentInfo.BusinessLocalBeanHome.class)) {
+                if (!callMethod.getDeclaringClass().equals(BeanContext.BusinessLocalHome.class) &&
+                        !callMethod.getDeclaringClass().equals(BeanContext.BusinessRemoteHome.class) &&
+                        !callMethod.getDeclaringClass().equals(BeanContext.BusinessLocalBeanHome.class)) {
 
                     // Setup for business invocation
-                    Method createOrInit = deploymentInfo.getMatchingBeanMethod(callMethod);
+                    Method createOrInit = beanContext.getMatchingBeanMethod(callMethod);
                     createContext.set(Method.class, createOrInit);
 
                     // Initialize interceptor stack
@@ -419,7 +410,7 @@ public class ManagedContainer implements
                 afterInvoke(createContext, txPolicy, instance);
             }
 
-            return new ProxyInfo(deploymentInfo, primaryKey);
+            return new ProxyInfo(beanContext, primaryKey);
         } finally {
             ThreadContext.exit(oldCallContext);
         }
@@ -429,10 +420,10 @@ public class ManagedContainer implements
         return new VMID();
     }
 
-    protected Object removeEJBObject(CoreDeploymentInfo deploymentInfo, Object primKey, Class callInterface, Method callMethod, Object[] args, InterfaceType interfaceType) throws OpenEJBException {
+    protected Object removeEJBObject(BeanContext beanContext, Object primKey, Class callInterface, Method callMethod, Object[] args, InterfaceType interfaceType) throws OpenEJBException {
         if (primKey == null) throw new NullPointerException("primKey is null");
 
-        ThreadContext callContext = new ThreadContext(deploymentInfo, primKey);
+        ThreadContext callContext = new ThreadContext(beanContext, primKey);
         ThreadContext oldCallContext = ThreadContext.enter(callContext);
         try {
             // Security check
@@ -457,7 +448,7 @@ public class ManagedContainer implements
             }
 
             // Start transaction
-            TransactionPolicy txPolicy = createTransactionPolicy(callContext.getDeploymentInfo().getTransactionType(callMethod), callContext);
+            TransactionPolicy txPolicy = createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod), callContext);
 
             Object returnValue = null;
             boolean retain = false;
@@ -488,7 +479,7 @@ public class ManagedContainer implements
                 callContext.setCurrentOperation(Operation.REMOVE);
                 callContext.setCurrentAllowedStates(null);
                 callContext.setInvokedInterface(callInterface);
-                runMethod = deploymentInfo.getMatchingBeanMethod(callMethod);
+                runMethod = beanContext.getMatchingBeanMethod(callMethod);
                 callContext.set(Method.class, runMethod);
 
                 // Do not pass arguments on home.remove(remote) calls
@@ -498,7 +489,7 @@ public class ManagedContainer implements
                 }
                 
                 // Initialize interceptor stack
-                List<InterceptorData> interceptors = deploymentInfo.getMethodInterceptors(runMethod);
+                List<InterceptorData> interceptors = beanContext.getMethodInterceptors(runMethod);
                 InterceptorStack interceptorStack = new InterceptorStack(instance.bean, runMethod, Operation.REMOVE, interceptors, instance.interceptors);
 
                 // Invoke
@@ -511,7 +502,7 @@ public class ManagedContainer implements
                 throw e;
             } catch (Throwable e) {
                 if (interfaceType.isBusiness()) {
-                    retain = deploymentInfo.retainIfExeption(runMethod);
+                    retain = beanContext.retainIfExeption(runMethod);
                     handleException(callContext, txPolicy, e);
                 } else {
                     try {
@@ -524,7 +515,7 @@ public class ManagedContainer implements
                 if (!retain) {
                     try {
                         callContext.setCurrentOperation(Operation.PRE_DESTROY);
-                        List<InterceptorData> callbackInterceptors = deploymentInfo.getCallbackInterceptors();
+                        List<InterceptorData> callbackInterceptors = beanContext.getCallbackInterceptors();
                         InterceptorStack interceptorStack = new InterceptorStack(instance.bean, null, Operation.PRE_DESTROY, callbackInterceptors, instance.interceptors);
                         interceptorStack.invoke();
                     } catch (Throwable callbackException) {
@@ -551,15 +542,15 @@ public class ManagedContainer implements
         }
     }
 
-    protected Object businessMethod(CoreDeploymentInfo deploymentInfo, Object primKey, Class callInterface, Method callMethod, Object[] args, InterfaceType interfaceType) throws OpenEJBException {
-        ThreadContext callContext = new ThreadContext(deploymentInfo, primKey);
+    protected Object businessMethod(BeanContext beanContext, Object primKey, Class callInterface, Method callMethod, Object[] args, InterfaceType interfaceType) throws OpenEJBException {
+        ThreadContext callContext = new ThreadContext(beanContext, primKey);
         ThreadContext oldCallContext = ThreadContext.enter(callContext);
         try {
             // Security check
             checkAuthorization(callMethod, interfaceType);
 
             // Start transaction
-            TransactionPolicy txPolicy = createTransactionPolicy(callContext.getDeploymentInfo().getTransactionType(callMethod), callContext);
+            TransactionPolicy txPolicy = createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod), callContext);
 
             Object returnValue = null;
             Instance instance = null;
@@ -586,11 +577,11 @@ public class ManagedContainer implements
                 callContext.setCurrentOperation(Operation.BUSINESS);
                 callContext.setCurrentAllowedStates(null);
                 callContext.setInvokedInterface(callInterface);
-                Method runMethod = deploymentInfo.getMatchingBeanMethod(callMethod);
+                Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
                 callContext.set(Method.class, runMethod);
 
                 // Initialize interceptor stack
-                List<InterceptorData> interceptors = deploymentInfo.getMethodInterceptors(runMethod);
+                List<InterceptorData> interceptors = beanContext.getMethodInterceptors(runMethod);
                 InterceptorStack interceptorStack = new InterceptorStack(instance.bean, runMethod, Operation.BUSINESS, interceptors, instance.interceptors);
 
                 // Invoke
@@ -674,7 +665,7 @@ public class ManagedContainer implements
 
     private void releaseInstance(Instance instance) {
         // Don't pool if the bean has been undeployed
-        if (instance.deploymentInfo.isDestroyed()) return;
+        if (instance.beanContext.isDestroyed()) return;
 
         // verify the instance is not associated with a bean-managed transaction
         if (instance.getBeanTransaction() != null) {
@@ -715,7 +706,7 @@ public class ManagedContainer implements
             throw (ApplicationException) e;
         }
 
-        ExceptionType type = callContext.getDeploymentInfo().getExceptionType(e);
+        ExceptionType type = callContext.getBeanContext().getExceptionType(e);
         if (type == SYSTEM) {
             discardInstance(callContext);
             handleSystemException(txPolicy, e, callContext);
@@ -747,9 +738,9 @@ public class ManagedContainer implements
         }
     }
 
-    private Index<EntityManagerFactory, EntityManager> createEntityManagers(CoreDeploymentInfo deploymentInfo) {
+    private Index<EntityManagerFactory, EntityManager> createEntityManagers(BeanContext beanContext) {
         // create the extended entity managers
-        Index<EntityManagerFactory, Map> factories = deploymentInfo.getExtendedEntityManagerFactories();
+        Index<EntityManagerFactory, Map> factories = beanContext.getExtendedEntityManagerFactories();
         Index<EntityManagerFactory, EntityManager> entityManagers = null;
         if (factories != null && factories.size() > 0) {
             entityManagers = new Index<EntityManagerFactory, EntityManager>(new ArrayList<EntityManagerFactory>(factories.keySet()));
@@ -775,10 +766,10 @@ public class ManagedContainer implements
     private void registerEntityManagers(Instance instance, ThreadContext callContext) throws OpenEJBException {
         if (entityManagerRegistry == null) return;
 
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
 
         // get the factories
-        Index<EntityManagerFactory, Map> factories = deploymentInfo.getExtendedEntityManagerFactories();
+        Index<EntityManagerFactory, Map> factories = beanContext.getExtendedEntityManagerFactories();
         if (factories == null) return;
 
         // get the managers for the factories
@@ -787,7 +778,7 @@ public class ManagedContainer implements
 
         // register them
         try {
-            entityManagerRegistry.addEntityManagers((String) deploymentInfo.getDeploymentID(), instance.primaryKey, entityManagers);
+            entityManagerRegistry.addEntityManagers((String) beanContext.getDeploymentID(), instance.primaryKey, entityManagers);
         } catch (EntityManagerAlreadyRegisteredException e) {
             throw new EJBException(e);
         }
@@ -797,10 +788,10 @@ public class ManagedContainer implements
         if (entityManagerRegistry == null) return;
         if (instance == null) return;
 
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
 
         // register them
-        entityManagerRegistry.removeEntityManagers((String) deploymentInfo.getDeploymentID(), instance.primaryKey);
+        entityManagerRegistry.removeEntityManagers((String) beanContext.getDeploymentID(), instance.primaryKey);
     }
 
 
@@ -819,10 +810,10 @@ public class ManagedContainer implements
 
         // SessionSynchronization are only enabled for beans after CREATE that are not bean-managed and implement the SessionSynchronization interface
         boolean synchronize = callContext.getCurrentOperation() != Operation.CREATE &&
-                callContext.getDeploymentInfo().isSessionSynchronized() &&
+                callContext.getBeanContext().isSessionSynchronized() &&
                 txPolicy.isTransactionActive();
 
-        coordinator.registerSessionSynchronization(instance, callContext.getDeploymentInfo(), callContext.getPrimaryKey(), synchronize);
+        coordinator.registerSessionSynchronization(instance, callContext.getBeanContext(), callContext.getPrimaryKey(), synchronize);
     }
 
     /**
@@ -859,7 +850,7 @@ public class ManagedContainer implements
 
         }
 
-        private void registerSessionSynchronization(Instance instance, CoreDeploymentInfo deploymentInfo, Object primaryKey, boolean synchronize) {
+        private void registerSessionSynchronization(Instance instance, BeanContext beanContext, Object primaryKey, boolean synchronize) {
 
             Synchronization synchronization = registry.get(primaryKey);
 
@@ -876,12 +867,12 @@ public class ManagedContainer implements
             }
 
             // Invoke afterBegin
-            ThreadContext callContext = new ThreadContext(instance.deploymentInfo, instance.primaryKey, Operation.AFTER_BEGIN);
+            ThreadContext callContext = new ThreadContext(instance.beanContext, instance.primaryKey, Operation.AFTER_BEGIN);
             callContext.setCurrentAllowedStates(null);
             ThreadContext oldCallContext = ThreadContext.enter(callContext);
             try {
 
-                List<InterceptorData> interceptors = deploymentInfo.getCallbackInterceptors();
+                List<InterceptorData> interceptors = beanContext.getCallbackInterceptors();
                 InterceptorStack interceptorStack = new InterceptorStack(instance.bean, null, Operation.AFTER_BEGIN, interceptors, instance.interceptors);
                 interceptorStack.invoke();
 
@@ -912,14 +903,14 @@ public class ManagedContainer implements
                 if (!synchronization.isCallSessionSynchronization()) continue;
 
                 // Invoke beforeCompletion
-                ThreadContext callContext = new ThreadContext(instance.deploymentInfo, instance.primaryKey, Operation.BEFORE_COMPLETION);
+                ThreadContext callContext = new ThreadContext(instance.beanContext, instance.primaryKey, Operation.BEFORE_COMPLETION);
                 callContext.setCurrentAllowedStates(null);
                 ThreadContext oldCallContext = ThreadContext.enter(callContext);
                 try {
                     instance.setInUse(true);
 
-                    CoreDeploymentInfo deploymentInfo = instance.deploymentInfo;
-                    List<InterceptorData> interceptors = deploymentInfo.getCallbackInterceptors();
+                    BeanContext beanContext = instance.beanContext;
+                    List<InterceptorData> interceptors = beanContext.getCallbackInterceptors();
                     InterceptorStack interceptorStack = new InterceptorStack(instance.bean, null, Operation.BEFORE_COMPLETION, interceptors, instance.interceptors);
                     interceptorStack.invoke();
 
@@ -952,15 +943,15 @@ public class ManagedContainer implements
 
                 Instance instance = synchronization.instance;
 
-                ThreadContext callContext = new ThreadContext(instance.deploymentInfo, instance.primaryKey, Operation.AFTER_COMPLETION);
+                ThreadContext callContext = new ThreadContext(instance.beanContext, instance.primaryKey, Operation.AFTER_COMPLETION);
                 callContext.setCurrentAllowedStates(null);
                 ThreadContext oldCallContext = ThreadContext.enter(callContext);
                 try {
                     instance.setInUse(true);
                     if (synchronization.isCallSessionSynchronization()) {
 
-                        CoreDeploymentInfo deploymentInfo = instance.deploymentInfo;
-                        List<InterceptorData> interceptors = deploymentInfo.getCallbackInterceptors();
+                        BeanContext beanContext = instance.beanContext;
+                        List<InterceptorData> interceptors = beanContext.getCallbackInterceptors();
                         InterceptorStack interceptorStack = new InterceptorStack(instance.bean, null, Operation.AFTER_COMPLETION, interceptors, instance.interceptors);
                         interceptorStack.invoke(status == Status.COMMITTED);
                     }
@@ -994,14 +985,14 @@ public class ManagedContainer implements
 
     public class StatefulCacheListener implements CacheListener<Instance> {
         public void afterLoad(Instance instance) throws SystemException, ApplicationException {
-            CoreDeploymentInfo deploymentInfo = instance.deploymentInfo;
+            BeanContext beanContext = instance.beanContext;
 
-            ThreadContext threadContext = new ThreadContext(instance.deploymentInfo, instance.primaryKey, Operation.ACTIVATE);
+            ThreadContext threadContext = new ThreadContext(instance.beanContext, instance.primaryKey, Operation.ACTIVATE);
             ThreadContext oldContext = ThreadContext.enter(threadContext);
             try {
                 Method remove = instance.bean instanceof SessionBean ? SessionBean.class.getMethod("ejbActivate") : null;
 
-                List<InterceptorData> callbackInterceptors = deploymentInfo.getCallbackInterceptors();
+                List<InterceptorData> callbackInterceptors = beanContext.getCallbackInterceptors();
                 InterceptorStack interceptorStack = new InterceptorStack(instance.bean, remove, Operation.ACTIVATE, callbackInterceptors, instance.interceptors);
 
                 interceptorStack.invoke();
@@ -1014,14 +1005,14 @@ public class ManagedContainer implements
         }
 
         public void beforeStore(Instance instance) {
-            CoreDeploymentInfo deploymentInfo = instance.deploymentInfo;
+            BeanContext beanContext = instance.beanContext;
 
-            ThreadContext threadContext = new ThreadContext(deploymentInfo, instance.primaryKey, Operation.PASSIVATE);
+            ThreadContext threadContext = new ThreadContext(beanContext, instance.primaryKey, Operation.PASSIVATE);
             ThreadContext oldContext = ThreadContext.enter(threadContext);
             try {
                 Method passivate = instance.bean instanceof SessionBean ? SessionBean.class.getMethod("ejbPassivate") : null;
 
-                List<InterceptorData> callbackInterceptors = deploymentInfo.getCallbackInterceptors();
+                List<InterceptorData> callbackInterceptors = beanContext.getCallbackInterceptors();
                 InterceptorStack interceptorStack = new InterceptorStack(instance.bean, passivate, Operation.PASSIVATE, callbackInterceptors, instance.interceptors);
 
                 interceptorStack.invoke();
@@ -1034,15 +1025,15 @@ public class ManagedContainer implements
         }
 
         public void timedOut(Instance instance) {
-            CoreDeploymentInfo deploymentInfo = instance.deploymentInfo;
+            BeanContext beanContext = instance.beanContext;
 
-            ThreadContext threadContext = new ThreadContext(deploymentInfo, instance.primaryKey, Operation.PRE_DESTROY);
+            ThreadContext threadContext = new ThreadContext(beanContext, instance.primaryKey, Operation.PRE_DESTROY);
             threadContext.setCurrentAllowedStates(null);
             ThreadContext oldContext = ThreadContext.enter(threadContext);
             try {
                 Method remove = instance.bean instanceof SessionBean ? SessionBean.class.getMethod("ejbRemove") : null;
 
-                List<InterceptorData> callbackInterceptors = deploymentInfo.getCallbackInterceptors();
+                List<InterceptorData> callbackInterceptors = beanContext.getCallbackInterceptors();
                 InterceptorStack interceptorStack = new InterceptorStack(instance.bean, remove, Operation.PRE_DESTROY, callbackInterceptors, instance.interceptors);
 
                 interceptorStack.invoke();

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedHomeHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedHomeHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedHomeHandler.java Tue Sep 14 07:43:38 2010
@@ -22,16 +22,16 @@ import java.util.List;
 
 import javax.ejb.RemoveException;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.InterfaceType;
-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;
 
 public class ManagedHomeHandler extends EjbHomeProxyHandler {
 
-    public ManagedHomeHandler(DeploymentInfo deploymentInfo, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        super(deploymentInfo, interfaceType, interfaces, mainInterface);
+    public ManagedHomeHandler(BeanContext beanContext, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        super(beanContext, interfaceType, interfaces, mainInterface);
     }
 
     public Object createProxy(Object primaryKey, Class mainInterface) {
@@ -62,8 +62,8 @@ public class ManagedHomeHandler extends 
         throw new RemoveException("Session objects are private resources and do not have primary keys");
     }
 
-    protected EjbObjectProxyHandler newEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        return new ManagedObjectHandler(getDeploymentInfo(), pk, interfaceType, interfaces, mainInterface);
+    protected EjbObjectProxyHandler newEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        return new ManagedObjectHandler(getBeanContext(), pk, interfaceType, interfaces, mainInterface);
     }
 
 }

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