コード例 #1
0
ファイル: CmpContainer.java プロジェクト: Sathis/tomee
 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
ファイル: CmpContainer.java プロジェクト: Sathis/tomee
  @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
ファイル: CmpContainer.java プロジェクト: Sathis/tomee
  @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);
    }
  }