org.apache.openjpa.kernel
Class DelegatingExtent

java.lang.Object
  extended by org.apache.openjpa.kernel.DelegatingExtent
All Implemented Interfaces:
Extent

public class DelegatingExtent
extends Object
implements Extent

Delegating extent that also can perform exception translation for use in facades.

Since:
0.4.0
Author:
Abe White

Constructor Summary
DelegatingExtent(Extent extent)
          Constructor; supply delegate.
DelegatingExtent(Extent extent, RuntimeExceptionTranslator trans)
          Constructor; supply delegate and exception translator.
 
Method Summary
 void closeAll()
          Close all open iterators.
 boolean equals(Object other)
           
 Broker getBroker()
          The broker that generated the extent.
 Extent getDelegate()
          Return the direct delegate.
 Class getElementType()
          The class of extent elements.
 FetchConfiguration getFetchConfiguration()
          Return the (mutable) fetch configuration for this extent.
 boolean getIgnoreChanges()
          Whether this extent will ignore changes made in the current transaction.
 Extent getInnermostDelegate()
          Return the native delegate.
 int hashCode()
           
 boolean hasSubclasses()
          Whether the extent includes subclasses.
 Iterator iterator()
          Return an iterator over the extent members.
 List list()
          Returns a list of all objects represented by this extent.
 void lock()
          Synchronizes on an internal lock.
 void setIgnoreChanges(boolean ignoreCache)
          Whether this extent will ignore changes made in the current transaction.
protected  RuntimeException translate(RuntimeException re)
          Translate the OpenJPA exception.
 void unlock()
          Release the internal lock.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingExtent

public DelegatingExtent(Extent extent)
Constructor; supply delegate.


DelegatingExtent

public DelegatingExtent(Extent extent,
                        RuntimeExceptionTranslator trans)
Constructor; supply delegate and exception translator.

Method Detail

getDelegate

public Extent getDelegate()
Return the direct delegate.


getInnermostDelegate

public Extent getInnermostDelegate()
Return the native delegate.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

translate

protected RuntimeException translate(RuntimeException re)
Translate the OpenJPA exception.


getElementType

public Class getElementType()
Description copied from interface: Extent
The class of extent elements.

Specified by:
getElementType in interface Extent

hasSubclasses

public boolean hasSubclasses()
Description copied from interface: Extent
Whether the extent includes subclasses.

Specified by:
hasSubclasses in interface Extent

getBroker

public Broker getBroker()
Description copied from interface: Extent
The broker that generated the extent.

Specified by:
getBroker in interface Extent

getFetchConfiguration

public FetchConfiguration getFetchConfiguration()
Description copied from interface: Extent
Return the (mutable) fetch configuration for this extent.

Specified by:
getFetchConfiguration in interface Extent

getIgnoreChanges

public boolean getIgnoreChanges()
Description copied from interface: Extent
Whether this extent will ignore changes made in the current transaction.

Specified by:
getIgnoreChanges in interface Extent

setIgnoreChanges

public void setIgnoreChanges(boolean ignoreCache)
Description copied from interface: Extent
Whether this extent will ignore changes made in the current transaction.

Specified by:
setIgnoreChanges in interface Extent

list

public List list()
Description copied from interface: Extent
Returns a list of all objects represented by this extent. This method creates a List by traversing the entire iterator returned by a call to Extent.iterator(). This means that Collection.size() will work correctly, but if the extent represents a large data set, this method may be quite slow and may consume quite a bit of memory.

Specified by:
list in interface Extent

iterator

public Iterator iterator()
Description copied from interface: Extent
Return an iterator over the extent members.

Specified by:
iterator in interface Extent

closeAll

public void closeAll()
Description copied from interface: Extent
Close all open iterators.

Specified by:
closeAll in interface Extent

lock

public void lock()
Description copied from interface: Extent
Synchronizes on an internal lock.

Specified by:
lock in interface Extent

unlock

public void unlock()
Description copied from interface: Extent
Release the internal lock.

Specified by:
unlock in interface Extent


Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.