Package org.objectweb.perseus.persistence.api

Examples of org.objectweb.perseus.persistence.api.PersistenceException


                    "unexport(hints) ctx=" + context + " / oid=" + oid);
        }
        try {
            ((PName) oid).unexport(context, hints);
        } catch (PException e) {
            throw new PersistenceException(e);
        }
      registerUnexport(context.getWorkingSet(), oid);
    }
View Full Code Here


    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");
      }
      throw new NoDSIPersistenceException(e);
    } catch (PException e) {
            Exception ie = ExceptionHelper.getNested(e);
            logger.log(BasicLevel.ERROR, "read ctx=" + context
                      + " / oid=" + oid
                      + " / obj.class=" + obj.getClass().getName(), ie);
            throw new PersistenceException(ie);
        }
    }
View Full Code Here

    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");
      }
      throw new NoDSIPersistenceException(e);
        } catch (PException e) {
            Exception ie = ExceptionHelper.getNested(e);
            logger.log(BasicLevel.ERROR, "read conn=" + conn
                    + " / oid=" + oid
                    + " / obj.class=" + obj.getClass().getName()
                    + " / tx=" + ws, ie);
            throw new PersistenceException(ie);
        }
    }
View Full Code Here

      try {
        pb.write(context, (PAccessor) obj);
      } catch (PExceptionNoDSI e) {
        throw new NoDSIPersistenceException(e);
      } catch (PException e) {
        throw new PersistenceException(e);
      }
             pb.speedoGetHome().sendEvent(postEvent, pb, null);
    }
    }
View Full Code Here

   * @param oid is the identifier of the futur object
   * @return a memory instance
   */
  public Object newInstance(Object oid, ConnectionHolder context) throws PersistenceException {
    if (!(oid instanceof PName))
      throw new PersistenceException("Unmanaged object identifier: " + oid);
    PName pn = (PName) oid;
    String className = null;
    try {
      pn = pn.resolve(context);
      if (logger.isLoggable(BasicLevel.DEBUG)) {
        logger.log(BasicLevel.DEBUG, "newInstance(" + oid + "): pn.resolve=" + pn);
        logger.log(BasicLevel.DEBUG, "newInstance(" + oid + "): pn.type=" + pn.getPType());
      }
      PType type = pn.getPType();
      if (type == null) {
        //Error detected by Roland Hedayat
        throw new PersistenceException("newInstance() "
          + "\n\toid=" + oid
          + "\n\tpn=" + pn
          + "\n\tpn.pnc=" + (pn.getPNameManager() != null ? pn.getPNameManager() : null));
      }
      className = type.getJormName();
      int idx = className.indexOf(JormPathHelper.SEP);
      PClassMapping pcm = ((PBinder) pn.getPNameManager())
          .getBinderClassMapping();
      PersistentObjectItf sp = null;
      if ((pcm instanceof AbstractGenClassHome) && idx != -1) {
        // This is a Generic class
        className = getGCClassName(className.substring(0, idx));
        sp = (PersistentObjectItf) Class.forName(className).newInstance();
      } else {
        if (pcm != null) {
          className = pcm.getClassName();
        }
        ClassLoader cl = jf.getClassLoader(className);
        if (cl == null) {
          cl = oid.getClass().getClassLoader();
          if (cl == null) {
            cl = ClassLoader.getSystemClassLoader();
          }
        }
        sp = (PersistentObjectItf)
            cl.loadClass(className).newInstance();
      }
            sp.speedoSetReferenceState(null);
      return sp;
    } catch (PException e) {
      throw new PersistenceException(
          "Impossible to analyze the object identifier" + oid, e);
    } catch (Exception e) {
      throw new PersistenceException(
          "Impossible to instanciate the class " + className
          + "Be careful to the generic class (Collection, ...), oid class:"
          + oid.getClass(), e);
    }
  }
View Full Code Here

TOP

Related Classes of org.objectweb.perseus.persistence.api.PersistenceException

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.