Package org.apache.ojb.odmg

Examples of org.apache.ojb.odmg.TransactionImpl


        {
            return realSubject;
        }
        else
        {
            TransactionImpl tx = getTransaction();
            if(tx != null && tx.isOpen())
            {
                prepareRealSubject(tx.getBroker());
                if(realSubject != null)
                {
                    RuntimeObject rt = new RuntimeObject(realSubject, tx, false);
                    tx.lockAndRegister(rt, Transaction.WRITE, true);
                    tx.lockAndRegisterCleanup();
                }
            }
            else
            {
                PBKey aPbKey = getPBKey();
View Full Code Here


     * @see java.util.Iterator#remove()
     */
    public void remove()
    {
        iter.remove();
        TransactionImpl tx = dSet.getTransaction();
        if (tx != null)
        {
            tx.markDelete(currentEntry);
        }
        currentEntry = null;
    }
View Full Code Here

    {
        DListEntry entry = new DListEntry(this.dlist, obj);
        entry.setPosition(this.nextIndex() - 1);
        iter.add(entry);

        TransactionImpl tx = dlist.getTransaction();
        if (tx != null)
        {
            tx.lock(entry, Transaction.WRITE);
        }
    }
View Full Code Here

    public PBKey getPBKey()
    {
        if(pbKey == null)
        {
            TransactionImpl tx = getTransaction();
            if(tx != null && tx.isOpen())
            {
                pbKey = tx.getBroker().getPBKey();
            }
        }
        return pbKey;
    }
View Full Code Here

    public void add(int index, Object element)
    {
        DListEntry entry = prepareEntry(element);
        elements.add(index, entry);
        // if we are in a transaction: acquire locks !
        TransactionImpl tx = getTransaction();
        if (checkForOpenTransaction(tx))
        {
            RuntimeObject rt = new RuntimeObject(this, tx);
            tx.lockAndRegister(rt, Transaction.WRITE, false);

            tx.lock(element, Transaction.READ);

            rt = new RuntimeObject(entry, tx, true);
            tx.lockAndRegister(rt, Transaction.WRITE, false);
        }

        // changing the position markers of entries:
        int offset = 0;
        try
View Full Code Here

     */
    public Object remove(int index)
    {
        DListEntry entry = (DListEntry) elements.get(index);
        // if we are in a transaction: acquire locks !
        TransactionImpl tx = getTransaction();
        if (checkForOpenTransaction(tx))
        {
            tx.getAssociatedDatabase().deletePersistent(entry);
        }
        elements.remove(index);
        // changing the position markers of entries:
        int offset = 0;
        try
View Full Code Here

     */
    public DCollection query(String predicate) throws QueryInvalidException
    {
        // 1.build complete OQL statement
        String oql = "select all from java.lang.Object where " + predicate;
        TransactionImpl tx = getTransaction();
        if (tx == null) throw new QueryInvalidException("Need running transaction to do query");

        OQLQuery predicateQuery = tx.getImplementation().newOQLQuery();
        predicateQuery.create(oql);
        Query pQ = ((OQLQueryImpl) predicateQuery).getQuery();
        Criteria pCrit = pQ.getCriteria();

        PBCapsule handle = new PBCapsule(pbKey, tx);
View Full Code Here

        DMapEntry entry = prepareEntry(key, value);
        boolean ok = entries.add(entry);
        if (ok)
        {
            TransactionImpl tx = getTransaction();
            if ((tx != null) && (tx.isOpen()))
            {
                RuntimeObject rt = new RuntimeObject(this, tx);
                tx.lockAndRegister(rt, Transaction.WRITE, false);

                tx.lock(key, Transaction.READ);
                tx.lock(value, Transaction.READ);

                rt = new RuntimeObject(entry, tx, true);
                tx.lockAndRegister(rt, Transaction.WRITE, false);
            }
            return null;
        }
        else
        {
View Full Code Here

        Object oldValue = null;
        if (correctEntry != null)
        {
            oldValue = correctEntry.getValue();
            i.remove();
            TransactionImpl tx = getTransaction();
            if ((tx != null) && (tx.isOpen()))
            {
                tx.getAssociatedDatabase().deletePersistent(correctEntry);
            }
        }
        return oldValue;
    }
View Full Code Here

TOP

Related Classes of org.apache.ojb.odmg.TransactionImpl

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.