com.amazon.carbonado.qe
Class DelegatedQueryExecutor<S extends Storable>

java.lang.Object
  extended by com.amazon.carbonado.qe.DelegatedQueryExecutor<S>
All Implemented Interfaces:
QueryExecutor<S>

public class DelegatedQueryExecutor<S extends Storable>
extends Object
implements QueryExecutor<S>

QueryExecutor which delegates by executing a Query on a Storage.

Author:
Brian S O'Neill

Constructor Summary
DelegatedQueryExecutor(Storage<S> rootStorage, Filter<S> filter, OrderingList<S> ordering)
           
DelegatedQueryExecutor(Storage<S> rootStorage, QueryExecutor<S> executor)
           
 
Method Summary
 long count(FilterValues<S> values)
          Counts the query results using the given filter values.
 Cursor<S> fetch(FilterValues<S> values)
          Returns a new cursor using the given filter values.
 Cursor<S> fetchSlice(FilterValues<S> values, long from, Long to)
          Returns a new cursor using the given filter values and slice.
 Filter<S> getFilter()
          Returns the filter used by this QueryExecutor.
 OrderingList<S> getOrdering()
          Returns the result ordering of this QueryExecutor.
 Class<S> getStorableType()
          Returns the storable type that this executor operates on.
 boolean printNative(Appendable app, int indentLevel, FilterValues<S> values)
          Prints the native query to any appendable, if applicable.
 boolean printPlan(Appendable app, int indentLevel, FilterValues<S> values)
          Prints the query plan to any appendable, if applicable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatedQueryExecutor

public DelegatedQueryExecutor(Storage<S> rootStorage,
                              QueryExecutor<S> executor)
                       throws FetchException
Parameters:
rootStorage - root storage to query
executor - executor to emulate
Throws:
IllegalArgumentException - if any parameter is null
FetchException

DelegatedQueryExecutor

public DelegatedQueryExecutor(Storage<S> rootStorage,
                              Filter<S> filter,
                              OrderingList<S> ordering)
                       throws FetchException
Parameters:
rootStorage - root storage to query
filter - optional query filter
ordering - optional ordering
Throws:
IllegalArgumentException - if rootStorage is null
FetchException
Method Detail

getStorableType

public Class<S> getStorableType()
Description copied from interface: QueryExecutor
Returns the storable type that this executor operates on.

Specified by:
getStorableType in interface QueryExecutor<S extends Storable>

fetch

public Cursor<S> fetch(FilterValues<S> values)
                                 throws FetchException
Description copied from interface: QueryExecutor
Returns a new cursor using the given filter values.

Specified by:
fetch in interface QueryExecutor<S extends Storable>
Throws:
FetchException

fetchSlice

public Cursor<S> fetchSlice(FilterValues<S> values,
                            long from,
                            Long to)
                                      throws FetchException
Description copied from interface: QueryExecutor
Returns a new cursor using the given filter values and slice.

Specified by:
fetchSlice in interface QueryExecutor<S extends Storable>
Throws:
FetchException

count

public long count(FilterValues<S> values)
           throws FetchException
Description copied from interface: QueryExecutor
Counts the query results using the given filter values.

Specified by:
count in interface QueryExecutor<S extends Storable>
Throws:
FetchException

getFilter

public Filter<S> getFilter()
Description copied from interface: QueryExecutor
Returns the filter used by this QueryExecutor.

Specified by:
getFilter in interface QueryExecutor<S extends Storable>
Returns:
query filter, never null

getOrdering

public OrderingList<S> getOrdering()
Description copied from interface: QueryExecutor
Returns the result ordering of this QueryExecutor.

Specified by:
getOrdering in interface QueryExecutor<S extends Storable>
Returns:
query ordering in an unmodifiable list

printNative

public boolean printNative(Appendable app,
                           int indentLevel,
                           FilterValues<S> values)
                    throws IOException
Description copied from interface: QueryExecutor
Prints the native query to any appendable, if applicable.

Specified by:
printNative in interface QueryExecutor<S extends Storable>
values - optional
Returns:
false if not implemented
Throws:
IOException

printPlan

public boolean printPlan(Appendable app,
                         int indentLevel,
                         FilterValues<S> values)
                  throws IOException
Description copied from interface: QueryExecutor
Prints the query plan to any appendable, if applicable.

Specified by:
printPlan in interface QueryExecutor<S extends Storable>
values - optional
Returns:
false if not implemented
Throws:
IOException


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.