Package org.objectweb.speedo.workingset.api

Examples of org.objectweb.speedo.workingset.api.TransactionItf


   */
  public synchronized void registerSynchronization() throws XAException {
    if (xac.synchroRegistred) {
      return;
    }
    TransactionItf tx = xac.pm.getSpeedoTransaction();
    if (tx.isActive() && logger != null) {
      logger.log(BasicLevel.WARN, "Speedo TransactionItf started and the " +
          "PersistenceManager is not marked as registered to " +
          "the XA transaction");
    }
    if (Debug.ON && logger != null && logger.isLoggable(BasicLevel.DEBUG)) {
      logger.log(BasicLevel.DEBUG, "registerSynchronization");
    }
    TransactionManager tm = mcf.tm;
    if (tm == null) {
      String msg = "Impossible to register the Speedo " +
          "container as synchronization on the current transaction: " +
          (tm == null
          ? "The transaction manager has not found with the JNDI name: "
          + mcf.getTransactionManagerJNDIName()
          : "The TransactionItf object of the Speedo implementation does not implement javax.transaction.Synchronization");
      if (logger != null) {
          logger.log(BasicLevel.ERROR, msg);
            }
      throw new XAException(msg);
    }
    try {
      tm.getTransaction().registerSynchronization(xac.pm);
      if (!tx.isActive()) {
        tx.begin();
      }
      xac.synchroRegistred = true;
    } catch (RollbackException e) {
      //The JDO container cannot be registered then the transaction
      // must be rolledback
      if (tx.isActive()) {
        tx.rollback();
      }
    } catch (Exception e) {
      String msg = "Impossible to register the Speedo " +
          "container as synchronization on the current" +
          " transaction: " + e.getMessage();
View Full Code Here


      BindingController pmBC = Fractal.getBindingController(pmC);

      //instanciate the JDOTransactionItf
      Component tC = Fractal.getFactory(tT).newFcInstance();
      Fractal.getNameController(tC).setFcName("transaction");
      TransactionItf t = (TransactionItf) tC.getFcInterface("transaction");
      BindingController tBC = Fractal.getBindingController(tC);

      //Add the new components into the Speedo composite
      Fractal.getContentController(speedoComponent).addFcSubComponent(pmC);
      Fractal.getContentController(speedoComponent).addFcSubComponent(tC);

      //add bindings on the po manager
      pmBC.bindFc(JDOPOManager.JORM_FACTORY_BINDING,
        components[JF_COMPONENT_IDX]);
      pmBC.bindFc(JDOPOManager.PNAME_CODER_BINDING,
        components[PNC_COMPONENT_IDX]);
      pmBC.bindFc(JDOPOManager.PO_MANAGER_FACTORY_BINDING,
        components[PMF_COMPONENT_IDX]);
      pmBC.bindFc(JDOPOManager.QUERY_MANAGER_BINDING,
        components[QM_COMPONENT_IDX]);
      pmBC.bindFc(JDOPOManager.TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING,
        components[TPM_COMPONENT_IDX]);
      pmBC.bindFc(JDOPOManager.TRANSACTION_BINDING, t);

      //add bindings on the transaction
      tBC.bindFc(AbstractTransaction.PO_MANAGER_BINDING, pm);
      tBC.bindFc(AbstractTransaction.TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING,
        components[TPM_COMPONENT_IDX]);
      tBC.bindFc(AbstractTransaction.MAPPER_BINDING,
        components[MAPPER_COMPONENT_IDX]);

      //Add a ConenctionHolder to the transaction
      t.setConnectionHolder(chf.createConnectionHolder());

      //start components
      Fractal.getLifeCycleController(pmC).startFc();
      Fractal.getLifeCycleController(tC).startFc();
View Full Code Here

    }
    POManagerItf pm = pmf.lookup();
    if (pm == null) {
        throw personality.newUserRuntimeException("When a persistent object is used (read), a PersistenceManager is needed");
    }
    TransactionItf t = pm.getSpeedoTransaction();
    try {
        StateItf sa = (StateItf) tpm.readIntention(t, sp, null);
        sa.loadFields(pm, fields);
        return sa;
        } catch (RolledBackPersistenceException e) {
            throw t.rollBackOnInternalError(e);
    } catch (PersistenceException e) {
      throw personality.newRuntimeException("Impossible to notify a read intention",
              ExceptionHelper.getNested(e));
    }
  }
View Full Code Here

    }
    POManagerItf pm = pmf.lookup();
    if (pm == null) {
        throw personality.newUserRuntimeException("When a persistent object is used (read), a PersistenceManager/EntityManager is needed");
    }
    TransactionItf t = pm.getSpeedoTransaction();
    try {
      sendEvent(PRE_DIRTY, sp, null);
        StateItf sa = (StateItf) tpm.writeIntention(t, sp,
                isFieldLockingLevel ? thinLock : null);
        sa.loadFields(pm, fields);
      sendEvent(POST_DIRTY, sp, null);
        return sa;
        } catch (RolledBackPersistenceException e) {
            throw t.rollBackOnInternalError(e);
    } catch (PersistenceException e) {
      throw personality.newRuntimeException("Impossible to notify a write intention",
        ExceptionHelper.getNested(e));
    }
  }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.workingset.api.TransactionItf

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.