示例#1
0
 private EntityBean createNewInstance(final ThreadContext callContext) {
   final BeanContext beanContext = callContext.getBeanContext();
   try {
     return (EntityBean) beanContext.getCmpImplClass().newInstance();
   } catch (final Exception e) {
     throw new EJBException(
         "Unable to create new entity bean instance " + beanContext.getCmpImplClass(), e);
   }
 }
示例#2
0
  @Override
  public void undeploy(final BeanContext beanContext) throws OpenEJBException {
    synchronized (this) {
      deploymentsById.remove(beanContext.getDeploymentID());
      beansByClass.remove(beanContext.getCmpImplClass());

      try {
        final Field field = beanContext.getCmpImplClass().getField("deploymentInfo");
        field.set(null, null);
      } catch (final Exception e) {
        // ignore
      }

      beanContext.setContainer(null);
      beanContext.setContainerData(null);
    }
  }
示例#3
0
  @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);
    }
  }