Package nzilbb.labbcat.server.api.admin
Class Annotators
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- nzilbb.labbcat.server.api.admin.Annotators
-
@RequiredRole("admin") public class Annotators extends APIRequestHandler
Servlet that manages installation/upgrade/uninstallation of annotators./api/admin/annotator
Only the POST method is accepted. The protocol for installation of an annotator module is:
- Upload the annotator .jar file with a multipart POST request (the first file
parameter encountered is taken, regardless of its name). The response is a
JSON-encoded envelope with a "model" object with the following attributes:
- jar
- The name of the .jar file uploaded (this must be used in the subsequent request).
- annotatorId
- The ID of the annotator found in the .jar file.
- version
- The version of the annotator implementation.
- installedVersion
- The version of the already-installed annotator implementation, if any.
- hasConfigWebapp
- Whether or not the annotator implements a 'config' webapp
- hasTaskWebapp
- Whether or not the annotator implements a 'task' webapp
- hasExtWebapp
- Whether or not the annotator implements an 'ext' webapp
- info
- A complete HTML document containing a description of the annotator.
- Make a POST request with the following application/x-www-form-urlencoded
parameters:
- action
- Either
install
orcancel
- jar
- The name of the .jar file, as returned in the response to the preovious request.
instsall
, then the response is a JSON-encoded envelope with a "model" object with the following attributes:- jar
- The name of the .jar file, as returned in the response to the preovious request.
- annotatorId
- The ID of the annotator found in the .jar file.
- url
- The URL that must be visited next in order to complete the installation by configuring the annotator. This may be the URL of the 'config' webapp if there is one, or the 'setConfig' request if not.
- Visit the
url
returned in the reponse to the previous request. The resulting response will be an HTML document.
Annotators can be uninstalled by making a POST request with the following application/x-www-form-urlencoded parameters:
- action
-
uninstall
- annotatorId
- The ID of the annotator.
- Author:
- Robert Fromont robert@fromont.net.nz
- Upload the annotator .jar file with a multipart POST request (the first file
parameter encountered is taken, regardless of its name). The response is a
JSON-encoded envelope with a "model" object with the following attributes:
-
-
Field Summary
-
Fields inherited from class nzilbb.labbcat.server.api.APIRequestHandler
SC_BAD_REQUEST, SC_CONFLICT, SC_FORBIDDEN, SC_INTERNAL_SERVER_ERROR, SC_METHOD_NOT_ALLOWED, SC_NOT_FOUND, SC_OK, SC_UNPROCESSABLE_CONTENT, SC_UNSUPPORTED_MEDIA_TYPE
-
-
Constructor Summary
Constructors Constructor Description Annotators(File tempDir)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
get(Consumer<String> contentTypeConsumer, OutputStream out)
GET handler: lists currently installed annotators.javax.json.JsonObject
post(RequestParameters parameters, Consumer<Integer> httpStatus, File annotatorDir)
POST handler - receive an uploaded file or an installation confirmation.-
Methods inherited from class nzilbb.labbcat.server.api.APIRequestHandler
GetSystemAttribute, init, writeResponse
-
-
-
-
Constructor Detail
-
Annotators
public Annotators(File tempDir)
Default constructor.
-
-
Method Detail
-
post
public javax.json.JsonObject post(RequestParameters parameters, Consumer<Integer> httpStatus, File annotatorDir)
POST handler - receive an uploaded file or an installation confirmation.- Parameters:
parameters
- Request parameter map.httpStatus
- Receives the response status code, in case or error.annotatorDir
- The directory in which annotator jars and their files are stored.- Returns:
- JSON-encoded object representing the response
-
get
public void get(Consumer<String> contentTypeConsumer, OutputStream out) throws IOException
GET handler: lists currently installed annotators.- Throws:
IOException
-
-