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

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-core-aio-boot</artifactId> <artifactId>alfresco-transform-core-aio-boot</artifactId>
<name>Alfresco Core All in One Transformer Spring Boot</name> <name>Alfresco Core All-In-One Transformer Spring Boot</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<parent> <parent>
@@ -14,7 +14,7 @@
</parent> </parent>
<properties> <properties>
<image.name>alfresco/alfresco-transform-aio</image.name> <image.name>alfresco/alfresco-transform-core-aio</image.name>
<image.registry>quay.io</image.registry> <image.registry>quay.io</image.registry>
<env.project_artifactId>${project.artifactId}</env.project_artifactId> <env.project_artifactId>${project.artifactId}</env.project_artifactId>
</properties> </properties>

View File

@@ -32,17 +32,26 @@ import static org.alfresco.transformer.fs.FileManager.createAttachment;
import static org.alfresco.transformer.fs.FileManager.createSourceFile; import static org.alfresco.transformer.fs.FileManager.createSourceFile;
import static org.alfresco.transformer.fs.FileManager.createTargetFile; import static org.alfresco.transformer.fs.FileManager.createTargetFile;
import static org.alfresco.transformer.fs.FileManager.createTargetFileName; import static org.alfresco.transformer.fs.FileManager.createTargetFileName;
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_ENCODING;
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_EXTENSION;
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_MIMETYPE;
import static org.alfresco.transformer.util.RequestParamMap.TARGET_EXTENSION;
import static org.alfresco.transformer.util.RequestParamMap.TARGET_MIMETYPE;
import static org.alfresco.transformer.util.RequestParamMap.TEST_DELAY;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE; import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
import java.io.File; import java.io.File;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.alfresco.transform.exceptions.TransformException;
import org.alfresco.transformer.logging.LogEntry; import org.alfresco.transformer.logging.LogEntry;
import org.alfresco.transformer.probes.ProbeTestTransform; import org.alfresco.transformer.probes.ProbeTestTransform;
import org.alfresco.transformer.transformers.AllInOneTransformer; import org.alfresco.transformer.transformers.AllInOneTransformer;
@@ -61,20 +70,6 @@ public class AIOController extends AbstractTransformerController
{ {
private static final Logger logger = LoggerFactory.getLogger(AIOController.class); private static final Logger logger = LoggerFactory.getLogger(AIOController.class);
//TODO Should these be moved to the AbstractTransformerController or are they present in the transform.client? They are used by most controllers...
private static final String SOURCE_ENCODING = "sourceEncoding";
private static final String SOURCE_EXTENSION = "sourceExtension";
private static final String TARGET_EXTENSION = "targetExtension";
private static final String TARGET_MIMETYPE = "targetMimetype";
private static final String SOURCE_MIMETYPE = "sourceMimetype";
private static final String TEST_DELAY = "testDelay";
private static final String[] UNWANTED_OPTIONS = {SOURCE_EXTENSION,
TARGET_EXTENSION,
TARGET_MIMETYPE,
SOURCE_MIMETYPE,
TEST_DELAY
};
@Autowired @Autowired
private AllInOneTransformer transformer; private AllInOneTransformer transformer;
@@ -94,18 +89,23 @@ public class AIOController extends AbstractTransformerController
public void processTransform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype, public void processTransform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
Map<String, String> transformOptions, Long timeout) Map<String, String> transformOptions, Long timeout)
{ {
debugLogTransform("Processing transform", sourceMimetype, targetMimetype, transformOptions); logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype, transformOptions); final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype, transformOptions);
transformOptions.put(AllInOneTransformer.TRANSFORM_NAME_PARAMETER, transform); transformOptions.put(AllInOneTransformer.TRANSFORM_NAME_PARAMETER, transform);
try try
{ {
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, transformOptions); transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, transformOptions);
} }
catch (Exception e) catch (IllegalArgumentException e)
{ {
logger.error(e.getMessage(), e); throw new TransformException(BAD_REQUEST.value(), e.getMessage(), e);
}
catch (Exception e)
{
throw new TransformException(INTERNAL_SERVER_ERROR.value(), e.getMessage(), e);
} }
@@ -134,7 +134,7 @@ public class AIOController extends AbstractTransformerController
} }
catch(Exception e) catch(Exception e)
{ {
logger.error(e.getMessage(), e); throw new TransformException(INTERNAL_SERVER_ERROR.value(), e.getMessage(), e);
} }
} }
@@ -144,19 +144,22 @@ public class AIOController extends AbstractTransformerController
@PostMapping(value = "/transform", consumes = MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/transform", consumes = MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Resource> transform(HttpServletRequest request, public ResponseEntity<Resource> transform(HttpServletRequest request,
@RequestParam("file") MultipartFile sourceMultipartFile, @RequestParam("file") MultipartFile sourceMultipartFile,
@RequestParam(TARGET_EXTENSION) String targetExtension,
@RequestParam(TARGET_MIMETYPE) String targetMimetype,
@RequestParam(SOURCE_MIMETYPE) String sourceMimetype, @RequestParam(SOURCE_MIMETYPE) String sourceMimetype,
@RequestParam Map<String, String> transformOptions, @RequestParam(TARGET_MIMETYPE) String targetMimetype,
@RequestParam(TARGET_EXTENSION) String targetExtension,
@RequestParam Map<String, String> requestParameters,
@RequestParam (value = TEST_DELAY, required = false) Long testDelay) @RequestParam (value = TEST_DELAY, required = false) Long testDelay)
{ {
// TODO - remove this logginng debugLogTransform("Request parameters: ", sourceMimetype, targetMimetype, targetExtension, requestParameters);
debugLogTransform("Entering request with: ", sourceMimetype, targetMimetype, transformOptions);
//Remove all required parameters from request parameters to get the list of options
List<String> optionsToFilter = Arrays.asList(SOURCE_EXTENSION, TARGET_EXTENSION, TARGET_MIMETYPE,
SOURCE_MIMETYPE, TEST_DELAY);
Map<String, String> transformOptions = new HashMap<>(requestParameters);
transformOptions.keySet().removeAll(optionsToFilter);
transformOptions.values().removeIf(v -> v.isEmpty());
//Using @RequestParam Map<String, String> will gather all text params, including those specified seperately above.
removeUnwantedOptions(transformOptions, UNWANTED_OPTIONS, true);
final String targetFilename = createTargetFileName( final String targetFilename = createTargetFileName(
sourceMultipartFile.getOriginalFilename(), targetExtension); sourceMultipartFile.getOriginalFilename(), targetExtension);
@@ -164,24 +167,25 @@ public class AIOController extends AbstractTransformerController
final File sourceFile = createSourceFile(request, sourceMultipartFile); final File sourceFile = createSourceFile(request, sourceMultipartFile);
final File targetFile = createTargetFile(request, targetFilename); final File targetFile = createTargetFile(request, targetFilename);
// TODO Currently sourceMimetype and targetMimetype could be an empty string how does this affect getting the name?
// not all controllers take these from the request? Do requests intended for these transforms provide these?
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype, transformOptions);
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype, transformOptions);
transformOptions.put(AllInOneTransformer.TRANSFORM_NAME_PARAMETER, transform); transformOptions.put(AllInOneTransformer.TRANSFORM_NAME_PARAMETER, transform);
// TODO - remove this logginng debugLogTransform("Performing transform with parameters: ", sourceMimetype, targetMimetype,
debugLogTransform("After filtering props request with: ", sourceMimetype, targetMimetype, transformOptions); targetExtension, requestParameters);
try try
{ {
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, transformOptions); transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, transformOptions);
} }
catch (Exception e) catch (IllegalArgumentException e)
{ {
logger.error(e.getMessage(), e); throw new TransformException(BAD_REQUEST.value(), e.getMessage(), e);
}
catch (Exception e)
{
throw new TransformException(INTERNAL_SERVER_ERROR.value(), e.getMessage(), e);
} }
final ResponseEntity<Resource> body = createAttachment(targetFilename, targetFile); final ResponseEntity<Resource> body = createAttachment(targetFilename, targetFile);
LogEntry.setTargetSize(targetFile.length()); LogEntry.setTargetSize(targetFile.length());
@@ -191,39 +195,13 @@ public class AIOController extends AbstractTransformerController
return body; return body;
} }
private void debugLogTransform(String message, String sourceMimetype, String targetMimetype, Map<String, String> transformOptions) { private void debugLogTransform(String message, String sourceMimetype, String targetMimetype, String targetExtension,
Map<String, String> transformOptions) {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug( logger.debug(
"{} : sourceMimetype: '{}', targetMimetype: '{}', transformOptions: '{}'", "{} : sourceMimetype: '{}', targetMimetype: '{}', targetExtension: '{}', transformOptions: '{}'",
message, sourceMimetype, targetMimetype, transformOptions); message, sourceMimetype, targetMimetype, targetExtension, transformOptions);
}
}
/**
* Removes entries from transformOptions that have keys that match a value
* contained in unwantedStrings.
* Entries that contain empty strings can optionally be removed.
*
* @param transformOptions
* @param unwantedStrings
* @param emptyStrings
*/
private void removeUnwantedOptions(Map<String, String> transformOptions, String[] unwantedStrings, boolean emptyStrings)
{
for (Iterator<Map.Entry<String, String>> iter = transformOptions.entrySet().iterator();iter.hasNext();)
{
Map.Entry<String, String> entry = iter.next();
if (entry.getValue().isEmpty() || Arrays.asList(unwantedStrings).contains(entry.getKey()))
{
iter.remove();
if (logger.isDebugEnabled())
{
logger.debug("Key={} has been removed from the provided RequestParameters and it was passed value={}",
entry.getKey(), entry.getValue()
);
}
}
} }
} }
} }

