Alan Davis babe26b0ba
HXENG-64 refactor ATS (#657)
Refactor to clean up packages in the t-model and to introduce a simpler to implement t-engine base.

The new t-engines (tika, imagemagick, libreoffice, pdfrenderer, misc, aio, aspose) and t-router may be used in combination with older components as the API between the content Repo and between components has not changed. As far as possible the same artifacts are created (the -boot projects no longer exist). They may be used with older ACS repo versions.

The main changes to look for are:
* The introduction of TransformEngine and CustomTransformer interfaces to be implemented.
* The removal in t-engines and t-router of the Controller, Application, test template page, Controller tests and application config, as this is all now done by the t-engine base package.
* The t-router now extends the t-engine base, which also reduced the amount of duplicate code.
* The t-engine base provides the test page, which includes drop downs of known transform options. The t-router is able to use pipeline and failover transformers. This was not possible to do previously as the router had no test UI.
* Resources including licenses are automatically included in the all-in-one t-engine, from the individual t-engines. They just need to be added as dependencies in the pom. 
* The ugly code in the all-in-one t-engine and misc t-engine to pick transformers has gone, as they are now just selected by the transformRegistry.
* The way t-engines respond to http or message queue transform requests has been combined (eliminates the similar but different code that existed before).
* The t-engine base now uses InputStream and OutputStream rather than Files by default. As a result it will be simpler to avoid writing content to a temporary location.
* A number of the Tika and Misc CustomTransforms no longer use Files.
* The original t-engine base still exists so customers can continue to create custom t-engines the way they have done previously. the project has just been moved into a folder called deprecated.
* The folder structure has changed. The long "alfresco-transform-..." names have given way to shorter easier to read and type names.
* The t-engine project structure now has a single project rather than two. 
* The previous config values still exist, but there are now a new set for config values for in files with names that don't misleadingly imply they only contain pipeline of routing information. 
* The concept of 'routing' has much less emphasis in class names as the code just uses the transformRegistry. 
* TransformerConfig may now be read as json or yaml. The restrictions about what could be specified in yaml has gone.
* T-engines and t-router may use transform config from files. Previously it was just the t-router.
* The POC code to do with graphs of possible routes has been removed.
* All master branch changes have been merged in.
* The concept of a single transform request which results in multiple responses (e.g. images from a video) has been added to the core processing of requests in the t-engine base.
* Many SonarCloud linter fixes.
2022-09-14 13:40:19 +01:00

2.5 KiB

T-Engines

The t-engines provide the basic transform operations. The Transform Service provides a common base for the communication with other components. It is this base that is described in this section. The base is a Spring Boot application to which transform specific code is added and then wrapped in a Docker image with any programs that the transforms need. The base does not need to be used as long as there appears to be a process responding endpoints and messages.

A t-engine groups together one of more Transformers. Each Transformer (provided by transform specific code) knows how to perform a set of transformations from one MIME Type to another with a common set of t-options.

0010 my-t-engine
  Transformer 1
    mimetype A -> mimetype B
    mimetype A -> mimetype C
    mimetype B -> mimetype C
    option1
    option2
  Transformer 2
    mimetype A -> mimetype B
    mimetype D -> mimetype C
    option2
    option3
0020 another-t-engine
  ...
0030 yet-another-t-engine
  ...

Endpoints

  • POST /transform to perform a transform. There are two forms:
    • For asynchronous transforms: Perform a transform using a TransformRequest received from the t-router via a message queue. The TransformReply is sent back via the queue.
    • For synchronous transforms: Performs a transform on content uploaded as a Multipart File and provides the resulting content as a download. Transform options are extracted from the request properties. The following are not added as transform options, but are used to select the transformer: sourceMimetype & targetMimetype.
  • GET /transform/config to obtain t-config about what the t-engine supports. It has a parameter configVersion to allow a caller and the t-engine to negotiate down to a common format. The value is an integer which indicate which elements may to be added to the config. These elements reflect functionality supported by the base (such as pre-signed URLs). The CoreVersionDecorator adds to the Config returned by the transform specific code.
  • GET / provides an html test page to upload a source file, enter transform options and issue a synchronous transform request. Useful in testing.
  • GET /log provides a page with basic log information. Useful in testing.
  • GET /error provides an error page when testing.
  • GET /version provides a String message to be included in client debug messages.
  • GET /ready used by Kubernetes as a ready probe.
  • GET /live used by Kubernetes as a ready probe.