Package com.tangosol.coherence.rest
Class NamedQueryResource
java.lang.Object
com.tangosol.coherence.rest.NamedQueryResource
REST resource representing a set of filtered cache entries.
- Author:
- ic 2011.12.03
-
Field Summary
Modifier and TypeFieldDescriptionprotected AggregatorRegistry
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.protected ProcessorRegistry
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.protected QueryEngineRegistry
Query engine registry. -
Constructor Summary
ConstructorDescriptionNamedQueryResource
(NamedCache cache, NamedQuery query, int cMaxResults) Create a instance of NamedQueryResource. -
Method Summary
Modifier and TypeMethodDescriptionaddListener
(boolean fLite, jakarta.ws.rs.core.UriInfo uriInfo) Register SSE event listener for this named query.jakarta.ws.rs.core.Response
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
Invoke the specified processor against the entries that belong to the named query.
-
Field Details
-
m_cache
NamedCache wrapped by this resource. -
m_query
Named query responsible to filter cache entries. -
m_cMaxResults
protected int m_cMaxResultsMaximum size of the result set this resource is allowed to return. -
m_registry
Query engine registry. -
m_aggregatorRegistry
Aggregator registry that is used to map the given aggregator name to an EntryAggregator instance. -
m_processorRegistry
a processor registry that is used to map the given processor name to an EntryProcessor instance.
-
-
Constructor Details
-
NamedQueryResource
Create a instance of NamedQueryResource.- Parameters:
cache
- cache to create a resource forquery
- query filtering the cache entriescMaxResults
- 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 methodsAggr
- 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 methodsProc
- 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 methodnStart
- the starting index of result set to be returnedcResults
- the size of result set to be returned (page size)sSort
- a string expression that represents orderingpropertySet
- 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 methodnStart
- the starting index of result set to be returnedcResults
- the size of result set to be returned (page size)sSort
- a string expression that represents orderingpropertySet
- 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 eventsuriInfo
- 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 methodextractor
- the extractor to apply to each entry in the result setnStart
- the starting index of result set to be returnedcResults
- 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
Return the keys of cache entries that satisfy the named query criteria.- Parameters:
uriInfo
- UriInfo for invoked resource method- Returns:
- filtered key set
-