org.eclipse.smila.objectstore.httphandler
Class StoreAdminHandler
java.lang.Object
org.eclipse.smila.http.server.util.ARequestHandler
org.eclipse.smila.http.server.json.JsonRequestHandler
org.eclipse.smila.objectstore.httphandler.AStoreHandler
org.eclipse.smila.objectstore.httphandler.StoreAdminHandler
- All Implemented Interfaces:
- HttpHandler, RequestHandler
public class StoreAdminHandler
- extends AStoreHandler
Implements the handling of HTTP requests for getting store infos, creating and deleting stores.
Field Summary |
static java.lang.String |
PARAM_RETURNOBJECTS
parameter to switch on or off list of objects in store info. |
Method Summary |
protected int |
getSuccessStatus(java.lang.String method,
java.lang.String requestUri)
for PUT and DELETE, success status is HttpStatus.CREATED . |
protected boolean |
isValidMethod(java.lang.String method,
java.lang.String requestUri)
Valid methods are GET (store info), PUT (create store) or DELETE (remove store). |
java.lang.Object |
process(java.lang.String method,
java.lang.String requestUri,
Record parameters)
process input record and return result object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PARAM_RETURNOBJECTS
public static final java.lang.String PARAM_RETURNOBJECTS
- parameter to switch on or off list of objects in store info.
- See Also:
- Constant Field Values
StoreAdminHandler
public StoreAdminHandler()
- Default constructor.
isValidMethod
protected boolean isValidMethod(java.lang.String method,
java.lang.String requestUri)
- Valid methods are GET (store info), PUT (create store) or DELETE (remove store).
Checks if the handler allows the HTTP method.
- Overrides:
isValidMethod
in class JsonRequestHandler
- Parameters:
method
- HTTP methodrequestUri
- request URI
- Returns:
- true if the method can be used for the URI, else false.
getSuccessStatus
protected int getSuccessStatus(java.lang.String method,
java.lang.String requestUri)
- for PUT and DELETE, success status is
HttpStatus.CREATED
.
- Overrides:
getSuccessStatus
in class JsonRequestHandler
- Parameters:
method
- HTTP methodrequestUri
- request URI
- Returns:
- the status code to return for successful requests using the method and request URI. By default it is "OK"
(200).
process
public java.lang.Object process(java.lang.String method,
java.lang.String requestUri,
Record parameters)
throws ObjectStoreException
- process input record and return result object.
- Specified by:
process
in class JsonRequestHandler
- Parameters:
method
- HTTP methodrequestUri
- request URI.parameters
- input record parsed either from request body, if it has content, or from request URI parameters.
- Returns:
- null for create- and delete-store requests, Store information object else.
- Throws:
ObjectStoreException