
org.chronos.chronodb.internal.api.query.QueryManager Maven / Gradle / Ivy
Show all versions of org.chronos.chronodb.api Show documentation
package org.chronos.chronodb.internal.api.query;
import org.chronos.chronodb.api.ChronoDB;
import org.chronos.chronodb.api.ChronoDBTransaction;
import org.chronos.chronodb.api.builder.query.QueryBuilderFinalizer;
import org.chronos.chronodb.api.builder.query.QueryBuilderStarter;
/**
* The {@link QueryManager} is responsible for providing access to a number of objects related to queries in a given
* {@link ChronoDB} instance.
*
*
* In particular, these objects include the following:
*
* - {@link QueryParser}: The query parser used for parsing {@link QueryTokenStream}s
*
- {@link QueryOptimizer}: The optimizer which is run on every {@link ChronoDBQuery} before executing it
*
- {@link QueryBuilderStarter}: The query builder implementation
*
*
* All of the above interfaces require implementations that agree with each other and belong together. The query manager
* acts as the container and/or factory for these implementation class instances.
*
*
* @author [email protected] -- Initial Contribution and API
*
*/
public interface QueryManager {
/**
* Returns the {@link QueryParser} implementation.
*
*
* It is assumed that this method will constantly return the same object (with respect to the ==
* operator).
*
* @return The query parser to be used. Never null
.
*/
public QueryParser getQueryParser();
/**
* Returns the {@link QueryOptimizer} implementation.
*
*
* It is assumed that this method will constantly return the same object (with respect to the ==
* operator).
*
* @return The query optimizer to be used. Never null
.
*/
public QueryOptimizer getQueryOptimizer();
/**
* Returns a new instance of the {@link QueryBuilderStarter} class associated with this query manager.
*
*
* This is essentially a factory method for the concrete implementation of {@link QueryBuilderStarter}. It must
* return a new instance on every call.
*
*
* @param tx
* The transaction on which the query is being built. Must not be null
.
*
* @return A new instance of the query builder implementation.
*/
public QueryBuilderStarter createQueryBuilder(ChronoDBTransaction tx);
/**
* Returns a new instance of the {@link QueryBuilderFinalizer} class associated with this query manager.
*
*
* This is essentially a factory method for the concrete implementation of {@link QueryBuilderFinalizer}. It must
* return a new instance on every call.
*
* @param tx
* The transaction on which the query is being executed. Must not be null
.
* @param query
* The query to execute on the transaction. Must not be null
.
*
* @return A new instance of the query builder finalizer implementation.
*/
public QueryBuilderFinalizer createQueryBuilderFinalizer(ChronoDBTransaction tx, ChronoDBQuery query);
}