Examples of IndirectionHandler


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

                        {
                            item = colIterator.next();
                            RuntimeObject rt = new RuntimeObject(item, this);
                            if (rt.isProxy())
                            {
                                IndirectionHandler handler = ProxyHelper.getIndirectionHandler(item);
                                if (!handler.alreadyMaterialized())
                                {
                                    handler.addListener(this);
                                    continue;
                                }
                                else
                                {
                                    // @todo consider registering to hear when this is
                                    // derefernced instead of just loading here -bmc
                                    item = handler.getRealSubject();
                                }
                            }
                            lockAndRegister(rt, lockMode, true);
                        }
                    }
View Full Code Here

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

            throws LockingException
    {
        ContextEntry entry;
        LockManager lockManager;
        Swizzling swizzlingStrategy;
        IndirectionHandler handler = null;
        OTMKit kit = _tx.getKit();
        // Are we building object's relations for the userObject in the transaction?
        // Otherwise we just get data from the "userObject" and put it into
        // the previously loaded/created object in the transaction
        boolean buildingObject = false;
        boolean lazySwizzle = false;

        if (lock == LockType.NO_LOCK)
        {
            return null;
        }

        entry = (ContextEntry) _objects.get(oid);

        if (userObject == null)
        {
            // invalidating object...
            _original.remove(oid);
            _checkpointed.remove(oid);
            if (entry != null)
            {
                entry.userObject = null;
                entry.cacheObject = null;
            }
            return entry;
        }

        lockManager = LockManager.getInstance();
        swizzlingStrategy = kit.getSwizzlingStrategy();

        handler = ProxyHelper.getIndirectionHandler(userObject);
        if ((handler != null) && handler.alreadyMaterialized())
        {
            userObject = handler.getRealSubject();
            handler = null;
        }

        if ((entry == null) || (entry.userObject == null))
        {
View Full Code Here

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

             *
             * arminw:
             * wrap Object or Identity with a helper class. The main object will get
             * dirty when the 1:1 reference change: add or replaced by another object or deleted
             */
            IndirectionHandler handler = ProxyHelper.getIndirectionHandler(referenceObject);
            // if it is a not materialized proxy, use the Identity
            if(handler != null)
            {
                erh = handler.alreadyMaterialized()
                        ? new EqualsRefHelper(handler.getRealSubject())
                        : new EqualsRefHelper(handler.getIdentity());
            }
            else
            {
                erh = new EqualsRefHelper(referenceObject);
            }
View Full Code Here

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

            try
            {
                PersistenceBroker broker = capsule.getBroker();
                Iterator it = colProxy.ojbIterator();
                Object tempObj;
                IndirectionHandler tempHandler;
                while(it.hasNext())
                {
                    tempObj = it.next();
                    // the referenced objects can be proxy objects too
                    tempHandler = ProxyHelper.getIndirectionHandler(tempObj);
                    if(tempHandler != null)
                    {
                        addReference(tempHandler.getIdentity(), tempObj);
                    }
                    else
                    {
                        addReference(broker.serviceIdentity().buildIdentity(tempObj), tempObj);
                    }
View Full Code Here

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

        query.create("select books from " + Book.class.getName() + " where title like $1");
        query.bind(name);
        Collection result = (Collection) query.execute();
        assertEquals(1, result.size());
        Book b = (Book) result.iterator().next();
        IndirectionHandler handler = ProxyHelper.getIndirectionHandler(b.getPublisher());
        assertNotNull(handler);
        assertFalse(handler.alreadyMaterialized());
        handler.addListener(
                new MaterializationListener()
                {
                    public void beforeMaterialization(IndirectionHandler handler, Identity oid)
                    {
                        fail("Reference shall not materialize while locking");
View Full Code Here

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

        query.create("select books from " + Book.class.getName() + " where title like $1");
        query.bind(name);
        Collection result = (Collection) query.execute();
        assertEquals(1, result.size());
        Book b = (Book) result.iterator().next();
        IndirectionHandler handler = ProxyHelper.getIndirectionHandler(b.getPublisher());
        assertNotNull(handler);
        assertFalse(handler.alreadyMaterialized());
        handler.addListener(
                new MaterializationListener()
                {
                    public void beforeMaterialization(IndirectionHandler handler, Identity oid)
                    {
                        fail("Reference shall not materialize while locking");
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

                 * 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

     * @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
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.