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 [6/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/stateful/StatefulContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java Tue Sep 14 07:43:38 2010
@@ -46,8 +46,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;
@@ -57,7 +57,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;
@@ -101,7 +100,7 @@ public class StatefulContainer implement
/**
* 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>();
@@ -120,14 +119,14 @@ public class StatefulContainer implement
sessionContext = new StatefulContext(this.securityService, new StatefulUserTransaction(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);
@@ -135,7 +134,7 @@ public class StatefulContainer implement
}
}
- for (Class businessRemote : deploymentInfo.getBusinessRemoteInterfaces()) {
+ for (Class businessRemote : beanContext.getBusinessRemoteInterfaces()) {
try {
Method method = businessRemote.getMethod(removeMethod.getName());
methods.put(method, MethodType.REMOVE);
@@ -144,7 +143,7 @@ public class StatefulContainer implement
}
}
- Class legacyRemote = deploymentInfo.getRemoteInterface();
+ Class legacyRemote = beanContext.getRemoteInterface();
if (legacyRemote != null) {
try {
Method method = legacyRemote.getMethod("remove");
@@ -153,7 +152,7 @@ public class StatefulContainer implement
}
}
- Class legacyLocal = deploymentInfo.getLocalInterface();
+ Class legacyLocal = beanContext.getLocalInterface();
if (legacyLocal != null) {
try {
Method method = legacyLocal.getMethod("remove");
@@ -162,9 +161,9 @@ public class StatefulContainer implement
}
}
- 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")) {
@@ -173,9 +172,9 @@ public class StatefulContainer implement
}
}
- 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")) {
@@ -184,9 +183,9 @@ public class StatefulContainer implement
}
}
- 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")) {
@@ -195,7 +194,7 @@ public class StatefulContainer implement
}
}
- Class homeInterface = deploymentInfo.getHomeInterface();
+ Class homeInterface = beanContext.getHomeInterface();
if (homeInterface != null) {
for (Method method : homeInterface.getMethods()) {
if (method.getName().startsWith("create")) {
@@ -206,7 +205,7 @@ public class StatefulContainer implement
}
}
- Class localHomeInterface = deploymentInfo.getLocalHomeInterface();
+ Class localHomeInterface = beanContext.getLocalHomeInterface();
if (localHomeInterface != null) {
for (Method method : localHomeInterface.getMethods()) {
if (method.getName().startsWith("create")) {
@@ -231,30 +230,22 @@ public class StatefulContainer implement
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 start(BeanContext beanContext) throws OpenEJBException {
}
- public void stop(DeploymentInfo deploymentInfo) throws OpenEJBException {
+ public void stop(BeanContext beanContext) throws OpenEJBException {
}
- public void undeploy(DeploymentInfo deploymentInfo) throws OpenEJBException {
- undeploy((CoreDeploymentInfo) deploymentInfo);
- }
-
- private synchronized void undeploy(final CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
- Data data = (Data) deploymentInfo.getContainerData();
+ public synchronized void undeploy(final BeanContext beanContext) throws OpenEJBException {
+ Data data = (Data) beanContext.getContainerData();
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
for (ObjectName objectName : data.jmxNames) {
@@ -265,40 +256,40 @@ public class StatefulContainer implement
}
}
- deploymentsById.remove(deploymentInfo.getDeploymentID());
- deploymentInfo.setContainer(null);
- deploymentInfo.setContainerData(null);
+ deploymentsById.remove(beanContext.getDeploymentID());
+ beanContext.setContainer(null);
+ beanContext.setContainerData(null);
cache.removeAll(new CacheFilter<Instance>() {
public boolean matches(Instance instance) {
- return deploymentInfo == instance.deploymentInfo;
+ return beanContext == instance.beanContext;
}
});
- deploymentInfo.set(EJBContext.class, this.sessionContext);
+ beanContext.set(EJBContext.class, this.sessionContext);
}
- 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("StatefulSessionBean", deploymentInfo.getEjbName());
+ jmxName.set("EJBModule", beanContext.getModuleID());
+ jmxName.set("StatefulSessionBean", beanContext.getEjbName());
jmxName.set("j2eeType", "");
- jmxName.set("name", deploymentInfo.getEjbName());
+ jmxName.set("name", beanContext.getEjbName());
// register the invocation stats interceptor
try {
@@ -310,7 +301,7 @@ public class StatefulContainer implement
}
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);
@@ -329,45 +320,45 @@ public class StatefulContainer implement
}
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);
}
@@ -377,17 +368,17 @@ public class StatefulContainer implement
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();
@@ -405,12 +396,12 @@ public class StatefulContainer implement
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
@@ -429,7 +420,7 @@ public class StatefulContainer implement
afterInvoke(createContext, txPolicy, instance);
}
- return new ProxyInfo(deploymentInfo, primaryKey);
+ return new ProxyInfo(beanContext, primaryKey);
} finally {
ThreadContext.exit(oldCallContext);
}
@@ -439,10 +430,10 @@ public class StatefulContainer implement
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
@@ -467,7 +458,7 @@ public class StatefulContainer implement
}
// Start transaction
- TransactionPolicy txPolicy = createTransactionPolicy(callContext.getDeploymentInfo().getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(callContext.getBeanContext().getTransactionType(callMethod), callContext);
Object returnValue = null;
boolean retain = false;
@@ -498,7 +489,7 @@ public class StatefulContainer implement
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
@@ -508,7 +499,7 @@ public class StatefulContainer implement
}
// 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
@@ -521,7 +512,7 @@ public class StatefulContainer implement
throw e;
} catch (Throwable e) {
if (interfaceType.isBusiness()) {
- retain = deploymentInfo.retainIfExeption(runMethod);
+ retain = beanContext.retainIfExeption(runMethod);
handleException(callContext, txPolicy, e);
} else {
try {
@@ -534,7 +525,7 @@ public class StatefulContainer implement
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) {
@@ -561,15 +552,15 @@ public class StatefulContainer implement
}
}
- 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;
@@ -596,11 +587,11 @@ public class StatefulContainer implement
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
@@ -648,7 +639,7 @@ public class StatefulContainer implement
}
}
- Duration accessTimeout = getAccessTimeout(instance.deploymentInfo, callMethod);
+ Duration accessTimeout = getAccessTimeout(instance.beanContext, callMethod);
final Lock currLock = instance.getLock();
final boolean lockAcquired;
@@ -685,12 +676,12 @@ public class StatefulContainer implement
return instance;
}
- private Duration getAccessTimeout(CoreDeploymentInfo deploymentInfo, Method callMethod) {
- callMethod = deploymentInfo.getMatchingBeanMethod(callMethod);
+ private Duration getAccessTimeout(BeanContext beanContext, Method callMethod) {
+ callMethod = beanContext.getMatchingBeanMethod(callMethod);
- Duration accessTimeout = deploymentInfo.getAccessTimeout(callMethod);
+ Duration accessTimeout = beanContext.getAccessTimeout(callMethod);
if (accessTimeout == null) {
- accessTimeout = deploymentInfo.getAccessTimeout();
+ accessTimeout = beanContext.getAccessTimeout();
if (accessTimeout == null) {
accessTimeout = this.accessTimeout;
}
@@ -712,7 +703,7 @@ public class StatefulContainer implement
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) {
@@ -755,7 +746,7 @@ public class StatefulContainer implement
throw (ApplicationException) e;
}
- ExceptionType type = callContext.getDeploymentInfo().getExceptionType(e);
+ ExceptionType type = callContext.getBeanContext().getExceptionType(e);
if (type == SYSTEM) {
discardInstance(callContext);
handleSystemException(txPolicy, e, callContext);
@@ -790,9 +781,9 @@ public class StatefulContainer implement
}
}
- 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()));
@@ -818,10 +809,10 @@ public class StatefulContainer implement
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
@@ -830,7 +821,7 @@ public class StatefulContainer implement
// 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);
}
@@ -840,10 +831,10 @@ public class StatefulContainer implement
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);
}
@@ -862,10 +853,10 @@ public class StatefulContainer implement
// 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);
}
/**
@@ -902,7 +893,7 @@ public class StatefulContainer implement
}
- 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);
@@ -919,12 +910,12 @@ public class StatefulContainer implement
}
// 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();
@@ -955,14 +946,14 @@ public class StatefulContainer implement
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();
@@ -995,15 +986,15 @@ public class StatefulContainer implement
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);
}
@@ -1037,14 +1028,14 @@ public class StatefulContainer implement
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();
@@ -1057,14 +1048,14 @@ public class StatefulContainer implement
}
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();
@@ -1077,15 +1068,15 @@ public class StatefulContainer implement
}
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/stateful/StatefulEjbHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulEjbHomeHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulEjbHomeHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulEjbHomeHandler.java Tue Sep 14 07:43:38 2010
@@ -23,15 +23,15 @@ import java.util.List;
import javax.ejb.RemoveException;
import org.apache.openejb.InterfaceType;
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.core.ivm.EjbHomeProxyHandler;
import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
import org.apache.openejb.util.proxy.ProxyManager;
public class StatefulEjbHomeHandler extends EjbHomeProxyHandler {
- public StatefulEjbHomeHandler(DeploymentInfo deploymentInfo, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
- super(deploymentInfo, interfaceType, interfaces, mainInterface);
+ public StatefulEjbHomeHandler(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 StatefulEjbHomeHandler exte
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 StatefulEjbObjectHandler(getDeploymentInfo(), pk, interfaceType, interfaces, mainInterface);
+ protected EjbObjectProxyHandler newEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+ return new StatefulEjbObjectHandler(getBeanContext(), pk, interfaceType, interfaces, mainInterface);
}
}
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulEjbObjectHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulEjbObjectHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulEjbObjectHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulEjbObjectHandler.java Tue Sep 14 07:43:38 2010
@@ -16,8 +16,8 @@
*/
package org.apache.openejb.core.stateful;
+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 StatefulEjbObjectHandler extends EjbObjectProxyHandler {
- public StatefulEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
- super(deploymentInfo, pk, interfaceType, interfaces, mainInterface);
+ public StatefulEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+ super(beanContext, pk, interfaceType, interfaces, mainInterface);
}
public Object getRegistryId() {
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulUserTransaction.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulUserTransaction.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulUserTransaction.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulUserTransaction.java Tue Sep 14 07:43:38 2010
@@ -26,7 +26,7 @@ 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.BeanContext;
import org.apache.openejb.BeanType;
public class StatefulUserTransaction implements UserTransaction {
@@ -49,8 +49,8 @@ public class StatefulUserTransaction imp
}
// get the deployment info
- CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
- if (deploymentInfo.getComponentType() != BeanType.STATEFUL) {
+ BeanContext beanContext = callContext.getBeanContext();
+ if (beanContext.getComponentType() != BeanType.STATEFUL) {
// some other non-stateful ejb is using our user transaction
return;
}
@@ -61,7 +61,7 @@ public class StatefulUserTransaction imp
// 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/stateless/StatelessContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java Tue Sep 14 07:43:38 2010
@@ -34,13 +34,12 @@ import javax.ejb.EJBObject;
import javax.interceptor.AroundInvoke;
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.OpenEJBException;
import org.apache.openejb.ProxyInfo;
import org.apache.openejb.SystemException;
-import org.apache.openejb.core.CoreDeploymentInfo;
import org.apache.openejb.core.ExceptionType;
import org.apache.openejb.core.Operation;
import org.apache.openejb.core.ThreadContext;
@@ -62,7 +61,7 @@ public class StatelessContainer implemen
private StatelessInstanceManager 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;
@@ -73,17 +72,16 @@ public class StatelessContainer implemen
instanceManager = new StatelessInstanceManager(securityService, accessTimeout, closeTimeout, poolBuilder, callbackThreads);
- 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);
}
}
- 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);
}
@@ -96,43 +94,37 @@ public class StatelessContainer implemen
return containerID;
}
- public void deploy(DeploymentInfo info) throws OpenEJBException {
- CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) info;
- String id = (String) deploymentInfo.getDeploymentID();
+ public void deploy(BeanContext beanContext) throws OpenEJBException {
+ 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 {
- CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) info;
- instanceManager.deploy(deploymentInfo);
+ public void start(BeanContext beanContext) throws OpenEJBException {
+ instanceManager.deploy(beanContext);
}
- public void stop(DeploymentInfo info) throws OpenEJBException {
+ public void stop(BeanContext beanContext) throws OpenEJBException {
}
- public void undeploy(DeploymentInfo info) {
- undeploy((CoreDeploymentInfo)info);
- }
-
- private void undeploy(CoreDeploymentInfo deploymentInfo) {
- instanceManager.undeploy(deploymentInfo);
- EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+ public void undeploy(BeanContext beanContext) {
+ 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);
}
}
@@ -149,16 +141,16 @@ public class StatelessContainer 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);
Object bean = null;
try {
@@ -169,7 +161,7 @@ public class StatelessContainer 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) {
@@ -216,23 +208,23 @@ public class StatelessContainer implemen
protected Object _invoke(Method callMethod, Method runMethod, Object[] args, Instance instance, ThreadContext callContext, InterfaceType type)
throws OpenEJBException {
- CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+ BeanContext beanContext = callContext.getBeanContext();
- TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);
+ TransactionPolicy txPolicy = createTransactionPolicy(beanContext.getTransactionType(callMethod), callContext);
Object returnValue = null;
try {
if (type == InterfaceType.SERVICE_ENDPOINT){
callContext.setCurrentOperation(Operation.BUSINESS_WS);
- returnValue = invokeWebService(args, deploymentInfo, runMethod, instance, returnValue);
+ returnValue = invokeWebService(args, beanContext, runMethod, instance, returnValue);
} else {
- List<InterceptorData> interceptors = deploymentInfo.getMethodInterceptors(runMethod);
+ List<InterceptorData> interceptors = beanContext.getMethodInterceptors(runMethod);
InterceptorStack interceptorStack = new InterceptorStack(instance.bean, runMethod, type == InterfaceType.TIMEOUT ? Operation.TIMEOUT : Operation.BUSINESS, interceptors,
instance.interceptors);
returnValue = interceptorStack.invoke(args);
}
} catch (Throwable re) {// handle reflection exception
- ExceptionType exceptionType = deploymentInfo.getExceptionType(re);
+ ExceptionType exceptionType = beanContext.getExceptionType(re);
if (exceptionType == ExceptionType.SYSTEM) {
/* System Exception ****************************/
@@ -264,7 +256,7 @@ public class StatelessContainer implemen
return returnValue;
}
- private Object invokeWebService(Object[] args, CoreDeploymentInfo deploymentInfo, Method runMethod, Instance instance, Object returnValue) throws Exception {
+ private Object invokeWebService(Object[] args, BeanContext beanContext, Method runMethod, Instance instance, Object returnValue) throws Exception {
if (args.length < 2) {
throw new IllegalArgumentException("WebService calls must follow format {messageContext, interceptor, [arg...]}.");
}
@@ -287,7 +279,7 @@ public class StatelessContainer 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());
@@ -315,7 +307,7 @@ public class StatelessContainer implemen
return returnValue;
}
- 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/stateless/StatelessEjbHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessEjbHomeHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessEjbHomeHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessEjbHomeHandler.java Tue Sep 14 07:43:38 2010
@@ -22,14 +22,14 @@ import java.util.List;
import javax.ejb.RemoveException;
import org.apache.openejb.InterfaceType;
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.core.ivm.EjbHomeProxyHandler;
import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
public class StatelessEjbHomeHandler extends EjbHomeProxyHandler {
- public StatelessEjbHomeHandler(DeploymentInfo deploymentInfo, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
- super(deploymentInfo, interfaceType, interfaces, mainInterface);
+ public StatelessEjbHomeHandler(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 StatelessEjbHomeHandler ext
return null;
}
- protected EjbObjectProxyHandler newEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
- return new StatelessEjbObjectHandler(getDeploymentInfo(), pk, interfaceType, interfaces, mainInterface);
+ protected EjbObjectProxyHandler newEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+ return new StatelessEjbObjectHandler(getBeanContext(), pk, interfaceType, interfaces, mainInterface);
}
}
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessEjbObjectHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessEjbObjectHandler.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessEjbObjectHandler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessEjbObjectHandler.java Tue Sep 14 07:43:38 2010
@@ -16,9 +16,9 @@
*/
package org.apache.openejb.core.stateless;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.Container;
import org.apache.openejb.InterfaceType;
-import org.apache.openejb.DeploymentInfo;
import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
import org.apache.openejb.util.proxy.ProxyManager;
@@ -29,8 +29,8 @@ import java.util.List;
public class StatelessEjbObjectHandler extends EjbObjectProxyHandler {
public Object registryId;
- public StatelessEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
- super(deploymentInfo, pk, interfaceType, interfaces, mainInterface);
+ public StatelessEjbObjectHandler(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/stateless/StatelessInstanceManager.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java Tue Sep 14 07:43:38 2010
@@ -41,6 +41,7 @@ import javax.naming.NamingException;
import javax.management.ObjectName;
import javax.management.MBeanServer;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.OpenEJBException;
import org.apache.openejb.SystemException;
import org.apache.openejb.ApplicationException;
@@ -48,7 +49,6 @@ import org.apache.openejb.monitoring.Sta
import org.apache.openejb.monitoring.ObjectNameBuilder;
import org.apache.openejb.monitoring.ManagedMBean;
import org.apache.openejb.loader.Options;
-import org.apache.openejb.core.CoreDeploymentInfo;
import org.apache.openejb.core.Operation;
import org.apache.openejb.core.ThreadContext;
import org.apache.openejb.core.InstanceContext;
@@ -98,14 +98,14 @@ public class StatelessInstanceManager {
}
private class StatelessSupplier implements Pool.Supplier<Instance> {
- private final CoreDeploymentInfo deploymentInfo;
+ private final BeanContext beanContext;
- private StatelessSupplier(CoreDeploymentInfo deploymentInfo) {
- this.deploymentInfo = deploymentInfo;
+ private StatelessSupplier(BeanContext beanContext) {
+ this.beanContext = beanContext;
}
public void discard(Instance instance, Pool.Event reason) {
- ThreadContext ctx = new ThreadContext(deploymentInfo, null);
+ ThreadContext ctx = new ThreadContext(beanContext, null);
ThreadContext oldCallContext = ThreadContext.enter(ctx);
try {
freeInstance(ctx, instance);
@@ -115,12 +115,12 @@ public class StatelessInstanceManager {
}
public Instance create() {
- ThreadContext ctx = new ThreadContext(deploymentInfo, null);
+ ThreadContext ctx = new ThreadContext(beanContext, null);
ThreadContext oldCallContext = ThreadContext.enter(ctx);
try {
- return ceateInstance(ctx, ctx.getDeploymentInfo());
+ return ceateInstance(ctx, ctx.getBeanContext());
} catch (OpenEJBException e) {
- logger.error("Unable to fill pool: for deployment '" + deploymentInfo.getDeploymentID() + "'", e);
+ logger.error("Unable to fill pool: for deployment '" + beanContext.getDeploymentID() + "'", e);
} finally {
ThreadContext.exit(oldCallContext);
}
@@ -144,8 +144,8 @@ public class StatelessInstanceManager {
* @throws OpenEJBException
*/
public Object getInstance(ThreadContext callContext) throws OpenEJBException {
- CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
- Data data = (Data) deploymentInfo.getContainerData();
+ BeanContext beanContext = callContext.getBeanContext();
+ Data data = (Data) beanContext.getContainerData();
Instance instance = null;
try {
@@ -167,21 +167,21 @@ public class StatelessInstanceManager {
if (instance != null) return instance;
- return ceateInstance(callContext, deploymentInfo);
+ return ceateInstance(callContext, beanContext);
}
- private Instance ceateInstance(ThreadContext callContext, CoreDeploymentInfo deploymentInfo) throws org.apache.openejb.ApplicationException {
+ private Instance ceateInstance(ThreadContext callContext, BeanContext beanContext) throws org.apache.openejb.ApplicationException {
try {
- 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 {
@@ -194,7 +194,7 @@ public class StatelessInstanceManager {
if (e instanceof InvocationTargetException) {
e = ((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 org.apache.openejb.ApplicationException(new RemoteException("Cannot obtain a free instance.", e));
}
@@ -218,8 +218,8 @@ public class StatelessInstanceManager {
if (bean == null) throw new SystemException("Invalid arguments");
Instance instance = Instance.class.cast(bean);
- CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
- Data data = (Data) deploymentInfo.getContainerData();
+ BeanContext beanContext = callContext.getBeanContext();
+ Data data = (Data) beanContext.getContainerData();
Pool<Instance> pool = data.getPool();
@@ -241,8 +241,8 @@ public class StatelessInstanceManager {
if (bean == null) throw new SystemException("Invalid arguments");
Instance instance = Instance.class.cast(bean);
- CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
- Data data = (Data) deploymentInfo.getContainerData();
+ BeanContext beanContext = callContext.getBeanContext();
+ Data data = (Data) beanContext.getContainerData();
Pool<Instance> pool = data.getPool();
@@ -252,11 +252,11 @@ public class StatelessInstanceManager {
private void freeInstance(ThreadContext callContext, Instance instance) {
try {
callContext.setCurrentOperation(Operation.PRE_DESTROY);
- CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+ BeanContext beanContext = callContext.getBeanContext();
- 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);
interceptorStack.invoke();
@@ -266,8 +266,8 @@ public class StatelessInstanceManager {
}
- public void deploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
- Options options = new Options(deploymentInfo.getProperties());
+ public void deploy(BeanContext beanContext) throws OpenEJBException {
+ Options options = new Options(beanContext.getProperties());
Duration accessTimeout = getDuration(options, "Timeout", this.accessTimeout, TimeUnit.MILLISECONDS);
accessTimeout = getDuration(options, "AccessTimeout", accessTimeout, TimeUnit.MILLISECONDS);
@@ -277,25 +277,25 @@ public class StatelessInstanceManager {
recipe.allow(Option.CASE_INSENSITIVE_FACTORY);
recipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
- recipe.setAllProperties(deploymentInfo.getProperties());
+ recipe.setAllProperties(beanContext.getProperties());
final Pool.Builder builder = (Pool.Builder) recipe.create();
setDefault(builder.getMaxAge(), TimeUnit.HOURS);
setDefault(builder.getIdleTimeout(), TimeUnit.MINUTES);
setDefault(builder.getInterval(), TimeUnit.MINUTES);
- final StatelessSupplier supplier = new StatelessSupplier(deploymentInfo);
+ final StatelessSupplier supplier = new StatelessSupplier(beanContext);
builder.setSupplier(supplier);
builder.setExecutor(executor);
Data data = new Data(builder.build(), accessTimeout, closeTimeout);
- deploymentInfo.setContainerData(data);
+ beanContext.setContainerData(data);
- deploymentInfo.set(EJBContext.class, data.sessionContext);
+ beanContext.set(EJBContext.class, data.sessionContext);
try {
- final Context context = deploymentInfo.getJndiEnc();
+ final Context context = beanContext.getJndiEnc();
context.bind("comp/EJBContext", data.sessionContext);
context.bind("comp/WebServiceContext", new EjbWsContext(data.sessionContext));
} catch (NamingException e) {
@@ -307,18 +307,18 @@ public class StatelessInstanceManager {
double maxAgeOffset = builder.getMaxAgeOffset();
// 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 {
@@ -363,8 +363,8 @@ public class StatelessInstanceManager {
return duration;
}
- 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();
@@ -378,13 +378,13 @@ public class StatelessInstanceManager {
try {
if (!data.closePool()) {
- logger.error("Timed-out waiting for stateless pool to close: for deployment '" + deploymentInfo.getDeploymentID() + "'");
+ logger.error("Timed-out waiting for stateless pool to close: for deployment '" + beanContext.getDeploymentID() + "'");
}
} catch (InterruptedException e) {
Thread.interrupted();
}
- deploymentInfo.setContainerData(null);
+ beanContext.setContainerData(null);
}
private final class Data {
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java Tue Sep 14 07:43:38 2010
@@ -30,7 +30,7 @@ import javax.ejb.TimerConfig;
import javax.transaction.Status;
import javax.transaction.TransactionManager;
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.InterfaceType;
import org.apache.openejb.OpenEJBException;
import org.apache.openejb.RpcContainer;
@@ -56,7 +56,7 @@ public class EjbTimerServiceImpl impleme
public static final String OPENEJB_TIMEOUT_JOB_NAME = "OPENEJB_TIMEOUT_JOB";
public static final String OPENEJB_TIMEOUT_JOB_GROUP_NAME = "OPENEJB_TIMEOUT_GROUP";
private final TransactionManager transactionManager;
- final DeploymentInfo deployment;
+ final BeanContext deployment;
private final boolean transacted;
private final int retryAttempts;
@@ -64,7 +64,7 @@ public class EjbTimerServiceImpl impleme
private Scheduler scheduler;
- public EjbTimerServiceImpl(DeploymentInfo deployment) {
+ public EjbTimerServiceImpl(BeanContext deployment) {
this(deployment, getDefaultTransactionManager(), getDefaultScheduler(), new MemoryTimerStore(getDefaultTransactionManager()), 1);
}
@@ -72,7 +72,7 @@ public class EjbTimerServiceImpl impleme
return SystemInstance.get().getComponent(TransactionManager.class);
}
- public EjbTimerServiceImpl(DeploymentInfo deployment, TransactionManager transactionManager, Scheduler scheduler, TimerStore timerStore, int retryAttempts) {
+ public EjbTimerServiceImpl(BeanContext deployment, TransactionManager transactionManager, Scheduler scheduler, TimerStore timerStore, int retryAttempts) {
this.deployment = deployment;
this.transactionManager = transactionManager;
this.scheduler = scheduler;
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerHandleImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerHandleImpl.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerHandleImpl.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerHandleImpl.java Tue Sep 14 07:43:38 2010
@@ -16,9 +16,9 @@
*/
package org.apache.openejb.core.timer;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.spi.ContainerSystem;
-import org.apache.openejb.DeploymentInfo;
import javax.ejb.NoSuchObjectLocalException;
import javax.ejb.Timer;
@@ -40,11 +40,11 @@ public class TimerHandleImpl implements
if (containerSystem == null) {
throw new NoSuchObjectLocalException("OpenEJb container system is not running");
}
- DeploymentInfo deploymentInfo = containerSystem.getDeploymentInfo(deploymentId);
- if (deploymentInfo == null) {
+ BeanContext beanContext = containerSystem.getBeanContext(deploymentId);
+ if (beanContext == null) {
throw new NoSuchObjectLocalException("Deployment info not found " + deploymentId);
}
- EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+ EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService == null) {
throw new NoSuchObjectLocalException("Deployment no longer supports ejbTimout " + deploymentId + ". Has this ejb been redeployed?");
}
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerImpl.java Tue Sep 14 07:43:38 2010
@@ -26,9 +26,8 @@ import javax.ejb.EJBException;
import java.io.Serializable;
import java.util.Date;
-import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.core.BaseContext;
-import org.apache.openejb.core.ThreadContext;
public class TimerImpl implements Timer {
private final TimerData timerData;
@@ -86,7 +85,7 @@ public class TimerImpl implements Timer
* Insure that timer methods can be invoked for the current operation on this Context.
*/
private void checkState() throws IllegalStateException, NoSuchObjectLocalException {
- final DeploymentInfo deployment = timerData.timerService.deployment;
+ final BeanContext deployment = timerData.timerService.deployment;
final BaseContext context = (BaseContext) deployment.get(EJBContext.class);
context.check(BaseContext.Call.timerMethod);
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerServiceWrapper.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerServiceWrapper.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerServiceWrapper.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerServiceWrapper.java Tue Sep 14 07:43:38 2010
@@ -26,7 +26,7 @@ import javax.ejb.Timer;
import javax.ejb.TimerConfig;
import javax.ejb.TimerService;
-import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.core.ThreadContext;
public class TimerServiceWrapper implements TimerService {
@@ -80,13 +80,13 @@ public class TimerServiceWrapper impleme
private TimerService getTimerService() throws IllegalStateException {
ThreadContext threadContext = ThreadContext.getThreadContext();
- CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
- EjbTimerService timerService = deploymentInfo.getEjbTimerService();
+ BeanContext beanContext = threadContext.getBeanContext();
+ EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService == null) {
- throw new IllegalStateException("This ejb does not support timers " + deploymentInfo.getDeploymentID());
- } else if(deploymentInfo.getEjbTimeout() == null) {
- throw new IllegalStateException("This ejb does not support timers " + deploymentInfo.getDeploymentID() + " due to no timeout method is configured");
+ throw new IllegalStateException("This ejb does not support timers " + beanContext.getDeploymentID());
+ } else if(beanContext.getEjbTimeout() == null) {
+ throw new IllegalStateException("This ejb does not support timers " + beanContext.getDeploymentID() + " due to no timeout method is configured");
}
- return new TimerServiceImpl(timerService, threadContext.getPrimaryKey(), deploymentInfo.getEjbTimeout());
+ return new TimerServiceImpl(timerService, threadContext.getPrimaryKey(), beanContext.getEjbTimeout());
}
}
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/EjbTransactionUtil.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/EjbTransactionUtil.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/EjbTransactionUtil.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/EjbTransactionUtil.java Tue Sep 14 07:43:38 2010
@@ -20,9 +20,9 @@ package org.apache.openejb.core.transact
import java.rmi.RemoteException;
import org.apache.openejb.ApplicationException;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.InvalidateReferenceException;
import org.apache.openejb.SystemException;
-import org.apache.openejb.DeploymentInfo;
import org.apache.openejb.core.Operation;
import org.apache.openejb.core.ThreadContext;
import org.apache.openejb.core.ThreadContextListener;
@@ -51,8 +51,8 @@ public final class EjbTransactionUtil {
*/
public static TransactionPolicy createTransactionPolicy(TransactionType type, ThreadContext threadContext) throws SystemException, ApplicationException {
// start the new transaction policy
- DeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
- TransactionPolicy txPolicy = deploymentInfo.getTransactionPolicyFactory().createTransactionPolicy(type);
+ BeanContext beanContext = threadContext.getBeanContext();
+ TransactionPolicy txPolicy = beanContext.getTransactionPolicyFactory().createTransactionPolicy(type);
// save previous EJB ThreadContext transaction policy so it can be restored later
TransactionPolicy oldTxPolicy = threadContext.getTransactionPolicy();
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/spi/ContainerSystem.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/spi/ContainerSystem.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/spi/ContainerSystem.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/spi/ContainerSystem.java Tue Sep 14 07:43:38 2010
@@ -16,26 +16,23 @@
*/
package org.apache.openejb.spi;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.Container;
-import org.apache.openejb.DeploymentInfo;
-import org.apache.openejb.core.WebDeploymentInfo;
-import org.apache.openejb.core.JndiFactory;
+import org.apache.openejb.core.WebContext;
import javax.naming.Context;
-import javax.xml.namespace.QName;
-import java.net.URL;
public interface ContainerSystem {
- public DeploymentInfo getDeploymentInfo(Object id);
+ public BeanContext getBeanContext(Object id);
- public DeploymentInfo [] deployments();
+ public BeanContext[] deployments();
public Container getContainer(Object id);
public Container [] containers();
- WebDeploymentInfo getWebDeploymentInfo(String id);
+ WebContext getWebContext(String id);
Context getJNDIContext();
}
\ No newline at end of file
Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/AccessTimeoutTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/AccessTimeoutTest.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/AccessTimeoutTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/AccessTimeoutTest.java Tue Sep 14 07:43:38 2010
@@ -18,7 +18,7 @@ package org.apache.openejb.assembler.cla
import junit.framework.TestCase;
import org.apache.openejb.config.ConfigurationFactory;
-import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.jee.EjbJar;
import org.apache.openejb.jee.SingletonBean;
import org.apache.openejb.loader.SystemInstance;
@@ -109,11 +109,11 @@ public class AccessTimeoutTest extends T
private void loadAttributes(EjbJarInfo ejbJarInfo, String deploymentId) {
ContainerSystem system = SystemInstance.get().getComponent(ContainerSystem.class);
- CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) system.getDeploymentInfo(deploymentId);
+ BeanContext beanContext = system.getBeanContext(deploymentId);
List<MethodConcurrencyInfo> lockInfos = new ArrayList<MethodConcurrencyInfo>();
List<MethodConcurrencyInfo> accessTimeoutInfos = new ArrayList<MethodConcurrencyInfo>();
MethodConcurrencyBuilder.normalize(ejbJarInfo.methodConcurrency, lockInfos, accessTimeoutInfos);
- attributes = MethodInfoUtil.resolveAttributes(accessTimeoutInfos, deploymentInfo);
+ attributes = MethodInfoUtil.resolveAttributes(accessTimeoutInfos, beanContext);
}
private void assertAttribute(long time, TimeUnit unit, Method method) {
Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/ConcurrentLockTypeTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/ConcurrentLockTypeTest.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/ConcurrentLockTypeTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/ConcurrentLockTypeTest.java Tue Sep 14 07:43:38 2010
@@ -17,8 +17,8 @@
package org.apache.openejb.assembler.classic;
import junit.framework.TestCase;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.config.ConfigurationFactory;
-import org.apache.openejb.core.CoreDeploymentInfo;
import org.apache.openejb.jee.ConcurrentLockType;
import org.apache.openejb.jee.ContainerConcurrency;
import org.apache.openejb.jee.EjbJar;
@@ -116,11 +116,11 @@ public class ConcurrentLockTypeTest exte
private void loadAttributes(EjbJarInfo ejbJarInfo, String deploymentId) {
ContainerSystem system = SystemInstance.get().getComponent(ContainerSystem.class);
- CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) system.getDeploymentInfo(deploymentId);
+ BeanContext beanContext = system.getBeanContext(deploymentId);
List<MethodConcurrencyInfo> lockInfos = new ArrayList<MethodConcurrencyInfo>();
List<MethodConcurrencyInfo> accessTimeoutInfos = new ArrayList<MethodConcurrencyInfo>();
MethodConcurrencyBuilder.normalize(ejbJarInfo.methodConcurrency, lockInfos, accessTimeoutInfos);
- attributes = MethodInfoUtil.resolveAttributes(lockInfos, deploymentInfo);
+ attributes = MethodInfoUtil.resolveAttributes(lockInfos, beanContext);
}
private void assertAttribute(String attribute, Method method) {
Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/ConcurrentMethodTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/ConcurrentMethodTest.java?rev=996774&r1=996773&r2=996774&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/ConcurrentMethodTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/ConcurrentMethodTest.java Tue Sep 14 07:43:38 2010
@@ -17,8 +17,8 @@
package org.apache.openejb.assembler.classic;
import junit.framework.TestCase;
+import org.apache.openejb.BeanContext;
import org.apache.openejb.config.ConfigurationFactory;
-import org.apache.openejb.core.CoreDeploymentInfo;
import org.apache.openejb.jee.EjbJar;
import org.apache.openejb.jee.SingletonBean;
import org.apache.openejb.loader.SystemInstance;
@@ -72,12 +72,12 @@ public class ConcurrentMethodTest extend
private void loadAttributes(EjbJarInfo ejbJarInfo, String deploymentId) {
ContainerSystem system = SystemInstance.get().getComponent(ContainerSystem.class);
- CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) system.getDeploymentInfo(deploymentId);
+ BeanContext beanContext = system.getBeanContext(deploymentId);
List<MethodConcurrencyInfo> lockInfos = new ArrayList<MethodConcurrencyInfo>();
List<MethodConcurrencyInfo> accessTimeoutInfos = new ArrayList<MethodConcurrencyInfo>();
MethodConcurrencyBuilder.normalize(ejbJarInfo.methodConcurrency, lockInfos, accessTimeoutInfos);
- accessTimeoutAttributes = MethodInfoUtil.resolveAttributes(accessTimeoutInfos, deploymentInfo);
- lockAttributes = MethodInfoUtil.resolveAttributes(lockInfos, deploymentInfo);
+ accessTimeoutAttributes = MethodInfoUtil.resolveAttributes(accessTimeoutInfos, beanContext);
+ lockAttributes = MethodInfoUtil.resolveAttributes(lockInfos, beanContext);
}
private void assertAccessTimeoutAttribute(long time, TimeUnit unit, Method method) {