Package org.apache.ojb.broker

Examples of org.apache.ojb.broker.OJBRuntimeException


        if (ojbQuery != null)
        {
            return new ObjectSetImpl(broker, ojbQuery, limitCount);
        }
        else throw new OJBRuntimeException("internal ojbQuery not filled. Can't execute this query yet!");
    }
View Full Code Here


        prepare();
    }

    public PersistenceBroker getBroker()
    {
        if(isIlleagal) throw new OJBRuntimeException("You could not reuse PBCapsule after destroy");
        return broker;
    }
View Full Code Here

        return broker;
    }

    private void prepare()
    {
        if(isIlleagal) throw new OJBRuntimeException("You could not reuse PBCapsule after destroy");
        // we allow queries even if no ODMG transaction is running.
        // thus we use direct access to PBF via the given PBKey to
        // get a PB instance
        if (tx == null)
        {
View Full Code Here

            }
        }
        catch (PBFactoryException e)
        {
            log.error("Could not obtain PB for PBKey " + pbKey, e);
            throw new OJBRuntimeException("Unexpected micro-kernel exception", e);
        }
        return _broker;
    }
View Full Code Here

                result = (DList) broker.getCollectionByQuery(DListImpl.class, q);
            }
            catch (PersistenceBrokerException e)
            {
                getLog().error("Query failed", e);
                throw new OJBRuntimeException(e);
            }
        }
        finally
        {
            // cleanup stuff
View Full Code Here

        }
    }

    void addM2NLinkEntry(CollectionDescriptor cod, Object leftSource, Object rightSource)
    {
        if(!cod.isMtoNRelation()) throw new OJBRuntimeException("Expect a m:n releation, but specified a 1:n");
        m2nLinkList.add(new LinkEntryMtoN(leftSource, cod, rightSource, false));
    }
View Full Code Here

        }
    }

    void addM2NUnlinkEntry(CollectionDescriptor cod, Object leftSource, Object rightSource)
    {
        if(!cod.isMtoNRelation()) throw new OJBRuntimeException("Expect a m:n releation, but specified a 1:n");
        m2nUnlinkList.add(new LinkEntryMtoN(leftSource, cod, rightSource, true));
    }
View Full Code Here

        linkEntryList.add(entry);
    }

    void addLinkOneToN(CollectionDescriptor col, Object source, boolean unlink)
    {
        if(col.isMtoNRelation()) throw new OJBRuntimeException("Expected an 1:n relation, but specified a m:n");
        LinkEntry entry = new LinkEntryOneToN(source, col, getObject(), unlink);
        linkEntryList.add(entry);
    }
View Full Code Here

        try
        {
            status = transaction.getStatus();
            if (status != Status.STATUS_ACTIVE)
            {
                throw new OJBRuntimeException(
                        "Transaction synchronization failed - wrong status of external container tx: " +
                        getStatusString(status));
            }
        }
        catch (SystemException e)
        {
            throw new OJBRuntimeException("Can't read status of external tx", e);
        }

        try
        {
            //Sequence of the following method calls is significant
            // 1. register the synchronization with the ODMG notion of a transaction.
            transaction.registerSynchronization((J2EETransactionImpl) odmgTrans);
            // 2. mark the ODMG transaction as being in a JTA Transaction
            // Associate external transaction with the odmg transaction.
            txRepository.set(new TxBuffer(odmgTrans, transaction));
        }
        catch (Exception e)
        {
            log.error("Cannot associate PersistenceBroker with running Transaction", e);
            throw new OJBRuntimeException(
                    "Transaction synchronization failed - wrong status of external container tx", e);
        }
    }
View Full Code Here

        Configuration conf = OjbConfigurator.getInstance().getConfigurationFor(null);
        Class lockMapClass = conf.getClass("LockMapClass", Object.class);
        Class lockManagerClass = conf.getClass("LockManagerClass", null);
        if(lockManagerClass == null)
        {
            throw new OJBRuntimeException(buildErrorMsg(lockMapClass, lockManagerClass));
        }
        if(!lockMapClass.equals(Object.class))
        {
            // use the deprecated old odmg locking stuff
            log.info("Setup *deprecated* odmg-locking api.");
            log.info("Used LockManagerClass=" + lockManagerClass);
            log.info("Used LockMapClass=" + lockMapClass);
            if(!org.apache.ojb.odmg.locking.LockManager.class.isAssignableFrom(lockManagerClass))
            {
                throw new OJBRuntimeException(buildErrorMsg(lockMapClass, lockManagerClass));
            }
            setupLockManager(lockManagerClass);
        }
        else
        {
            // use the kernel locking api
            log.info("Setup odmg-locking api.");
            log.info("Used LockManagerClass=" + lockManagerClass);
            if(org.apache.ojb.odmg.locking.LockManager.class.isAssignableFrom(lockManagerClass))
            {
                throw new OJBRuntimeException(buildErrorMsg(lockMapClass, lockManagerClass));
            }
            setupLockManager(conf, lockManagerClass);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.OJBRuntimeException

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.