use of org.apache.openejb.core.entity.EntityContext in project tomee by apache.
the class CmpContainer method setEntityContext.
private void setEntityContext(final EntityBean entityBean) {
if (entityBean == null) {
throw new NullPointerException("entityBean is null");
}
// activating entity doen't have a primary key
final BeanContext beanContext = getBeanContextByClass(entityBean.getClass());
final ThreadContext callContext = new ThreadContext(beanContext, null);
callContext.setCurrentOperation(Operation.SET_CONTEXT);
final ThreadContext oldCallContext = ThreadContext.enter(callContext);
try {
entityBean.setEntityContext(new EntityContext(securityService));
} catch (final RemoteException e) {
throw new EJBException(e);
} finally {
ThreadContext.exit(oldCallContext);
}
}
use of org.apache.openejb.core.entity.EntityContext in project tomee by apache.
the class CmpContainer method deploy.
@Override
public void deploy(final BeanContext beanContext) throws OpenEJBException {
synchronized (this) {
final Object deploymentId = beanContext.getDeploymentID();
cmpEngine.deploy(beanContext);
beanContext.setContainerData(cmpEngine);
beanContext.set(EJBContext.class, new EntityContext(securityService));
// try to set deploymentInfo static field on bean implementation class
try {
final Field field = beanContext.getCmpImplClass().getField("deploymentInfo");
field.set(null, beanContext);
} catch (final Exception e) {
// ignore
}
// add to indexes
deploymentsById.put(deploymentId, beanContext);
beansByClass.put(beanContext.getCmpImplClass(), beanContext);
beanContext.setContainer(this);
}
}
Aggregations