Package org.objectweb.speedo.pm.api

Examples of org.objectweb.speedo.pm.api.POManagerItf


     * @param sp a speedo po instance.
     * @exception SpeedoRuntimeException if the instance is managed by
     * another persistence manager.
     */
    protected void assertPOManager(PersistentObjectItf sp) {
        POManagerItf pm = (POManagerItf) sp.speedoGetPOManager();
        if (!thisPM.equals(pm)) {           
            if (pm == null) {
                try {
                    tpm.readIntention(tx, sp, null);
                } catch (RolledBackPersistenceException e) {
View Full Code Here


    }

    public void clear() {
      if (detachedStatus == DetachedLifeCycle.DETACHED_NONE) {
          Iterator i = elements.iterator();
            POManagerItf pm = null;
          while (i.hasNext()) {
              GenClassElement gcelem = (GenClassElement) i.next();
              gcelem.setStatus(PIndexedElem.ELEM_DELETED);
        if (pm == null) {
          pm = gcpo.speedoGetPOManager();
View Full Code Here

   * Looks for a JdoTxContext associated with the particular transaction.
   * @param xid  The DTP transaction identifier.
   */
  SpeedoXAContext getXAContext(Xid xid) {
    SpeedoXAContext xac = (SpeedoXAContextxid2xac.get(xid);
    POManagerItf txc = null;
    if (xac != null) {
      txc = xac.pm;
    }
        if (Debug.ON && logger.isLoggable(BasicLevel.DEBUG))
            logger.log(BasicLevel.DEBUG,
View Full Code Here

    public Object getElement(POManagerItf pm) {
    Object res = element;
        if (res instanceof PName) {
      synchronized(this) {
        if (res instanceof PName) {
                    POManagerItf mypm = pm;
          if (mypm == null) {
                        mypm = ((PersistentObjectItf) gca.gcpo).speedoGetPOManager();
          }
                res = mypm.speedoGetObject((PName) res, false);
        }
        if (status != PIndexedElem.ELEM_DELETED) {
            //when an element is deleted, it will be unbound from its
            // identifier. Then all futur GenClassElement comparaison
            // will be impossible if we do not have the identifier 
View Full Code Here

        } else if (o instanceof POManagerItf) {
            if (((POManagerItf) o).getPOManagerFactory() == pmf)
                return (POManagerItf) o;
        } else {
            for (Iterator it = ((List) o).iterator(); it.hasNext();) {
                POManagerItf pm = (POManagerItf) it.next();
                if (pm.getPOManagerFactory() == pmf)
                    return pm;
            }
        }
        return null;
    }
View Full Code Here

        if (o == null) {
            pms.set(pm);
        } else if (o instanceof POManagerItf) {
            // There is one POManagerItf, then check if the old and the new
            // po manager are managed by the same PMF.
            POManagerItf pm1 = (POManagerItf) o;
            if (pm1.getPOManagerFactory()
                    == pm.getPOManagerFactory()) {
                pms.set(pm);
            } else {
                // Put the old and the new in a List
                ArrayList al = new ArrayList(3);
View Full Code Here

   */
  public Object createResource(Object o) throws PoolException {
    try {
      //instanciate the POManagerItf
      Component pmC = Fractal.getFactory(pmT).newFcInstance();
      POManagerItf pm = (POManagerItf) pmC.getFcInterface("po-manager");
      Fractal.getNameController(pmC).setFcName("po-manager");
      BindingController pmBC = Fractal.getBindingController(pmC);

      //instanciate the JDOTransactionItf
      Component tC = Fractal.getFactory(tT).newFcInstance();
View Full Code Here

                    sgcp.speedoSetPType(thepo.speedoGetPType().getNestedPType());
                }
                sgcp.speedoSetLinkedField(thepo.speedoGetGenClassId());
                sgcp.speedoSetPNameHints(thepo.getPName());
            }
            POManagerItf mypm = pm;
      if (mypm == null) {
                mypm = thepo.speedoGetPOManager();
                if (mypm == null) {
                    throw new SpeedoRuntimeException(
                        "When a persistent object is used (read or write), " +
                        "a PersistenceManager is needed");
                }
      }
            mypm.speedoMakePersistent(sp, map);
        }
    }
View Full Code Here

    //at the moment, only support for transactional and nontransactional strategy
    if (strategy != NON_TRANSACTIONAL) {
      //get the pmf
      POManagerFactoryItf pmf = sequenceManager.getPMF();
      //get the pm
      POManagerItf pm = pmf.lookup();
      //check that a transaction is active
      return (pm != null  && pm.getSpeedoTransaction().isActive());
    }
    return true;
  }
View Full Code Here

     */
    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();
            if (pm == null) {
                // Allocate a new PersistenceManager to close at the end
                pm = (POManagerItf) sp.speedoGetHome().getPOManagerFactory()
                        .getPOManager();
                pmAllocated = true;
            }
            try {
                state = sp.speedoGetHome().readIntention(sp, fieldIds);
            } catch (Exception e) {
                // Close the PersistenceManager if it has been allocated localy
                if (pmAllocated) {
                    pm.closePOManager();
                }
                throw new IOException(e.getMessage());
            }
        } else {
            state = sp.speedoGetReferenceState();
        }
        try {
            out.writeObject(state);
            out.defaultWriteObject();
        } finally {
            // Close the PersistenceManager if it has been allocated localy
            if (pmAllocated) {
                pm.closePOManager();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pm.api.POManagerItf

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.