Class AbstractListenerHandler<ObjType>

java.lang.Object
org.apache.druid.server.listener.resource.AbstractListenerHandler<ObjType>
Type Parameters:
ObjType - A List of this type is expected in the input stream as JSON. Must be able to be converted to/from Map<String, Object>
All Implemented Interfaces:
ListenerHandler

public abstract class AbstractListenerHandler<ObjType> extends Object implements ListenerHandler
This is a simplified handler for announcement listeners. The input is expected to be a JSON list objects. Empty maps `{}` are taken care of at this level and never passed down to the subclass's handle method.
  • Constructor Details

    • AbstractListenerHandler

      public AbstractListenerHandler(com.fasterxml.jackson.core.type.TypeReference<ObjType> inObjTypeRef)
      The standard constructor takes in a type reference for the object and for a list of the object. This is to work around some limitations in Java with type erasure.
      Parameters:
      inObjTypeRef - The TypeReference for the input object type
  • Method Details

    • handlePOST

      public final javax.ws.rs.core.Response handlePOST(InputStream inputStream, com.fasterxml.jackson.databind.ObjectMapper mapper, String id)
      Specified by:
      handlePOST in interface ListenerHandler
    • handlePOSTAll

      public final javax.ws.rs.core.Response handlePOSTAll(InputStream inputStream, com.fasterxml.jackson.databind.ObjectMapper mapper)
      Specified by:
      handlePOSTAll in interface ListenerHandler
    • handleGET

      public final javax.ws.rs.core.Response handleGET(String id)
      Specified by:
      handleGET in interface ListenerHandler
    • handleGETAll

      public final javax.ws.rs.core.Response handleGETAll()
      Specified by:
      handleGETAll in interface ListenerHandler
    • handleDELETE

      public final javax.ws.rs.core.Response handleDELETE(String id)
      Specified by:
      handleDELETE in interface ListenerHandler
    • use_AbstractListenerHandler_instead

      public final void use_AbstractListenerHandler_instead()
      Specified by:
      use_AbstractListenerHandler_instead in interface ListenerHandler
    • delete

      @Nullable protected abstract Object delete(String id)
      Delete the object for a particular id
      Parameters:
      id - A string id of the object to be deleted. This id is never null or empty.
      Returns:
      The object to be returned in the entity. A NULL return will cause a 404 response. A non-null return will cause a 202 response. An Exception thrown will cause a 500 response.
    • get

      @Nullable protected abstract Object get(String id)
      Get the object for a particular id
      Parameters:
      id - A string id of the object desired. This id is never null or empty.
      Returns:
      The object to be returned in the entity. A NULL return will cause a 404 response. A non-null return will cause a 200 response. An Exception thrown will cause a 500 response.
    • getAll

      @Nullable protected abstract Object getAll()
    • post

      @Nullable public abstract Object post(Map<String,ObjType> inputObject)
      Process a POST request of the input items
      Parameters:
      inputObject - A list of the objects which were POSTed
      Returns:
      An object to be returned in the entity of the response.