View File

@@ -72,9 +72,6 @@ public abstract class AbstractTransformer implements Transformer
return transformConfig; return transformConfig;
} }
/*
* TODO - Override default config name by a configurable location defined by a property
*/
private TransformConfig loadTransformConfig() throws Exception private TransformConfig loadTransformConfig() throws Exception
{ {
String configFileName = getTransformerConfigPrefix() + TRANSFORMER_CONFIG_SUFFIX; String configFileName = getTransformerConfigPrefix() + TRANSFORMER_CONFIG_SUFFIX;

View File

@@ -26,6 +26,24 @@
*/ */
package org.alfresco.transformer.transformers; package org.alfresco.transformer.transformers;
import static org.alfresco.transformer.util.RequestParamMap.ALLOW_ENLARGEMENT;
import static org.alfresco.transformer.util.RequestParamMap.ALPHA_REMOVE;
import static org.alfresco.transformer.util.RequestParamMap.AUTO_ORIENT;
import static org.alfresco.transformer.util.RequestParamMap.COMMAND_OPTIONS;
import static org.alfresco.transformer.util.RequestParamMap.CROP_GRAVITY;
import static org.alfresco.transformer.util.RequestParamMap.CROP_HEIGHT;
import static org.alfresco.transformer.util.RequestParamMap.CROP_PERCENTAGE;
import static org.alfresco.transformer.util.RequestParamMap.CROP_WIDTH;
import static org.alfresco.transformer.util.RequestParamMap.CROP_X_OFFSET;
import static org.alfresco.transformer.util.RequestParamMap.CROP_Y_OFFSET;
import static org.alfresco.transformer.util.RequestParamMap.END_PAGE;
import static org.alfresco.transformer.util.RequestParamMap.MAINTAIN_ASPECT_RATIO;
import static org.alfresco.transformer.util.RequestParamMap.RESIZE_HEIGHT;
import static org.alfresco.transformer.util.RequestParamMap.RESIZE_PERCENTAGE;
import static org.alfresco.transformer.util.RequestParamMap.RESIZE_WIDTH;
import static org.alfresco.transformer.util.RequestParamMap.START_PAGE;
import static org.alfresco.transformer.util.RequestParamMap.THUMBNAIL;
import static org.alfresco.transformer.util.RequestParamMap.TIMEOUT;
import static org.alfresco.transformer.util.Util.stringToInteger; import static org.alfresco.transformer.util.Util.stringToInteger;
import static org.alfresco.transformer.util.Util.stringToLong; import static org.alfresco.transformer.util.Util.stringToLong;
@@ -41,27 +59,6 @@ public class ImageMagickAdapter extends AbstractTransformer
private static String CONFIG_PREFIX = "imagemagick"; private static String CONFIG_PREFIX = "imagemagick";
private ImageMagickCommandExecutor commandExecutor; private ImageMagickCommandExecutor commandExecutor;
//TODO move key strings to a central class
private static final String START_PAGE = "startPage";
private static final String END_PAGE = "endPage";
private static final String ALPHA_REMOVE = "alphaRemove";
private static final String AUTO_ORIENT = "autoOrient";
private static final String CROP_GRAVITY = "cropGravity";
private static final String CROP_WIDTH = "cropWidth";
private static final String CROP_HEIGHT = "cropHeight";
private static final String CROP_PERCENTAGE = "cropPercentage";
private static final String CROP_X_OFFSET = "cropXOffset";
private static final String CROP_Y_OFFSET = "cropYOffset";
private static final String THUMBNAIL = "thumbnail";
private static final String RESIZE_WIDTH = "resizeWidth";
private static final String RESIZE_HEIGHT = "resizeHeight";
private static final String RESIZE_PERCENTAGE = "resizePercentage";
private static final String ALLOW_ENLARGEMENT = "allowEnlargement";
private static final String MAINTAIN_ASPECT_RATIO = "maintainAspectRatio";
private static final String COMMAND_OPTIONS = "commandOptions";
private static final String TIMEOUT_REQUEST_PARAM = "timeOut";
public ImageMagickAdapter() throws Exception public ImageMagickAdapter() throws Exception
{ {
super(); super();
@@ -105,7 +102,7 @@ public class ImageMagickAdapter extends AbstractTransformer
stringToInteger(transformOptions.get(END_PAGE)) stringToInteger(transformOptions.get(END_PAGE))
); );
Long timeout = stringToLong(transformOptions.get(TIMEOUT_REQUEST_PARAM)); Long timeout = stringToLong(transformOptions.get(TIMEOUT));
commandExecutor.run(options, sourceFile, pageRange, targetFile, timeout); commandExecutor.run(options, sourceFile, pageRange, targetFile, timeout);
} }

