Class 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
    true if 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
    • Constructor Detail

      • Upgrade

        public Upgrade​(File root,
                       String driverName,
                       String connectionURL,
                       String connectionName,
                       String connectionPassword)
        Constructor.
    • 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
      • get

        public javax.json.JsonObject get​(Consumer<Integer> httpStatus)
        The GET method for the servlet.
        Parameters:
        httpStatus - Receives the response status code, in case of error.
        Returns:
        JSON-encoded object representing the response