Package org.datanucleus.store.query
Class QueryManagerImpl
java.lang.Object
org.datanucleus.store.query.QueryManagerImpl
- All Implemented Interfaces:
QueryManager
- Direct Known Subclasses:
FederatedQueryManagerImpl
Manages the creation, compilation and results of queries.
Provides caching of query compilations (generic and datastore-specific) and results.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map
<String, InvocationEvaluator> Cache of InvocationEvaluator objects keyed by the "class:methodName", for use by in-memory querying.protected NucleusContext
protected final QueryCompilationCache
Cache for generic query compilations.protected final QueryDatastoreCompilationCache
Cache for datastore query compilations.protected final QueryResultsCache
Cache for query results.protected StoreManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDatastoreQueryCompilation
(String datastore, String language, String query, Object compilation) Method to store the datastore-specific compilation for a query.void
addQueryCompilation
(String language, String query, QueryCompilation compilation) Method to store the compilation for a query.void
addQueryResult
(Query query, Map params, List<Object> results) Method to store the results for a query.void
close()
Close the QueryManager, releasing all cached compilations and results.void
Method to evict all query results for the specified candidate type.getDatastoreQueryCompilation
(String datastore, String language, String query) Accessor for the datastore-specific compilation for a query.getInMemoryEvaluatorForMethod
(Class type, String methodName) Accessor for an evaluator for invocation of the specified method for the supplied type.Accessor for the generic compilation cache.getQueryCompilationForQuery
(String language, String query) Accessor for a Query compilation for the specified query and language.Accessor for the datastore compilation cache.Accessor for JDOQL/JPQL query method aliases keyed by the prefix.getQueryResult
(Query query, Map params) Accessor for the results for a query.Accessor for the query results cache.void
removeDatastoreQueryCompilation
(String datastore, String language, String query) Method to remove a cached datastore query compilation.void
removeQueryCompilation
(String language, String query) Method to remove a query compilation.
-
Field Details
-
nucleusCtx
-
storeMgr
-
queryCompilationCache
Cache for generic query compilations. -
queryCompilationCacheDatastore
Cache for datastore query compilations. -
queryResultsCache
Cache for query results. -
inmemoryQueryMethodEvaluatorByName
Cache of InvocationEvaluator objects keyed by the "class:methodName", for use by in-memory querying. -
queryMethodAliasByPrefix
-
-
Constructor Details
-
QueryManagerImpl
-
-
Method Details
-
close
public void close()Description copied from interface:QueryManager
Close the QueryManager, releasing all cached compilations and results.- Specified by:
close
in interfaceQueryManager
-
getQueryMethodAliasesByPrefix
Description copied from interface:QueryManager
Accessor for JDOQL/JPQL query method aliases keyed by the prefix.- Specified by:
getQueryMethodAliasesByPrefix
in interfaceQueryManager
- Returns:
- The method aliases map
-
getQueryCompilationCache
Description copied from interface:QueryManager
Accessor for the generic compilation cache.- Specified by:
getQueryCompilationCache
in interfaceQueryManager
- Returns:
- The cache of generic compilations
-
addQueryCompilation
Description copied from interface:QueryManager
Method to store the compilation for a query.- Specified by:
addQueryCompilation
in interfaceQueryManager
- Parameters:
language
- Language of the queryquery
- The query stringcompilation
- The compilation of this query
-
removeQueryCompilation
Description copied from interface:QueryManager
Method to remove a query compilation.- Specified by:
removeQueryCompilation
in interfaceQueryManager
- Parameters:
language
- The query languagequery
- The query string
-
getQueryCompilationForQuery
Description copied from interface:QueryManager
Accessor for a Query compilation for the specified query and language.- Specified by:
getQueryCompilationForQuery
in interfaceQueryManager
- Parameters:
language
- Language of the queryquery
- Query string- Returns:
- The compilation (if present)
-
getQueryDatastoreCompilationCache
Description copied from interface:QueryManager
Accessor for the datastore compilation cache.- Specified by:
getQueryDatastoreCompilationCache
in interfaceQueryManager
- Returns:
- The cache of datastore compilations
-
addDatastoreQueryCompilation
public void addDatastoreQueryCompilation(String datastore, String language, String query, Object compilation) Description copied from interface:QueryManager
Method to store the datastore-specific compilation for a query.- Specified by:
addDatastoreQueryCompilation
in interfaceQueryManager
- Parameters:
datastore
- The datastore identifierlanguage
- The query languagequery
- The query (string form)compilation
- The compiled information
-
removeDatastoreQueryCompilation
Description copied from interface:QueryManager
Method to remove a cached datastore query compilation.- Specified by:
removeDatastoreQueryCompilation
in interfaceQueryManager
- Parameters:
datastore
- The datastorelanguage
- The languagequery
- The query (string form)
-
getDatastoreQueryCompilation
Description copied from interface:QueryManager
Accessor for the datastore-specific compilation for a query.- Specified by:
getDatastoreQueryCompilation
in interfaceQueryManager
- Parameters:
datastore
- The datastore identifierlanguage
- The query languagequery
- The query (string form)- Returns:
- The compiled information (if available)
-
getQueryResultsCache
Description copied from interface:QueryManager
Accessor for the query results cache.- Specified by:
getQueryResultsCache
in interfaceQueryManager
- Returns:
- Query results cache (if present)
-
evictQueryResultsForType
Description copied from interface:QueryManager
Method to evict all query results for the specified candidate type.- Specified by:
evictQueryResultsForType
in interfaceQueryManager
- Parameters:
cls
- Candidate type
-
addQueryResult
Description copied from interface:QueryManager
Method to store the results for a query.- Specified by:
addQueryResult
in interfaceQueryManager
- Parameters:
query
- The queryparams
- Map of parameter values keyed by param nameresults
- The results (List of object identities)
-
getQueryResult
Description copied from interface:QueryManager
Accessor for the results for a query.- Specified by:
getQueryResult
in interfaceQueryManager
- Parameters:
query
- The queryparams
- Map of parameter values keyed by param name- Returns:
- The results (List of object identities)
-
getInMemoryEvaluatorForMethod
Description copied from interface:QueryManager
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.- Specified by:
getInMemoryEvaluatorForMethod
in interfaceQueryManager
- Parameters:
type
- The class namemethodName
- Name of the method- Returns:
- Evaluator suitable for this type with this method name
-