Package org.objectweb.speedo.mim.api

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


    // IMPLEMENTATION OF THE PersistentObjectItf INTERFACE //
    //---------------------------------------------//

    public boolean speedoIsPersistent() {
        StateItf sa = speedoGetState();
        return sa == null || LifeCycle.isPersistent(sa.speedoGetStatus());
    }
View Full Code Here


     */
    public State bind(State state, Object oid, byte mode) {
        State old = super.bind(state, oid, mode);
        if(! (state instanceof VirtualState)){
            if (mode == BasicWorkingSet.WRITE_INTENTION) {
                StateItf sa = (StateItf) state;
                sa.speedoChangeVersion();
            }
        }
        return old;
    }
View Full Code Here

            }
                for (Iterator it = toRemoved.iterator(); it.hasNext();) {
                    Object o = it.next();
                    if (o instanceof PersistentObjectItf) {
                        pm.speedoDeletePersistent(o);
                        StateItf s = ((PersistentObjectItf) o).speedoGetState();
                        s.setFlushed(true);
                    } else {
                        pm.speedoDeletePersistent(o, candidateClass);
                    }
                }
                pm.deletePersistentAll(toRemoved);
View Full Code Here

     *
     * @throws IOException
     */
    public static void writeObject(java.io.ObjectOutputStream out,
            PersistentObjectItf sp, long[] fieldIds) throws IOException {
        StateItf state;
        boolean pmAllocated = false;
        POManagerItf pm = null;
        if (sp.speedoIsActive()) {
            // Fetch the PersistenceManager
            pm = sp.speedoGetHome().getPOManagerFactory().lookup();
View Full Code Here

    public void read(ConnectionHolder context, Object oid, State obj) throws PersistenceException {
        if (logger.isLoggable(BasicLevel.DEBUG))
            logger.log(BasicLevel.DEBUG, "read ctx=" + context
                    + " / oid=" + oid
                    + " / obj.class=" + obj.getClass().getName());
        StateItf state = (StateItf) obj;
    PersistentObjectItf pb = (PersistentObjectItf) state.getSpeedoPO();
    int speedoStatus = state.speedoGetStatus();
    if (pb.getStatus() == PBinding.LIFECYCLE_DELTOWRITE
            && speedoStatus != LifeCycle.PERSISTENT_DELETED
            && speedoStatus != LifeCycle.PERSISTENT_NEW_DELETED) {
        throw new PersistenceException(
                "Concurrency problem, transaction must be rolledback");
    }
        try {
            pb.read(context, state);
            context.getWorkingSet().bind(state, oid, WorkingSet.UNKNOWN_INTENTION);
            //modified with rebind
            state.indexFieldModified(Integer.MAX_VALUE, true);
          pb.speedoGetHome().sendEvent(HomeItf.POST_LOAD, pb, null);
        } catch (PExceptionNoDSI e) {
      if (logger.isLoggable(BasicLevel.DEBUG)) {
              logger.log(BasicLevel.DEBUG, "read ==> NO DSI");
      }
View Full Code Here

    if (logger.isLoggable(BasicLevel.DEBUG))
            logger.log(BasicLevel.DEBUG, "read conn=" + conn
                    + " / oid=" + oid
                    + " / obj.class=" + obj.getClass().getName()
                    + " / tx=" + ws);
        StateItf state = (StateItf) obj;
    PersistentObjectItf pb = (PersistentObjectItf) state.getSpeedoPO();
    int speedoStatus = state.speedoGetStatus();
    if (pb.getStatus() == PBinding.LIFECYCLE_DELTOWRITE
            && speedoStatus != LifeCycle.PERSISTENT_DELETED
            && speedoStatus != LifeCycle.PERSISTENT_NEW_DELETED) {
        throw new PersistenceException(
                "Concurrency problem, transaction must be rolledback");
    }
    Object ctx = usePrefetchBuffer(ws, oid) ? ws : null;
        try {
            pb.read(conn, state, ctx, forUpdate);
            ws.bind(state, oid, WorkingSet.UNKNOWN_INTENTION);
            //modified with rebind
            state.indexFieldModified(Integer.MAX_VALUE, true);
          pb.speedoGetHome().sendEvent(HomeItf.POST_LOAD, pb, null);
    } catch (PExceptionNoDSI e) {
      if (logger.isLoggable(BasicLevel.DEBUG)) {
              logger.log(BasicLevel.DEBUG, "read ==> NO DSI");
      }
View Full Code Here

    return ((PersistentObjectItf) ce).speedoCreateState();
  }

  public State createState(State s) {
    PersistentObjectItf sp = (PersistentObjectItf) s.getCacheEntry();
    StateItf sa = sp.speedoCreateState();
    sp.speedoCopyState(((StateItf) s), sa);
    return sa;
  }
View Full Code Here

        sp.speedoGetHome().sendEvent(HomeItf.POST_CLEAR, sp, null);
    }
  }

  public void makeClean(State state) {
        StateItf sa = (StateItf) state;
    sa.speedoSetStatus(LifeCycle.PERSISTENT_CLEAN);
  }
View Full Code Here

   * field of the given speedo accessor may be accessed by the caller of this
   * method.
   */
  public final StateItf readIntention(PersistentObjectItf sp, long[] fields) {
    if (!sp.speedoIsActive()) {
      StateItf sa = sp.speedoGetReferenceState();
      if (sa == null) {
        sp.speedoSetReferenceState(sp.speedoCreateState());
      }
      return sa;
    }
    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",
View Full Code Here

   * field of the given speedo accessor may be accessed by the caller of this
   * method.
   */
  public StateItf writeIntention(PersistentObjectItf sp, long[] fields, Object thinLock) {
    if (!sp.speedoIsActive()) {
      StateItf sa = sp.speedoGetReferenceState();
      if (sa == null) {
        sp.speedoSetReferenceState(sp.speedoCreateState());
      }
      return sa;
    }
    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) {
View Full Code Here

TOP

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

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.