Package com.tangosol.coherence.rest
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 SummaryFields Modifier and Type Field Description protected AggregatorRegistrym_aggregatorRegistryAggregator registry that is used to map the given aggregator name to an EntryAggregator instance.protected NamedCachem_cacheNamedCache wrapped by this resource.protected intm_cMaxResultsMaximum size of the result set this resource is allowed to return.protected ProcessorRegistrym_processorRegistrya processor registry that is used to map the given processor name to an EntryProcessor instance.protected NamedQuerym_queryNamed query responsible to filter cache entries.protected QueryEngineRegistrym_registryQuery engine registry.
 - 
Constructor SummaryConstructors Constructor Description NamedQueryResource(NamedCache cache, NamedQuery query, int cMaxResults)Create a instance of NamedQueryResource.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description MapEventOutputaddListener(boolean fLite, javax.ws.rs.core.UriInfo uriInfo)Register SSE event listener for this named query.javax.ws.rs.core.Responseaggregate(javax.ws.rs.core.UriInfo uriInfo, String sAggr)Perform an aggregating operation against the entries that belong to the named query.protected CollectionexecuteQuery(javax.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.javax.ws.rs.core.ResponsegetEntries(javax.ws.rs.core.UriInfo uriInfo, int nStart, int cResults, String sSort, PropertySet propertySet)Return the cache entries that satisfy criteria defined by this resource.javax.ws.rs.core.ResponsegetKeys(javax.ws.rs.core.UriInfo uriInfo)Return the keys for cache entries that satisfy criteria defined by this resource.javax.ws.rs.core.ResponsegetValues(javax.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 Setkeys(javax.ws.rs.core.UriInfo uriInfo)Return the keys of cache entries that satisfy the named query criteria.javax.ws.rs.core.Responseprocess(javax.ws.rs.core.UriInfo uriInfo, String sProc)Invoke the specified processor against the entries that belong to the named query.
 
- 
- 
- 
Field Detail- 
m_cacheprotected NamedCache m_cache NamedCache wrapped by this resource.
 - 
m_queryprotected NamedQuery m_query Named query responsible to filter cache entries.
 - 
m_cMaxResultsprotected 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 Detail- 
NamedQueryResourcepublic 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 Detail- 
aggregate@GET @Path("{aggr: \\s*(\\w(?:\\w|-)*)\\((.*)\\)}") @Produces({"application/json","application/xml","text/plain"}) public javax.ws.rs.core.Response aggregate(@Context javax.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 javax.ws.rs.core.Response process(@Context javax.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 javax.ws.rs.core.Response getValues(@Context javax.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 javax.ws.rs.core.Response getEntries(@Context javax.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 javax.ws.rs.core.Response getKeys(@Context javax.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 javax.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
 
 - 
executeQueryprotected Collection executeQuery(javax.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
 
 - 
keysprotected Set keys(javax.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
 
 
- 
 
-