Examples of IndirectionHandler


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

        Class topLevelClass = null;
        Class realClass = null;
        Object[] pks = null;
        try
        {
            final IndirectionHandler handler = ProxyHelper.getIndirectionHandler(objOrProxy);

            synchronized(objOrProxy)
            {
                if(handler != null)
                {
                    result = handler.getIdentity();
                }
                else
                {
                    // now we are sure that the specified object is not a proxy
                    realClass = objOrProxy.getClass();
View Full Code Here

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

    }

    protected void associateBatched(Collection proxies, Collection realSubjects)
    {
        PersistenceBroker pb = getBroker();
        IndirectionHandler handler;
        Identity id;
        Object proxy;
        Object realSubject;
        HashMap realSubjectsMap = new HashMap(realSubjects.size());

        for (Iterator it = realSubjects.iterator(); it.hasNext(); )
        {
            realSubject = it.next();
            realSubjectsMap.put(pb.serviceIdentity().buildIdentity(realSubject), realSubject);
        }

        for (Iterator it = proxies.iterator(); it.hasNext(); )
        {
            proxy = it.next();
            handler = ProxyHelper.getIndirectionHandler(proxy);

            if (handler == null)
            {
                continue;
            }

            id = handler.getIdentity();
            realSubject = realSubjectsMap.get(id);
            if (realSubject != null)
            {
                handler.setRealSubject(realSubject);
            }
        }
    }
View Full Code Here

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

    protected Query[] buildPrefetchQueries(Collection proxies, Collection realSubjects)
    {
        Collection queries = new ArrayList();
        Collection idsSubset;
        Object proxy;
        IndirectionHandler handler;
        Identity id;
        Class realClass;
        HashMap classToIds = new HashMap();
        Class topLevelClass = getItemClassDescriptor().getClassOfObject();
        PersistenceBroker pb = getBroker();
        ObjectCache cache = pb.serviceObjectCache();

        for (Iterator it = proxies.iterator(); it.hasNext(); )
        {
            proxy = it.next();
            handler = ProxyHelper.getIndirectionHandler(proxy);

            if (handler == null)
            {
                continue;
            }
           
            id = handler.getIdentity();
            if (cache.lookup(id) != null)
            {
                realSubjects.add(pb.getObjectByIdentity(id));
                continue;
            }
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

                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

            }
            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

        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

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

            if (handler != null)
            {
                Identity sourceOID = handler.getIdentity();
                m_objectsTopLevelClass = sourceOID.m_objectsTopLevelClass;
                m_objectsRealClass = sourceOID.m_objectsRealClass;
                m_pkValues = sourceOID.m_pkValues;
            }
            else
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.