Examples of JDOPersistentObjectItf


Examples of org.objectweb.speedo.mim.jdo.api.JDOPersistentObjectItf

    public void evict(Object o) {
      if (o == null)
        return;
        assertIsOpen();
        bindPMThread();
        JDOPersistentObjectItf sp = (JDOPersistentObjectItf) o;
        if (tx.isActive() && sp.jdoIsDirty())
            throw new JDOUserException("Impossible to evict a dirty " +
                    "instance attached to an active transaction");
        try {
      tpm.evict(tx, sp.getCeIdentifier(), false);
        } catch (PersistenceException e) {
            throw new JDOUserException(
                "Impossible to evict the persistent object from the cache", e);
        }
    }
View Full Code Here

Examples of org.objectweb.speedo.mim.jdo.api.JDOPersistentObjectItf

        assertIsOpen();
        bindPMThread();
    assertIsPO(o, "");
    if (o == null)
      return null;
    JDOPersistentObjectItf jdopo = (JDOPersistentObjectItf) o;
    if (jdopo.speedoGetReferenceState().getDetachedStatus() == DetachedLifeCycle.DETACHED_NONE) {
      return speedoMakePersistent((PersistentObjectItf) o, null);
    } else {
      return speedoAttachCopy(o, new HashMap());
    }
    }
View Full Code Here

Examples of org.objectweb.speedo.mim.jdo.api.JDOPersistentObjectItf

      return speedoAttachCopy(o, new HashMap());
    }
    }
   
    public Object speedoMakePersistent(PersistentObjectItf po, Map map) {
        JDOPersistentObjectItf jdopo = (JDOPersistentObjectItf) po;
        if (jdopo.jdoIsPersistent())
            return po;
        if (!jdopo.speedoIsActive()) {
          if (jdopo.speedoGetReferenceState().getDetachedStatus() != DetachedLifeCycle.DETACHED_NONE) {
             return null;
          }
        }
        synchronized(jdopo) {
            if (jdopo.jdoIsPersistent())
                return po;
            try {
              return speedoPersist(po, map);
            } catch (Exception e) {
                try {
                    jdopo.init(null);
                } catch (PException e1) {
                    logger.log(BasicLevel.WARN, "Error during unbinding:", e1);
                }
                if (e instanceof RolledBackPersistenceException) {
                    throw ((JDOTransactionItf) tx).rollBackOnInternalError(e);
View Full Code Here

Examples of org.objectweb.speedo.mim.jdo.api.JDOPersistentObjectItf

        bindPMThread();
        speedoDeletePersistent(o);
    }
  
    public void speedoDeletePersistent(Object o) {
        JDOPersistentObjectItf sp = (JDOPersistentObjectItf) o;
      // Verify the instance is managed by this persistence manager
      assertPOManager(sp);
      // Verify the transaction is active
      if (!tx.isActive()) {
        throw new JDOUserException("DeletePersistent " +
            "must be called in an active transaction");
      }
      StateItf sa = null;
      try {
        if (!sp.jdoIsPersistent()) {
          throw new JDOUserException(
              "DeletePersistent on an instance non persistent.");
        }
        if (sp.jdoIsDeleted()) {
          return;
        }
             sp.speedoGetHome().sendEvent(HomeItf.PRE_REMOVE, sp, null);
        sa = (StateItf) tpm.unexport(tx, sp);
             sp.speedoGetHome().sendEvent(HomeItf.POST_REMOVE, sp, null);
      } catch (RolledBackPersistenceException e) {
        throw ((JDOTransactionItf) tx).rollBackOnInternalError(e);
      } catch (PersistenceException e) {
        throw new JDOException("", ExceptionHelper.getNested(e));
      }
      //remove the multivalued fields and cascade delete
      sa.deletePersistent(this);
        if (logger.isLoggable(BasicLevel.DEBUG)) {
            logger.log(BasicLevel.DEBUG,
                    "Delete a persistent instance, identifier=" + sp.getPName());
        }
    }
View Full Code Here

Examples of org.objectweb.speedo.mim.jdo.api.JDOPersistentObjectItf

    bindPMThread();
    if (o == null || !(o instanceof JDOPersistentObjectItf)
      || !((JDOPersistentObjectItf) o).jdoIsPersistent()) {
      return;
    }
        JDOPersistentObjectItf sp = (JDOPersistentObjectItf) o;
        synchronized(sp) {
      if (sp.jdoIsDirty()) {
        throw new JDOUserException("Try to make transient a dirty instance.");
            }
      try {
        tpm.unbind(tx, sp);
      } catch (PersistenceException e) {
View Full Code Here

Examples of org.objectweb.speedo.mim.jdo.api.JDOPersistentObjectItf

            return;
        makeTransactionalAll(pcs.toArray());
    }

    public void makeNontransactional(Object o) {
        JDOPersistentObjectItf sp = (JDOPersistentObjectItf) o;
        //preconditions
        assertIsOpen();
        bindPMThread();
        assertIsPO(sp, "");
        assertPOManager(sp);
        if (sp.jdoIsDirty())
            throw new JDOUserException("Try to make non-transactional a dirty instance.");
    sp.speedoGetState().speedoChangeStatus(LifeCycle.ACTION_MAKENONTRANSACTIONAL);
    }
View Full Code Here

Examples of org.objectweb.speedo.mim.jdo.api.JDOPersistentObjectItf

    assertIsPO(o, "detachCopy");
    return speedoDetachCopy((PersistentObjectItf)o, new HashMap(), new ArrayList());
  }
 
  public Object speedoDetachCopy(PersistentObjectItf po, Map map, Collection fgHints){
        JDOPersistentObjectItf jdopo = (JDOPersistentObjectItf) po;
    //check the meta info about the detachability of the class
    if(jdopo.jdoIsPersistent()){
      if(jdopo.jdoIsDeleted()){
        //persistent_deleted
        if(!jdopo.jdoIsNew())
          throw new JDOUserException("This object cannot be detached: it has been deleted from the datastore.");
      }
    }
    else{
      //makePersistent
      speedoMakePersistent(jdopo, null);
   
    if(!jdopo.speedoGetHome().isDetachable()){
      throw new JDOUserException("This class cannot be detached: it has not been defined as detachable in the jdo file.");
    }
      jdopo.speedoGetHome().sendEvent(HomeItf.PRE_DETACH, jdopo, null);
    //persistent_new or persistent_dirty: updated with object id and version
    if(jdopo.jdoIsTransactional() && jdopo.jdoIsDirty()){
      try{
        StateItf sa = (StateItf) tpm.writeIntention(tx, jdopo, null);
        if(!sa.hasBeenFlush()){
          //flush
          tpm.flush(tx, sa);
        }
      } catch (Exception e) {
        throw new JDODataStoreException(
        "Problem while flushing a persistent object in order to detach a copy.",
        new Exception[]{ExceptionHelper.getNested(e)});
      }
    }
    //the core processing
    //avoid cycles using a map
    try{
      synchronized(fgHints){
        PersistentObjectItf copy = jdopo.speedoGetHome().detachCopy(jdopo, this, map, null, fgHints);
        if (jdopo.speedoGetHome().getVersioningStrategy() == SpeedoVersion.VERSION_NUMBER) {
          copy.speedoGetReferenceState().speedoChangeVersion();
        }
        return copy;
      }
    }
    catch(Exception e){
      throw new JDOUserException("Detach cannot be performed", new Exception[]{ExceptionHelper.getNested(e)});
    } finally {
        jdopo.speedoGetHome().sendEvent(HomeItf.POST_DETACH, jdopo, null);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.