use of org.apache.openejb.BeanContext in project tomee by apache.
the class BaseContext method getEJBLocalHome.
public EJBLocalHome getEJBLocalHome() {
final ThreadContext threadContext = ThreadContext.getThreadContext();
final BeanContext di = threadContext.getBeanContext();
return di.getEJBLocalHome();
}
use of org.apache.openejb.BeanContext in project tomee by apache.
the class BaseContext method getRollbackOnly.
public boolean getRollbackOnly() throws IllegalStateException {
doCheck(Call.getRollbackOnly);
final ThreadContext threadContext = ThreadContext.getThreadContext();
final BeanContext di = threadContext.getBeanContext();
if (di.isBeanManagedTransaction()) {
throw new IllegalStateException("bean-managed transaction beans can not access the getRollbackOnly() method: deploymentId=" + di.getDeploymentID());
}
final TransactionPolicy txPolicy = threadContext.getTransactionPolicy();
if (txPolicy == null) {
throw new IllegalStateException("ThreadContext does not contain a TransactionEnvironment");
}
if (txPolicy.getTransactionType() == TransactionType.Never || txPolicy.getTransactionType() == TransactionType.NotSupported || txPolicy.getTransactionType() == TransactionType.Supports) {
throw new IllegalStateException("getRollbackOnly accessible only from MANDATORY, REQUIRED, or REQUIRES_NEW");
}
return txPolicy.isRollbackOnly();
}
use of org.apache.openejb.BeanContext in project tomee by apache.
the class BaseContext method getUserTransaction.
public UserTransaction getUserTransaction(final UserTransaction userTransaction) throws IllegalStateException {
final ThreadContext threadContext = ThreadContext.getThreadContext();
final BeanContext di = threadContext.getBeanContext();
if (di.isBeanManagedTransaction()) {
return userTransaction;
} else {
throw new IllegalStateException("container-managed transaction beans can not access the UserTransaction");
}
}
use of org.apache.openejb.BeanContext in project tomee by apache.
the class EjbSelect method execute_byte.
public static byte execute_byte(final Object obj, final String methodSignature, final Object... args) throws FinderException {
final BeanContext beanContext = (BeanContext) obj;
final Container container = beanContext.getContainer();
if (!(container instanceof CmpContainer)) {
throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
}
final CmpContainer cmpContainer = (CmpContainer) container;
final Number result = (Number) cmpContainer.select(beanContext, methodSignature, "byte", args);
return result.byteValue();
}
use of org.apache.openejb.BeanContext in project tomee by apache.
the class EjbSelect method execute_short.
public static short execute_short(final Object obj, final String methodSignature, final Object... args) throws FinderException {
final BeanContext beanContext = (BeanContext) obj;
final Container container = beanContext.getContainer();
if (!(container instanceof CmpContainer)) {
throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
}
final CmpContainer cmpContainer = (CmpContainer) container;
final Number result = (Number) cmpContainer.select(beanContext, methodSignature, "short", args);
return result.shortValue();
}
Aggregations