org.datanucleus.store.query
Class QueryManager

java.lang.Object
  extended by org.datanucleus.store.query.QueryManager

public class QueryManager
extends java.lang.Object

Manages the runtime, metadata and lifecycle of queries. Provides caching of query compilations.


Field Summary
protected static Localiser LOCALISER
          Localisation of messages.
 
Constructor Summary
QueryManager(OMFContext omfContext)
           
 
Method Summary
 void addDatastoreQueryCompilation(java.lang.String datastore, java.lang.String language, java.lang.String query, java.lang.Object compilation)
          Method to store the datastore-specific compilation for a query.
 void addDatastoreQueryResult(Query query, java.util.Map params, java.util.List<java.lang.Object> results)
          Method to store the results for a query.
 void addQueryCompilation(java.lang.String language, java.lang.String query, QueryCompilation compilation)
          Method to store the compilation for a query.
 void close()
           
 void deleteDatastoreQueryCompilation(java.lang.String datastore, java.lang.String language, java.lang.String query)
          Method to remove a cached datastore query compilation.
 java.lang.Object getDatastoreQueryCompilation(java.lang.String datastore, java.lang.String language, java.lang.String query)
          Accessor for the datastore-specific compilation for a query.
 java.util.List<java.lang.Object> getDatastoreQueryResult(Query query, java.util.Map params)
          Accessor for the results for a query.
 InvocationEvaluator getInMemoryEvaluatorForMethod(java.lang.Class type, java.lang.String methodName)
          Accessor for an evaluator for invocation of the specified method for the supplied type.
 QueryCompilation getQueryCompilationForQuery(java.lang.String language, java.lang.String query)
          Accessor for a Query compilation for the specified query and language.
 QueryResultsCache getQueryResultsCache()
           
 QueryRuntime getQueryRuntime()
           
protected  void initialiseQueryCaches()
          Method to find and initialise the query cache, for caching query compilations.
 Query newQuery(java.lang.String language, ObjectManager om, java.lang.Object query)
          Method to generate a new query using the passed query as basis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localisation of messages.

Constructor Detail

QueryManager

public QueryManager(OMFContext omfContext)
Method Detail

initialiseQueryCaches

protected void initialiseQueryCaches()
Method to find and initialise the query cache, for caching query compilations.


close

public void close()

getQueryRuntime

public QueryRuntime getQueryRuntime()

newQuery

public Query newQuery(java.lang.String language,
                      ObjectManager om,
                      java.lang.Object query)
Method to generate a new query using the passed query as basis.

Parameters:
language - The query language
om - The Object Manager
query - The query filter (String) or a previous Query
Returns:
The Query

addQueryCompilation

public void addQueryCompilation(java.lang.String language,
                                java.lang.String query,
                                QueryCompilation compilation)
Method to store the compilation for a query.

Parameters:
language - Language of the query
query - The query string
compilation - The compilation of this query

getQueryCompilationForQuery

public QueryCompilation getQueryCompilationForQuery(java.lang.String language,
                                                    java.lang.String query)
Accessor for a Query compilation for the specified query and language.

Parameters:
language - Language of the query
query - Query string
Returns:
The compilation (if present)

addDatastoreQueryCompilation

public void addDatastoreQueryCompilation(java.lang.String datastore,
                                         java.lang.String language,
                                         java.lang.String query,
                                         java.lang.Object compilation)
Method to store the datastore-specific compilation for a query.

Parameters:
datastore - The datastore identifier
language - The query language
query - The query (string form)
compilation - The compiled information

deleteDatastoreQueryCompilation

public void deleteDatastoreQueryCompilation(java.lang.String datastore,
                                            java.lang.String language,
                                            java.lang.String query)
Method to remove a cached datastore query compilation.

Parameters:
datastore - The datastore
language - The language
query - The query (string form)

getDatastoreQueryCompilation

public java.lang.Object getDatastoreQueryCompilation(java.lang.String datastore,
                                                     java.lang.String language,
                                                     java.lang.String query)
Accessor for the datastore-specific compilation for a query.

Parameters:
datastore - The datastore identifier
language - The query language
query - The query (string form)
Returns:
The compiled information (if available)

getQueryResultsCache

public QueryResultsCache getQueryResultsCache()

addDatastoreQueryResult

public void addDatastoreQueryResult(Query query,
                                    java.util.Map params,
                                    java.util.List<java.lang.Object> results)
Method to store the results for a query.

Parameters:
query - The query
params - Map of parameter values keyed by param name
results - The results (List of object identities)

getDatastoreQueryResult

public java.util.List<java.lang.Object> getDatastoreQueryResult(Query query,
                                                                java.util.Map params)
Accessor for the results for a query.

Parameters:
query - The query
params - Map of parameter values keyed by param name
Returns:
The results (List of object identities)

getInMemoryEvaluatorForMethod

public InvocationEvaluator getInMemoryEvaluatorForMethod(java.lang.Class type,
                                                         java.lang.String methodName)
Accessor for an evaluator for invocation of the specified method for the supplied type. If it is not a supported method for that type then returns null.

Parameters:
type - The class name
methodName - Name of the method
Returns:
Evaluator suitable for this type with this method name


Copyright © 2010. All Rights Reserved.