Examples of IndirectionHandler


Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

     * @return Object[]
     * @throws PersistenceBrokerException
     */
    public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy, boolean convertToSql) throws PersistenceBrokerException
    {
        IndirectionHandler handler = ProxyHelper.getIndirectionHandler(objectOrProxy);

        if(handler != null)
        {
            return getKeyValues(cld, handler.getIdentity(), convertToSql)//BRJ: convert Identity
        }
        else
        {
            ClassDescriptor realCld = getRealClassDescriptor(cld, objectOrProxy);
            return getValuesForObject(realCld.getPkFields(), objectOrProxy, convertToSql);
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

     */
    private synchronized void register(Object newTxObject, int lockMode)
            throws LockNotGrantedException, PersistenceBrokerException
    {
        Object objectToRegister = newTxObject;
        IndirectionHandler handler = null;

        // Proxies must be treated specially
        handler = ProxyHelper.getIndirectionHandler(newTxObject);

        /*
        if the object is a Proxy there are two options:
        1. The proxies real subject has already been materialized:
           we take this real subject as the object to register and proceed
           as if it were a ordinary object.
        2. The real subject has not been materialized: Then there is nothing
           to be registered now!
           Of course we might just materialize the real subject to have something
           to register. But this would make proxies useless for ODMG as proxies would
           get materialized even if their real subjects were not used by the
           client app.
           Thus we register the current transaction as a Listener to the IndirectionHandler
           of the Proxy.
           Only when the IndirectionHandler performs the materialization of the real subject
           at some later point in time it invokes callbacks on all it's listeners.
           Using this callback we can defer the registering until it's really needed.
        */
        if (handler != null)
        {
            if (handler.alreadyMaterialized())
            {
                objectToRegister = handler.getRealSubject();
            }
            else
            {
                registerToIndirectionHandler(handler);
                registerUnmaterializedLocks(newTxObject);
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

                try
                {
                    while (colIterator.hasNext())
                    {
                        item = colIterator.next();
                        IndirectionHandler handler = ProxyHelper.getIndirectionHandler(item);
                        if (handler != null)
                        {
                            if (!handler.alreadyMaterialized())
                            {
                                continue;
                            }
                            else
                            {
                                // @todo consider registering to hear when this is
                                // derefernced instead of just loading here -bmc
                                item = handler.getRealSubject();
                            }
                        }
                        if(!cds.isMtoNRelation())
                        {
                            //if itemCld refers to an interface the foreignKeyFieldDescriptors
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

            }
            else // PersistentBrokerImpl.this
            {
                // a special case: current collection being loaded contains proxies,
                // just load them without setting any fields
                IndirectionHandler handler = (IndirectionHandler) listenedObject;
                return new PlainPrefetcher(pb, handler.getIdentity().getObjectsTopLevelClass());
            }
        }
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

             * if it's been materialized, we put it in the map, because it could change.
             * if it hasn't been materialized, it hasn't changed.
             *
             * Also handles virtual proxies.
             */
            IndirectionHandler handler = ProxyHelper.getIndirectionHandler(temp);

            if(handler != null)
            {
                /**
                 * only register if the proxy has been materialized
                 * if it's materialized later and the map is compared, it will
                 * trigger the update
                 */
                fieldValues.put(rds, handler.getIdentity());
            }
            else
            {
                fieldValues.put(rds, temp);
            }
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

                 * on a query for a class that is mapped to a table that has other classes
                 * mapped to that table as well, but aren't extents.
                 */
                if (candidate != null)
                {
                    IndirectionHandler handler = ProxyHelper.getIndirectionHandler(candidate);

                    if ((handler != null)
                            || itemClass.isAssignableFrom(candidate.getClass()))
                    {
                        result.ojbAdd(candidate);
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

                if ((refObj != null) && prefetchProxies
                        && (m_retrievalTasks != null)
                        && (rds.getProxyPrefetchingLimit() > 0))
                {
                    IndirectionHandler handler = ProxyHelper.getIndirectionHandler(refObj);

                    if ((handler != null)
                            && addRetrievalTask(obj, rds))
                    {
                        new PBMaterializationListener(obj, m_retrievalTasks,
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

    best performance, thus create Identity object only if needed
    and do 'is new object' check only if needed.
    */
    private void init(final TransactionImpl tx)
    {
        final IndirectionHandler handler = ProxyHelper.getIndirectionHandler(obj);
        if(handler != null)
        {
            this.handler = handler;
            isNew = Boolean.FALSE;
            identity = handler.getIdentity();
            if(handler.alreadyMaterialized())
            {
                cld = tx.getBroker().getClassDescriptor(handler.getRealSubject().getClass());
            }
            else
            {
                cld = tx.getBroker().getClassDescriptor(identity.getObjectsRealClass());
            }
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

    private void init(final Object objectToIdentify, final PersistenceBroker targetBroker, ClassDescriptor cld)
    {
        if(objectToIdentify == null) throw new OJBRuntimeException("Can't create Identity for 'null'-object");
        try
        {
            final IndirectionHandler handler = ProxyHelper.getIndirectionHandler(objectToIdentify);

            synchronized(objectToIdentify)
            {
                if (handler != null)
                {
                    final Identity sourceOID = handler.getIdentity();
                    m_objectsTopLevelClass = sourceOID.m_objectsTopLevelClass;
                    m_objectsRealClass = sourceOID.m_objectsRealClass;
                    m_pkValues = sourceOID.m_pkValues;
                }
                else
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.IndirectionHandler

           at some later point in time it invokes callbacks on all it's listeners.
           Using this callback we can defer the registering until it's really needed.
        */
        if(rtObject.isProxy())
        {
            IndirectionHandler handler = rtObject.getHandler();
            if(handler == null)
            {
                throw new OJBRuntimeException("Unexpected error, expect an proxy object as indicated: " + rtObject);
            }
            if (handler.alreadyMaterialized())
            {
                objectToRegister = handler.getRealSubject();
            }
            else
            {
                registerToIndirectionHandler(handler);
                registerUnmaterializedLocks(rtObject.getObj());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.