Class EntryResource

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

public class EntryResource extends Object
REST resource representing a single cache entry.
Author:
as 2011.06.06
  • Field Details

    • m_cache

      protected NamedCache m_cache
      NamedCache which stores the referenced entry.
    • m_oKey

      protected Object m_oKey
      Referenced entry's key.
    • m_clzValue

      protected Class m_clzValue
      Class of the referenced entry's value.
    • m_marshallerRegistry

      @Inject protected MarshallerRegistry m_marshallerRegistry
      Marshaller registry to obtain marshallers from.
    • 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

    • EntryResource

      public EntryResource(NamedCache cache, Object oKey, Class clzValue)
      Construct EntryResource.
      Parameters:
      cache - cache in which referenced entry is stored
      oKey - referenced entry's key
      clzValue - 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

      protected jakarta.ws.rs.core.Response putInternal(Object oValue)
      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

      protected Object getValue()
      Get the entry value.
      Returns:
      entry value, or void if the entry does not exist
    • setValue

      protected Object setValue(Object oValue)
      Set the entry value.
      Parameters:
      oValue - new value
      Returns:
      current entry value if there is a conflict, or null otherwise
    • remove

      protected Object 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