Package com.tangosol.coherence.rest
Class EntryResource
java.lang.Object
com.tangosol.coherence.rest.EntryResource
REST resource representing a single cache entry.
- Author:
- as 2011.06.06
-
Field Summary
Modifier and TypeFieldDescriptionprotected NamedCache
NamedCache which stores the referenced entry.protected Class
Class of the referenced entry's value.protected MarshallerRegistry
Marshaller registry to obtain marshallers from.protected Object
Referenced entry's key.protected ProcessorRegistry
a processor registry that is used to map the given processor name to an EntryProcessor instance. -
Constructor Summary
ConstructorDescriptionEntryResource
(NamedCache cache, Object oKey, Class clzValue) Construct EntryResource. -
Method Summary
Modifier and TypeMethodDescriptionaddListener
(boolean fLite) Register SSE event listener for this entry.jakarta.ws.rs.core.Response
delete()
Remove the entry.protected boolean
exists()
Return true if the referenced entry exists in the cache.jakarta.ws.rs.core.Response
get
(PropertySet propertySet, jakarta.ws.rs.core.Request request) Return the entry value or a subset of its properties.protected Object
getValue()
Get the entry value.jakarta.ws.rs.core.Response
Invoke the specified processor against the entry's key.jakarta.ws.rs.core.Response
put
(jakarta.ws.rs.core.HttpHeaders headers, InputStream in) Update the entry value.protected jakarta.ws.rs.core.Response
putInternal
(Object oValue) Update the cache entry.protected Object
remove()
Remove entry from the cache.protected Object
Set the entry value.
-
Field Details
-
m_cache
NamedCache which stores the referenced entry. -
m_oKey
Referenced entry's key. -
m_clzValue
Class of the referenced entry's value. -
m_marshallerRegistry
Marshaller registry to obtain marshallers from. -
m_processorRegistry
a processor registry that is used to map the given processor name to an EntryProcessor instance.
-
-
Constructor Details
-
EntryResource
Construct EntryResource.- Parameters:
cache
- cache in which referenced entry is storedoKey
- referenced entry's keyclzValue
- class of the referenced entry's value
-
-
Method Details
-
get
@GET public jakarta.ws.rs.core.Response get(@MatrixParam("p") PropertySet propertySet, @Context jakarta.ws.rs.core.Request request) Return the entry value or a subset of its properties.- Parameters:
propertySet
- properties to return (if null, value itself will be returned)request
- current HTTP request- Returns:
- entry value or a subset of its properties
-
put
@PUT public jakarta.ws.rs.core.Response put(@Context jakarta.ws.rs.core.HttpHeaders headers, InputStream in) Update the entry value.- Parameters:
headers
- a mutable map of the HTTP message headers.in
- a stream containing a JSON/XML/Binary representation of the new value- Returns:
- response with a status of 200 (OK) if the entry was updated
successfully, or a status of 409 (Conflict) if the value class
implements the
Versionable
interface and the version of the entry in the cache does not match the version of the entry in the request (in case of conflict, the current entry value will be returned in the body of the response as well)
-
delete
@DELETE public jakarta.ws.rs.core.Response delete()Remove the entry.- Returns:
- response with a status of 200 (OK) if entry was removed successfully, or with a status of 404 (Not Found) if it wasn't present in the cache
-
process
@POST @Path("{proc: \\s*(\\w(?:\\w|-)*)\\((.*)\\)}") @Produces({"application/json","application/xml","text/plain"}) public jakarta.ws.rs.core.Response process(@PathParam("proc") String sProc) Invoke the specified processor against the entry's key.- Parameters:
sProc
- name of the processor- Returns:
- the result of the invocation as returned from the EntryProcessor
-
addListener
@GET @Produces("text/event-stream") public MapEventOutput addListener(@QueryParam("lite") boolean fLite) Register SSE event listener for this entry.- Parameters:
fLite
- flag specifying whether to register for lite or full events- Returns:
- the EventOutput that will be used to send events to the client
-
putInternal
Update the cache entry.- Parameters:
oValue
- new entry value- Returns:
- response with a status of 200 (OK) if the entry was updated
successfully, or a status of 409 (Conflict) if the value class
implements the
Versionable
interface and the version of the entry in the cache does not match the version of the entry in the request (in case of conflict, the current entry value will be returned in the body of the response as well)
-
getValue
Get the entry value.- Returns:
- entry value, or void if the entry does not exist
-
setValue
Set the entry value.- Parameters:
oValue
- new value- Returns:
- current entry value if there is a conflict, or null otherwise
-
remove
Remove entry from the cache.- Returns:
- entry value, or void if the entry does not exist
-
exists
protected boolean exists()Return true if the referenced entry exists in the cache.- Returns:
- true if the entry exists, false otherwise
-