Merge branch 'ATS-675_aio_transformer' into ATS-702_ATS-675_Add-AIO-Tests

This commit is contained in:
David Edwards
2020-04-07 20:26:29 +01:00
12 changed files with 149 additions and 128 deletions

View File

@@ -40,10 +40,12 @@ import org.alfresco.transform.client.registry.TransformCache;
import org.alfresco.transform.exceptions.TransformException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.core.io.ResourceLoader;
/**
* Used by clients to work out if a transformation is supported based on the engine_config.json.
@@ -52,13 +54,22 @@ public class TransformRegistryImpl extends AbstractTransformRegistry
{
private static final Logger log = LoggerFactory.getLogger(TransformRegistryImpl.class);
// TODO - do we really need this string?
@Autowired
ResourceLoader resourceLoader;
@Value("${transform.config.location:classpath:engine_config.json}")
private String locationFromProperty;
@Value("${transform.config.location:classpath:engine_config.json}")
private Resource engineConfig;
@PostConstruct
public void afterPropertiesSet()
{
engineConfig = resourceLoader.getResource(locationFromProperty);
TransformConfig transformConfig = getTransformConfig();
registerAll(transformConfig, null, locationFromProperty);
}
// Holds the structures used by AbstractTransformRegistry to look up what is supported.
// Unlike other sub classes this class does not extend Data or replace it at run time.
private TransformCache data = new TransformCache();
@@ -74,17 +85,10 @@ public class TransformRegistryImpl extends AbstractTransformRegistry
catch (IOException e)
{
throw new TransformException(INTERNAL_SERVER_ERROR.value(),
"Could not read " + engineConfig.getDescription(), e);
"Could not read " + locationFromProperty, e);
}
}
@PostConstruct
public void afterPropertiesSet()
{
TransformConfig transformConfig = getTransformConfig();
registerAll(transformConfig, null, locationFromProperty);
}
@Override
public TransformCache getData()
{

View File

@@ -0,0 +1,60 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 200 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* -
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transformer.util;
public interface RequestParamMap
{
String SOURCE_ENCODING = "sourceEncoding";
String SOURCE_EXTENSION = "sourceExtension";
String SOURCE_MIMETYPE = "sourceMimetype";
String TARGET_EXTENSION = "targetExtension";
String TARGET_MIMETYPE = "targetMimetype";
String TEST_DELAY = "testDelay";
String PAGE_REQUEST_PARAM = "page";
String WIDTH_REQUEST_PARAM = "width";
String HEIGHT_REQUEST_PARAM = "height";
String ALLOW_PDF_ENLARGEMENT = "allowPdfEnlargement";
String MAINTAIN_PDF_ASPECT_RATIO = "maintainPdfAspectRatio";
String START_PAGE = "startPage";
String END_PAGE = "endPage";
String ALPHA_REMOVE = "alphaRemove";
String AUTO_ORIENT = "autoOrient";
String CROP_GRAVITY = "cropGravity";
String CROP_WIDTH = "cropWidth";
String CROP_HEIGHT = "cropHeight";
String CROP_PERCENTAGE = "cropPercentage";
String CROP_X_OFFSET = "cropXOffset";
String CROP_Y_OFFSET = "cropYOffset";
String THUMBNAIL = "thumbnail";
String RESIZE_WIDTH = "resizeWidth";
String RESIZE_HEIGHT = "resizeHeight";
String RESIZE_PERCENTAGE = "resizePercentage";
String ALLOW_ENLARGEMENT = "allowEnlargement";
String MAINTAIN_ASPECT_RATIO = "maintainAspectRatio";
String COMMAND_OPTIONS = "commandOptions";
String TIMEOUT = "timeOut";
}