The objective of this PR is to replace all the ContentService calls related to transforms with calls to the SynchronousTransformClient that switches between Local and Legacy transforms. This will allow us to remove the Legacy transforms at some point and also take advantage of the T-Engines which can be scaled.
- Introduced a ContentTransformService interface to hold all the ContentService calls related to transforms and an implementation class ContentTransformServiceAdaptor as a super class of ContentServiceImpl. The Adaptor provides code to allow the SynchronousTransformClient to be called. As a result any external custom code that uses these methods will be able to take advantage of Local or Legacy transforms.
- The transform code originally in ContentServiceImpl has been moved to ContentTransformServiceImpl, which is a super class of the LegacySynchronousTransformClient.
- All calls in the repository have been replaced with calls to SynchronousTransformClient. There are still a few calls to these methods in ContentServiceImplTest and ArchiveContentTransformerTest that have not been changes as they test Legacy transform code.
- The asynchronous LocalTransformClient now uses the SynchronousTransformClient.
- Bug fix to the TransformationOptionsConverter as it was found that the page number being used for images was wrong. Legacy transformers start at page 1, where as Local and ImageMagick itself start at 0.
- Added a conversion to the new transform option (Map<String,String) in TransformationOptionsConverter, as some of the ContentTransformServiceAdaptor methods need to wrap a Local transformer in a Legacy transformer, so that it may be returned.
- A number of existing tests were passing because the wrong exception was being thrown. When the Local transformer was used this became more obvious as the tests would fail.
- To avoid other test failing the Local Transform registry is loaded on start up rather than waiting for it to be scheduled, as a few milliseconds needed to read the config was till too large for the test to run and fail. A similar approach had been taken before with tests.
The Tika T-Engine was not being called by the Transform Service or Local transforms, because the sub-transform name was required.
Moved common classes (with repo) to alfresco-transform-model so that it can be used by the T-Engines to work out which sub transformer to use. InT also performed a refactor on these classes (alfresco-transform-model 1.0.2.7). Also includes changes to legacy transformers so that they don't pass the sub transformer name any more.
Break done of changes:
- Removed rendition definition spring beans and created 0100-baseRenditions.json. Changes are picked up periodically by the running system.
- Refactored TransformServiceRegistryImpl to extract ConfigFileFinder to reads json from resources, files or directories.
- Refactored TransformServiceRegistryImpl to extract ConfigScheduler to periodically reads config data.
- Used ConfigFileFinder and ConfigScheduler in RenditionDefinition2Impl to read rendition defs.
- Removed the need for a current 'Data' parameter to be passed to register methods when adding transforms or renditions.
- Changes in test classes of AbstractRenditionIntegrationTests to force the config to be read once before each test, as tests were sometimes not getting the correct config due to scheduling.
Creation of local transformers that don't depend on any of the legacy transformer code deprecated in ACS 6.1. The previous local transformers are now referred to as legacy transformers.
The localTransformClient and localTransformServiceRegistry now are switches between these two classes of transform.
The tests were refactored to run Spring annotations instead of ApplicationContextHelper to mitigate the problems of Camel Context loading. The refactored tests are all part of AppContext06TestSuite.
Disabled PdfBoxContentTransformerTest as it requires installation of additional software on the build agent. The test is deprecated already.
An exception was being thrown if there was no supported rendition. In the case where a rendition already existed, RenditionService2 should have removed the content and hashcode on the rendition node and updated the source nodes thumbnailLastModified value. This is what happens if there is a transform failure when there is a rendition available. Also found that changing the mimetype nut not the content was not resulting in a new rendition as the hashcode did not include the mimetype.
Problems found in caches in the ThumbnailService caused this to take place. TransformerDebug has also been improved to include Transform Service requests and responses.