Interface QueryService


  • public interface QueryService
    Interface for the query service, which is used for instantiating queries, creating and destroying indexes, creating CQs and operating on CQs. Creating an index on an employee's age using QueryService in region "employeeRegion":
       
         QueryService queryService = cache.getQueryService();
         queryService.createIndex ("SampleIndex",        // indexName
                                   "e.age",              // indexedExpression
                                   "/employeeRegion e"); //regionPath
       
     
    The CQs work on the server regions, the client can use the CQ methods supported in this class to create/operate CQs on the server. The CQ obtains the Server connection from the corresponding local region on the client. The implementation of this interface is obtained from the Cache using RegionService.getQueryService().
    Since:
    GemFire 4.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.Object UNDEFINED
      The undefined constant
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean clearDefinedIndexes()
      Clears all the indexes that were defined using defineIndex(String, String, String)
      void closeCqs()
      Unregister all Continuous Queries.
      java.util.List<Index> createDefinedIndexes()
      Creates all the indexes that were defined using defineIndex(String, String, String)
      Index createHashIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath)
      Deprecated.
      Due to the overhead caused by rehashing while expanding the backing array, hash index has been deprecated since Apache Geode 1.4.0.
      Index createHashIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath, java.lang.String imports)
      Deprecated.
      Due to the overhead caused by rehashing while expanding the backing array, hash index has been deprecated since Apache Geode 1.4.0.
      Index createIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath)
      Create an index that can be used when executing queries.
      Index createIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath, java.lang.String imports)
      Create an index that can be used when executing queries.
      Index createIndex​(java.lang.String indexName, IndexType indexType, java.lang.String indexedExpression, java.lang.String fromClause)
      Index createIndex​(java.lang.String indexName, IndexType indexType, java.lang.String indexedExpression, java.lang.String fromClause, java.lang.String imports)
      Index createKeyIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath)
      Create a key index that can be used when executing queries.
      void defineHashIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath)
      Deprecated.
      Due to the overhead caused by rehashing while expanding the backing array, hash index has been deprecated since Apache Geode 1.4.0.
      void defineHashIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath, java.lang.String imports)
      Deprecated.
      Due to the overhead caused by rehashing while expanding the backing array, hash index has been deprecated since Apache Geode 1.4.0.
      void defineIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath)
      Defines an index that can be used when executing queries.
      void defineIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath, java.lang.String imports)
      Defines an index that can be used when executing queries.
      void defineKeyIndex​(java.lang.String indexName, java.lang.String indexedExpression, java.lang.String regionPath)
      Defines a key index that can be used when executing queries.
      void executeCqs()
      Starts execution of all the registered continuous queries for this client.
      void executeCqs​(java.lang.String regionName)
      Starts execution of all the continuous queries registered on the specified region for this client.
      java.util.List<java.lang.String> getAllDurableCqsFromServer()
      Retrieves all the durable CQs registered by the client calling this method.
      CqQuery getCq​(java.lang.String cqName)
      Retrieves the Continuous Query specified by the name.
      CqQuery[] getCqs()
      Retrieve all registered Continuous Queries.
      CqQuery[] getCqs​(java.lang.String regionName)
      Retrieves all the registered Continuous Queries for a given region.
      CqServiceStatistics getCqStatistics()
      Returns CqServiceStatistics object, which provides helper methods to get CQ service related statistics for this client.
      Index getIndex​(Region<?,​?> region, java.lang.String indexName)
      Get the Index from the specified Region with the specified name.
      java.util.Collection<Index> getIndexes()
      Get a collection of all the indexes in the Cache.
      java.util.Collection<Index> getIndexes​(Region<?,​?> region)
      Get a collection of all the indexes on the specified Region
      java.util.Collection<Index> getIndexes​(Region<?,​?> region, IndexType indexType)
      Deprecated.
      As of 6.6.2, use getIndexes(Region) only.
      CqQuery newCq​(java.lang.String name, java.lang.String queryString, CqAttributes cqAttr)
      Constructs a new named continuous query, represented by an instance of CqQuery.
      CqQuery newCq​(java.lang.String name, java.lang.String queryString, CqAttributes cqAttr, boolean isDurable)
      Constructs a new named continuous query, represented by an instance of CqQuery.
      CqQuery newCq​(java.lang.String queryString, CqAttributes cqAttr)
      Constructs a new continuous query, represented by an instance of CqQuery.
      CqQuery newCq​(java.lang.String queryString, CqAttributes cqAttr, boolean isDurable)
      Constructs a new continuous query, represented by an instance of CqQuery.
      Query newQuery​(java.lang.String queryString)
      Constructs a new Query object.
      void removeIndex​(Index index)
      Remove the specified index.
      void removeIndexes()
      Remove all the indexes from this cache.
      void removeIndexes​(Region<?,​?> region)
      Remove all the indexes on the specified Region
      void stopCqs()
      Stops execution of all the continuous queries for this client to become inactive.
      void stopCqs​(java.lang.String regionName)
      Stops execution of all the continuous queries registered on the specified region for this client.
    • Field Detail

      • UNDEFINED

        static final java.lang.Object UNDEFINED
        The undefined constant
    • Method Detail

      • newQuery

        Query newQuery​(java.lang.String queryString)
        Constructs a new Query object.
        Parameters:
        queryString - the String that is the query program
        Returns:
        The new Query object.
        Throws:
        QueryInvalidException - if the syntax of the queryString is invalid.
        See Also:
        Query
      • createHashIndex

        @Deprecated
        Index createHashIndex​(java.lang.String indexName,
                              java.lang.String indexedExpression,
                              java.lang.String regionPath)
                       throws IndexInvalidException,
                              IndexNameConflictException,
                              IndexExistsException,
                              RegionNotFoundException,
                              java.lang.UnsupportedOperationException
        Deprecated.
        Due to the overhead caused by rehashing while expanding the backing array, hash index has been deprecated since Apache Geode 1.4.0. Use method createIndex(String, String, String) instead.
        Create a hash index that can be used when executing equal and not equal queries. Hash index is not supported with asynchronous index maintenance. Hash index is also not supported with a from clause with multiple iterators. Queries on numeric types must match the indexed value. For Example: For a float field the query should be specified as floatField = 1.0f
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the field of the region values that are referenced by the regionPath.
        regionPath - that resolves to region values or nested collections of region values which will correspond to the FROM clause in a query. Check following examples. The regionPath is restricted to only one expression Example: Query1: "Select * from /portfolio p where p.mktValue = 25.00" For index on mktValue field: indexExpression: "p.mktValue" regionPath: "/portfolio p"
        Returns:
        the newly created Index
        Throws:
        QueryInvalidException - if the argument query language strings have invalid syntax
        IndexInvalidException - if the arguments do not correctly specify an index
        IndexNameConflictException - if an index with this name already exists
        IndexExistsException - if an index with these parameters already exists with a different name
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
        java.lang.UnsupportedOperationException - If Index is being created on a region which does not support indexes.
      • defineKeyIndex

        void defineKeyIndex​(java.lang.String indexName,
                            java.lang.String indexedExpression,
                            java.lang.String regionPath)
                     throws RegionNotFoundException
        Defines a key index that can be used when executing queries. The key index expression indicates query engine to use region key as index for query evaluation. They are used to make use of the implicit hash index supported with GemFire regions.
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the keys of the region that is referenced by the regionPath. For example, an index with indexedExpression "ID" might be used for a query with a WHERE clause of "ID > 10", In this case the ID value is evaluated using region keys.
        regionPath - that resolves to the region which will correspond to the FROM clause in a query. The regionPath must include exactly one region. Example: Query1: "Select * from /portfolio p where p.ID = 10" indexExpression: "p.ID" regionPath: "/portfolio p"
        Throws:
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
      • defineHashIndex

        @Deprecated
        void defineHashIndex​(java.lang.String indexName,
                             java.lang.String indexedExpression,
                             java.lang.String regionPath)
                      throws RegionNotFoundException
        Deprecated.
        Due to the overhead caused by rehashing while expanding the backing array, hash index has been deprecated since Apache Geode 1.4.0. Use method defineIndex(String, String, String) instead.
        Defines a hash index that can be used when executing equal and not equal queries. Hash index is not supported with asynchronous index maintenance. Hash index is also not supported with a from clause with multiple iterators. Queries on numeric types must match the indexed value. For Example: For a float field the query should be specified as floatField = 1.0f To create all the defined indexes call createDefinedIndexes()
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the field of the region values that are referenced by the regionPath.
        regionPath - that resolves to region values or nested collections of region values which will correspond to the FROM clause in a query. Check following examples. The regionPath is restricted to only one expression Example: Query1: "Select * from /portfolio p where p.mktValue = 25.00" For index on mktValue field: indexExpression: "p.mktValue" regionPath: "/portfolio p"
        Throws:
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
      • defineHashIndex

        @Deprecated
        void defineHashIndex​(java.lang.String indexName,
                             java.lang.String indexedExpression,
                             java.lang.String regionPath,
                             java.lang.String imports)
                      throws RegionNotFoundException
        Deprecated.
        Due to the overhead caused by rehashing while expanding the backing array, hash index has been deprecated since Apache Geode 1.4.0. Use method defineIndex(String, String, String, String) instead.
        Defines a hash index that can be used when executing equal and not equal queries. Hash index is not supported with asynchronous index maintenance. Hash index is also not supported with a from clause with multiple iterators. Queries on numeric types must match the indexed value. For Example: For a float field the query should be specified as floatField = 1.0f To create all the defined indexes call createDefinedIndexes()
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the field of the region values that are referenced by the regionPath.
        regionPath - that resolves to region values or nested collections of region values which will correspond to the FROM clause in a query. The regionPath must include exactly one region The regionPath is restricted to only one expression
        imports - string containing imports (in the query language syntax, each import statement separated by a semicolon), provides packages and classes used in variable typing in the Indexed and FROM expressions. The use is the same as for the FROM clause in querying. Example: Query1: "Select * from /portfolio p where p.mktValue = 25.00" For index on mktValue field: indexExpression: "p.mktValue" regionPath: "/portfolio p"
        Throws:
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
      • defineIndex

        void defineIndex​(java.lang.String indexName,
                         java.lang.String indexedExpression,
                         java.lang.String regionPath)
                  throws RegionNotFoundException
        Defines an index that can be used when executing queries. To create all the defined indexes call createDefinedIndexes()
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the field of the region values that are referenced by the regionPath.
        regionPath - that resolves to region values or nested collections of region values which will correspond to the FROM clause in a query. Check following examples. The regionPath must include exactly one region, but may include multiple expressions as required to drill down into nested region contents. Example: Query1: "Select * from /portfolio p where p.mktValue > 25.00" For index on mktValue field: indexExpression: "p.mktValue" regionPath: "/portfolio p" Query2: "Select * from /portfolio p, p.positions.values pos where pos.secId ='VMWARE'" For index on secId field: indexExpression: "pos.secId" regionPath: "/portfolio p, p.positions.values pos"
        Throws:
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
      • defineIndex

        void defineIndex​(java.lang.String indexName,
                         java.lang.String indexedExpression,
                         java.lang.String regionPath,
                         java.lang.String imports)
                  throws RegionNotFoundException
        Defines an index that can be used when executing queries. To create all the defined indexes call createDefinedIndexes()
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the field of the region values that are referenced by the regionPath.
        regionPath - that resolves to region values or nested collections of region values which will correspond to the FROM clause in a query. The regionPath must include exactly one region, but may include multiple expressions as required to drill down into nested region contents. Check following examples.
        imports - string containing imports (in the query language syntax, each import statement separated by a semicolon), provides packages and classes used in variable typing in the Indexed and FROM expressions. The use is the same as for the FROM clause in querying. Example: Query1: "Select * from /portfolio p where p.mktValue > 25.00" For index on mktValue field: indexExpression: "p.mktValue" regionPath: "/portfolio p" Query2: "Select * from /portfolio p, p.positions.values pos where pos.secId ='VMWARE'" For index on secId field: indexExpression: "pos.secId" regionPath: "/portfolio p, p.positions.values pos TYPE Position" imports: "package.Position"
        Throws:
        QueryInvalidException - if the argument query language strings have invalid syntax
        IndexInvalidException - if the arguments do not correctly specify an index
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
        java.lang.UnsupportedOperationException - If Index is being created on a region which overflows to disk
      • createHashIndex

        @Deprecated
        Index createHashIndex​(java.lang.String indexName,
                              java.lang.String indexedExpression,
                              java.lang.String regionPath,
                              java.lang.String imports)
                       throws IndexInvalidException,
                              IndexNameConflictException,
                              IndexExistsException,
                              RegionNotFoundException,
                              java.lang.UnsupportedOperationException
        Deprecated.
        Due to the overhead caused by rehashing while expanding the backing array, hash index has been deprecated since Apache Geode 1.4.0. Use method createIndex(String, String, String, String) instead
        Create a hash index that can be used when executing equal and not equal queries. Hash index is not supported with asynchronous index maintenance. Hash index is also not supported with a from clause with multiple iterators. Queries on numeric types must match the indexed value. For Example: For a float field the query should be specified as floatField = 1.0f
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the field of the region values that are referenced by the regionPath.
        regionPath - that resolves to region values or nested collections of region values which will correspond to the FROM clause in a query. The regionPath must include exactly one region The regionPath is restricted to only one expression
        imports - string containing imports (in the query language syntax, each import statement separated by a semicolon), provides packages and classes used in variable typing in the Indexed and FROM expressions. The use is the same as for the FROM clause in querying. Example: Query1: "Select * from /portfolio p where p.mktValue = 25.00" For index on mktValue field: indexExpression: "p.mktValue" regionPath: "/portfolio p"
        Returns:
        the newly created Index
        Throws:
        QueryInvalidException - if the argument query language strings have invalid syntax
        IndexInvalidException - if the arguments do not correctly specify an index
        IndexNameConflictException - if an index with this name already exists
        IndexExistsException - if an index with these parameters already exists with a different name
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
        java.lang.UnsupportedOperationException - If Index is being created on a region which overflows to disk
      • createIndex

        @Deprecated
        Index createIndex​(java.lang.String indexName,
                          IndexType indexType,
                          java.lang.String indexedExpression,
                          java.lang.String fromClause)
                   throws IndexInvalidException,
                          IndexNameConflictException,
                          IndexExistsException,
                          RegionNotFoundException,
                          java.lang.UnsupportedOperationException
        Deprecated.
        As of 6.6.2, use createIndex(String, String, String) and createKeyIndex(String, String, String) instead. Create an index that can be used when executing queries.
        Parameters:
        indexName - the name of this index, used for statistics collection and to identify this index for later access
        indexType - the type of index. The indexType must be either IndexType.FUNCTIONAL or IndexType.PRIMARY_KEY.
        indexedExpression - refers to the elements of the collection (or collection of structs) that are referenced in the fromClause. This expression is used to optimize the comparison of the same path found in a query's WHERE clause when used to compare against a constant expression. For example, an index with indexedExpression "mktValue" might be used for a query with a WHERE clause of "mktValue > 25.00". The exact use and specification of the indexedExpression varies depending on the indexType. Query parameters and region paths are not allowed in the indexedExpression (e.g. $1).
        fromClause - expression, that resolves to a collection or list of collections which will correspond to the FROM clause or part of a FROM clause in a SELECT statement. The FROM clause must include exactly one region, but may include multiple FROM expressions as required to drill down into nested region contents. The collections that the FROM expressions evaluate to must be dependent on one and only one entry in the referenced region (otherwise the index could not be maintained on single entry updates). References to query parameters are not allowed. For primary key indexes, the fromClause must be just one collection which must be a region path only.
        Returns:
        the newly created Index
        Throws:
        QueryInvalidException - if the argument query language strings have invalid syntax
        IndexInvalidException - if the arguments do not correctly specify an index
        IndexNameConflictException - if an index with this name already exists
        IndexExistsException - if an index with these parameters already exists with a different name
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
        java.lang.UnsupportedOperationException - If Index is being created on a region which overflows to disk
      • createIndex

        @Deprecated
        Index createIndex​(java.lang.String indexName,
                          IndexType indexType,
                          java.lang.String indexedExpression,
                          java.lang.String fromClause,
                          java.lang.String imports)
                   throws IndexInvalidException,
                          IndexNameConflictException,
                          IndexExistsException,
                          RegionNotFoundException,
                          java.lang.UnsupportedOperationException
        Deprecated.
        As of 6.6.2, use createIndex(String, String, String, String) and createKeyIndex(String, String, String) instead. Create an index that can be used when executing queries.
        Parameters:
        indexName - the name of this index, used for statistics collection and to identify this index for later access
        indexType - the type of index. The indexType must be either IndexType.FUNCTIONAL or IndexType.PRIMARY_KEY.
        indexedExpression - refers to the elements of the collection (or collection of structs) that are referenced in the fromClause. This expression is used to optimize the comparison of the same path found in a query's WHERE clause when used to compare against a constant expression. For example, an index with indexedExpression "mktValue" might be used for a query with a WHERE clause of "mktValue > 25.00". The exact use and specification of the indexedExpression varies depending on the indexType. Query parameters and region paths are not allowed in the indexedExpression (e.g. $1).
        fromClause - expression, that resolves to a collection or list of collections which will correspond to the FROM clause or part of a FROM clause in a SELECT statement. The FROM clause must include exactly one region, but may include multiple FROM expressions as required to drill down into nested region contents. The collections that the FROM expressions evaluate to must be dependent on one and only one entry in the referenced region (otherwise the index could not be maintained on single entry updates). References to query parameters are not allowed. For primary key indexes, the fromClause must be just one collection which must be a region path only.
        imports - string containing imports (in the query language syntax, each import statement separated by a semicolon), provides packages and classes used in variable typing in the Indexed and FROM expressions. The use is the same as for the FROM clause in querying.
        Returns:
        the newly created Index
        Throws:
        QueryInvalidException - if the argument query language strings have invalid syntax
        IndexInvalidException - if the arguments do not correctly specify an index
        IndexNameConflictException - if an index with this name already exists
        IndexExistsException - if an index with these parameters already exists with a different name
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
        java.lang.UnsupportedOperationException - If Index is being created on a region which overflows to disk
      • createIndex

        Index createIndex​(java.lang.String indexName,
                          java.lang.String indexedExpression,
                          java.lang.String regionPath)
                   throws IndexInvalidException,
                          IndexNameConflictException,
                          IndexExistsException,
                          RegionNotFoundException,
                          java.lang.UnsupportedOperationException
        Create an index that can be used when executing queries.
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the field of the region values that are referenced by the regionPath.
        regionPath - that resolves to region values or nested collections of region values which will correspond to the FROM clause in a query. Check following examples. The regionPath must include exactly one region, but may include multiple expressions as required to drill down into nested region contents. Example: Query1: "Select * from /portfolio p where p.mktValue > 25.00" For index on mktValue field: indexExpression: "p.mktValue" regionPath: "/portfolio p" Query2: "Select * from /portfolio p, p.positions.values pos where pos.secId ='VMWARE'" For index on secId field: indexExpression: "pos.secId" regionPath: "/portfolio p, p.positions.values pos"
        Returns:
        the newly created Index
        Throws:
        QueryInvalidException - if the argument query language strings have invalid syntax
        IndexInvalidException - if the arguments do not correctly specify an index
        IndexNameConflictException - if an index with this name already exists
        IndexExistsException - if an index with these parameters already exists with a different name
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
        java.lang.UnsupportedOperationException - If Index is being created on a region which does not support indexes.
      • createIndex

        Index createIndex​(java.lang.String indexName,
                          java.lang.String indexedExpression,
                          java.lang.String regionPath,
                          java.lang.String imports)
                   throws IndexInvalidException,
                          IndexNameConflictException,
                          IndexExistsException,
                          RegionNotFoundException,
                          java.lang.UnsupportedOperationException
        Create an index that can be used when executing queries.
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the field of the region values that are referenced by the regionPath.
        regionPath - that resolves to region values or nested collections of region values which will correspond to the FROM clause in a query. The regionPath must include exactly one region, but may include multiple expressions as required to drill down into nested region contents. Check following examples.
        imports - string containing imports (in the query language syntax, each import statement separated by a semicolon), provides packages and classes used in variable typing in the Indexed and FROM expressions. The use is the same as for the FROM clause in querying. Example: Query1: "Select * from /portfolio p where p.mktValue > 25.00" For index on mktValue field: indexExpression: "p.mktValue" regionPath: "/portfolio p" Query2: "Select * from /portfolio p, p.positions.values pos where pos.secId ='VMWARE'" For index on secId field: indexExpression: "pos.secId" regionPath: "/portfolio p, p.positions.values pos TYPE Position" imports: "package.Position"
        Returns:
        the newly created Index
        Throws:
        QueryInvalidException - if the argument query language strings have invalid syntax
        IndexInvalidException - if the arguments do not correctly specify an index
        IndexNameConflictException - if an index with this name already exists
        IndexExistsException - if an index with these parameters already exists with a different name
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
        java.lang.UnsupportedOperationException - If Index is being created on a region which overflows to disk
      • createKeyIndex

        Index createKeyIndex​(java.lang.String indexName,
                             java.lang.String indexedExpression,
                             java.lang.String regionPath)
                      throws IndexInvalidException,
                             IndexNameConflictException,
                             IndexExistsException,
                             RegionNotFoundException,
                             java.lang.UnsupportedOperationException
        Create a key index that can be used when executing queries. The key index expression indicates query engine to use region key as index for query evaluation. They are used to make use of the implicit hash index supported with GemFire regions.
        Parameters:
        indexName - the name of this index.
        indexedExpression - refers to the keys of the region that is referenced by the regionPath. For example, an index with indexedExpression "ID" might be used for a query with a WHERE clause of "ID > 10", In this case the ID value is evaluated using region keys.
        regionPath - that resolves to the region which will correspond to the FROM clause in a query. The regionPath must include exactly one region. Example: Query1: "Select * from /portfolio p where p.ID = 10" indexExpression: "p.ID" regionPath: "/portfolio p"
        Returns:
        the newly created Index
        Throws:
        QueryInvalidException - if the argument query language strings have invalid syntax
        IndexInvalidException - if the arguments do not correctly specify an index
        IndexNameConflictException - if an index with this name already exists
        IndexExistsException - if an index with these parameters already exists with a different name
        RegionNotFoundException - if the region referred to in the fromClause doesn't exist
        java.lang.UnsupportedOperationException - If Index is being created on a region which overflows to disk
      • clearDefinedIndexes

        boolean clearDefinedIndexes()
        Clears all the indexes that were defined using defineIndex(String, String, String)
        Returns:
        true if indexes were successfully cleared
      • getIndex

        Index getIndex​(Region<?,​?> region,
                       java.lang.String indexName)
        Get the Index from the specified Region with the specified name.
        Parameters:
        region - the Region for the requested index
        indexName - the name of the index to retrieve
        Returns:
        the index of the region with this name, or null if there isn't one
      • getIndexes

        java.util.Collection<Index> getIndexes()
        Get a collection of all the indexes in the Cache.
        Returns:
        the collection of all indexes in this Cache, or an empty (unmodifiable) collection if no indexes are found.
      • getIndexes

        java.util.Collection<Index> getIndexes​(Region<?,​?> region)
        Get a collection of all the indexes on the specified Region
        Parameters:
        region - the region for the requested indexes
        Returns:
        the collection of indexes on the specified region, or an empty (unmodifiable) collection if no indexes are found.
      • getIndexes

        @Deprecated
        java.util.Collection<Index> getIndexes​(Region<?,​?> region,
                                               IndexType indexType)
        Deprecated.
        As of 6.6.2, use getIndexes(Region) only. Get a collection of all the indexes on the specified Region of the specified index type.
        Parameters:
        region - the region for the requested indexes
        indexType - the type of indexes to get. Currently must be Indexable.FUNCTIONAL
        Returns:
        the collection of indexes for the specified region and type, or an empty (unmodifiable) collection if no indexes are found.
      • removeIndex

        void removeIndex​(Index index)
        Remove the specified index.
        Parameters:
        index - the Index to remove
      • removeIndexes

        void removeIndexes()
        Remove all the indexes from this cache.
      • removeIndexes

        void removeIndexes​(Region<?,​?> region)
        Remove all the indexes on the specified Region
        Parameters:
        region - the Region to remove all indexes from
      • newCq

        CqQuery newCq​(java.lang.String queryString,
                      CqAttributes cqAttr)
               throws QueryInvalidException,
                      CqException
        Constructs a new continuous query, represented by an instance of CqQuery. The CqQuery is not executed until the execute method is invoked on the CqQuery.
        Parameters:
        queryString - the OQL query
        cqAttr - the CqAttributes
        Returns:
        the newly created CqQuery object
        Throws:
        java.lang.IllegalArgumentException - if queryString or cqAttr is null.
        java.lang.IllegalStateException - if this method is called from a cache server.
        QueryInvalidException - if there is a syntax error in the query.
        CqException - if failed to create CQ. E.g.: Query string should refer to only one region. Joins are not supported. The query must be a SELECT statement. DISTINCT queries are not supported. Projections are not supported. Only one iterator in the FROM clause is supported, and it must be a region path. Bind parameters in the query are not yet supported.
        Since:
        GemFire 5.5
      • newCq

        CqQuery newCq​(java.lang.String queryString,
                      CqAttributes cqAttr,
                      boolean isDurable)
               throws QueryInvalidException,
                      CqException
        Constructs a new continuous query, represented by an instance of CqQuery. The CqQuery is not executed until the execute method is invoked on the CqQuery.
        Parameters:
        queryString - the OQL query
        cqAttr - the CqAttributes
        isDurable - true if the CQ is durable
        Returns:
        the newly created CqQuery object
        Throws:
        java.lang.IllegalArgumentException - if queryString or cqAttr is null.
        java.lang.IllegalStateException - if this method is called from a cache server.
        QueryInvalidException - if there is a syntax error in the query.
        CqException - if failed to create CQ. E.g.: Query string should refer to only one region. Joins are not supported. The query must be a SELECT statement. DISTINCT queries are not supported. Projections are not supported. Only one iterator in the FROM clause is supported, and it must be a region path. Bind parameters in the query are not yet supported.
        Since:
        GemFire 5.5
      • newCq

        CqQuery newCq​(java.lang.String name,
                      java.lang.String queryString,
                      CqAttributes cqAttr)
               throws QueryInvalidException,
                      CqExistsException,
                      CqException
        Constructs a new named continuous query, represented by an instance of CqQuery. The CqQuery is not executed until the execute method is invoked on the CqQuery. The name of the query will be used to identify this query in statistics archival.
        Parameters:
        name - the String name for this query
        queryString - the OQL query
        cqAttr - the CqAttributes
        Returns:
        the newly created CqQuery object
        Throws:
        CqExistsException - if a CQ by this name already exists on this client
        java.lang.IllegalArgumentException - if queryString or cqAttr is null.
        java.lang.IllegalStateException - if this method is called from a cache server.
        QueryInvalidException - if there is a syntax error in the query.
        CqException - if failed to create cq. E.g.: Query string should refer to only one region. Joins are not supported. The query must be a SELECT statement. DISTINCT queries are not supported. Projections are not supported. Only one iterator in the FROM clause is supported, and it must be a region path. Bind parameters in the query are not yet supported.
        Since:
        GemFire 5.5
      • newCq

        CqQuery newCq​(java.lang.String name,
                      java.lang.String queryString,
                      CqAttributes cqAttr,
                      boolean isDurable)
               throws QueryInvalidException,
                      CqExistsException,
                      CqException
        Constructs a new named continuous query, represented by an instance of CqQuery. The CqQuery is not executed until the execute method is invoked on the CqQuery. The name of the query will be used to identify this query in statistics archival.
        Parameters:
        name - the String name for this query
        queryString - the OQL query
        cqAttr - the CqAttributes
        isDurable - true if the CQ is durable
        Returns:
        the newly created CqQuery object
        Throws:
        CqExistsException - if a CQ by this name already exists on this client
        java.lang.IllegalArgumentException - if queryString or cqAttr is null.
        java.lang.IllegalStateException - if this method is called from a cache server.
        QueryInvalidException - if there is a syntax error in the query.
        CqException - if failed to create cq. E.g.: Query string should refer to only one region. Joins are not supported. The query must be a SELECT statement. DISTINCT queries are not supported. Projections are not supported. Only one iterator in the FROM clause is supported, and it must be a region path. Bind parameters in the query are not yet supported.
        Since:
        GemFire 5.5
      • closeCqs

        void closeCqs()
        Unregister all Continuous Queries. All artifacts and resources associated with the CQs are released. Any attempt to access closed CqQuery objects will result in the CqClosedException being thrown to the caller.
        Since:
        GemFire 5.5
      • getCqs

        CqQuery[] getCqs()
        Retrieve all registered Continuous Queries. This is a collection of CqQuery objects.
        Returns:
        CqQuery[] list of registered CQs, null if there are no CQs.
        Since:
        GemFire 5.5
      • getCqs

        CqQuery[] getCqs​(java.lang.String regionName)
                  throws CqException
        Retrieves all the registered Continuous Queries for a given region. This is a collection of CqQuery objects.
        Parameters:
        regionName - the name of the region on which registered CQs will be retrieved
        Returns:
        CqQuery[] list of registered CQs on the specified region, null if there are no CQs.
        Throws:
        CqException - if the region does not exist.
        Since:
        GemFire 5.5
      • getCq

        CqQuery getCq​(java.lang.String cqName)
        Retrieves the Continuous Query specified by the name.
        Parameters:
        cqName - - String, name of the CQ
        Returns:
        CqQuery object, null if no CqQuery object is found.
        Since:
        GemFire 5.5
      • executeCqs

        void executeCqs()
                 throws CqException
        Starts execution of all the registered continuous queries for this client. This is complementary to stopCqs.
        Throws:
        CqException - if failure to execute CQ.
        Since:
        GemFire 5.5
        See Also:
        stopCqs()
      • stopCqs

        void stopCqs()
              throws CqException
        Stops execution of all the continuous queries for this client to become inactive. This is useful when client needs to control the incoming CQ messages during bulk region operations.
        Throws:
        CqException - if failure to stop CQ.
        Since:
        GemFire 5.5
        See Also:
        executeCqs()
      • executeCqs

        void executeCqs​(java.lang.String regionName)
                 throws CqException
        Starts execution of all the continuous queries registered on the specified region for this client. This is complementary method to stopCQs().
        Parameters:
        regionName - the name of the region on which registered CQs will be executed
        Throws:
        CqException - if failure to execute CQs.
        Since:
        GemFire 5.5
        See Also:
        stopCqs()
      • stopCqs

        void stopCqs​(java.lang.String regionName)
              throws CqException
        Stops execution of all the continuous queries registered on the specified region for this client. This is useful when client needs to control the incoming CQ messages during bulk region operations.
        Parameters:
        regionName - the name of the region on which registered CQs will be stopped
        Throws:
        CqException - if failure to stop CQs.
        Since:
        GemFire 5.5
        See Also:
        executeCqs()
      • getAllDurableCqsFromServer

        java.util.List<java.lang.String> getAllDurableCqsFromServer()
                                                             throws CqException
        Retrieves all the durable CQs registered by the client calling this method.
        Returns:
        List of names of registered durable CQs, empty list if no durable cqs.
        Throws:
        CqException - if an exception is encountered when retrieving CQs
        Since:
        GemFire 7.0
      • getCqStatistics

        CqServiceStatistics getCqStatistics()
        Returns CqServiceStatistics object, which provides helper methods to get CQ service related statistics for this client. Specifically the following aggregate information on the client's CQs is collected: Number of CQs created (cumulative) Number of CQs active currently Number of CQs stopped or suspended currently Number of CQs closed (cumulative) Number of CQs active on a specified region currently
        Returns:
        CqServiceStatistics object
        Since:
        GemFire 5.5
        See Also:
        CqServiceStatistics