org.jpox.store.extent
Class AbstractExtent

java.lang.Object
  extended byorg.jpox.store.extent.AbstractExtent
All Implemented Interfaces:
javax.jdo.Extent
Direct Known Subclasses:
ClassTableExtent, ClassViewExtent

public abstract class AbstractExtent
extends java.lang.Object
implements javax.jdo.Extent

Abstract representation of an Extent for stores. Individual stores should extend this to implement Extent's for their purpose.

Version:
$Revision: 1.9 $

Field Summary
protected  java.lang.Class candidateClass
          The candidate class.
protected  AbstractClassMetaData cmd
          ClassMetaData for the candidate class.
protected static Localiser LOCALISER
          Localised messages source
protected  PersistenceManager pm
          Persistence Manager for the Extent.
protected  Query query
          Query executed for returning the Extent.
protected  java.util.HashMap queryResultsByIterator
          Map of the iterators of the Extents accessed.
protected  StoreManager storeMgr
          Manager for the Store.
protected  boolean subclasses
          Whether to include subclasses.
 
Constructor Summary
AbstractExtent(PersistenceManager pm, java.lang.Class cls, boolean subclasses)
          Constructor.
 
Method Summary
 void close(java.util.Iterator iter)
          Close an Iterator associated with this Extent instance.
 void closeAll()
          Close all Iterators associated with this Extent instance.
 java.lang.Class getCandidateClass()
          Accessor for the class of instances in this Extent.
 javax.jdo.FetchPlan getFetchPlan()
          This method retrieves the fetch plan associated with the Extent.
 javax.jdo.PersistenceManager getPersistenceManager()
          Accessor for the owning PersistenceManager.
 boolean hasSubclasses()
          Returns whether this Extent was defined to contain subclasses.
 java.util.Iterator iterator()
          Returns an iterator over all the instances in the Extent.
 java.lang.String toString()
          Stringifier method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localised messages source


pm

protected final PersistenceManager pm
Persistence Manager for the Extent.


candidateClass

protected final java.lang.Class candidateClass
The candidate class. We store the class since we need to retain it for class loading.


subclasses

protected final boolean subclasses
Whether to include subclasses.


cmd

protected final AbstractClassMetaData cmd
ClassMetaData for the candidate class.


storeMgr

protected final StoreManager storeMgr
Manager for the Store.


query

protected final Query query
Query executed for returning the Extent.


queryResultsByIterator

protected java.util.HashMap queryResultsByIterator
Map of the iterators of the Extents accessed.

Constructor Detail

AbstractExtent

public AbstractExtent(PersistenceManager pm,
                      java.lang.Class cls,
                      boolean subclasses)
Constructor.

Parameters:
pm - Persistence Manager
cls - candidate class
subclasses - Whether to include subclasses
Method Detail

hasSubclasses

public boolean hasSubclasses()
Returns whether this Extent was defined to contain subclasses.

Specified by:
hasSubclasses in interface javax.jdo.Extent
Returns:
true if this Extent was defined to include subclasses.

getCandidateClass

public java.lang.Class getCandidateClass()
Accessor for the class of instances in this Extent.

Specified by:
getCandidateClass in interface javax.jdo.Extent
Returns:
the Class of instances of this Extent

getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager()
Accessor for the owning PersistenceManager.

Specified by:
getPersistenceManager in interface javax.jdo.Extent
Returns:
the owning PersistenceManager

iterator

public java.util.Iterator iterator()
Returns an iterator over all the instances in the Extent.

Specified by:
iterator in interface javax.jdo.Extent
Returns:
an iterator over all the instances in the Extent.

close

public void close(java.util.Iterator iter)
Close an Iterator associated with this Extent instance. Iterators closed by this method will return false to hasNext() and will throw NoSuchElementException on next(). The Extent instance can still be used as a parameter of Query.setCandidates, and to get an Iterator.

Specified by:
close in interface javax.jdo.Extent
Parameters:
iter - an iterator obtained by the method iterator() on this Extent instance.

closeAll

public void closeAll()
Close all Iterators associated with this Extent instance. Iterators closed by this method will return false to hasNext() and will throw NoSuchElementException on next(). The Extent instance can still be used as a parameter of Query.setCandidates, and to get an Iterator.

Specified by:
closeAll in interface javax.jdo.Extent

getFetchPlan

public javax.jdo.FetchPlan getFetchPlan()
This method retrieves the fetch plan associated with the Extent. It always returns the identical instance for the same Extent instance. Any change made to the fetch plan affects subsequent instance retrievals via next(). Only instances not already in memory are affected by the fetch plan. Fetch plan is described in Section 12.7.

Specified by:
getFetchPlan in interface javax.jdo.Extent
Returns:
the FetchPlan

toString

public java.lang.String toString()
Stringifier method.

Returns:
Stringified form of this object


Copyright © -2007 . All Rights Reserved.