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

java.lang.Object
  extended by com.amazon.carbonado.qe.StandardQueryFactory<S>
All Implemented Interfaces:
QueryFactory<S>
Direct Known Subclasses:
QueryEngine

public abstract class StandardQueryFactory<S extends Storable>
extends Object
implements QueryFactory<S>

Builds and caches StandardQuery instances.

Author:
Brian S O'Neill

Constructor Summary
protected StandardQueryFactory(Class<S> type)
           
protected StandardQueryFactory(Class<S> type, boolean lazySetExecutor)
           
 
Method Summary
 void clearExecutors()
          For each cached query, calls StandardQuery.clearExecutor().
protected abstract  StandardQuery<S> createQuery(Filter<S> filter, FilterValues<S> values, OrderingList<S> ordering, QueryHints hints)
          Implement this method to return query implementations.
 Class<S> getStorableType()
           
 Query<S> query()
          Returns a new or cached query that fetches everything.
 Query<S> query(Filter<S> filter)
          Returns a new or cached query for the given filter.
 Query<S> query(Filter<S> filter, FilterValues<S> values, OrderingList<S> ordering)
          Returns a new or cached query for the given query specification.
 Query<S> query(Filter<S> filter, FilterValues<S> values, OrderingList<S> ordering, QueryHints hints)
          Returns a new or cached query for the given query specification.
 Query<S> query(Filter<S> filter, OrderingList<S> ordering)
          Returns a new or cached query for the given query specification.
 Query<S> query(Filter<S> filter, OrderingList<S> ordering, QueryHints hints)
          Returns a new or cached query for the given query specification.
 Query<S> query(String filter)
          Returns a new or cached query for the given filter.
 void resetExecutors()
          For each cached query, calls StandardQuery.resetExecutor().
 void setExecutors()
          For each cached query, calls StandardQuery.setExecutor().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardQueryFactory

protected StandardQueryFactory(Class<S> type)

StandardQueryFactory

protected StandardQueryFactory(Class<S> type,
                               boolean lazySetExecutor)
Parameters:
lazySetExecutor - by default, query executors are built and set eagerly. Pass true to build and set executor on first query use.
Method Detail

getStorableType

public Class<S> getStorableType()
Specified by:
getStorableType in interface QueryFactory<S extends Storable>

query

public Query<S> query()
                                throws FetchException
Returns a new or cached query that fetches everything.

Throws:
FetchException

query

public Query<S> query(String filter)
                                throws FetchException
Returns a new or cached query for the given filter.

Throws:
IllegalArgumentException - if filter is null
FetchException

query

public Query<S> query(Filter<S> filter)
                                throws FetchException
Returns a new or cached query for the given filter.

Throws:
IllegalArgumentException - if filter is null
FetchException

query

public Query<S> query(Filter<S> filter,
                      OrderingList<S> ordering)
                                throws FetchException
Returns a new or cached query for the given query specification.

Throws:
IllegalArgumentException - if filter is null
FetchException

query

public Query<S> query(Filter<S> filter,
                      OrderingList<S> ordering,
                      QueryHints hints)
                                throws FetchException
Returns a new or cached query for the given query specification.

Throws:
IllegalArgumentException - if filter is null
FetchException

query

public Query<S> query(Filter<S> filter,
                      FilterValues<S> values,
                      OrderingList<S> ordering)
                                throws FetchException
Returns a new or cached query for the given query specification.

Parameters:
filter - optional filter object, defaults to open filter if null
values - optional values object, defaults to filter initial values
ordering - optional order-by properties
Throws:
FetchException

query

public Query<S> query(Filter<S> filter,
                      FilterValues<S> values,
                      OrderingList<S> ordering,
                      QueryHints hints)
                                throws FetchException
Returns a new or cached query for the given query specification.

Specified by:
query in interface QueryFactory<S extends Storable>
Parameters:
filter - optional filter object, defaults to open filter if null
values - optional values object, defaults to filter initial values
ordering - optional order-by properties
hints - optional hints
Throws:
FetchException

setExecutors

public void setExecutors()
                  throws RepositoryException
For each cached query, calls StandardQuery.setExecutor().

Throws:
RepositoryException

resetExecutors

public void resetExecutors()
                    throws RepositoryException
For each cached query, calls StandardQuery.resetExecutor(). This call can be used to rebuild all cached query plans after the set of available indexes has changed.

Throws:
RepositoryException

clearExecutors

public void clearExecutors()
For each cached query, calls StandardQuery.clearExecutor(). This call can be used to clear all cached query plans after the set of available indexes has changed.


createQuery

protected abstract StandardQuery<S> createQuery(Filter<S> filter,
                                                FilterValues<S> values,
                                                OrderingList<S> ordering,
                                                QueryHints hints)
                                                          throws FetchException
Implement this method to return query implementations.

Parameters:
filter - optional filter object, defaults to open filter if null
values - optional values object, defaults to filter initial values
ordering - optional order-by properties
hints - optional hints
Throws:
FetchException


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