atg.repository.search.indexing.config
Class RepositoryIterator

java.lang.Object
  extended by atg.repository.search.indexing.config.RepositoryIterator

public class RepositoryIterator
extends java.lang.Object

An instance of this class can be configured to act as an iterator through a repository for a given item descriptor.
It will load repository items in batches to avoid performance problems with large repository sets.
It is also possible to start iterating from a specific repository id.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static ApplicationLogging mLogger
          Logger
 
Constructor Summary
RepositoryIterator(Repository pRepository, java.lang.String pItemDescriptorName, int pBatchSize, javax.transaction.TransactionManager pTransactionManager, java.lang.String pIdPropertyName)
           
RepositoryIterator(Repository pRepository, java.lang.String pItemDescriptorName, int pBatchSize, javax.transaction.TransactionManager pTransactionManager, java.lang.String pIdPropertyName, boolean pAutoFetchNextBatch, int pStartIndex, boolean pPreLoadBatch)
           
 
Method Summary
protected  void doReset()
          Initializes member variables required for this iterator to work.
 java.util.List<java.lang.String> getBatchesStartIndexes()
          Gets a list of the start indexes for every batch processed by this repository iterator instance.
 int getBatchSize()
           
 java.lang.String getIdPropertyName()
           
 java.lang.String getItemDescriptorName()
           
 ApplicationLogging getLogger()
           
 int getNumItems()
           
 Repository getRepository()
           
 javax.transaction.TransactionManager getTransactionManager()
           
 boolean hasNext()
           
 boolean isAutoFetchNextBatch()
           
protected  void loadBatch()
           
 RepositoryItem next()
           
 void reset()
           
 void reset(int pStartIndex)
          Resets this iterator.
 void setAutoFetchNextBatch(boolean autoFetchNextBatch)
           
 void setBatchSize(int pBatchSize)
           
 void setStartIndex(int pIndex)
          Forces the iterator to start using a batch from the given index position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

mLogger

public static ApplicationLogging mLogger
Logger

Constructor Detail

RepositoryIterator

public RepositoryIterator(Repository pRepository,
                          java.lang.String pItemDescriptorName,
                          int pBatchSize,
                          javax.transaction.TransactionManager pTransactionManager,
                          java.lang.String pIdPropertyName)
                   throws RepositoryException,
                          TransactionDemarcationException
Throws:
RepositoryException
TransactionDemarcationException

RepositoryIterator

public RepositoryIterator(Repository pRepository,
                          java.lang.String pItemDescriptorName,
                          int pBatchSize,
                          javax.transaction.TransactionManager pTransactionManager,
                          java.lang.String pIdPropertyName,
                          boolean pAutoFetchNextBatch,
                          int pStartIndex,
                          boolean pPreLoadBatch)
                   throws RepositoryException,
                          TransactionDemarcationException
Parameters:
pRepository -
pItemDescriptorName -
pBatchSize -
pTransactionManager -
pIdPropertyName -
pAutoFetchNextBatch -
pStartIndex -
pPreLoadBatch -
Throws:
RepositoryException
TransactionDemarcationException
Method Detail

getRepository

public Repository getRepository()

getItemDescriptorName

public java.lang.String getItemDescriptorName()

setBatchSize

public void setBatchSize(int pBatchSize)

getBatchSize

public int getBatchSize()

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()

getIdPropertyName

public java.lang.String getIdPropertyName()

isAutoFetchNextBatch

public boolean isAutoFetchNextBatch()

setAutoFetchNextBatch

public void setAutoFetchNextBatch(boolean autoFetchNextBatch)

hasNext

public boolean hasNext()
                throws RepositoryException,
                       TransactionDemarcationException
Throws:
RepositoryException
TransactionDemarcationException

next

public RepositoryItem next()
                    throws RepositoryException,
                           TransactionDemarcationException
Throws:
RepositoryException
TransactionDemarcationException

reset

public void reset()
           throws RepositoryException,
                  TransactionDemarcationException
Throws:
RepositoryException
TransactionDemarcationException

reset

public void reset(int pStartIndex)
           throws RepositoryException,
                  TransactionDemarcationException
Resets this iterator.

Parameters:
pStartIndex - Starting index for fetching repository data
Throws:
RepositoryException
TransactionDemarcationException

doReset

protected void doReset()
                throws RepositoryException,
                       TransactionDemarcationException
Initializes member variables required for this iterator to work.

Throws:
RepositoryException
TransactionDemarcationException

getBatchesStartIndexes

public java.util.List<java.lang.String> getBatchesStartIndexes()
Gets a list of the start indexes for every batch processed by this repository iterator instance. The indexes are returned as a List of String.

Returns:
List of String indexes

setStartIndex

public void setStartIndex(int pIndex)
                   throws RepositoryException,
                          TransactionDemarcationException
Forces the iterator to start using a batch from the given index position.

Parameters:
pIndex - int index to start batch from.
Throws:
RepositoryException
TransactionDemarcationException

getNumItems

public int getNumItems()
Returns:
int total number of items this iterator can process

loadBatch

protected void loadBatch()
                  throws RepositoryException,
                         TransactionDemarcationException
Throws:
RepositoryException
TransactionDemarcationException

getLogger

public ApplicationLogging getLogger()