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
- 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 Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Objectdelete(String id)Delete the object for a particular idprotected abstract Objectget(String id)Get the object for a particular idprotected abstract ObjectgetAll()javax.ws.rs.core.ResponsehandleDELETE(String id)javax.ws.rs.core.ResponsehandleGET(String id)javax.ws.rs.core.ResponsehandleGETAll()javax.ws.rs.core.ResponsehandlePOST(InputStream inputStream, com.fasterxml.jackson.databind.ObjectMapper mapper, String id)javax.ws.rs.core.ResponsehandlePOSTAll(InputStream inputStream, com.fasterxml.jackson.databind.ObjectMapper mapper)abstract Objectpost(Map<String,ObjType> inputObject)Process a POST request of the input itemsvoiduse_AbstractListenerHandler_instead()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.server.listener.resource.ListenerHandler
handleUpdates
-
-
-
-
Constructor Detail
-
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 Detail
-
handlePOST
public final javax.ws.rs.core.Response handlePOST(InputStream inputStream, com.fasterxml.jackson.databind.ObjectMapper mapper, String id)
- Specified by:
handlePOSTin interfaceListenerHandler
-
handlePOSTAll
public final javax.ws.rs.core.Response handlePOSTAll(InputStream inputStream, com.fasterxml.jackson.databind.ObjectMapper mapper)
- Specified by:
handlePOSTAllin interfaceListenerHandler
-
handleGET
public final javax.ws.rs.core.Response handleGET(String id)
- Specified by:
handleGETin interfaceListenerHandler
-
handleGETAll
public final javax.ws.rs.core.Response handleGETAll()
- Specified by:
handleGETAllin interfaceListenerHandler
-
handleDELETE
public final javax.ws.rs.core.Response handleDELETE(String id)
- Specified by:
handleDELETEin interfaceListenerHandler
-
use_AbstractListenerHandler_instead
public final void use_AbstractListenerHandler_instead()
- Specified by:
use_AbstractListenerHandler_insteadin interfaceListenerHandler
-
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.
-
-