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 [5/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/managed/ManagedUserTransaction.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedUserTransaction.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedUserTransaction.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedUserTransaction.java Tue Sep 14 07:43:38 2010
@@ -26,9 +26,8 @@ import javax.transaction.RollbackExcepti
 
 import org.apache.openejb.persistence.JtaEntityManagerRegistry;
 import org.apache.openejb.core.ThreadContext;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.BeanType;
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
 
 public class ManagedUserTransaction implements UserTransaction {
     private final UserTransaction userTransaction;
@@ -50,8 +49,8 @@ public class ManagedUserTransaction impl
         }
 
         // get the deployment info
-        DeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
-        if (deploymentInfo.getComponentType() != BeanType.MANAGED) {
+        BeanContext beanContext = callContext.getBeanContext();
+        if (beanContext.getComponentType() != BeanType.MANAGED) {
             // some other non-stateful ejb is using our user transaction
             return;
         }
@@ -62,7 +61,7 @@ public class ManagedUserTransaction impl
             // is is not a bean method
             return;
         }
-        jtaEntityManagerRegistry.transactionStarted((String)deploymentInfo.getDeploymentID(), primaryKey);
+        jtaEntityManagerRegistry.transactionStarted((String) beanContext.getDeploymentID(), primaryKey);
     }
 
     public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java Tue Sep 14 07:43:38 2010
@@ -17,8 +17,8 @@
  */
 package org.apache.openejb.core.mdb;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.resource.XAResourceWrapper;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.transaction.TransactionType;
 
 import javax.resource.spi.UnavailableException;
@@ -35,17 +35,17 @@ import java.util.List;
 public class EndpointFactory implements MessageEndpointFactory {
     private final ActivationSpec activationSpec;
     private final MdbContainer container;
-    private final CoreDeploymentInfo deploymentInfo;
+    private final BeanContext beanContext;
     private final MdbInstanceFactory instanceFactory;
     private final ClassLoader classLoader;
     private final Class[] interfaces;
     private final XAResourceWrapper xaResourceWrapper;
     protected final List<ObjectName> jmxNames = new ArrayList<ObjectName>();
     
-    public EndpointFactory(ActivationSpec activationSpec, MdbContainer container, CoreDeploymentInfo deploymentInfo, MdbInstanceFactory instanceFactory, XAResourceWrapper xaResourceWrapper) {
+    public EndpointFactory(ActivationSpec activationSpec, MdbContainer container, BeanContext beanContext, MdbInstanceFactory instanceFactory, XAResourceWrapper xaResourceWrapper) {
         this.activationSpec = activationSpec;
         this.container = container;
-        this.deploymentInfo = deploymentInfo;
+        this.beanContext = beanContext;
         this.instanceFactory = instanceFactory;
         classLoader = container.getMessageListenerInterface().getClassLoader();
         interfaces = new Class[]{container.getMessageListenerInterface(), MessageEndpoint.class};
@@ -64,7 +64,7 @@ public class EndpointFactory implements 
         if (xaResource != null && xaResourceWrapper != null) {
             xaResource = xaResourceWrapper.wrap(xaResource, container.getContainerID().toString());
         }
-        EndpointHandler endpointHandler = new EndpointHandler(container, deploymentInfo, instanceFactory, xaResource);
+        EndpointHandler endpointHandler = new EndpointHandler(container, beanContext, instanceFactory, xaResource);
         MessageEndpoint messageEndpoint = (MessageEndpoint) Proxy.newProxyInstance(classLoader, interfaces, endpointHandler);
         return messageEndpoint;
     }
@@ -94,7 +94,7 @@ public class EndpointFactory implements 
     }
 
     public boolean isDeliveryTransacted(Method method) throws NoSuchMethodException {
-        TransactionType transactionType = deploymentInfo.getTransactionType(method);
+        TransactionType transactionType = beanContext.getTransactionType(method);
         return TransactionType.Required == transactionType;
     }
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointHandler.java Tue Sep 14 07:43:38 2010
@@ -19,8 +19,7 @@ package org.apache.openejb.core.mdb;
 
 import org.apache.openejb.ApplicationException;
 import org.apache.openejb.SystemException;
-import org.apache.openejb.core.CoreDeploymentInfo;
-import org.apache.openejb.core.mdb.Instance;
+import org.apache.openejb.BeanContext;
 
 import javax.ejb.EJBException;
 import javax.resource.spi.ApplicationServerInternalException;
@@ -64,14 +63,14 @@ public class EndpointHandler implements 
     }
 
     private final MdbContainer container;
-    private final CoreDeploymentInfo deployment;
+    private final BeanContext deployment;
     private final MdbInstanceFactory instanceFactory;
     private final XAResource xaResource;
 
     private State state = State.NONE;
     private Object instance;
 