View File

@@ -26,6 +26,12 @@
*/ */
package org.alfresco.transformer.transformers; package org.alfresco.transformer.transformers;
import static org.alfresco.transformer.util.RequestParamMap.ALLOW_PDF_ENLARGEMENT;
import static org.alfresco.transformer.util.RequestParamMap.HEIGHT_REQUEST_PARAM;
import static org.alfresco.transformer.util.RequestParamMap.MAINTAIN_PDF_ASPECT_RATIO;
import static org.alfresco.transformer.util.RequestParamMap.PAGE_REQUEST_PARAM;
import static org.alfresco.transformer.util.RequestParamMap.TIMEOUT;
import static org.alfresco.transformer.util.RequestParamMap.WIDTH_REQUEST_PARAM;
import static org.alfresco.transformer.util.Util.stringToLong; import static org.alfresco.transformer.util.Util.stringToLong;
import java.io.File; import java.io.File;
@@ -39,15 +45,6 @@ public class PdfRendererAdapter extends AbstractTransformer
{ {
private static String CONFIG_PREFIX = "pdfrenderer"; private static String CONFIG_PREFIX = "pdfrenderer";
private PdfRendererCommandExecutor pdfExecutor; private PdfRendererCommandExecutor pdfExecutor;
//TODO move key strings to a central class
private final static String PAGE_REQUEST_PARAM = "page";
private final static String WIDTH_REQUEST_PARAM = "width";
private final static String HEIGHT_REQUEST_PARAM = "height";
private final static String ALLOW_PDF_ENLARGEMENT = "allowPdfEnlargement";
private final static String MAINTAIN_PDF_ASPECT_RATIO = "maintainPdfAspectRatio";
private final static String TIMEOUT_REQUEST_PARAM = "timeout";
public PdfRendererAdapter() throws Exception public PdfRendererAdapter() throws Exception
{ {
@@ -75,7 +72,7 @@ public class PdfRendererAdapter extends AbstractTransformer
.withMaintainPdfAspectRatio(transformOptions.get(MAINTAIN_PDF_ASPECT_RATIO)) .withMaintainPdfAspectRatio(transformOptions.get(MAINTAIN_PDF_ASPECT_RATIO))
.build(); .build();
Long timeout = stringToLong(transformOptions.get(TIMEOUT_REQUEST_PARAM)); Long timeout = stringToLong(transformOptions.get(TIMEOUT));
pdfExecutor.run(options, sourceFile, targetFile, timeout); pdfExecutor.run(options, sourceFile, targetFile, timeout);
} }

View File

@@ -35,11 +35,6 @@ import java.util.Map;
/** /**
* Interface for transformers which can perform transformations and specify their own supported configuration. * Interface for transformers which can perform transformations and specify their own supported configuration.
*
* TODO - This could be implemented by each individual Transform engine in its own module
* and used by controllers for simplicity and clarity. Controllers could be made generic
*
* @author eknizat
*/ */
public interface Transformer public interface Transformer
{ {
@@ -51,10 +46,6 @@ public interface Transformer
/** /**
* Implementation of the actual transformation. * Implementation of the actual transformation.
* *
*
* TODO - Do we really need the sourceMimetype and targetMimetype as separate arguments?
* they could be passed in parameters with predefined keys like TRANSFORM_NAME_PARAMETER
*
* @param sourceFile * @param sourceFile
* @param targetFile * @param targetFile
* @param transformOptions * @param transformOptions
@@ -67,8 +58,6 @@ public interface Transformer
/** /**
* @return Supported config for the transformer implementation. * @return Supported config for the transformer implementation.
* *
* TODO - maybe this does not have to be part of the common transform interface?
*
*/ */
TransformConfig getTransformConfig(); TransformConfig getTransformConfig();

View File

@@ -80,7 +80,6 @@ public class AllInOneTransformerTest
return new String(Files.readAllBytes(file.toPath()), encoding); return new String(Files.readAllBytes(file.toPath()), encoding);
} }
// TODO - add more thorough test
@Test @Test
public void testConfigAggregation() throws Exception public void testConfigAggregation() throws Exception
{ {

View File

@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-imagemagick-boot</artifactId> <artifactId>alfresco-transform-imagemagick-boot</artifactId>
<name>Alfresco ImageMagick Transformer SpringBoot</name> <name>Alfresco ImageMagick Transformer Spring Boot</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<parent> <parent>

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-misc-boot</artifactId> <artifactId>alfresco-transform-misc-boot</artifactId>
<name>Alfresco Docker Miscellaneous Transformers</name> <name>Alfresco Miscellaneous Transformer Spring Boot</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<parent> <parent>

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-misc</artifactId> <artifactId>alfresco-transform-misc</artifactId>
<name>Alfresco Miscellaneous Transformers</name> <name>Alfresco Miscellaneous Transformer</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<parent> <parent>

View File

@@ -40,10 +40,12 @@ import org.alfresco.transform.client.registry.TransformCache;
import org.alfresco.transform.exceptions.TransformException; import org.alfresco.transform.exceptions.TransformException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import com.fasterxml.jackson.databind.ObjectMapper; 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. * 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); 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}") @Value("${transform.config.location:classpath:engine_config.json}")
private String locationFromProperty; private String locationFromProperty;
@Value("${transform.config.location:classpath:engine_config.json}")
private Resource engineConfig; 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. // 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. // Unlike other sub classes this class does not extend Data or replace it at run time.
private TransformCache data = new TransformCache(); private TransformCache data = new TransformCache();
@@ -74,17 +85,10 @@ public class TransformRegistryImpl extends AbstractTransformRegistry
catch (IOException e) catch (IOException e)
{ {
throw new TransformException(INTERNAL_SERVER_ERROR.value(), 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 @Override
public TransformCache getData() 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";
}