Class QueryManagerImpl

  • All Implemented Interfaces:
    QueryManager
    Direct Known Subclasses:
    FederatedQueryManagerImpl

    public class QueryManagerImpl
    extends java.lang.Object
    implements QueryManager
    Manages the creation, compilation and results of queries. Provides caching of query compilations (generic and datastore-specific) and results.
    • Field Detail

      • queryCompilationCache

        protected final QueryCompilationCache queryCompilationCache
        Cache for generic query compilations.
      • queryCompilationCacheDatastore

        protected final QueryDatastoreCompilationCache queryCompilationCacheDatastore
        Cache for datastore query compilations.
      • queryResultsCache

        protected final QueryResultsCache queryResultsCache
        Cache for query results.
      • inmemoryQueryMethodEvaluatorByName

        protected java.util.Map<java.lang.String,​InvocationEvaluator> inmemoryQueryMethodEvaluatorByName
        Cache of InvocationEvaluator objects keyed by the "class:methodName", for use by in-memory querying.
      • queryMethodAliasByPrefix

        protected java.util.Map<java.lang.String,​java.lang.String> queryMethodAliasByPrefix
    • Method Detail

      • close

        public void close()
        Description copied from interface: QueryManager
        Close the QueryManager, releasing all cached compilations and results.
        Specified by:
        close in interface QueryManager
      • getQueryMethodAliasesByPrefix

        public java.util.Map<java.lang.String,​java.lang.String> getQueryMethodAliasesByPrefix()
        Description copied from interface: QueryManager
        Accessor for JDOQL/JPQL query method aliases keyed by the prefix.
        Specified by:
        getQueryMethodAliasesByPrefix in interface QueryManager
        Returns:
        The method aliases map
      • addQueryCompilation

        public void addQueryCompilation​(java.lang.String language,
                                        java.lang.String query,
                                        QueryCompilation compilation)
        Description copied from interface: QueryManager
        Method to store the compilation for a query.
        Specified by:
        addQueryCompilation in interface QueryManager
        Parameters:
        language - Language of the query
        query - The query string
        compilation - The compilation of this query
      • removeQueryCompilation

        public void removeQueryCompilation​(java.lang.String language,
                                           java.lang.String query)
        Description copied from interface: QueryManager
        Method to remove a query compilation.
        Specified by:
        removeQueryCompilation in interface QueryManager
        Parameters:
        language - The query language
        query - The query string
      • getQueryCompilationForQuery

        public QueryCompilation getQueryCompilationForQuery​(java.lang.String language,
                                                            java.lang.String query)
        Description copied from interface: QueryManager
        Accessor for a Query compilation for the specified query and language.
        Specified by:
        getQueryCompilationForQuery in interface QueryManager
        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)
        Description copied from interface: QueryManager
        Method to store the datastore-specific compilation for a query.
        Specified by:
        addDatastoreQueryCompilation in interface QueryManager
        Parameters:
        datastore - The datastore identifier
        language - The query language
        query - The query (string form)
        compilation - The compiled information
      • removeDatastoreQueryCompilation

        public void removeDatastoreQueryCompilation​(java.lang.String datastore,
                                                    java.lang.String language,
                                                    java.lang.String query)
        Description copied from interface: QueryManager
        Method to remove a cached datastore query compilation.
        Specified by:
        removeDatastoreQueryCompilation in interface QueryManager
        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)
        Description copied from interface: QueryManager
        Accessor for the datastore-specific compilation for a query.
        Specified by:
        getDatastoreQueryCompilation in interface QueryManager
        Parameters:
        datastore - The datastore identifier
        language - The query language
        query - The query (string form)
        Returns:
        The compiled information (if available)
      • evictQueryResultsForType

        public void evictQueryResultsForType​(java.lang.Class cls)
        Description copied from interface: QueryManager
        Method to evict all query results for the specified candidate type.
        Specified by:
        evictQueryResultsForType in interface QueryManager
        Parameters:
        cls - Candidate type
      • addQueryResult

        public void addQueryResult​(Query query,
                                   java.util.Map params,
                                   java.util.List<java.lang.Object> results)
        Description copied from interface: QueryManager
        Method to store the results for a query.
        Specified by:
        addQueryResult in interface QueryManager
        Parameters:
        query - The query
        params - Map of parameter values keyed by param name
        results - The results (List of object identities)
      • getQueryResult

        public java.util.List<java.lang.Object> getQueryResult​(Query query,
                                                               java.util.Map params)
        Description copied from interface: QueryManager
        Accessor for the results for a query.
        Specified by:
        getQueryResult in interface QueryManager
        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)
        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 interface QueryManager
        Parameters:
        type - The class name
        methodName - Name of the method
        Returns:
        Evaluator suitable for this type with this method name