-    public EndpointHandler(MdbContainer container, CoreDeploymentInfo deployment, MdbInstanceFactory instanceFactory, XAResource xaResource) throws UnavailableException {
+    public EndpointHandler(MdbContainer container, BeanContext deployment, MdbInstanceFactory instanceFactory, XAResource xaResource) throws UnavailableException {
         this.container = container;
         this.deployment = deployment;
         this.instanceFactory = instanceFactory;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java Tue Sep 14 07:43:38 2010
@@ -17,8 +17,8 @@
  */
 package org.apache.openejb.core.mdb;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.OpenEJBException;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.SystemException;
 import org.apache.openejb.ApplicationException;
 import org.apache.openejb.ContainerType;
@@ -30,8 +30,6 @@ import org.apache.openejb.monitoring.Man
 import org.apache.openejb.resource.XAResourceWrapper;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.loader.Options;
-import org.apache.openejb.core.BaseContext;
-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,7 +77,7 @@ public class MdbContainer implements Rpc
     private final Class activationSpecClass;
     private final int instanceLimit;
 
-    private final ConcurrentMap<Object, CoreDeploymentInfo> deployments = new ConcurrentHashMap<Object, CoreDeploymentInfo>();
+    private final ConcurrentMap<Object, BeanContext> deployments = new ConcurrentHashMap<Object, BeanContext>();
     private final XAResourceWrapper xaResourceWrapper;
     private final InboundRecovery inboundRecovery;
 
@@ -94,11 +92,11 @@ public class MdbContainer implements Rpc
         inboundRecovery = SystemInstance.get().getComponent(InboundRecovery.class);
     }
 
-    public DeploymentInfo [] deployments() {
-        return deployments.values().toArray(new DeploymentInfo[deployments.size()]);
+    public BeanContext[] getBeanContexts() {
+        return deployments.values().toArray(new BeanContext[deployments.size()]);
     }
 
-    public DeploymentInfo getDeploymentInfo(Object deploymentID) {
+    public BeanContext getBeanContext(Object deploymentID) {
         return deployments.get(deploymentID);
     }
 
@@ -122,47 +120,46 @@ public class MdbContainer implements Rpc
         return activationSpecClass;
     }
 
-    public void deploy(DeploymentInfo info) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) info;
-        Object deploymentId = deploymentInfo.getDeploymentID();
-        if (!deploymentInfo.getMdbInterface().equals(messageListenerInterface)) {
+    public void deploy(BeanContext beanContext) throws OpenEJBException {
+        Object deploymentId = beanContext.getDeploymentID();
+        if (!beanContext.getMdbInterface().equals(messageListenerInterface)) {
             throw new OpenEJBException("Deployment '" + deploymentId + "' has message listener interface " +
-                    deploymentInfo.getMdbInterface().getName() + " but this MDB container only supports " +
+                    beanContext.getMdbInterface().getName() + " but this MDB container only supports " +
                     messageListenerInterface);
         }
 
         // create the activation spec
-        ActivationSpec activationSpec = createActivationSpec(deploymentInfo);
+        ActivationSpec activationSpec = createActivationSpec(beanContext);
 
         if (inboundRecovery != null) {
             inboundRecovery.recover(resourceAdapter, activationSpec, containerID.toString());
         }
         
-        Options options = new Options(deploymentInfo.getProperties());
+        Options options = new Options(beanContext.getProperties());
         int instanceLimit = options.get("InstanceLimit", this.instanceLimit);
         // create the message endpoint
-        MdbInstanceFactory instanceFactory = new MdbInstanceFactory(deploymentInfo, securityService, instanceLimit);
-        EndpointFactory endpointFactory = new EndpointFactory(activationSpec, this, deploymentInfo, instanceFactory, xaResourceWrapper);
+        MdbInstanceFactory instanceFactory = new MdbInstanceFactory(beanContext, securityService, instanceLimit);
+        EndpointFactory endpointFactory = new EndpointFactory(activationSpec, this, beanContext, instanceFactory, xaResourceWrapper);
 
         // update the data structures
         // this must be done before activating the endpoint since the ra may immedately begin delivering messages
-        deploymentInfo.setContainer(this);
-        deploymentInfo.setContainerData(endpointFactory);
-        deployments.put(deploymentId, deploymentInfo);
+        beanContext.setContainer(this);
+        beanContext.setContainerData(endpointFactory);
+        deployments.put(deploymentId, beanContext);
 
         // 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 {
@@ -178,28 +175,28 @@ public class MdbContainer implements Rpc
             resourceAdapter.endpointActivation(endpointFactory, activationSpec);
         } catch (ResourceException e) {
             // activation failed... clean up
-            deploymentInfo.setContainer(null);
-            deploymentInfo.setContainerData(null);
+            beanContext.setContainer(null);
+            beanContext.setContainerData(null);
             deployments.remove(deploymentId);
 
             throw new OpenEJBException(e);
         }
 
         // start the timer service
-        EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+        EjbTimerService timerService = beanContext.getEjbTimerService();
         if (timerService != null) {
             timerService.start();
         }
     }
 
-    private ActivationSpec createActivationSpec(DeploymentInfo deploymentInfo)throws OpenEJBException {
+    private ActivationSpec createActivationSpec(BeanContext beanContext)throws OpenEJBException {
         try {
             // initialize the object recipe
             ObjectRecipe objectRecipe = new ObjectRecipe(activationSpecClass);
             objectRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
             objectRecipe.disallow(Option.FIELD_INJECTION);
 
-            Map<String, String> activationProperties = deploymentInfo.getActivationProperties();
+            Map<String, String> activationProperties = beanContext.getActivationProperties();
             for (Map.Entry<String, String> entry : activationProperties.entrySet()) {
                 objectRecipe.setMethodProperty(entry.getKey(), entry.getValue());
             }
@@ -233,20 +230,19 @@ public class MdbContainer implements Rpc
         }
     }
 
-    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 {
-        if (!(info instanceof CoreDeploymentInfo)) {
+    public void undeploy(BeanContext beanContext) throws OpenEJBException {
+        if (!(beanContext instanceof BeanContext)) {
             return;
         }
 
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) info;
         try {
-            EndpointFactory endpointFactory = (EndpointFactory) deploymentInfo.getContainerData();
+            EndpointFactory endpointFactory = (EndpointFactory) beanContext.getContainerData();
             if (endpointFactory != null) {
                 resourceAdapter.endpointDeactivation(endpointFactory, endpointFactory.getActivationSpec());
 
@@ -260,9 +256,9 @@ public class MdbContainer implements Rpc
                 }
             }
         } finally {
-            deploymentInfo.setContainer(null);
-            deploymentInfo.setContainerData(null);
-            deployments.remove(deploymentInfo.getDeploymentID());
+            beanContext.setContainer(null);
+            beanContext.setContainerData(null);
+            deployments.remove(beanContext.getDeploymentID());
         }
     }
 
@@ -278,9 +274,9 @@ public class MdbContainer implements Rpc
     }
 
     public Object invoke(Object deploymentId, InterfaceType type, Class callInterface, Method method, Object[] args, Object primKey) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) getDeploymentInfo(deploymentId);
