Package org.objectweb.speedo.mim.api

Examples of org.objectweb.speedo.mim.api.PersistentObjectItf


     * @param o the instance to refresh.
     */
    public void refresh(Object o) {
      if (o == null)
        return;
      PersistentObjectItf sp = (PersistentObjectItf) o;
      assertIsOpen();
      bindPMThread();
      assertIsPO(sp, "refresh");
        assertPOManager(sp);
        if (!sp.speedoIsActive())
            throw new JDOUserException("Refresh on a transient instance.");
      speedoRefresh(sp, new HashMap(), new ArrayList());
    }
View Full Code Here


        try {
            assertIsPO(pc, "");
        } catch (Exception e) {
            return null;
        }
        PersistentObjectItf sp = (PersistentObjectItf) pc;
        if (!sp.speedoIsActive())
            throw new JDOUserException("Object non persistent.");
        assertPOManager(sp);
        try {
            return pnc.encodeAbstract(sp.getPName());
        } catch (PException e) {
            throw new JDOException(
                    "Problem while encoding persistent name.",
                    new Exception[]{ExceptionHelper.getNested(e)});
        }
View Full Code Here

            if (!mustLoad) {
                //TODO: manage cascade delete
            }
        }
        if (mustLoad) {
            PersistentObjectItf po = (PersistentObjectItf) speedoGetObjectById(oid, false);
            speedoDeletePersistent(po);
            return;
        }
        //no listener or callback
//TODO       
View Full Code Here

    }
    //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){
View Full Code Here

    // then return the attached copy
    if (o != null)
      return o;
   
    Object oid = ((PersistentObjectItf)detached).speedoGetEncodedPName();
    PersistentObjectItf sp = null;
    try {
      if (oid == null) {
        //make the object persistent
        speedoMakePersistent((PersistentObjectItf) detached, map);
        //return detached;
        sp = (PersistentObjectItf) detached;
      } else {
        sp = (PersistentObjectItf) speedoGetObjectById(oid, false);
      }
        sp.speedoGetHome().sendEvent(HomeItf.PRE_ATTACH, sp, null);
      StateItf sar = sp.speedoGetHome().readIntention(sp, null);
      //if made persistent in this method
      // force the state to detached_dirty
      if (oid == null) {
        sar.forceDetachedDirty();
      }
      //call the attach method on the po
      sp.speedoGetHome().attachCopy(sp, this, map, detached, sar);
      // if made persistent in this method
      // restore the state to detached_none
      if (oid == null) {
        sar.restoreDetachedNone();
      }
      //change the version on attach
      sar.speedoChangeVersion();
        sp.speedoGetHome().sendEvent(HomeItf.POST_ATTACH, sp, null);
      return sp;
    } catch (Exception e) {
      Exception ie = ExceptionHelper.getNested(e);
      String msg = "Impossible to attach a copy of the persistent object with the identifier: " + oid;
      logger.log(BasicLevel.INFO, msg, ie);
View Full Code Here

        try {
            assertIsPO(o, "");
        } catch (Exception e) {
            return null;
        }
        PersistentObjectItf po = (PersistentObjectItf) o;
        assertPOManager(po);
        if (!po.speedoIsActive()) {
            throw new SpeedoRuntimeException("Non persistent object does not have identifier: " + o);
        }
        try {
            return pnc.encodeAbstract(po.getPName());
        } catch (PException e) {
            throw new SpeedoRuntimeException(
                    "Problem while encoding persistent name.",
                    new Exception[]{ExceptionHelper.getNested(e)});
        }
View Full Code Here

      Object elem = iElem.getElement(pm);
      Object clone = null;
      //if the element is a Persistent Object
      if (elem instanceof PersistentObjectItf) {
        //get the speedo po associated
        PersistentObjectItf sp = (PersistentObjectItf) elem;
        if(detachCtx != null)
          clone = detachCtx.get(sp);
        if(clone == null){
          synchronized(fgHints){
            if(valueToFetch){
View Full Code Here

        elem = ((MapElem) elem).getElement();
      }
      //if the element is a Persistent Object, attach it
      if (elem instanceof PersistentObjectItf) {
        //get the detached speedo po
        PersistentObjectItf spDetached = (PersistentObjectItf) elem;
        PersistentObjectItf sp = (PersistentObjectItf) attachCtx.get(spDetached);
        if(sp == null){
          attachCtx.put(spDetached, sp);
          sp = (PersistentObjectItf) pm.speedoAttachCopy(spDetached, attachCtx);
        }
        //get the pname
        elem = sp.getPName();
      }
      if (put) {
        //put the elem in the element list
        put(key, elem, false);
      }
View Full Code Here

      MapElem iElem = (MapElem) it.next();
      Object elem = iElem.getElement(pm);
      //if the element is a PO
      if (elem instanceof PersistentObjectItf) {
        //get the speedo po associated
        PersistentObjectItf sp = (PersistentObjectItf) elem;
        if(ctx != null && !ctx.containsKey(sp.getPName())){
          synchronized(fgHints){
            if(valueToFetch){
              if (refresh) {
                //refresh
                              pm.speedoRefresh(sp, ctx, fgHintsToSend);
View Full Code Here

    while(it.hasNext()){
      Object elem = it.next();
      //if it is a persistent object
      if (elem instanceof PersistentObjectItf) {
        //get the detached speedo po
        PersistentObjectItf spDetached = (PersistentObjectItf) elem;
        PersistentObjectItf sp = (PersistentObjectItf) map.get(spDetached);
        if(sp == null){
          map.put(spDetached, sp);
          sp = (PersistentObjectItf) pm.speedoAttachCopy(spDetached, map);
        }
        //put the element of the collection attribute in the elements attribute (the opposite of the jdoDetachCopy method)
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.mim.api.PersistentObjectItf

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.