public class NamedQueryResource extends Object
Modifier and Type | Field and Description |
---|---|
protected AggregatorRegistry |
m_aggregatorRegistry
Aggregator registry that is used to map the given aggregator name to
an EntryAggregator instance.
|
protected NamedCache |
m_cache
NamedCache wrapped by this resource.
|
protected int |
m_cMaxResults
Maximum size of the result set this resource is allowed to return.
|
protected ProcessorRegistry |
m_processorRegistry
a processor registry that is used to map the given processor name to
an EntryProcessor instance.
|
protected NamedQuery |
m_query
Named query responsible to filter cache entries.
|
protected QueryEngineRegistry |
m_registry
Query engine registry.
|
Constructor and Description |
---|
NamedQueryResource(NamedCache cache,
NamedQuery query,
int cMaxResults)
Create a instance of NamedQueryResource.
|
Modifier and Type | Method and Description |
---|---|
MapEventOutput |
addListener(boolean fLite,
javax.ws.rs.core.UriInfo uriInfo)
Register SSE event listener for this named query.
|
javax.ws.rs.core.Response |
aggregate(javax.ws.rs.core.UriInfo uriInfo,
String sAggr)
Perform an aggregating operation against the entries that belong to
the named query.
|
protected 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.
|
javax.ws.rs.core.Response |
getEntries(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.Response |
getKeys(javax.ws.rs.core.UriInfo uriInfo)
Return the keys for cache entries that satisfy criteria defined by
this resource.
|
javax.ws.rs.core.Response |
getValues(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 Set |
keys(javax.ws.rs.core.UriInfo uriInfo)
Return the keys of cache entries that satisfy the named query criteria.
|
javax.ws.rs.core.Response |
process(javax.ws.rs.core.UriInfo uriInfo,
String sProc)
Invoke the specified processor against the entries that belong to the
named query.
|
protected NamedCache m_cache
protected NamedQuery m_query
protected int m_cMaxResults
@Inject protected QueryEngineRegistry m_registry
@Inject protected AggregatorRegistry m_aggregatorRegistry
@Inject protected ProcessorRegistry m_processorRegistry
public NamedQueryResource(NamedCache cache, NamedQuery query, int cMaxResults)
cache
- cache to create a resource forquery
- query filtering the cache entriescMaxResults
- max size of result set for this resource@GET @Path(value="{aggr: \\s*(\\w(?:\\w|-)*)\\((.*)\\)}") @Produces(value={"application/json","application/xml","text/plain"}) public javax.ws.rs.core.Response aggregate(@Context javax.ws.rs.core.UriInfo uriInfo, @PathParam(value="aggr") String sAggr)
uriInfo
- UriInfo for the invoked resource methodsAggr
- name of the aggregator@POST @Path(value="{proc: \\s*(\\w(?:\\w|-)*)\\((.*)\\)}") @Produces(value={"application/json","application/xml"}) public javax.ws.rs.core.Response process(@Context javax.ws.rs.core.UriInfo uriInfo, @PathParam(value="proc") String sProc)
uriInfo
- UriInfo for the invoked resource methodsProc
- the name of the processor@GET public javax.ws.rs.core.Response getValues(@Context javax.ws.rs.core.UriInfo uriInfo, @MatrixParam(value="start") @DefaultValue(value="0") int nStart, @MatrixParam(value="count") @DefaultValue(value="-1") int cResults, @MatrixParam(value="sort") String sSort, @MatrixParam(value="p") PropertySet propertySet)
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)@GET @Path(value="entries") @Produces(value={"application/json","application/xml","text/plain"}) public javax.ws.rs.core.Response getEntries(@Context javax.ws.rs.core.UriInfo uriInfo, @MatrixParam(value="start") @DefaultValue(value="0") int nStart, @MatrixParam(value="count") @DefaultValue(value="-1") int cResults, @MatrixParam(value="sort") String sSort, @MatrixParam(value="p") PropertySet propertySet)
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)@GET @Path(value="keys") @Produces(value={"application/json","application/xml","text/plain"}) public javax.ws.rs.core.Response getKeys(@Context javax.ws.rs.core.UriInfo uriInfo)
uriInfo
- UriInfo for the invoked resource method@GET @Produces(value="text/event-stream") public MapEventOutput addListener(@MatrixParam(value="lite") boolean fLite, @Context javax.ws.rs.core.UriInfo uriInfo)
fLite
- flag specifying whether to register for lite or full eventsuriInfo
- UriInfo for the invoked resource methodprotected Collection executeQuery(javax.ws.rs.core.UriInfo uriInfo, ValueExtractor<Map.Entry,?> extractor, int nStart, int cResults, String sSort)
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 orderprotected Set keys(javax.ws.rs.core.UriInfo uriInfo)
uriInfo
- UriInfo for invoked resource method