com.ca.jcs.enumeration
Class AppendingNamingEnumeration<T>

java.lang.Object
  extended by com.ca.jcs.enumeration.RawNamingEnumeration<T>
      extended by com.ca.jcs.enumeration.AppendingNamingEnumeration<T>
All Implemented Interfaces:
Enumeration<T>, NamingEnumeration<T>
Direct Known Subclasses:
AppendingNamingEnumeration

public class AppendingNamingEnumeration<T>
extends RawNamingEnumeration<T>

An enumeration that can step through the elements of a collection or sequentially through a list of child enumerations (ie logically appending them).


Field Summary
 
Fields inherited from class com.ca.jcs.enumeration.RawNamingEnumeration
countLimit, scope, startTime, timeLimit, visitedCount
 
Constructor Summary
AppendingNamingEnumeration()
           
AppendingNamingEnumeration(Collection<T> queryResults, long sizeLimit)
          Deprecated. Use AppendingNamingEnumeration(SearchControls, Collection) instead.
AppendingNamingEnumeration(SearchControls searchControls)
          Create an enumeration which will respect any time or size limitation specified in searchControls.
AppendingNamingEnumeration(SearchControls searchControls, Collection<T> queryResults)
          Create an enumeration around the provided queryResults, which were determined in a single bulk query.
AppendingNamingEnumeration(SearchControls searchControls, NamingEnumeration<T> child)
          Create an "non-immediate" mode (ie normal) enumeration around the provided child enumeration, where other child enumerations can be appended up to the point where RawNamingEnumeration.next() is first called.
AppendingNamingEnumeration(SearchControls searchControls, Object result)
          Create an enumeration around a single search result / name class pair.
 
Method Summary
 void appendEnumeration(NamingEnumeration<T> child)
          Append a child enumeration to this one, where if it is in "immediate" mode then the child's entries are appended to an internal cache list and otherwise the child enumeration is remembered and elements will be read from it after the previous contained child enumeration becomes exhausted.
 void close()
          Close any child enumerations which have not yet been exhausted.
 boolean rawHasMore()
          Returns true if at one object remains to be retrieved from this enumeration, or one of the child enumerations.
 T rawNext()
          Returns next child from current child enumeration.
 
Methods inherited from class com.ca.jcs.enumeration.RawNamingEnumeration
getCountLimit, getNonFatalException, getTimeLimit, getVisitedCount, hasMore, hasMoreElements, next, nextElement, setCountLimit, setNonFatalException, setTimeLimit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppendingNamingEnumeration

public AppendingNamingEnumeration()

AppendingNamingEnumeration

public AppendingNamingEnumeration(SearchControls searchControls)
Create an enumeration which will respect any time or size limitation specified in searchControls.


AppendingNamingEnumeration

public AppendingNamingEnumeration(SearchControls searchControls,
                                  Collection<T> queryResults)
Create an enumeration around the provided queryResults, which were determined in a single bulk query. This can be more runtime efficient but is less scalable then streaming results through an enumeration one-by-one, due to needing all results in memory at once.


AppendingNamingEnumeration

public AppendingNamingEnumeration(Collection<T> queryResults,
                                  long sizeLimit)
Deprecated. Use AppendingNamingEnumeration(SearchControls, Collection) instead.

Create an enumeration around the provided queryResults, which were determined in a single bulk query. This can be more runtime efficient but is less scalable then streaming results through an enumeration one-by-one, due to needing all results in memory at once.


AppendingNamingEnumeration

public AppendingNamingEnumeration(SearchControls searchControls,
                                  NamingEnumeration<T> child)
                           throws NamingException
Create an "non-immediate" mode (ie normal) enumeration around the provided child enumeration, where other child enumerations can be appended up to the point where RawNamingEnumeration.next() is first called.

Throws:
NamingException

AppendingNamingEnumeration

public AppendingNamingEnumeration(SearchControls searchControls,
                                  Object result)
Create an enumeration around a single search result / name class pair.

Method Detail

appendEnumeration

public void appendEnumeration(NamingEnumeration<T> child)
                       throws NamingException
Append a child enumeration to this one, where if it is in "immediate" mode then the child's entries are appended to an internal cache list and otherwise the child enumeration is remembered and elements will be read from it after the previous contained child enumeration becomes exhausted.

Parameters:
child - Enumeration to be appended, or if null then this method simply returns without doing anything.
Throws:
NamingException

rawHasMore

public boolean rawHasMore()
                   throws NamingException
Returns true if at one object remains to be retrieved from this enumeration, or one of the child enumerations.

Specified by:
rawHasMore in class RawNamingEnumeration<T>
Throws:
NamingException

rawNext

public T rawNext()
          throws NamingException
Returns next child from current child enumeration.

Specified by:
rawNext in class RawNamingEnumeration<T>
Throws:
NamingException

close

public void close()
           throws NamingException
Close any child enumerations which have not yet been exhausted.

Throws:
NamingException


Created 2011-07-14 13:27 EST