Package nzilbb.labbcat.server.api.admin
Class Serialization
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- nzilbb.labbcat.server.api.admin.Serialization
-
@RequiredRole("admin") public class Serialization extends APIRequestHandler
Servlet that manages installation/upgrade/uninstallation of formatters (serializers/deserializers)./api/admin/serialization
Only the POST method is accepted. The protocol for installation of a serialization module is:
- Upload the formatter .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).
- name
- The human-readable name of the file format handled by the serialization module found in the .jar file.
- mimeType
- The MIME (Content) Type handled by the serialization module found in the .jar file.
- version
- The version of the serialization implementation.
- deserializer
- Whether or not the module can read files of the given format
- serializer
- Whether or not the module can produce files of the given format
- icon
- URL for the module's icon.
- installedVersion
- The version of the already-installed serialization implementation, if any.
- 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 previous request.
intsall
, 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 previous request.
- name
- The human-readable name of the file format handled by the serialization module found in the .jar file.
- mimeType
- The MIME (Content) Type handled by the serialization module found in the .jar file.
- version
- The version of the serialization implementation.
Serialization modules can be uninstalled by making a POST request with the following application/x-www-form-urlencoded parameters:
- action
-
uninstall
- mimeType
- The MIME (Content) Type handled by the serialization.
- Author:
- Robert Fromont robert@fromont.net.nz
- Upload the formatter .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_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
-
-
Constructor Summary
Constructors Constructor Description Serialization(File tempDir)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.json.JsonObjectpost(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
getContext, GetSystemAttribute, init, writeResponse
-
-
-
-
Constructor Detail
-
Serialization
public Serialization(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 of error.annotatorDir- The directory in which annotator jars and their files are stored.- Returns:
- JSON-encoded object representing the response
-
-