+        BeanContext beanContext = getBeanContext(deploymentId);
 
-        EndpointFactory endpointFactory = (EndpointFactory) deploymentInfo.getContainerData();
+        EndpointFactory endpointFactory = (EndpointFactory) beanContext.getContainerData();
         MdbInstanceFactory instanceFactory = endpointFactory.getInstanceFactory();
         Instance instance;
         try {
@@ -290,7 +286,7 @@ public class MdbContainer implements Rpc
         }
 
         try {
-            beforeDelivery(deploymentInfo, instance, method, null);
+            beforeDelivery(beanContext, instance, method, null);
             Object value = invoke(instance, method, type, args);
             afterDelivery(instance);
             return value;
@@ -299,7 +295,7 @@ public class MdbContainer implements Rpc
         }
     }
 
-    public void beforeDelivery(CoreDeploymentInfo deployInfo, Object instance, Method method, XAResource xaResource) throws SystemException {
+    public void beforeDelivery(BeanContext deployInfo, Object instance, Method method, XAResource xaResource) throws SystemException {
         // intialize call context
         ThreadContext callContext = new ThreadContext(deployInfo, null);
         ThreadContext oldContext = ThreadContext.enter(callContext);
@@ -337,7 +333,7 @@ public class MdbContainer implements Rpc
 
         // get the context data
         ThreadContext callContext = ThreadContext.getThreadContext();
-        CoreDeploymentInfo deployInfo = callContext.getDeploymentInfo();
+        BeanContext deployInfo = callContext.getBeanContext();
         MdbCallContext mdbCallContext = callContext.get(MdbCallContext.class);
 
         if (mdbCallContext == null) {
@@ -389,11 +385,11 @@ public class MdbContainer implements Rpc
         }
     }
 
-    private Object _invoke(Object instance, Method runMethod, Object[] args, DeploymentInfo deploymentInfo, InterfaceType interfaceType, MdbCallContext mdbCallContext) throws SystemException,
+    private Object _invoke(Object instance, Method runMethod, Object[] args, BeanContext beanContext, InterfaceType interfaceType, MdbCallContext mdbCallContext) throws SystemException,
             ApplicationException {
         Object returnValue;
         try {
-            List<InterceptorData> interceptors = deploymentInfo.getMethodInterceptors(runMethod);
+            List<InterceptorData> interceptors = beanContext.getMethodInterceptors(runMethod);
             InterceptorStack interceptorStack = new InterceptorStack(((Instance) instance).bean, runMethod, interfaceType == InterfaceType.TIMEOUT ? Operation.TIMEOUT : Operation.BUSINESS,
                     interceptors, ((Instance) instance).interceptors);
             returnValue = interceptorStack.invoke(args);
@@ -410,7 +406,7 @@ public class MdbContainer implements Rpc
             //    IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
             //    NullPointerException - if the specified object is null and the method is an instance method.
             //    ExceptionInInitializerError - if the initialization provoked by this method fails.
-            ExceptionType type = deploymentInfo.getExceptionType(e);
+            ExceptionType type = beanContext.getExceptionType(e);
             if (type == ExceptionType.SYSTEM) {
                 //
                 /// System Exception ****************************
@@ -439,7 +435,7 @@ public class MdbContainer implements Rpc
         }
     }
 
-    public void release(CoreDeploymentInfo deployInfo, Object instance) {
+    public void release(BeanContext deployInfo, Object instance) {
         // get the mdb call context
         ThreadContext callContext = ThreadContext.getThreadContext();
         if (callContext == null) {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbInstanceFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbInstanceFactory.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbInstanceFactory.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbInstanceFactory.java Tue Sep 14 07:43:38 2010
@@ -17,9 +17,9 @@
  */
 package org.apache.openejb.core.mdb;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.core.BaseContext;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.InstanceContext;
 import org.apache.openejb.core.Operation;
 import org.apache.openejb.core.ThreadContext;
@@ -53,7 +53,7 @@ import java.util.List;
 public class MdbInstanceFactory {
     private static final Logger logger = Logger.getInstance(LogCategory.OPENEJB, "org.apache.openejb.util.resources");
 
-    private final CoreDeploymentInfo deploymentInfo;
+    private final BeanContext beanContext;
     private final SecurityService securityService;
     private final int instanceLimit;
     private int instanceCount;
@@ -62,24 +62,24 @@ public class MdbInstanceFactory {
     /**
      * Creates a MdbInstanceFactory for a single specific deployment.
      *
-     * @param deploymentInfo  the deployment for which instances will be created
+     * @param beanContext  the deployment for which instances will be created
      * @param securityService the transaction manager for this container system
      * @param instanceLimit   the maximal number of instances or <= 0 if unlimited
      */
-    public MdbInstanceFactory(CoreDeploymentInfo deploymentInfo, SecurityService securityService, int instanceLimit) throws OpenEJBException {
-        this.deploymentInfo = deploymentInfo;
+    public MdbInstanceFactory(BeanContext beanContext, SecurityService securityService, int instanceLimit) throws OpenEJBException {
+        this.beanContext = beanContext;
         this.securityService = securityService;
         this.instanceLimit = instanceLimit;
         mdbContext = new MdbContext(securityService);
 
         try {
-            final Context context = deploymentInfo.getJndiEnc();
+            final Context context = beanContext.getJndiEnc();
             context.bind("comp/EJBContext", mdbContext);
         } catch (NamingException e) {
             throw new OpenEJBException("Failed to bind EJBContext", e);
         }
 
-        deploymentInfo.set(EJBContext.class, this.mdbContext);
+        beanContext.set(EJBContext.class, this.mdbContext);
     }
 
     /**
@@ -160,7 +160,7 @@ public class MdbInstanceFactory {
             // call post destroy method
             callContext.setCurrentOperation(Operation.PRE_DESTROY);
             Method remove = instance.bean instanceof MessageDrivenBean ? MessageDrivenBean.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();
         } catch (Throwable re) {
@@ -185,17 +185,17 @@ public class MdbInstanceFactory {
     }
 
     private Object constructBean() throws UnavailableException {
-        CoreDeploymentInfo deploymentInfo = this.deploymentInfo;
+        BeanContext beanContext = this.beanContext;
 
-        ThreadContext callContext = new ThreadContext(deploymentInfo, null, Operation.INJECTION);
+        ThreadContext callContext = new ThreadContext(beanContext, null, Operation.INJECTION);
         ThreadContext oldContext = ThreadContext.enter(callContext);
 
         try {
-            final InstanceContext context = deploymentInfo.newInstance();
+            final InstanceContext context = beanContext.newInstance();
 
             if (context.getBean() instanceof MessageDrivenBean) {
                 callContext.setCurrentOperation(Operation.CREATE);
-                Method create = deploymentInfo.getCreateMethod();
+                Method create = beanContext.getCreateMethod();
                 final InterceptorStack ejbCreate = new InterceptorStack(context.getBean(), create, Operation.CREATE, new ArrayList(), new HashMap());
                 ejbCreate.invoke();
             }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java Tue Sep 14 07:43:38 2010
@@ -21,11 +21,10 @@ import org.apache.openejb.spi.SecuritySe
 import org.apache.openejb.spi.CallerPrincipal;
 import org.apache.openejb.core.ThreadContextListener;
 import org.apache.openejb.core.ThreadContext;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.security.jacc.BasicJaccProvider;
 import org.apache.openejb.core.security.jacc.BasicPolicyConfiguration;
 import org.apache.openejb.InterfaceType;
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.loader.SystemInstance;
 
 import javax.security.auth.Subject;
@@ -135,13 +134,13 @@ public abstract class AbstractSecuritySe
     }
 
     public void contextEntered(ThreadContext oldContext, ThreadContext newContext) {
-        String moduleID = newContext.getDeploymentInfo().getModuleID();
+        String moduleID = newContext.getBeanContext().getModuleID();
         PolicyContext.setContextID(moduleID);
 
         SecurityContext securityContext = (oldContext != null) ? oldContext.get(SecurityContext.class) : null;
 
-        DeploymentInfo callingDeploymentInfo = (oldContext != null)? oldContext.getDeploymentInfo(): null;
-        Subject runAsSubject = getRunAsSubject(callingDeploymentInfo);
+        BeanContext callingBeanContext = (oldContext != null)? oldContext.getBeanContext(): null;
+        Subject runAsSubject = getRunAsSubject(callingBeanContext);
         if (runAsSubject != null) {
 
             securityContext = new SecurityContext(runAsSubject);
@@ -159,10 +158,10 @@ public abstract class AbstractSecuritySe
         newContext.set(SecurityContext.class, securityContext);
     }
 
-    protected Subject getRunAsSubject(DeploymentInfo callingDeploymentInfo) {
-        if (callingDeploymentInfo == null) return null;
+    protected Subject getRunAsSubject(BeanContext callingBeanContext) {
+        if (callingBeanContext == null) return null;
 
-        String runAsRole = callingDeploymentInfo.getRunAs();
+        String runAsRole = callingBeanContext.getRunAs();
         Subject runAs = createRunAsSubject(runAsRole);
         return runAs;
     }
@@ -175,7 +174,7 @@ public abstract class AbstractSecuritySe
         if (reenteredContext == null) {
             PolicyContext.setContextID(null);
         } else {
-            PolicyContext.setContextID(reenteredContext.getDeploymentInfo().getModuleID());
+            PolicyContext.setContextID(reenteredContext.getBeanContext().getModuleID());
         }
     }
 
@@ -223,7 +222,7 @@ public abstract class AbstractSecuritySe
         SecurityContext securityContext = threadContext.get(SecurityContext.class);
 
         try {
-            DeploymentInfo deployment = threadContext.getDeploymentInfo();
+            BeanContext deployment = threadContext.getBeanContext();
 
             securityContext.acc.checkPermission(new EJBRoleRefPermission(deployment.getEjbName(), role));
         } catch (AccessControlException e) {
@@ -254,9 +253,9 @@ public abstract class AbstractSecuritySe
 
         try {
 
-            DeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
+            BeanContext beanContext = threadContext.getBeanContext();
 
-            String ejbName = deploymentInfo.getEjbName();
+            String ejbName = beanContext.getEjbName();
 
             String name = (type == null)? null: type.getSpecName();
             if ("LocalBean".equals(name) || "LocalBeanHome".equals(name)) {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java Tue Sep 14 07:43:38 2010
@@ -26,7 +26,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 
 import javax.ejb.ConcurrentAccessTimeoutException;
@@ -37,13 +36,12 @@ import javax.ejb.EJBLocalObject;
 import javax.ejb.EJBObject;
 import javax.interceptor.AroundInvoke;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.ContainerType;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.InterfaceType;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.ProxyInfo;
 import org.apache.openejb.RpcContainer;
-import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.ExceptionType;
 import org.apache.openejb.core.Operation;
 import org.apache.openejb.core.ThreadContext;
@@ -64,7 +62,7 @@ public class SingletonContainer implemen
 
     private SingletonInstanceManager instanceManager;
 
-    private HashMap<String,DeploymentInfo> deploymentRegistry = new HashMap<String,DeploymentInfo>();
+    private HashMap<String, BeanContext> deploymentRegistry = new HashMap<String, BeanContext>();
 
     private Object containerID = null;
     private SecurityService securityService;
@@ -76,9 +74,8 @@ public class SingletonContainer implemen
 
         instanceManager = new SingletonInstanceManager(securityService);
 
-        for (DeploymentInfo deploymentInfo : deploymentRegistry.values()) {
-            org.apache.openejb.core.CoreDeploymentInfo di = (org.apache.openejb.core.CoreDeploymentInfo) deploymentInfo;
-            di.setContainer(this);
+        for (BeanContext beanContext : deploymentRegistry.values()) {
+            beanContext.setContainer(this);
         }
     }
 
@@ -86,11 +83,11 @@ public class SingletonContainer implemen
         this.accessTimeout = duration;
     }
 
-    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);
     }
@@ -103,51 +100,46 @@ public class SingletonContainer implemen
         return containerID;
     }
 
-    public void deploy(DeploymentInfo info) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) info;
-        instanceManager.deploy(deploymentInfo);
-        String id = (String) deploymentInfo.getDeploymentID();
+    public void deploy(BeanContext beanContext) throws OpenEJBException {
+        instanceManager.deploy(beanContext);
+        String id = (String) beanContext.getDeploymentID();
         synchronized (this) {
-            deploymentRegistry.put(id, deploymentInfo);
-            deploymentInfo.setContainer(this);
+            deploymentRegistry.put(id, beanContext);
+            beanContext.setContainer(this);
         }
 
-        EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+        EjbTimerService timerService = beanContext.getEjbTimerService();
         if (timerService != null) {
             timerService.start();
         }
         
     }
     
-    public void start(DeploymentInfo info) throws OpenEJBException {    
+    public void start(BeanContext info) throws OpenEJBException {
         instanceManager.start(info);
     }
     
-    public void stop(DeploymentInfo info) throws OpenEJBException {        
+    public void stop(BeanContext info) throws OpenEJBException {
     }
     
-    public void undeploy(DeploymentInfo info) {
-        undeploy((CoreDeploymentInfo)info);
-    }
-
-    private void undeploy(CoreDeploymentInfo deploymentInfo) {
-        ThreadContext threadContext = new ThreadContext(deploymentInfo, null);
+    public void undeploy(BeanContext beanContext) {
+        ThreadContext threadContext = new ThreadContext(beanContext, null);
         ThreadContext old = ThreadContext.enter(threadContext);
         try {
             instanceManager.freeInstance(threadContext);
         } finally{
             ThreadContext.exit(old);
         }
-        instanceManager.undeploy(deploymentInfo);
-        EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+        instanceManager.undeploy(beanContext);
+        EjbTimerService timerService = beanContext.getEjbTimerService();
         if (timerService != null) {
             timerService.stop();
         }
 
         synchronized (this) {
-            String id = (String) deploymentInfo.getDeploymentID();
-            deploymentInfo.setContainer(null);
-            deploymentInfo.setContainerData(null);
+            String id = (String) beanContext.getDeploymentID();
+            beanContext.setContainer(null);
+            beanContext.setContainerData(null);
             deploymentRegistry.remove(id);
         }
     }
@@ -164,16 +156,16 @@ public class SingletonContainer implemen
     }
 
     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);
 
-        Method runMethod = deployInfo.getMatchingBeanMethod(callMethod);
+        Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
 
-        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);
@@ -183,7 +175,7 @@ public class SingletonContainer implemen
             Class declaringClass = callMethod.getDeclaringClass();
             if (EJBHome.class.isAssignableFrom(declaringClass) || EJBLocalHome.class.isAssignableFrom(declaringClass)) {
                 if (callMethod.getName().startsWith("create")) {
-                    return createEJBObject(deployInfo, callMethod);
+                    return createEJBObject(beanContext, callMethod);
                 } else
                     return null;// EJBHome.remove( ) and other EJBHome methods are not process by the container
             } else if (EJBObject.class == declaringClass || EJBLocalObject.class == declaringClass) {
@@ -211,30 +203,30 @@ public class SingletonContainer implemen
     }
 
     protected Object _invoke(Method callMethod, Method runMethod, Object[] args, Instance instance, ThreadContext callContext, InterfaceType callType) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        BeanContext beanContext = callContext.getBeanContext();
                
-        Duration accessTimeout = getAccessTimeout(deploymentInfo, runMethod);        
-        boolean read = deploymentInfo.getConcurrencyAttribute(runMethod) == javax.ejb.LockType.READ;
+        Duration accessTimeout = getAccessTimeout(beanContext, runMethod);
+        boolean read = beanContext.getConcurrencyAttribute(runMethod) == javax.ejb.LockType.READ;
         
         final Lock lock = aquireLock(read, accessTimeout, instance);
 
         Object returnValue;
         try {
-            TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+            TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
 
             returnValue = null;
             try {
                 if (callType == InterfaceType.SERVICE_ENDPOINT) {
                     callContext.setCurrentOperation(Operation.BUSINESS_WS);
-                    returnValue = invokeWebService(args, deploymentInfo, runMethod, instance);
+                    returnValue = invokeWebService(args, beanContext, runMethod, instance);
                 } else {
-                    List<InterceptorData> interceptors = deploymentInfo.getMethodInterceptors(runMethod);
+                    List<InterceptorData> interceptors = beanContext.getMethodInterceptors(runMethod);
                     InterceptorStack interceptorStack = new InterceptorStack(instance.bean, runMethod, callType == InterfaceType.TIMEOUT ? Operation.TIMEOUT : Operation.BUSINESS, interceptors,
                             instance.interceptors);
                     returnValue = interceptorStack.invoke(args);
                 }
             } catch (Throwable e) {// handle reflection exception
-                ExceptionType type = deploymentInfo.getExceptionType(e);
+                ExceptionType type = beanContext.getExceptionType(e);
                 if (type == ExceptionType.SYSTEM) {
                     /* System Exception ****************************/
 
@@ -258,10 +250,10 @@ public class SingletonContainer implemen
         return returnValue;
     }
 
-    private Duration getAccessTimeout(CoreDeploymentInfo deploymentInfo, Method callMethod) {
-        Duration accessTimeout = deploymentInfo.getAccessTimeout(callMethod);
+    private Duration getAccessTimeout(BeanContext beanContext, Method callMethod) {
+        Duration accessTimeout = beanContext.getAccessTimeout(callMethod);
         if (accessTimeout == null) {
-            accessTimeout = deploymentInfo.getAccessTimeout();
+            accessTimeout = beanContext.getAccessTimeout();
             if (accessTimeout == null) {
                 accessTimeout = this.accessTimeout;
             }
@@ -302,7 +294,7 @@ public class SingletonContainer implemen
         return lock;
     }
 
-    private Object invokeWebService(Object[] args, CoreDeploymentInfo deploymentInfo, Method runMethod, Instance instance) throws Exception {
+    private Object invokeWebService(Object[] args, BeanContext beanContext, Method runMethod, Instance instance) throws Exception {
         if (args.length < 2) {
             throw new IllegalArgumentException("WebService calls must follow format {messageContext, interceptor, [arg...]}.");
         }
@@ -328,7 +320,7 @@ public class SingletonContainer implemen
         }
 
         //  Create an InterceptorData for the webservice interceptor to the list of interceptorDatas for this method
-        List<InterceptorData> interceptorDatas = new ArrayList<InterceptorData>(deploymentInfo.getMethodInterceptors(runMethod));
+        List<InterceptorData> interceptorDatas = new ArrayList<InterceptorData>(beanContext.getMethodInterceptors(runMethod));
         {
             InterceptorData providerData = new InterceptorData(interceptor.getClass());
             ClassFinder finder = new ClassFinder(interceptor.getClass());
@@ -355,7 +347,7 @@ public class SingletonContainer implemen
         throw new IllegalArgumentException("Uknown MessageContext type: " + messageContext.getClass().getName());
     }
 
-    protected ProxyInfo createEJBObject(org.apache.openejb.core.CoreDeploymentInfo deploymentInfo, Method callMethod) {
-        return new ProxyInfo(deploymentInfo, null);
+    protected ProxyInfo createEJBObject(BeanContext beanContext, Method callMethod) {
+        return new ProxyInfo(beanContext, null);
     }
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java Tue Sep 14 07:43:38 2010
@@ -21,15 +21,15 @@ 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;
 
 public class SingletonEjbHomeHandler extends EjbHomeProxyHandler {
 
-    public SingletonEjbHomeHandler(DeploymentInfo deploymentInfo, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        super(deploymentInfo, interfaceType, interfaces, mainInterface);
+    public SingletonEjbHomeHandler(BeanContext beanContext, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        super(beanContext, interfaceType, interfaces, mainInterface);
     }
 
     protected Object findX(Class interfce, Method method, Object[] args, Object proxy) throws Throwable {
@@ -45,8 +45,8 @@ public class SingletonEjbHomeHandler ext
         return null;
     }
 
-    protected EjbObjectProxyHandler newEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        return new SingletonEjbObjectHandler(getDeploymentInfo(), pk, interfaceType, interfaces, mainInterface);
+    protected EjbObjectProxyHandler newEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        return new SingletonEjbObjectHandler(getBeanContext(), pk, interfaceType, interfaces, mainInterface);
     }
 
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java Tue Sep 14 07:43:38 2010
@@ -18,8 +18,7 @@ package org.apache.openejb.core.singleto
 
 import org.apache.openejb.Container;
 import org.apache.openejb.InterfaceType;
-import org.apache.openejb.DeploymentInfo;
-import org.apache.openejb.core.ivm.BaseEjbProxyHandler;
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
 import org.apache.openejb.util.proxy.ProxyManager;
 
@@ -30,8 +29,8 @@ import java.util.List;
 public class SingletonEjbObjectHandler extends EjbObjectProxyHandler {
     public Object registryId;
 
-    public SingletonEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
-        super(deploymentInfo, pk, interfaceType, interfaces, mainInterface);
+    public SingletonEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+        super(beanContext, pk, interfaceType, interfaces, mainInterface);
     }
 
     public static Object createRegistryId(Object primKey, Object deployId, Container contnr) {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java Tue Sep 14 07:43:38 2010
@@ -41,8 +41,8 @@ import javax.xml.ws.WebServiceContext;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
+import org.apache.openejb.BeanContext;
 import org.apache.openejb.BeanType;
-import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.ApplicationException;
 import org.apache.openejb.core.transaction.TransactionType;
@@ -50,7 +50,6 @@ import org.apache.openejb.loader.SystemI
 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.Operation;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.core.InstanceContext;
@@ -76,17 +75,15 @@ public class SingletonInstanceManager {
         webServiceContext = new EjbWsContext(sessionContext);
     }
 
-    protected void start(DeploymentInfo info) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) info;
-        if (deploymentInfo.isLoadOnStartup()) {
-            initialize(info);
+    protected void start(BeanContext beanContext) throws OpenEJBException {
+        if (beanContext.isLoadOnStartup()) {
+            initialize(beanContext);
         }
     }
 
-    private void initialize(DeploymentInfo info) throws OpenEJBException {
-        CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) info;
+    private void initialize(BeanContext beanContext) throws OpenEJBException {
         try {
-            ThreadContext callContext = new ThreadContext(deploymentInfo, null);
+            ThreadContext callContext = new ThreadContext(beanContext, null);
             ThreadContext old = ThreadContext.enter(callContext);
             try {
                 getInstance(callContext);
@@ -94,13 +91,13 @@ public class SingletonInstanceManager {
                 ThreadContext.exit(old);
             }
         } catch (OpenEJBException e) {
-            throw new OpenEJBException("Singleton startup failed: "+deploymentInfo.getDeploymentID(), e);
+            throw new OpenEJBException("Singleton startup failed: "+ beanContext.getDeploymentID(), e);
         }
     }
 
     public Instance getInstance(final ThreadContext callContext) throws OpenEJBException {
-        final CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();                      
-        Data data = (Data) deploymentInfo.getContainerData();
+        final BeanContext beanContext = callContext.getBeanContext();
+        Data data = (Data) beanContext.getContainerData();
         AtomicReference<Future<Instance>> singleton = data.singleton;
         try {
             // Has the singleton been created yet?
@@ -114,7 +111,7 @@ public class SingletonInstanceManager {
             // other threads for the right to create the singleton
             FutureTask<Instance> task = new FutureTask<Instance>(new Callable<Instance>() {
                 public Instance call() throws Exception {                    
-                    return createInstance(callContext, deploymentInfo);
+                    return createInstance(callContext, beanContext);
                 }
             });
 
@@ -148,16 +145,16 @@ public class SingletonInstanceManager {
         }
     }
 
-    private void initializeDependencies(CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
+    private void initializeDependencies(BeanContext beanContext) throws OpenEJBException {
         SystemInstance systemInstance = SystemInstance.get();
         ContainerSystem containerSystem = systemInstance.getComponent(ContainerSystem.class);
-        for (String dependencyId : deploymentInfo.getDependsOn()) {
-            CoreDeploymentInfo dependencyInfo = (CoreDeploymentInfo) containerSystem.getDeploymentInfo(dependencyId);
-            if (dependencyInfo == null) {
-                throw new OpenEJBException("Deployment does not exist. Deployment(id='"+dependencyInfo+"')");
+        for (String dependencyId : beanContext.getDependsOn()) {
+            BeanContext dependencyContext = containerSystem.getBeanContext(dependencyId);
+            if (dependencyContext == null) {
+                throw new OpenEJBException("Deployment does not exist. Deployment(id='"+dependencyContext+"')");
             }
 
-            final Object containerData = dependencyInfo.getContainerData();
+            final Object containerData = dependencyContext.getContainerData();
 
             // Bean may not be a singleton or may be a singleton
             // managed by a different container implementation
@@ -169,18 +166,18 @@ public class SingletonInstanceManager {
         }
     }
     
-    private Instance createInstance(ThreadContext callContext, CoreDeploymentInfo deploymentInfo) throws ApplicationException {
+    private Instance createInstance(ThreadContext callContext, BeanContext beanContext) throws ApplicationException {
         try {
-            initializeDependencies(deploymentInfo);
+            initializeDependencies(beanContext);
             
-            final InstanceContext context = deploymentInfo.newInstance();
+            final InstanceContext context = beanContext.newInstance();
 
             if (context.getBean() instanceof SessionBean){
 
                 final Operation originalOperation = callContext.getCurrentOperation();
                 try {
                     callContext.setCurrentOperation(Operation.CREATE);
-                    final Method create = deploymentInfo.getCreateMethod();
+                    final Method create = beanContext.getCreateMethod();
                     final InterceptorStack ejbCreate = new InterceptorStack(context.getBean(), create, Operation.CREATE, new ArrayList<InterceptorData>(), new HashMap());
                     ejbCreate.invoke();
                 } finally {
@@ -189,7 +186,7 @@ public class SingletonInstanceManager {
             }
 
             ReadWriteLock lock;
-            if (deploymentInfo.isBeanManagedConcurrency()){
+            if (beanContext.isBeanManagedConcurrency()){
                 // Bean-Managed Concurrency
                 lock = new BeanManagedLock();
             } else {
@@ -202,15 +199,15 @@ public class SingletonInstanceManager {
             if (e instanceof java.lang.reflect.InvocationTargetException) {
                 e = ((java.lang.reflect.InvocationTargetException) e).getTargetException();
             }
-            String t = "The bean instance " + deploymentInfo.getDeploymentID() + " threw a system exception:" + e;
+            String t = "The bean instance " + beanContext.getDeploymentID() + " threw a system exception:" + e;
             logger.error(t, e);
             throw new ApplicationException(new NoSuchEJBException("Singleton failed to initialize").initCause(e));
         }
     }
 
     public void freeInstance(ThreadContext callContext) {
-        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
-        Data data = (Data) deploymentInfo.getContainerData();
+        BeanContext beanContext = callContext.getBeanContext();
+        Data data = (Data) beanContext.getContainerData();
         Future<Instance> instanceFuture = data.singleton.get();
 
         // Possible the instance was never created
@@ -221,7 +218,7 @@ public class SingletonInstanceManager {
             instance = instanceFuture.get();
         } catch (InterruptedException e) {
             Thread.interrupted();
-            logger.error("Singleton shutdown failed because the thread was interrupted: "+deploymentInfo.getDeploymentID(), e);
+            logger.error("Singleton shutdown failed because the thread was interrupted: "+beanContext.getDeploymentID(), e);
             return;
         } catch (ExecutionException e) {
             // Instance was never initialized
@@ -232,26 +229,26 @@ public class SingletonInstanceManager {
             callContext.setCurrentOperation(Operation.PRE_DESTROY);
             callContext.setCurrentAllowedStates(null);
 
-            Method remove = instance.bean instanceof SessionBean? deploymentInfo.getCreateMethod(): null;
+            Method remove = instance.bean instanceof SessionBean? beanContext.getCreateMethod(): null;
 
-            List<InterceptorData> callbackInterceptors = deploymentInfo.getCallbackInterceptors();
+            List<InterceptorData> callbackInterceptors = beanContext.getCallbackInterceptors();
             InterceptorStack interceptorStack = new InterceptorStack(instance.bean, remove, Operation.PRE_DESTROY, callbackInterceptors, instance.interceptors);
 
             //Transaction Demarcation for Singleton PostConstruct method
             TransactionType transactionType;
 
-            if (deploymentInfo.getComponentType() == BeanType.SINGLETON) {
+            if (beanContext.getComponentType() == BeanType.SINGLETON) {
                 List<Method> callbacks = callbackInterceptors.get(callbackInterceptors.size() -1).getPreDestroy();
                 if (callbacks.isEmpty()) {
                     transactionType = TransactionType.RequiresNew;
                 } else {
-                    transactionType = deploymentInfo.getTransactionType(callbacks.get(0));
+                    transactionType = beanContext.getTransactionType(callbacks.get(0));
                     if (transactionType == TransactionType.Required) {
                         transactionType = TransactionType.RequiresNew;
                     }
                 }
             } else {
-                transactionType = deploymentInfo.isBeanManagedTransaction()? TransactionType.BeanManaged: TransactionType.NotSupported;
+                transactionType = beanContext.isBeanManagedTransaction()? TransactionType.BeanManaged: TransactionType.NotSupported;
             }
             TransactionPolicy transactionPolicy = EjbTransactionUtil.createTransactionPolicy(transactionType, callContext);
             try{
@@ -266,7 +263,7 @@ public class SingletonInstanceManager {
             }
 
         } catch (Throwable re) {
-            logger.error("Singleton shutdown failed: "+deploymentInfo.getDeploymentID(), re);
+            logger.error("Singleton shutdown failed: "+beanContext.getDeploymentID(), re);
         }
     }
     
@@ -282,25 +279,25 @@ public class SingletonInstanceManager {
 
     }
 
-    public void deploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
-        Data data = new Data(deploymentInfo);
-        deploymentInfo.setContainerData(data);
+    public void deploy(BeanContext beanContext) throws OpenEJBException {
+        Data data = new Data(beanContext);
+        beanContext.setContainerData(data);
 
-        deploymentInfo.set(EJBContext.class, this.sessionContext);
+        beanContext.set(EJBContext.class, this.sessionContext);
 
         // 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("SingletonSessionBean", deploymentInfo.getEjbName());
+        jmxName.set("EJBModule", beanContext.getModuleID());
+        jmxName.set("SingletonSessionBean", beanContext.getEjbName());
         jmxName.set("j2eeType", "");
-        jmxName.set("name", deploymentInfo.getEjbName());
+        jmxName.set("name", beanContext.getEjbName());
 
         // register the invocation stats interceptor
         try {
@@ -312,7 +309,7 @@ public class SingletonInstanceManager {
         }
 
         try {
-            final Context context = deploymentInfo.getJndiEnc();
+            final Context context = beanContext.getJndiEnc();
             context.bind("comp/EJBContext", sessionContext);
             context.bind("comp/WebServiceContext", webServiceContext);
         } catch (NamingException e) {
@@ -320,8 +317,8 @@ public class SingletonInstanceManager {
         }
     }
 
-    public void undeploy(CoreDeploymentInfo deploymentInfo) {
-        Data data = (Data) deploymentInfo.getContainerData();
+    public void undeploy(BeanContext beanContext) {
+        Data data = (Data) beanContext.getContainerData();
         if (data == null) return;
 
         MBeanServer server = ManagementFactory.getPlatformMBeanServer();
@@ -333,15 +330,15 @@ public class SingletonInstanceManager {
             }
         }
 
-        deploymentInfo.setContainerData(null);
+        beanContext.setContainerData(null);
     }
 
     private final class Data {
         private final AtomicReference<Future<Instance>> singleton = new AtomicReference<Future<Instance>>();
         private final List<ObjectName> jmxNames = new ArrayList<ObjectName>();
-        private final CoreDeploymentInfo info;
+        private final BeanContext info;
 
-        public Data(CoreDeploymentInfo info) {
+        public Data(BeanContext info) {
             this.info = info;
         }
 

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/Instance.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/Instance.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/Instance.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/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;
@@ -38,7 +38,7 @@ import org.apache.openejb.util.PojoSeria
 
 public class Instance implements Serializable, Cache.TimeOut {
     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;
@@ -54,8 +54,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;
@@ -64,8 +64,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;
@@ -75,7 +75,7 @@ public class Instance implements Seriali
     }
 
     public Duration getTimeOut() {
-        return deploymentInfo.getStatefulTimeout();
+        return beanContext.getStatefulTimeout();
     }
     
     public synchronized boolean isInUse() {
@@ -151,7 +151,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;
             bean = toSerializable(i.bean);