org.kuali.rice.core.ojb
Class ContextClassLoaderCollectionProxy

java.lang.Object
  extended by org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl
      extended by org.kuali.rice.core.ojb.ContextClassLoaderCollectionProxy
All Implemented Interfaces:
Serializable, Iterable, Collection, org.apache.ojb.broker.core.proxy.CollectionProxy, org.apache.ojb.broker.ManageableCollection

public class ContextClassLoaderCollectionProxy
extends org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl

Sets up the context classloader properly for OJB proxies. The sequence of events in the super class is as follows:

 public synchronized Collection getData()
 {
    if (!isLoaded())
    {
      beforeLoading();
      setData(loadData());
      afterLoading();
    }
    return _data;
 }
 
Therefore, since there is no try-catch-finally in conjunction with this call, we need to handle exceptions thrown from loadData and unbind the classloader appropriately.

See Also:
Serialized Form

Field Summary
private  ClassLoader contextClassLoader
           
private static long serialVersionUID
           
 
Constructor Summary
ContextClassLoaderCollectionProxy(org.apache.ojb.broker.PBKey aKey, Class aCollClass, org.apache.ojb.broker.query.Query aQuery)
           
ContextClassLoaderCollectionProxy(org.apache.ojb.broker.PBKey aKey, org.apache.ojb.broker.query.Query aQuery)
           
 
Method Summary
protected  void afterLoading()
           
protected  void beforeLoading()
           
protected  Collection loadData()
           
 
Methods inherited from class org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl
add, addAll, addListener, afterStore, clear, contains, containsAll, getBroker, getBrokerKey, getCollectionClass, getData, getProfileKey, getQuery, isEmpty, isLoaded, iterator, loadProfileIfNeeded, loadSize, ojbAdd, ojbAddAll, ojbIterator, releaseBroker, remove, removeAll, removeListener, retainAll, setBrokerKey, setCollectionClass, setData, setProfileKey, setQuery, setSize, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

contextClassLoader

private transient ClassLoader contextClassLoader
Constructor Detail

ContextClassLoaderCollectionProxy

public ContextClassLoaderCollectionProxy(org.apache.ojb.broker.PBKey aKey,
                                         Class aCollClass,
                                         org.apache.ojb.broker.query.Query aQuery)

ContextClassLoaderCollectionProxy

public ContextClassLoaderCollectionProxy(org.apache.ojb.broker.PBKey aKey,
                                         org.apache.ojb.broker.query.Query aQuery)
Method Detail

beforeLoading

protected void beforeLoading()
Overrides:
beforeLoading in class org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl

loadData

protected Collection loadData()
                       throws org.apache.ojb.broker.PersistenceBrokerException
Overrides:
loadData in class org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl
Throws:
org.apache.ojb.broker.PersistenceBrokerException

afterLoading

protected void afterLoading()
Overrides:
afterLoading in class org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.