Class NamedQueryResource

java.lang.Object
com.tangosol.coherence.rest.NamedQueryResource

public class NamedQueryResource extends Object
REST resource representing a set of filtered cache entries.
Author:
ic 2011.12.03
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Aggregator registry that is used to map the given aggregator name to an EntryAggregator instance.
    protected NamedCache
    NamedCache wrapped by this resource.
    protected int
    Maximum size of the result set this resource is allowed to return.
    a processor registry that is used to map the given processor name to an EntryProcessor instance.
    protected NamedQuery
    Named query responsible to filter cache entries.
    Query engine registry.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NamedQueryResource(NamedCache cache, NamedQuery query, int cMaxResults)
    Create a instance of NamedQueryResource.
  • Method Summary

    Modifier and Type
    Method
    Description
    addListener(boolean fLite, jakarta.ws.rs.core.UriInfo uriInfo)
    Register SSE event listener for this named query.
    jakarta.ws.rs.core.Response
    aggregate(jakarta.ws.rs.core.UriInfo uriInfo, String sAggr)
    Perform an aggregating operation against the entries that belong to the named query.
    protected Collection
    executeQuery(jakarta.ws.rs.core.UriInfo uriInfo, ValueExtractor<Map.Entry,?> extractor, int nStart, int cResults, String sSort)
    Returns a collection of extracted values for cache entries that satisfy the criteria expressed by the query.
    jakarta.ws.rs.core.Response
    getEntries(jakarta.ws.rs.core.UriInfo uriInfo, int nStart, int cResults, String sSort, PropertySet propertySet)
    Return the cache entries that satisfy criteria defined by this resource.
    jakarta.ws.rs.core.Response
    getKeys(jakarta.ws.rs.core.UriInfo uriInfo)
    Return the keys for cache entries that satisfy criteria defined by this resource.
    jakarta.ws.rs.core.Response
    getValues(jakarta.ws.rs.core.UriInfo uriInfo, int nStart, int cResults, String sSort, PropertySet propertySet)
    Return the cache values that satisfy criteria defined by this resource.
    protected Set
    keys(jakarta.ws.rs.core.UriInfo uriInfo)
    Return the keys of cache entries that satisfy the named query criteria.
    jakarta.ws.rs.core.Response
    process(jakarta.ws.rs.core.UriInfo uriInfo, String sProc)
    Invoke the specified processor against the entries that belong to the named query.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • m_cache

      protected NamedCache m_cache
      NamedCache wrapped by this resource.
    • m_query

      protected NamedQuery m_query
      Named query responsible to filter cache entries.
    • m_cMaxResults

      protected int m_cMaxResults
      Maximum size of the result set this resource is allowed to return.
    • m_registry

      @Inject protected QueryEngineRegistry m_registry
      Query engine registry.
    • m_aggregatorRegistry

      @Inject protected AggregatorRegistry m_aggregatorRegistry
      Aggregator registry that is used to map the given aggregator name to an EntryAggregator instance.
    • m_processorRegistry

      @Inject protected ProcessorRegistry m_processorRegistry
      a processor registry that is used to map the given processor name to an EntryProcessor instance.
  • Constructor Details

    • NamedQueryResource

      public NamedQueryResource(NamedCache cache, NamedQuery query, int cMaxResults)
      Create a instance of NamedQueryResource.
      Parameters:
      cache - cache to create a resource for
      query - query filtering the cache entries
      cMaxResults - max size of result set for this resource
  • Method Details

    • aggregate

      @GET @Path("{aggr: \\s*(\\w(?:\\w|-)*)\\((.*)\\)}") @Produces({"application/json","application/xml","text/plain"}) public jakarta.ws.rs.core.Response aggregate(@Context jakarta.ws.rs.core.UriInfo uriInfo, @PathParam("aggr") String sAggr)
      Perform an aggregating operation against the entries that belong to the named query.
      Parameters:
      uriInfo - UriInfo for the invoked resource method
      sAggr - name of the aggregator
      Returns:
      the result of the aggregation
    • process

      @POST @Path("{proc: \\s*(\\w(?:\\w|-)*)\\((.*)\\)}") @Produces({"application/json","application/xml"}) public jakarta.ws.rs.core.Response process(@Context jakarta.ws.rs.core.UriInfo uriInfo, @PathParam("proc") String sProc)
      Invoke the specified processor against the entries that belong to the named query.
      Parameters:
      uriInfo - UriInfo for the invoked resource method
      sProc - the name of the processor
      Returns:
      a Map containing the results of invoking the EntryProcessor against the entries that are selected by the given query
    • getValues

      @GET public jakarta.ws.rs.core.Response getValues(@Context jakarta.ws.rs.core.UriInfo uriInfo, @MatrixParam("start") @DefaultValue("0") int nStart, @MatrixParam("count") @DefaultValue("-1") int cResults, @MatrixParam("sort") String sSort, @MatrixParam("p") PropertySet propertySet)
      Return the cache values that satisfy criteria defined by this resource.
      Parameters:
      uriInfo - UriInfo for the invoked resource method
      nStart - the starting index of result set to be returned
      cResults - the size of result set to be returned (page size)
      sSort - a string expression that represents ordering
      propertySet - properties to return (if null, values will be returned)
      Returns:
      values that satisfy criteria defined by this resource
    • getEntries

      @GET @Path("entries") @Produces({"application/json","application/xml","text/plain"}) public jakarta.ws.rs.core.Response getEntries(@Context jakarta.ws.rs.core.UriInfo uriInfo, @MatrixParam("start") @DefaultValue("0") int nStart, @MatrixParam("count") @DefaultValue("-1") int cResults, @MatrixParam("sort") String sSort, @MatrixParam("p") PropertySet propertySet)
      Return the cache entries that satisfy criteria defined by this resource.
      Parameters:
      uriInfo - UriInfo for the invoked resource method
      nStart - the starting index of result set to be returned
      cResults - the size of result set to be returned (page size)
      sSort - a string expression that represents ordering
      propertySet - the subset of properties to return for each value (if null, the complete values will be returned)
      Returns:
      the cache entries satisfying criteria defined by this resource
    • getKeys

      @GET @Path("keys") @Produces({"application/json","application/xml","text/plain"}) public jakarta.ws.rs.core.Response getKeys(@Context jakarta.ws.rs.core.UriInfo uriInfo)
      Return the keys for cache entries that satisfy criteria defined by this resource.
      Parameters:
      uriInfo - UriInfo for the invoked resource method
      Returns:
      the keys of the cache entries satisfying criteria defined by this resource
    • addListener

      @GET @Produces("text/event-stream") public MapEventOutput addListener(@MatrixParam("lite") boolean fLite, @Context jakarta.ws.rs.core.UriInfo uriInfo)
      Register SSE event listener for this named query.
      Parameters:
      fLite - flag specifying whether to register for lite or full events
      uriInfo - UriInfo for the invoked resource method
      Returns:
      the EventOutput that will be used to send events to the client
    • executeQuery

      protected Collection executeQuery(jakarta.ws.rs.core.UriInfo uriInfo, ValueExtractor<Map.Entry,?> extractor, int nStart, int cResults, String sSort)
      Returns a collection of extracted values for cache entries that satisfy the criteria expressed by the query.
      Parameters:
      uriInfo - UriInfo for the invoked resource method
      extractor - the extractor to apply to each entry in the result set
      nStart - the starting index of result set to be returned
      cResults - the size of result set to be returned (page size)
      sSort - a string expression that represents sort order
      Returns:
      the cache entries that satisfy the criteria defined by this named query
    • keys

      protected Set keys(jakarta.ws.rs.core.UriInfo uriInfo)
      Return the keys of cache entries that satisfy the named query criteria.
      Parameters:
      uriInfo - UriInfo for invoked resource method
      Returns:
      filtered key set