Class Upgrade
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- nzilbb.labbcat.server.api.admin.Upgrade
-
@RequiredRole("admin") public class Upgrade extends APIRequestHandler
/api/admin/upgrade[/*] : Handler for receiving, analysing, and processing a LaBB-CAT upgrader./api/admin/upgrade
POST method requests start the process by uploading an upload .war file, which is the same file as can be used to install a new version of LaBB-CAT.
The multipart-encoded parameter is:
- war
- Upgrade file to upload.
Output: A JSON-encoded response containing a
model
with the following attributes:- id
- A unique identifier for the upload which can be passed into subsequent PUT calls
to
/api/admin/upgrade/...for finalizing the upgrade. - oldVersion
- The version of LaBB-CAT currently installed.
- newVersion
- The version of LaBB-CAT that would be upgraded to if it's confirmed.
- migration
-
trueif the file is a migration package - i.e. a complete LaBB-CAT database include data which has been exported from elsewhere.
/api/admin/upgrade/...
PUT method confirms that the upgrade should proceed.
The request method must be PUT and the URL path following .../upgrade/ must be the id that was returned by the earlier POST.
Output: A JSON-encoded response containing a
model
with the following attributes:- id
- The upload ID passed in, which can be passed into subsequent calls if necessary.
- threadId
- The ID of the task unpacking the upgrade package.
The response will also contain any messages or errors associated with the confirmation of the upgrade.
Confirming the upgrade upacks the contents of the upgrader, triggering the start of the upgrade. Upgrade progress can be followed using GET requests.
/api/admin/upgrade/...
DELETE method requests cancel a previously POSTed upload of an upgrader.
The request method must be DELETE and the URL path following .../upload/ must be the id that was returned by the earlier POST.
/api/admin/upgrade
GET method provides the status of the current upgrade, if any.
Output: A JSON-encoded response containing a
model
with the following attributes:- version
- The current LaBB-CAT version
- threadId
- The task's ID
- threadName
- The name of the task
- running
- Whether the task is currently running
- duration
- How long the task has run for
- percentComplete
- How far through the task is
- status
- The task's current status description
- lastException
- The last exception to occur, if any
- stackTrace
- If an exception has occurred, this is a stack trace identifying where the exception was thrown
- messages
- An array of upgrade messages
If only the version attribute is present in the model, no upgrader is currently running.
- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Field Summary
-
Fields inherited from class nzilbb.labbcat.server.api.APIRequestHandler
SC_BAD_REQUEST, SC_CONFLICT, SC_CREATED, SC_FORBIDDEN, SC_INTERNAL_SERVER_ERROR, SC_METHOD_NOT_ALLOWED, SC_NOT_FOUND, SC_OK, SC_UNAUTHORIZED, SC_UNPROCESSABLE_CONTENT, SC_UNSUPPORTED_MEDIA_TYPE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.json.JsonObjectdelete(String pathInfo, Consumer<Integer> httpStatus)The DELETE method for the servlet.javax.json.JsonObjectget(Consumer<Integer> httpStatus)The GET method for the servlet.javax.json.JsonObjectpost(RequestParameters requestParameters, Consumer<Integer> httpStatus)The POST method for the servlet.javax.json.JsonObjectput(String pathInfo, RequestParameters requestParameters, Consumer<Integer> httpStatus)The PUT method for the servlet.-
Methods inherited from class nzilbb.labbcat.server.api.APIRequestHandler
getContext, GetSystemAttribute, init, writeResponse
-
-
-
-
Method Detail
-
post
public javax.json.JsonObject post(RequestParameters requestParameters, Consumer<Integer> httpStatus)
The POST method for the servlet.- Parameters:
requestParameters- Request parameter map.httpStatus- Receives the response status code, in case of error.- Returns:
- JSON-encoded object representing the response
-
put
public javax.json.JsonObject put(String pathInfo, RequestParameters requestParameters, Consumer<Integer> httpStatus)
The PUT method for the servlet.- Parameters:
pathInfo- The URL path from which the upload ID can be inferred.requestParameters- Request parameter map.httpStatus- Receives the response status code, in case of error.- Returns:
- JSON-encoded object representing the response
-
delete
public javax.json.JsonObject delete(String pathInfo, Consumer<Integer> httpStatus)
The DELETE method for the servlet.- Parameters:
pathInfo- The URL path from which the upload ID can be inferred.httpStatus- Receives the response status code, in case of error.- Returns:
- JSON-encoded object representing the response
-
-