ATS-675:Add All-In-One transformer (#200)

* ATS-695/ATS-675 Add aio boot project

- Added the bare bones of a spring boot project to be used by aio. Currently based loosely on transform-misc.

* ATS-674/ATS-695 Add forms for each transformer.

* ATS-675/ATS-695 add empty test to pass build during dev

* ATS-695 remove maven profile to fix build

* ATS-675 Define interface and the aio transformer

* Fix formatting and rename the module as per review comments

* ATS-675/ATS-695 Add ProbeTestTransformation

Currenly uses MiscController implementation.

* ATS-675/ATS-695 Add logger method,

This will be code repeated in the local transform method and the processTransform method

* ATS-675/ATS-695 Implement local transform method

Minimum implementation for transform method.

* ATS-675/ATS-695  Implement processTransform

* ATS-675/ATS-695 Rename project to alfresco-transform-core-aio-boot

Add alfresco-transform-core-aio dependencies

* ATS-675/ATS-695 Fix build

Update project location
Update imports and variable declarations in TODOs
Add error handling.
Formatting.

* ATS-693: Update transform-misc Dockerfile with newly reserved uid

* Revert "ATS-691: Combine the win/linux pathToFile logic"

This reverts commit 61fe4820

* ATS-693: Update transform-misc Dockerfile with newly reserved uid

* "ATS-693: Add Dockerfile to aio-boot module"

* ATS-675/ATS-695 Add resource required for ProbeTestTrasform

* ATS-675/ATS-695 Remove test resources, to be added in test implementation

* ATS-693: Fix path to jar resources

* ATS-675/ATS-703 Moved Options builder to non boot jar.

* ATS-675/ATS-703 Rename OptionsBuilder to PdfRendererOptionsBuilder

This is to avoid confilct with OptionsBuilders in other T-engines.

* ATS-675/ATS-695 Added PdfRendererApadpter.java

Added dependency to pom.xml
Required transformation of String to Long, method added to Util.java

* ATS-675/ ATS-704

Implemented LibreOfficeAdapter

* ATS-675 Parity with base aio naming convention

* ATS-675/ATS-705 Implemented ImageMagickAdapter

Moved and renamed OptionsBuilder. Moved to alfresco-transform-imagemagick, renamed ImageMagickOptionsBuilder.
Added dependencies to pom.xml

* ATS-693: Implement maven docker build

* Initial tests
* Add initial tests for config aggregation
* Update AbstractTransformerControllerTest to use the new engine config names

* Fix up controller

* Fix travis tests  (#205)

* Fix engine specific properties for engine config location
* Temporarily add engine configs to test resources for the boot modules.  Will need to fix this properly

* Resolve some review comments

* ATS-675 - Move static strings to util class

* Refactor classes for simpler design (#210)

* ATS-702 Fix error handling

(cherry picked from commit e30cb5fda6ba2ae09c91ef61e69cba4689bcc8d9)

* ATS-675 Rename test class (fixes typo)

* ATS-675: Add aio transformer to static scan
This commit is contained in:
eknizat 2020-04-08 17:40:34 +01:00 committed by GitHub
parent 5c6782a3aa
commit af77d429e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 4900 additions and 77 deletions

View File

@ -23,6 +23,8 @@ java -jar vosp-api-wrappers-java-$VERACODE_WRAPPER_VERSION.jar -vid $VERACODE_AP
alfresco-transform-tika/alfresco-transform-tika-boot/target/alfresco-transform-tika-boot-*.jar \
alfresco-transform-misc/alfresco-transform-misc/target/alfresco-transform-misc-*.jar \
alfresco-transform-misc/alfresco-transform-misc-boot/target/alfresco-transform-misc-boot*.jar \
alfresco-transform-core-aio/alfresco-transform-core-aio/target/alfresco-transform-core-aio-*.jar \
alfresco-transform-core-aio/alfresco-transform-core-aio-boot/target/alfresco-transform-core-aio-boot*.jar \
-version "$TRAVIS_JOB_ID - $TRAVIS_JOB_NUMBER" -scantimeout 3600
popd

View File

@ -0,0 +1,70 @@
# Image provides an all-in-one (AIO) container in which to run core transformations for Alfresco Content Services.
# Tika is from Apache. See the license at http://www.apache.org/licenses/LICENSE-2.0.
# LibreOffice is from The Document Foundation. See the license at https://www.libreoffice.org/download/license/ or in /libreoffice.txt.
# ImageMagick is from ImageMagick Studio LLC. See the license at http://www.imagemagick.org/script/license.php or in /ImageMagick-license.txt.
# alfresco-pdf-renderer uses the PDFium library from Google Inc. See the license at https://pdfium.googlesource.com/pdfium/+/master/LICENSE or in /pdfium.txt.
FROM alfresco/alfresco-base-java:11.0.1-openjdk-centos-7-6784d76a7b81
ENV APACHE_LICENSE_FILE=https://github.com/Alfresco/acs-community-packaging/blob/master/distribution/src/main/resources/licenses/3rd-party/Apache%202.0.txt
ARG IMAGEMAGICK_VERSION=7.0.7-27
ENV IMAGEMAGICK_RPM_URL=https://nexus.alfresco.com/nexus/service/local/repositories/thirdparty/content/org/imagemagick/imagemagick-distribution/${IMAGEMAGICK_VERSION}/imagemagick-distribution-${IMAGEMAGICK_VERSION}-linux.rpm
ENV IMAGEMAGICK_LIB_RPM_URL=https://nexus.alfresco.com/nexus/service/local/repositories/thirdparty/content/org/imagemagick/imagemagick-distribution/${IMAGEMAGICK_VERSION}/imagemagick-distribution-${IMAGEMAGICK_VERSION}-libs-linux.rpm
ENV IMAGEMAGICK_LICENSE_FILE=https://github.com/Alfresco/acs-community-packaging/blob/master/distribution/src/main/resources/licenses/3rd-party/ImageMagick-license.txt
ARG LIBREOFFICE_VERSION=6.1.6
ENV LIBREOFFICE_RPM_URL=https://nexus.alfresco.com/nexus/service/local/repositories/thirdparty/content/org/libreoffice/libreoffice-dist/${LIBREOFFICE_VERSION}/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz
ENV LIBREOFFICE_LICENSE_FILE=https://github.com/Alfresco/acs-community-packaging/blob/master/distribution/src/main/resources/licenses/3rd-party/libreoffice.txt
ENV ALFRESCO_PDF_RENDERER_LIB_RPM_URL=https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/alfresco-pdf-renderer/1.1/alfresco-pdf-renderer-1.1-linux.tgz
ENV PDFIUM_LICENSE_FILE=https://github.com/Alfresco/acs-community-packaging/blob/master/distribution/src/main/resources/licenses/3rd-party/pdfium.txt
ENV JAVA_OPTS=""
# Set default user information
ARG GROUPNAME=Alfresco
ARG GROUPID=1000
ARG AIOUSERNAME=transform-all-in-one
ARG USERID=33017
COPY target/alfresco-transform-core-aio-boot-${env.project_version}.jar /usr/bin
RUN ln /usr/bin/alfresco-transform-core-aio-boot-${env.project_version}.jar /usr/bin/alfresco-transform-core-aio-boot.jar && \
curl -s -S $IMAGEMAGICK_RPM_URL -o imagemagick-distribution-linux.rpm && \
curl -s -S $IMAGEMAGICK_LIB_RPM_URL -o imagemagick-distribution-libs-linux.rpm && \
curl -s -S $IMAGEMAGICK_LICENSE_FILE -o ImageMagick-license.txt && \
yum localinstall -y imagemagick-distribution-*linux.rpm && \
rm -f imagemagick-distribution-*.rpm && \
yum clean all && \
yum install -y cairo cups-libs libSM && \
test -f libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz && \
ln -s libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz libreoffice-dist-linux.gz || \
curl -s -S $LIBREOFFICE_RPM_URL -o libreoffice-dist-linux.gz && \
curl -s -S $LIBREOFFICE_LICENSE_FILE -o libreoffice.txt && \
tar xzf libreoffice-dist-linux.gz && \
yum localinstall -y LibreOffice*/RPMS/*.rpm && \
rm -rf libreoffice-dist-*linux.gz LibreOffice_*_Linux_x86-64_rpm && \
yum clean all && \
curl -s -S $ALFRESCO_PDF_RENDERER_LIB_RPM_URL -o alfresco-pdf-renderer-linux.tgz && \
curl -s -S $PDFIUM_LICENSE_FILE -o pdfium.txt && \
tar xf alfresco-pdf-renderer-linux.tgz -C /usr/bin && \
rm -f alfresco-pdf-renderer-linux.tgz && \
yum clean all && \
curl -s -S $APACHE_LICENSE_FILE -o Apache\ 2.0.txt && \
yum clean all
ADD target/generated-resources/licenses /licenses
ADD target/generated-resources/licenses.xml /licenses/
ADD target/generated-sources/license/THIRD-PARTY.txt /licenses/
RUN groupadd -g ${GROUPID} ${GROUPNAME} && \
useradd -u ${USERID} -G ${GROUPNAME} ${AIOUSERNAME} && \
chgrp -R ${GROUPNAME} /usr/bin/alfresco-transform-core-aio-boot.jar
EXPOSE 8090
USER ${AIOUSERNAME}
ENTRYPOINT java $JAVA_OPTS -jar /usr/bin/alfresco-transform-core-aio-boot.jar

View File

@ -0,0 +1,291 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>alfresco-transform-core-aio-boot</artifactId>
<name>Alfresco Core All-In-One Transformer Spring Boot</name>
<packaging>jar</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<properties>
<image.name>alfresco/alfresco-transform-core-aio</image.name>
<image.registry>quay.io</image.registry>
<env.project_artifactId>${project.artifactId}</env.project_artifactId>
</properties>
<dependencies>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transformer-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core-aio</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transformer-base</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.15.8</name>
<run>
<hostname>activemq</hostname>
<ports>
<port>8161:8161</port>
<port>5672:5672</port>
<port>61616:61616</port>
</ports>
<wait>
<log>Apache ActiveMQ 5.15.8 .* started</log>
<time>20000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
<image>
<alias>aio</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
<port>8090:8090</port>
</ports>
<wait>
<http>
<url>http://localhost:8090/transform/config</url>
<method>GET</method>
<status>200...299</status>
</http>
<time>300000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>internal</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
<image>
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
<!-- DockerHub image -->
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override">
<images>
<!-- QuayIO image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
<!-- DockerHub image -->
<image>
<name>${image.name}:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,232 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
import static org.alfresco.transformer.fs.FileManager.createAttachment;
import static org.alfresco.transformer.fs.FileManager.createSourceFile;
import static org.alfresco.transformer.fs.FileManager.createTargetFile;
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.MediaType.MULTIPART_FORM_DATA_VALUE;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Arrays;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import org.alfresco.transform.client.model.config.TransformConfig;
import org.alfresco.transform.exceptions.TransformException;
import org.alfresco.transformer.logging.LogEntry;
import org.alfresco.transformer.probes.ProbeTestTransform;
import org.alfresco.transformer.transformers.Transformer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
@Controller
public class AIOController extends AbstractTransformerController
{
private static final Logger logger = LoggerFactory.getLogger(AIOController.class);
@Autowired
private AIOTransformRegistry transformRegistry;
@Override
public String getTransformerName()
{
return "All in One Transformer";
}
@Override
public String version()
{
return getTransformerName() + " available";
}
@Override
public void processTransform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
Map<String, String> transformOptions, Long timeout)
{
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype, transformOptions);
transformInternal( transform, sourceFile, targetFile, MIMETYPE_HTML, MIMETYPE_TEXT_PLAIN, transformOptions);
}
// TODO ATS-713 Currently uses the Misc probeTest. The implementation will need to be changed such that the test can be selected based on the required transform
@Override
public ProbeTestTransform getProbeTestTransform()
{
// HtmlParserContentTransformer html -> text
// See the Javadoc on this method and Probes.md for the choice of these values.
return new ProbeTestTransform(this, "quick.html", "quick.txt",
119, 30, 150, 1024,
60 * 2 + 1, 60 * 2)
{
@Override
protected void executeTransformCommand(File sourceFile, File targetFile)
{
Map<String, String> parameters = new HashMap<>();
parameters.put(SOURCE_ENCODING, "UTF-8");
transformInternal( "misc", sourceFile, targetFile, MIMETYPE_HTML,
MIMETYPE_TEXT_PLAIN, parameters);
}
};
}
@PostMapping(value = "/transform", consumes = MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Resource> transform(HttpServletRequest request,
@RequestParam("file") MultipartFile sourceMultipartFile,
@RequestParam(SOURCE_MIMETYPE) String sourceMimetype,
@RequestParam(TARGET_MIMETYPE) String targetMimetype,
@RequestParam(TARGET_EXTENSION) String targetExtension,
@RequestParam Map<String, String> requestParameters,
@RequestParam (value = TEST_DELAY, required = false) Long testDelay)
{
debugLogTransform("Request parameters: ", sourceMimetype, targetMimetype, targetExtension, requestParameters);
//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());
final String targetFilename = createTargetFileName(
sourceMultipartFile.getOriginalFilename(), targetExtension);
getProbeTestTransform().incrementTransformerCount();
final File sourceFile = createSourceFile(request, sourceMultipartFile);
final File targetFile = createTargetFile(request, targetFilename);
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype, transformOptions);
debugLogTransform("Performing transform with parameters: ", sourceMimetype, targetMimetype,
targetExtension, transformOptions);
transformInternal(transform, sourceFile, targetFile, sourceMimetype, targetMimetype, transformOptions);
final ResponseEntity<Resource> body = createAttachment(targetFilename, targetFile);
LogEntry.setTargetSize(targetFile.length());
long time = LogEntry.setStatusCodeAndMessage(OK.value(), "Success");
time += LogEntry.addDelay(testDelay);
getProbeTestTransform().recordTransformTime(time);
return body;
}
private void debugLogTransform(String message, String sourceMimetype, String targetMimetype, String targetExtension,
Map<String, String> transformOptions) {
if (logger.isDebugEnabled())
{
logger.debug(
"{} : sourceMimetype: '{}', targetMimetype: '{}', targetExtension: '{}', transformOptions: '{}'",
message, sourceMimetype, targetMimetype, targetExtension, transformOptions);
}
}
@Override
public ResponseEntity<TransformConfig> info()
{
TransformConfig transformConfig = new TransformConfig();
logger.info("GET Transform Config.");
try
{
transformConfig = transformRegistry.getTransformConfig();
}
catch (Exception e)
{
throw new TransformException(INTERNAL_SERVER_ERROR.value(), e.getMessage(), e);
}
return new ResponseEntity<>(transformConfig, OK);
}
protected void transformInternal(String transformName, File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
Map<String, String> transformOptions)
{
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions);
Transformer transformer = transformRegistry.getByTransformName(transformName);
if (transformer == null)
{
new TransformException(INTERNAL_SERVER_ERROR.value(), "No transformer mapping for - transform:"
+ transformName + " sourceMimetype:" + sourceMimetype + " targetMimetype:" + targetMimetype);
}
if (logger.isDebugEnabled())
{
logger.debug("Performing transform '{}' using {}", transformName, transformer.getClass().getSimpleName());
}
try
{
Map<String, String> optionsWithTransformName = new HashMap<>(transformOptions);
optionsWithTransformName.put(Transformer.TRANSFORM_NAME_PARAMETER, transformName);
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, optionsWithTransformName);
}
catch (TransformException e)
{
throw e;
}
catch (IllegalArgumentException e)
{
throw new TransformException(BAD_REQUEST.value(), e.getMessage(), e);
}
catch (Exception e)
{
throw new TransformException(INTERNAL_SERVER_ERROR.value(), "Failed transform - transform:"
+ transformName + " sourceMimetype:" + sourceMimetype + " targetMimetype:" + targetMimetype);
}
}
}

View File

@ -0,0 +1,59 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import org.alfresco.transformer.transformers.ImageMagickAdapter;
import org.alfresco.transformer.transformers.LibreOfficeAdapter;
import org.alfresco.transformer.transformers.MiscAdapter;
import org.alfresco.transformer.transformers.PdfRendererAdapter;
import org.alfresco.transformer.transformers.TikaAdapter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
@Configuration
public class AIOCustomConfig
{
/**
*
* @return Override the TransformRegistryImpl used in {@link AbstractTransformerController}
*/
@Bean
@Primary
public TransformServiceRegistry aioTransformRegistry() throws Exception
{
AIOTransformRegistry aioTransformRegistry = new AIOTransformRegistry();
aioTransformRegistry.registerTransformer(new MiscAdapter());
aioTransformRegistry.registerTransformer(new TikaAdapter());
aioTransformRegistry.registerTransformer(new ImageMagickAdapter());
aioTransformRegistry.registerTransformer(new LibreOfficeAdapter());
aioTransformRegistry.registerTransformer(new PdfRendererAdapter());
return aioTransformRegistry;
}
}

View File

@ -0,0 +1,79 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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;
import static org.alfresco.transformer.logging.StandardMessages.LICENCE;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Bean;
import org.springframework.context.event.EventListener;
import io.micrometer.core.instrument.MeterRegistry;
@SpringBootApplication
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class Application
{
private static final Logger logger = LoggerFactory.getLogger(Application.class);
@Value("${container.name}")
private String containerName;
@Bean
MeterRegistryCustomizer<MeterRegistry> metricsCommonTags()
{
return registry -> registry.config().commonTags("containerName", containerName);
}
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
@EventListener(ApplicationReadyEvent.class)
public void startup()
{
logger.info("--------------------------------------------------------------------------------------------------------------------------------------------------------------");
Arrays.stream(LICENCE.split("\\n")).forEach(logger::info);
logger.info("The transformers in this project use libraries from Apache. See the license at http://www.apache.org/licenses/LICENSE-2.0. or in /Apache\\\\ 2.0.txt");
logger.info("Additional libraries used:");
logger.info("* htmlparser http://htmlparser.sourceforge.net/license.html");
logger.info("--------------------------------------------------------------------------------------------------------------------------------------------------------------");
logger.info("Starting application components... Done");
}
}

View File

@ -0,0 +1,2 @@
queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.aio.acs}

View File

@ -0,0 +1,17 @@
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<title>The quick brown fox jumps over the lazy dog</title>
<meta name="author" content="Nevin Nollop">
<meta name="keywords" content="Pangram, fox, dog">
<meta name="description" content="Gym class featuring a brown fox and lazy dog">
</head>
<body lang=EN-US>
The quick brown fox jumps over the lazy dog
</body>
</html>

View File

@ -0,0 +1,162 @@
<html xmlns:th="http://www.thymeleaf.org">
<style>
.transfomer {
display: inline-block;
padding-right: 20px;
}
</style>
<body>
<div>
<h1>All in One Transformer Test Transformation</h1>
<form method="POST" enctype="multipart/form-data" action="/transform">
<table>
<tr><td><div style="text-align:right">file *</div></td><td><input type="file" name="file" /></td></tr> <!-- Required by all transformers -->
<tr><td><div style="text-align:right">targetExtension *</div></td><td><input type="text" name="targetExtension" value="" /></td></tr> <!-- Required by all transformers -->
<tr><td><div style="text-align:right">timeout</div></td><td><input type="text" name="timeout" value="" /></td></tr> <!-- Required by all transformers -->
<tr><td><div style="text-align:right">testDelay</div></td><td><input type="text" name="testDelay" value="" /></td></tr> <!-- Required by all transformers -->
<tr><td><div style="text-align:right">sourceExtension </div></td><td><input type="text" name="sourceExtension" value="" /></td></tr> <!-- Required by Misc -->
<tr><td><div style="text-align:right">targetMimetype </div></td><td><input type="text" name="targetMimetype" value="" /></td></tr> <!-- Required by Tika, Misc -->
<tr><td><div style="text-align:right">sourceMimetype </div></td><td><input type="text" name="sourceMimetype" value="" /></td></tr> <!-- Required by Tika, Misc -->
<tr><td><div style="text-align:right">targetEncoding </div></td><td><input type="text" name="targetEncoding" value="" /></td></tr> <!-- Required by Tika, Misc -->
<tr><td><div style="text-align:right">sourceEncoding </div></td><td><input type="text" name="sourceEncoding" value="" /></td></tr> <!-- Required by Misc -->
<tr><td><div style="text-align:right">includeContents (archive) </div></td><td><input type="checkbox" name="includeContents" value="true" /></td></tr> <!-- Required by Tika -->
<tr><td><div style="text-align:right">notExtractBookmarksText</div></td><td><input type="checkbox" name="notExtractBookmarksText" value="true" /></td></tr> <!-- Required by Tika -->
<!-- PDF Renderer only -->
<tr><td><div style="text-align:right">page</div></td><td><input type="text" name="page" value="" /></td></tr>
<tr><td><div style="text-align:right">width</div></td><td><input type="text" name="width" value="" /></td></tr>
<tr><td><div style="text-align:right">height</div></td><td><input type="text" name="height" value="" /></td></tr>
<tr><td><div style="text-align:right">allowPdfEnlargement</div></td><td><input type="checkbox" name="allowPdfEnlargement" value="true" /></td></tr>
<tr><td><div style="text-align:right">maintainPdfAspectRatio</div></td><td><input type="checkbox" name="maintainPdfAspectRatio" value="true" /></td></tr>
<!-- ImageMagick only -->
<tr><td><div style="text-align:right">startPage</div></td><td><input type="text" name="startPage" /></td></tr>
<tr><td><div style="text-align:right">endPage</div></td><td><input type="text" name="endPage" /></td></tr>
<tr><td><div style="text-align:right">alphaRemove</div></td><td><input type="text" name="alphaRemove" /></td></tr>
<tr><td><div style="text-align:right">autoOrient</div></td><td><input type="text" name="autoOrient" /></td></tr>
<tr><td><div style="text-align:right">cropGravity</div></td><td><input type="text" name="cropGravity" />North, NorthEast...Center</td></tr>
<tr><td><div style="text-align:right">cropWidth</div></td><td><input type="text" name="cropWidth" /></td></tr>
<tr><td><div style="text-align:right">cropHeight</div></td><td><input type="text" name="cropHeight" /></td></tr>
<tr><td><div style="text-align:right">cropPercentage</div></td><td><input type="checkbox" name="cropPercentage" value="true" /></td></tr>
<tr><td><div style="text-align:right">cropXOffset</div></td><td><input type="text" name="cropXOffset" /></td></tr>
<tr><td><div style="text-align:right">cropYOffset</div></td><td><input type="text" name="cropYOffset" /></td></tr>
<tr><td><div style="text-align:right">thumbnail</div></td><td><input type="checkbox" name="thumbnail" value="true" /></td></tr>
<tr><td><div style="text-align:right">resizeWidth</div></td><td><input type="text" name="resizeWidth" value="" /></td></tr>
<tr><td><div style="text-align:right">resizeHeight</div></td><td><input type="text" name="resizeHeight" value="" /></td></tr>
<tr><td><div style="text-align:right">resizePercentage</div></td><td><input type="checkbox" name="resizePercentage" value="true" /></td></tr>
<tr><td><div style="text-align:right">allowEnlargement</div></td><td><input type="checkbox" name="allowEnlargement" value="true" /></td></tr>
<tr><td><div style="text-align:right">maintainAspectRatio</div></td><td><input type="checkbox" name="maintainAspectRatio" value="true" /></td></tr>
<tr><td></td><td><input type="submit" value="Transform" /></td></tr>
</table>
</form>
</div>
<div>
<a href="/log">Log entries</a>
</div>
<div class="transfomer">
<h2>Tika Test Transformations</h2>
<form method="POST" enctype="multipart/form-data" action="/transform">
<table>
<tr><td><div style="text-align:right">file *</div></td><td><input type="file" name="file" /></td></tr>
<tr><td><div style="text-align:right">sourceMimetype *</div></td><td><input type="text" name="sourceMimetype" value="application/msword" /></td></tr>
<tr><td><div style="text-align:right">targetExtension *</div></td><td><input type="text" name="targetExtension" value="txt" /></td></tr>
<tr><td><div style="text-align:right">targetMimetype *</div></td><td><input type="text" name="targetMimetype" value="text/plain" /></td></tr>
<tr><td><div style="text-align:right">targetEncoding *</div></td><td><input type="text" name="targetEncoding" value="UTF-8" /></td></tr>
<tr><td><div style="text-align:right">includeContents (archive) *</div></td><td><input type="checkbox" name="includeContents" value="true" /></td></tr>
<tr><td><div style="text-align:right">timeout</div></td><td><input type="text" name="timeout" value="" /></td></tr>
<tr><td><div style="text-align:right">testDelay</div></td><td><input type="text" name="testDelay" value="" /></td></tr>
<tr><td><div style="text-align:right">notExtractBookmarksText</div></td><td><input type="checkbox" name="notExtractBookmarksText" value="true" /></td></tr>
<tr><td></td><td><input type="submit" value="Transform" /></td></tr>
</table>
</form>
</div>
<div class="transfomer">
<h2>LibreOffice Test Transformation</h2>
<form method="POST" enctype="multipart/form-data" action="/transform">
<table>
<tr><td><div style="text-align:right">file *</div></td><td><input type="file" name="file" /></td></tr>
<tr><td><div style="text-align:right">targetExtension *</div></td><td><input type="text" name="targetExtension" value="" /></td></tr>
<tr><td><div style="text-align:right">timeout</div></td><td><input type="text" name="timeout" value="" /></td></tr>
<tr><td><div style="text-align:right">testDelay</div></td><td><input type="text" name="testDelay" value="" /></td></tr>
<tr><td></td><td><input type="submit" value="Transform" /></td></tr>
</table>
</form>
</div>
<div class="transfomer">
<h2>Alfresco PDF Renderer Test Transformation</h2>
<form method="POST" enctype="multipart/form-data" action="/transform">
<table>
<tr><td><div style="text-align:right">file *</div></td><td><input type="file" name="file" /></td></tr>
<tr><td><div style="text-align:right">targetExtension *</div></td><td><input type="text" name="targetExtension" value="" /></td></tr>
<tr><td><div style="text-align:right">timeout</div></td><td><input type="text" name="timeout" value="" /></td></tr>
<tr><td><div style="text-align:right">testDelay</div></td><td><input type="text" name="testDelay" value="" /></td></tr>
<tr><td><div style="text-align:right">page</div></td><td><input type="text" name="page" value="" /></td></tr>
<tr><td><div style="text-align:right">width</div></td><td><input type="text" name="width" value="" /></td></tr>
<tr><td><div style="text-align:right">height</div></td><td><input type="text" name="height" value="" /></td></tr>
<tr><td><div style="text-align:right">allowPdfEnlargement</div></td><td><input type="checkbox" name="allowPdfEnlargement" value="true" /></td></tr>
<tr><td><div style="text-align:right">maintainPdfAspectRatio</div></td><td><input type="checkbox" name="maintainPdfAspectRatio" value="true" /></td></tr>
<tr><td></td><td><input type="submit" value="Transform" /></td></tr>
</table>
</form>
</div>
<div class="transfomer">
<h2>Miscellaneous Transformers Test Transformation</h2>
<form method="POST" enctype="multipart/form-data" action="/transform">
<table>
<tr><td><div style="text-align:right">file *</div></td><td><input type="file" name="file" /></td></tr>
<tr><td><div style="text-align:right">sourceExtension *</div></td><td><input type="text" name="sourceExtension" value="" /></td></tr>
<tr><td><div style="text-align:right">targetExtension *</div></td><td><input type="text" name="targetExtension" value="" /></td></tr>
<tr><td><div style="text-align:right">sourceMimetype *</div></td><td><input type="text" name="sourceMimetype" value="" /></td></tr>
<tr><td><div style="text-align:right">targetMimetype *</div></td><td><input type="text" name="targetMimetype" value="" /></td></tr>
<tr><td><div style="text-align:right">sourceEncoding *</div></td><td><input type="text" name="sourceEncoding" value="" /></td></tr>
<tr><td><div style="text-align:right">targetEncoding *</div></td><td><input type="text" name="targetEncoding" value="" /></td></tr>
<tr><td><div style="text-align:right">timeout</div></td><td><input type="text" name="timeout" value="" /></td></tr>
<tr><td><div style="text-align:right">testDelay</div></td><td><input type="text" name="testDelay" value="" /></td></tr>
<tr><td></td><td><input type="submit" value="Transform" /></td></tr>
</table>
</form>
</div>
<div style="display: inline-block;">
<h2>ImageMagick Test Transformation</h2>
<form method="POST" enctype="multipart/form-data" action="/transform">
<table>
<tr><td><div style="text-align:right">file *</div></td><td><input type="file" name="file" /></td></tr>
<tr><td><div style="text-align:right">targetExtension *</div></td><td><input type="text" name="targetExtension" value="" /></td></tr>
<tr><td><div style="text-align:right">timeout</div></td><td><input type="text" name="timeout" value="" /></td></tr>
<tr><td><div style="text-align:right">testDelay</div></td><td><input type="text" name="testDelay" value="" /></td></tr>
<tr><td><div style="text-align:right">startPage</div></td><td><input type="text" name="startPage" /></td></tr>
<tr><td><div style="text-align:right">endPage</div></td><td><input type="text" name="endPage" /></td></tr>
<tr><td><div style="text-align:right">alphaRemove</div></td><td><input type="text" name="alphaRemove" /></td></tr>
<tr><td><div style="text-align:right">autoOrient</div></td><td><input type="text" name="autoOrient" /></td></tr>
<tr><td><div style="text-align:right">cropGravity</div></td><td><input type="text" name="cropGravity" />North, NorthEast...Center</td></tr>
<tr><td><div style="text-align:right">cropWidth</div></td><td><input type="text" name="cropWidth" /></td></tr>
<tr><td><div style="text-align:right">cropHeight</div></td><td><input type="text" name="cropHeight" /></td></tr>
<tr><td><div style="text-align:right">cropPercentage</div></td><td><input type="checkbox" name="cropPercentage" value="true" /></td></tr>
<tr><td><div style="text-align:right">cropXOffset</div></td><td><input type="text" name="cropXOffset" /></td></tr>
<tr><td><div style="text-align:right">cropYOffset</div></td><td><input type="text" name="cropYOffset" /></td></tr>
<tr><td><div style="text-align:right">thumbnail</div></td><td><input type="checkbox" name="thumbnail" value="true" /></td></tr>
<tr><td><div style="text-align:right">resizeWidth</div></td><td><input type="text" name="resizeWidth" value="" /></td></tr>
<tr><td><div style="text-align:right">resizeHeight</div></td><td><input type="text" name="resizeHeight" value="" /></td></tr>
<tr><td><div style="text-align:right">resizePercentage</div></td><td><input type="checkbox" name="resizePercentage" value="true" /></td></tr>
<tr><td><div style="text-align:right">allowEnlargement</div></td><td><input type="checkbox" name="allowEnlargement" value="true" /></td></tr>
<tr><td><div style="text-align:right">maintainAspectRatio</div></td><td><input type="checkbox" name="maintainAspectRatio" value="true" /></td></tr>
<tr><td></td><td><input type="submit" value="Transform" /></td></tr>
</table>
</form>
</div>
</body>
</html>

View File

@ -0,0 +1,73 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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;
import java.io.IOException;
import org.alfresco.transform.client.model.TransformRequest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@WebMvcTest(AIOController.class)
@Import(AIOCustomConfig.class)
public class AIOControllerTest //extends AbstractTransformerControllerTest
{
@Autowired
AIOController aioController;
//@Override
protected void mockTransformCommand(String sourceExtension, String targetExtension, String sourceMimetype,
boolean readTargetFileBytes) throws IOException {
// TODO Auto-generated method stub
}
//@Override
protected AbstractTransformerController getController() {
// TODO Auto-generated method stub
return null;
}
//@Override
protected void updateTransformRequestWithSpecificOptions(TransformRequest transformRequest) {
// TODO Auto-generated method stub
}
@Test
public void emptyTest()
{
aioController.info();
}
}

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>alfresco-transform-core-aio</artifactId>
<name>Alfresco Core All-In-One Transformer</name>
<packaging>jar</packaging>
<parent>
<artifactId>alfresco-transform-core</artifactId>
<groupId>org.alfresco</groupId>
<version>2.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transformer-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-misc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-tika</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-pdf-renderer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-libreoffice</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-imagemagick</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,171 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.alfresco.transform.client.model.config.TransformConfig;
import org.alfresco.transform.client.model.config.TransformOption;
import org.alfresco.transform.client.registry.AbstractTransformRegistry;
import org.alfresco.transform.client.registry.TransformCache;
import org.alfresco.transform.exceptions.TransformException;
import org.alfresco.transformer.transformers.Transformer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
/***
*
* @author eknizat
*/
public class AIOTransformRegistry extends AbstractTransformRegistry
{
private static final Logger log = LoggerFactory.getLogger(AIOTransformRegistry.class);
private static final String ENGINE_CONFIG_LOCATION_POSTFIX = "_engine_config.json";
private TransformConfig aggregatedConfig = new TransformConfig();
// 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();
private ObjectMapper jsonObjectMapper = new ObjectMapper();
/**
* Represents the mapping between a transform and a transformer, multiple mappings can point to the same transformer.
*/
private Map<String, Transformer> transformerTransformMapping = new HashMap();
/**
* The registration will go through all supported sub transformers and map them to the transformer implementation.
*
* @param transformer The transformer implementation,
* this could be a transformer managing multiple sub transformers.
* @throws Exception Exception is thrown if a mapping for a transformer name already exists.
*/
public void registerTransformer(Transformer transformer) throws Exception
{
String location = getTransformConfigLocation(transformer);
TransformConfig transformConfig = loadTransformConfig(location);
for (org.alfresco.transform.client.model.config.Transformer transformerConfig
: transformConfig.getTransformers())
{
String transformerName = transformerConfig.getTransformerName();
if (transformerTransformMapping.containsKey(transformerName))
{
throw new Exception("Transformer name " + transformerName + " is already registered.");
}
transformerTransformMapping.put(transformerName, transformer);
log.debug("Registered transformer with name: '{}'.", transformerName);
}
// add to data
aggregatedConfig.getTransformers().addAll(transformConfig.getTransformers());
aggregatedConfig.getTransformOptions().putAll(transformConfig.getTransformOptions());
registerAll(transformConfig, location, location);
}
/**
*
* @param transformName - the transform name used in mapping...
* @return
*/
public Transformer getByTransformName(String transformName)
{
return getTransformerTransformMapping().get(transformName);
}
public TransformConfig getTransformConfig() throws Exception
{
return aggregatedConfig;
}
protected String getTransformConfigLocation(Transformer transformer)
{
String location = transformer.getTransformerId() + ENGINE_CONFIG_LOCATION_POSTFIX;
return location;
}
protected TransformConfig loadTransformConfig(String name) throws Exception
{
if (getClass().getClassLoader().getResource(name) == null)
{
throw new Exception("Configuration '" + name + "' does not exist on the classpath.");
}
try (InputStream is = getClass().getClassLoader().getResourceAsStream(name);
Reader reader = new InputStreamReader(is, UTF_8))
{
return jsonObjectMapper.readValue(reader, TransformConfig.class);
}
catch (IOException e)
{
throw new Exception("Could not read '" + name + "' from the classpath.", e);
}
}
Map<String, Transformer> getTransformerTransformMapping()
{
return transformerTransformMapping;
}
void setTransformerTransformMapping(Map<String, Transformer> transformerTransformMapping)
{
this.transformerTransformMapping = transformerTransformMapping;
}
@Override
public TransformCache getData()
{
return data;
}
@Override
protected void logError(String msg)
{
log.error(msg);
}
}

View File

@ -0,0 +1,97 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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.transformers;
import org.alfresco.transformer.AIOTransformRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Map;
/**
* Top level transformer managing multiple sub transformers.
*
* @author eknizat
*/
public class AllInOneTransformer implements Transformer
{
private static final Logger logger = LoggerFactory.getLogger(AllInOneTransformer.class);
/**
* Represents the mapping between a transform and a transformer, multiple mappings can point to the same transformer.
*/
AIOTransformRegistry transformRegistry = new AIOTransformRegistry();
public AllInOneTransformer()
{
}
public void addTransformer(Transformer transformer) throws Exception
{
transformRegistry.registerTransformer(transformer);
}
@Override
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
Map<String, String> transformOptions) throws Exception
{
String transformName = transformOptions.get(TRANSFORM_NAME_PARAMETER);
Transformer transformer = transformRegistry.getByTransformName(transformName);
if (transformer == null)
{
throw new Exception("No transformer mapping for : transform:" + transformName + " sourceMimetype:"
+ sourceMimetype + " targetMimetype:" + targetMimetype);
}
if (logger.isDebugEnabled())
{
logger.debug("Performing transform '{}' using {}", transformName, transformer.getClass().getSimpleName());
}
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, transformOptions);
}
@Override
public String getTransformerId()
{
return "all-in-one";
}
public AIOTransformRegistry getTransformRegistry()
{
return transformRegistry;
}
public void setTransformRegistry(AIOTransformRegistry transformRegistry)
{
this.transformRegistry = transformRegistry;
}
}

View File

@ -0,0 +1,121 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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.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.stringToLong;
import java.io.File;
import java.util.Map;
import org.alfresco.transformer.ImageMagickOptionsBuilder;
import org.alfresco.transformer.executors.ImageMagickCommandExecutor;
public class ImageMagickAdapter implements Transformer
{
private static String ID = "imagemagick";
private ImageMagickCommandExecutor commandExecutor;
public ImageMagickAdapter() throws Exception
{
super();
commandExecutor = new ImageMagickCommandExecutor();
}
@Override
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
Map<String, String> transformOptions) throws Exception
{
final String options = ImageMagickOptionsBuilder
.builder()
.withStartPage(transformOptions.get(START_PAGE))
.withEndPage(transformOptions.get(END_PAGE))
.withAlphaRemove(transformOptions.get(ALPHA_REMOVE))
.withAutoOrient(transformOptions.get(AUTO_ORIENT))
.withCropGravity(transformOptions.get(CROP_GRAVITY))
.withCropWidth(transformOptions.get(CROP_WIDTH))
.withCropHeight(transformOptions.get(CROP_HEIGHT))
.withCropPercentage(transformOptions.get(CROP_PERCENTAGE))
.withCropXOffset(transformOptions.get(CROP_X_OFFSET))
.withCropYOffset(transformOptions.get(CROP_Y_OFFSET))
.withThumbnail(transformOptions.get(THUMBNAIL))
.withResizeWidth(transformOptions.get(RESIZE_WIDTH))
.withResizeHeight(transformOptions.get(RESIZE_HEIGHT))
.withResizePercentage(transformOptions.get(RESIZE_PERCENTAGE))
.withAllowEnlargement(transformOptions.get(ALLOW_ENLARGEMENT))
.withMaintainAspectRatio(transformOptions.get(MAINTAIN_ASPECT_RATIO))
.withCommandOptions(transformOptions.get(COMMAND_OPTIONS))
.build();
String pageRange = calculatePageRange(
stringToInteger(transformOptions.get(START_PAGE)),
stringToInteger(transformOptions.get(END_PAGE))
);
Long timeout = stringToLong(transformOptions.get(TIMEOUT));
commandExecutor.run(options, sourceFile, pageRange, targetFile, timeout);
}
@Override
public String getTransformerId()
{
return ID;
}
// COPIED From ImageMagickController
private static String calculatePageRange(Integer startPage, Integer endPage)
{
return startPage == null
? endPage == null
? ""
: "[" + endPage + ']'
: endPage == null || startPage.equals(endPage)
? "[" + startPage + ']'
: "[" + startPage + '-' + endPage + ']';
}
}

View File

@ -0,0 +1,57 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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.transformers;
import java.io.File;
import java.util.Map;
import org.alfresco.transformer.executors.LibreOfficeJavaExecutor;
public class LibreOfficeAdapter implements Transformer
{
private static String ID = "libreoffice";
private LibreOfficeJavaExecutor javaExecutor;
public LibreOfficeAdapter() throws Exception
{
super();
javaExecutor = new LibreOfficeJavaExecutor();
}
@Override
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
Map<String, String> transformOptions) throws Exception
{
javaExecutor.call(sourceFile, targetFile);
}
@Override
public String getTransformerId()
{
return ID;
}
}

View File

@ -0,0 +1,60 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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.transformers;
import java.io.File;
import java.util.Map;
public class MiscAdapter implements Transformer
{
private static final String ID = "misc";
private SelectingTransformer miscSelectingTransformer;
public MiscAdapter() throws Exception
{
super();
miscSelectingTransformer = new SelectingTransformer();
}
@Override
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype, Map<String,
String> transformOptions) throws Exception
{
String transformerName = transformOptions.get(TRANSFORM_NAME_PARAMETER);
miscSelectingTransformer.transform(transformerName, sourceFile, targetFile,
sourceMimetype, targetMimetype, transformOptions);
}
@Override
public String getTransformerId()
{
return ID;
}
}

View File

@ -0,0 +1,80 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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.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 java.io.File;
import java.util.Map;
import org.alfresco.transformer.executors.PdfRendererCommandExecutor;
import org.alfresco.transformer.PdfRendererOptionsBuilder;
public class PdfRendererAdapter implements Transformer
{
private static String ID = "pdfrenderer";
private PdfRendererCommandExecutor pdfExecutor;
public PdfRendererAdapter() throws Exception
{
super();
pdfExecutor = new PdfRendererCommandExecutor();
}
@Override
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
Map<String, String> transformOptions) throws Exception
{
final String options = PdfRendererOptionsBuilder
.builder()
.withPage(transformOptions.get(PAGE_REQUEST_PARAM))
.withWidth(transformOptions.get(WIDTH_REQUEST_PARAM))
.withHeight(transformOptions.get(HEIGHT_REQUEST_PARAM))
.withAllowPdfEnlargement(transformOptions.get(ALLOW_PDF_ENLARGEMENT))
.withMaintainPdfAspectRatio(transformOptions.get(MAINTAIN_PDF_ASPECT_RATIO))
.build();
Long timeout = stringToLong(transformOptions.get(TIMEOUT));
pdfExecutor.run(options, sourceFile, targetFile, timeout);
}
@Override
public String getTransformerId()
{
return ID;
}
}

View File

@ -0,0 +1,73 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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.transformers;
import org.alfresco.transformer.executors.TikaJavaExecutor;
import java.io.File;
import java.util.Map;
import static java.lang.Boolean.parseBoolean;
import static org.alfresco.transformer.executors.Tika.INCLUDE_CONTENTS;
import static org.alfresco.transformer.executors.Tika.NOT_EXTRACT_BOOKMARKS_TEXT;
import static org.alfresco.transformer.executors.Tika.TARGET_ENCODING;
import static org.alfresco.transformer.executors.Tika.TARGET_MIMETYPE;
public class TikaAdapter implements Transformer
{
private static final String ID = "tika";
private TikaJavaExecutor tikaJavaExecutor;
public TikaAdapter() throws Exception
{
super();
tikaJavaExecutor = new TikaJavaExecutor();
}
@Override
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype, Map<String, String> transformOptions) throws Exception
{
final String transform = transformOptions.get(TRANSFORM_NAME_PARAMETER);
final boolean includeContents = parseBoolean(
transformOptions.getOrDefault("includeContents", "false"));
final boolean notExtractBookmarksText = parseBoolean(
transformOptions.getOrDefault("notExtractBookmarksText", "false"));
final String targetEncoding = transformOptions.getOrDefault("targetEncoding", "UTF-8");
tikaJavaExecutor.call(sourceFile, targetFile, transform,
includeContents ? INCLUDE_CONTENTS : null,
notExtractBookmarksText ? NOT_EXTRACT_BOOKMARKS_TEXT : null,
TARGET_MIMETYPE + targetMimetype, TARGET_ENCODING + targetEncoding);
}
@Override
public String getTransformerId()
{
return ID;
}
}

View File

@ -0,0 +1,66 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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.transformers;
import org.alfresco.transform.client.model.config.TransformConfig;
import java.io.File;
import java.util.Map;
/**
* Interface for transformers which can perform transformations and specify their own supported configuration.
*/
public interface Transformer
{
/**
* Controllers pass this as an additional parameter..
*/
String TRANSFORM_NAME_PARAMETER = "alfresco.transform-name-parameter";
/**
* Implementation of the actual transformation.
*
* @param sourceFile
* @param targetFile
* @param transformOptions
* @throws Exception
*/
void transform(File sourceFile, File targetFile, String sourceMimetype,
String targetMimetype, Map<String, String> transformOptions) throws Exception;
/**
* @return Supported config for the transformer implementation.
*
*/
String getTransformerId();
}

View File

@ -0,0 +1,301 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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.transformers;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.alfresco.transform.client.model.config.TransformConfig;
import org.alfresco.transformer.AIOTransformRegistry;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.text.PDFTextStripper;
import org.junit.Before;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static org.alfresco.transformer.transformers.TextToPdfContentTransformer.PAGE_LIMIT;
import static org.alfresco.transformer.transformers.Transformer.TRANSFORM_NAME_PARAMETER;
import static org.junit.Assert.*;
public class AIOTransformRegistryTest
{
private static final String SOURCE_MIMETYPE = "text/html";
private static final String TARGET_MIMETYPE = "text/plain";
String SOURCE_ENCODING = "sourceEncoding";
String TARGET_ENCODING = "targetEncoding";
AIOTransformRegistry aioTransformer = new AIOTransformRegistry();
ObjectMapper objectMapper = new ObjectMapper();
@Before
public void before() throws Exception
{
aioTransformer.registerTransformer(new MiscAdapter());
aioTransformer.registerTransformer(new TikaAdapter());
}
private void writeToFile(File file, String content, String encoding) throws Exception
{
try (OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream(file), encoding))
{
ow.append(content);
}
}
private String readFromFile(File file, final String encoding) throws Exception
{
return new String(Files.readAllBytes(file.toPath()), encoding);
}
private TransformConfig loadConfig(String s) throws Exception
{
return objectMapper.readValue(new ClassPathResource(s).getFile(), TransformConfig.class);
}
@Test
public void testConfigAggregation() throws Exception
{
List<String> expectedTransformNames = Arrays.asList("html", "string", "appleIWorks", "textToPdf", "rfc822",
"Archive", "OutlookMsg", "PdfBox", "Office", "Poi", "OOXML", "TikaAuto", "TextMining");
List<String> expectedTransformOptionNames = Arrays.asList("tikaOptions", "archiveOptions", "pdfboxOptions",
"textToPdfOptions", "stringOptions", "htmlOptions");
TransformConfig miscConfig = loadConfig("misc_engine_config.json");
TransformConfig tikaConfig = loadConfig("tika_engine_config.json");
// check correct number of transformers
assertEquals("Number of expected transformers",
miscConfig.getTransformers().size() + tikaConfig.getTransformers().size(),
aioTransformer.getTransformConfig().getTransformers().size());
List<String> actualTransformerNames = aioTransformer.getTransformConfig().getTransformers()
.stream().map(t -> t.getTransformerName()).collect(Collectors.toList());
// check all transformers are there
for(String transformNames : expectedTransformNames)
{
assertTrue("Expected transformer missing.", actualTransformerNames.contains(transformNames));
}
// check correct number of options
assertEquals("Number of expected transformers",
miscConfig.getTransformOptions().size() + tikaConfig.getTransformOptions().size(),
aioTransformer.getTransformConfig().getTransformOptions().size());
Set<String> actualOptionNames = aioTransformer.getTransformConfig().getTransformOptions().keySet();
// check all options are there
for (String optionName : expectedTransformOptionNames)
{
assertTrue("Expected transform option missing.", actualOptionNames.contains(optionName));
}
}
// Test copied from Misc (HtmlParserContentTransformerTest) See ATS-712 aioTransformer - html
@Test
public void testMiscHtml() throws Exception
{
final String NEWLINE = System.getProperty("line.separator");
final String TITLE = "Testing!";
final String TEXT_P1 = "This is some text in English";
final String TEXT_P2 = "This is more text in English";
final String TEXT_P3 = "C'est en Fran\u00e7ais et Espa\u00f1ol";
String partA = "<html><head><title>" + TITLE + "</title></head>" + NEWLINE;
String partB = "<body><p>" + TEXT_P1 + "</p>" + NEWLINE +
"<p>" + TEXT_P2 + "</p>" + NEWLINE +
"<p>" + TEXT_P3 + "</p>" + NEWLINE;
String partC = "</body></html>";
final String expected = TITLE + NEWLINE + TEXT_P1 + NEWLINE + TEXT_P2 + NEWLINE + TEXT_P3 + NEWLINE;
File tmpS = null;
File tmpD = null;
try
{
// Content set to ISO 8859-1
tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
writeToFile(tmpS, partA + partB + partC, "ISO-8859-1");
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
Map<String, String> parameters = new HashMap<>();
parameters.put(SOURCE_ENCODING, "ISO-8859-1");
parameters.put(TRANSFORM_NAME_PARAMETER, "html");
Transformer transformer = aioTransformer.getByTransformName("html");
transformer.transform(tmpS, tmpD, SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters);
assertEquals(expected, readFromFile(tmpD, "UTF-8"));
tmpS.delete();
tmpD.delete();
// Content set to UTF-8
tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
writeToFile(tmpS, partA + partB + partC, "UTF-8");
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
parameters = new HashMap<>();
parameters.put(TRANSFORM_NAME_PARAMETER, "html");
parameters.put(SOURCE_ENCODING, "UTF-8");
transformer.transform(tmpS, tmpD, SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters);
assertEquals(expected, readFromFile(tmpD, "UTF-8"));
tmpS.delete();
tmpD.delete();
// Content set to UTF-16
tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
writeToFile(tmpS, partA + partB + partC, "UTF-16");
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
parameters = new HashMap<>();
parameters.put(TRANSFORM_NAME_PARAMETER, "html");
parameters.put(SOURCE_ENCODING, "UTF-16");
transformer.transform(tmpS, tmpD, SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters);
assertEquals(expected, readFromFile(tmpD, "UTF-8"));
tmpS.delete();
tmpD.delete();
// Note - since HTML Parser 2.0 META tags specifying the
// document encoding will ONLY be respected if the original
// content type was set to ISO-8859-1.
//
// This means there is now only one test which we can perform
// to ensure that this now-limited overriding of the encoding
// takes effect.
// Content set to ISO 8859-1, meta set to UTF-8
tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
String str = partA +
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" +
partB + partC;
writeToFile(tmpS, str, "UTF-8");
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
parameters = new HashMap<>();
parameters.put(TRANSFORM_NAME_PARAMETER, "html");
parameters.put(SOURCE_ENCODING, "ISO-8859-1");
transformer.transform(tmpS, tmpD, SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters);
assertEquals(expected, readFromFile(tmpD, "UTF-8"));
tmpS.delete();
tmpD.delete();
// Note - we can't test UTF-16 with only a meta encoding,
// because without that the parser won't know about the
// 2 byte format so won't be able to identify the meta tag
}
finally
{
if (tmpS != null && tmpS.exists()) tmpS.delete();
if (tmpD != null && tmpD.exists()) tmpD.delete();
}
}
// Test copied from Misc (TextToPdfContentTransformerTest) See ATS-712 aioTransformer - pdf
@Test
public void testMiscPdf() throws Exception
{
transformTextAndCheckPageLength(-1);
}
private void transformTextAndCheckPageLength(int pageLimit) throws Exception
{
int pageLength = 32;
int lines = (pageLength + 10) * ((pageLimit > 0) ? pageLimit : 1);
StringBuilder sb = new StringBuilder();
String checkText = null;
int cutoff = pageLimit * pageLength;
for (int i = 1; i <= lines; i++)
{
sb.append(i);
sb.append(" I must not talk in class or feed my homework to my cat.\n");
if (i == cutoff)
checkText = sb.toString();
}
sb.append("\nBart\n");
String text = sb.toString();
checkText = (checkText == null) ? clean(text) : clean(checkText);
transformTextAndCheck(text, "UTF-8", checkText, String.valueOf(pageLimit));
}
private void transformTextAndCheck(String text, String encoding, String checkText,
String pageLimit) throws Exception
{
// Get a reader for the text
File sourceFile = File.createTempFile("AlfrescoTestSource_", ".txt");
writeToFile(sourceFile, text, encoding);
// And a temp writer
File targetFile = File.createTempFile("AlfrescoTestTarget_", ".pdf");
// Transform to PDF
Map<String, String> parameters = new HashMap<>();
parameters.put(PAGE_LIMIT, pageLimit);
parameters.put(TRANSFORM_NAME_PARAMETER, "textToPdf");
Transformer transformer = aioTransformer.getByTransformName("textToPdf");
transformer.transform(sourceFile, targetFile, "text/plain", "application/pdf", parameters);
// Read back in the PDF and check it
PDDocument doc = PDDocument.load(targetFile);
PDFTextStripper textStripper = new PDFTextStripper();
StringWriter textWriter = new StringWriter();
textStripper.writeText(doc, textWriter);
doc.close();
String roundTrip = clean(textWriter.toString());
assertEquals(
"Incorrect text in PDF when starting from text in " + encoding,
checkText, roundTrip
);
sourceFile.delete();
targetFile.delete();
}
private String clean(String text)
{
text = text.replaceAll("\\s+\\r", "");
text = text.replaceAll("\\s+\\n", "");
text = text.replaceAll("\\r", "");
text = text.replaceAll("\\n", "");
return text;
}
}

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">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-imagemagick-boot</artifactId>
<name>Alfresco ImageMagick Transformer SpringBoot</name>
<name>Alfresco ImageMagick Transformer Spring Boot</name>
<packaging>jar</packaging>
<parent>

View File

@ -154,7 +154,7 @@ public class ImageMagickController extends AbstractTransformerController
File targetFile = createTargetFile(request, targetFilename);
// Both files are deleted by TransformInterceptor.afterCompletion
final String options = OptionsBuilder
final String options = ImageMagickOptionsBuilder
.builder()
.withStartPage(startPage)
.withEndPage(endPage)
@ -196,7 +196,7 @@ public class ImageMagickController extends AbstractTransformerController
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
final String options = OptionsBuilder
final String options = ImageMagickOptionsBuilder
.builder()
.withStartPage(transformOptions.get("startPage"))
.withEndPage(transformOptions.get("endPage"))

View File

@ -1,2 +1,5 @@
queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.imagemagick.acs}
transform:
config:
location: classpath:imagemagick_engine_config.json

View File

@ -85,6 +85,8 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
@WebMvcTest(ImageMagickController.class)
public class ImageMagickControllerTest extends AbstractTransformerControllerTest
{
private static final String ENGINE_CONFIG_NAME = "imagemagick_engine_config.json";
@Mock
private ExecutionResult mockExecutionResult;
@ -109,6 +111,12 @@ public class ImageMagickControllerTest extends AbstractTransformerControllerTest
mockTransformCommand("jpg", "png", "image/jpg", true);
}
@Override
public String getEngineConfigName()
{
return ENGINE_CONFIG_NAME;
}
@Override
protected void mockTransformCommand(String sourceExtension,
String targetExtension, String sourceMimetype,

View File

@ -42,7 +42,7 @@ import com.google.common.collect.ImmutableList;
*
* @author Cezar Leahu
*/
final class OptionsBuilder
public final class ImageMagickOptionsBuilder
{
private static final List<String> GRAVITY_VALUES = ImmutableList.of("North", "NorthEast",
"East", "SouthEast", "South", "SouthWest", "West", "NorthWest", "Center");
@ -65,180 +65,180 @@ final class OptionsBuilder
private Boolean maintainAspectRatio;
private String commandOptions;
private OptionsBuilder() {}
private ImageMagickOptionsBuilder() {}
public OptionsBuilder withStartPage(final String startPage)
public ImageMagickOptionsBuilder withStartPage(final String startPage)
{
return withStartPage(stringToInteger(startPage));
}
public OptionsBuilder withStartPage(final Integer startPage)
public ImageMagickOptionsBuilder withStartPage(final Integer startPage)
{
this.startPage = startPage;
return this;
}
public OptionsBuilder withEndPage(final String endPage)
public ImageMagickOptionsBuilder withEndPage(final String endPage)
{
return withEndPage(stringToInteger(endPage));
}
public OptionsBuilder withEndPage(final Integer endPage)
public ImageMagickOptionsBuilder withEndPage(final Integer endPage)
{
this.endPage = endPage;
return this;
}
public OptionsBuilder withAlphaRemove(final String alphaRemove)
public ImageMagickOptionsBuilder withAlphaRemove(final String alphaRemove)
{
return withAlphaRemove(stringToBoolean(alphaRemove));
}
public OptionsBuilder withAlphaRemove(final Boolean alphaRemove)
public ImageMagickOptionsBuilder withAlphaRemove(final Boolean alphaRemove)
{
this.alphaRemove = alphaRemove;
return this;
}
public OptionsBuilder withAutoOrient(final String autoOrient)
public ImageMagickOptionsBuilder withAutoOrient(final String autoOrient)
{
return withAutoOrient(stringToBoolean(autoOrient));
}
public OptionsBuilder withAutoOrient(final Boolean autoOrient)
public ImageMagickOptionsBuilder withAutoOrient(final Boolean autoOrient)
{
this.autoOrient = autoOrient;
return this;
}
public OptionsBuilder withCropGravity(final String cropGravity)
public ImageMagickOptionsBuilder withCropGravity(final String cropGravity)
{
this.cropGravity = cropGravity;
return this;
}
public OptionsBuilder withCropWidth(final String cropWidth)
public ImageMagickOptionsBuilder withCropWidth(final String cropWidth)
{
return withCropWidth(stringToInteger(cropWidth));
}
public OptionsBuilder withCropWidth(final Integer cropWidth)
public ImageMagickOptionsBuilder withCropWidth(final Integer cropWidth)
{
this.cropWidth = cropWidth;
return this;
}
public OptionsBuilder withCropHeight(final String cropHeight)
public ImageMagickOptionsBuilder withCropHeight(final String cropHeight)
{
return withCropHeight(stringToInteger(cropHeight));
}
public OptionsBuilder withCropHeight(final Integer cropHeight)
public ImageMagickOptionsBuilder withCropHeight(final Integer cropHeight)
{
this.cropHeight = cropHeight;
return this;
}
public OptionsBuilder withCropPercentage(final String cropPercentage)
public ImageMagickOptionsBuilder withCropPercentage(final String cropPercentage)
{
return withCropPercentage(stringToBoolean(cropPercentage));
}
public OptionsBuilder withCropPercentage(final Boolean cropPercentage)
public ImageMagickOptionsBuilder withCropPercentage(final Boolean cropPercentage)
{
this.cropPercentage = cropPercentage;
return this;
}
public OptionsBuilder withCropXOffset(final String cropXOffset)
public ImageMagickOptionsBuilder withCropXOffset(final String cropXOffset)
{
return withCropXOffset(stringToInteger(cropXOffset));
}
public OptionsBuilder withCropXOffset(final Integer cropXOffset)
public ImageMagickOptionsBuilder withCropXOffset(final Integer cropXOffset)
{
this.cropXOffset = cropXOffset;
return this;
}
public OptionsBuilder withCropYOffset(final String cropYOffset)
public ImageMagickOptionsBuilder withCropYOffset(final String cropYOffset)
{
return withCropYOffset(stringToInteger(cropYOffset));
}
public OptionsBuilder withCropYOffset(final Integer cropYOffset)
public ImageMagickOptionsBuilder withCropYOffset(final Integer cropYOffset)
{
this.cropYOffset = cropYOffset;
return this;
}
public OptionsBuilder withThumbnail(final String thumbnail)
public ImageMagickOptionsBuilder withThumbnail(final String thumbnail)
{
return withThumbnail(stringToBoolean(thumbnail));
}
public OptionsBuilder withThumbnail(final Boolean thumbnail)
public ImageMagickOptionsBuilder withThumbnail(final Boolean thumbnail)
{
this.thumbnail = thumbnail;
return this;
}
public OptionsBuilder withResizeWidth(final String resizeWidth)
public ImageMagickOptionsBuilder withResizeWidth(final String resizeWidth)
{
return withResizeWidth(stringToInteger(resizeWidth));
}
public OptionsBuilder withResizeWidth(final Integer resizeWidth)
public ImageMagickOptionsBuilder withResizeWidth(final Integer resizeWidth)
{
this.resizeWidth = resizeWidth;
return this;
}
public OptionsBuilder withResizeHeight(final String resizeHeight)
public ImageMagickOptionsBuilder withResizeHeight(final String resizeHeight)
{
return withResizeHeight(stringToInteger(resizeHeight));
}
public OptionsBuilder withResizeHeight(final Integer resizeHeight)
public ImageMagickOptionsBuilder withResizeHeight(final Integer resizeHeight)
{
this.resizeHeight = resizeHeight;
return this;
}
public OptionsBuilder withResizePercentage(final String resizePercentage)
public ImageMagickOptionsBuilder withResizePercentage(final String resizePercentage)
{
return withResizePercentage(stringToBoolean(resizePercentage));
}
public OptionsBuilder withResizePercentage(final Boolean resizePercentage)
public ImageMagickOptionsBuilder withResizePercentage(final Boolean resizePercentage)
{
this.resizePercentage = resizePercentage;
return this;
}
public OptionsBuilder withAllowEnlargement(final String allowEnlargement)
public ImageMagickOptionsBuilder withAllowEnlargement(final String allowEnlargement)
{
return withAllowEnlargement(stringToBoolean(allowEnlargement));
}
public OptionsBuilder withAllowEnlargement(final Boolean allowEnlargement)
public ImageMagickOptionsBuilder withAllowEnlargement(final Boolean allowEnlargement)
{
this.allowEnlargement = allowEnlargement;
return this;
}
public OptionsBuilder withMaintainAspectRatio(final String maintainAspectRatio)
public ImageMagickOptionsBuilder withMaintainAspectRatio(final String maintainAspectRatio)
{
return withMaintainAspectRatio(stringToBoolean(maintainAspectRatio));
}
public OptionsBuilder withMaintainAspectRatio(final Boolean maintainAspectRatio)
public ImageMagickOptionsBuilder withMaintainAspectRatio(final Boolean maintainAspectRatio)
{
this.maintainAspectRatio = maintainAspectRatio;
return this;
}
public OptionsBuilder withCommandOptions(final String commandOptions)
public ImageMagickOptionsBuilder withCommandOptions(final String commandOptions)
{
this.commandOptions = commandOptions;
return this;
@ -354,8 +354,8 @@ final class OptionsBuilder
args.toString();
}
public static OptionsBuilder builder()
public static ImageMagickOptionsBuilder builder()
{
return new OptionsBuilder();
return new ImageMagickOptionsBuilder();
}
}

View File

@ -1,2 +1,5 @@
queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.libreoffice.acs}
transform:
config:
location: classpath:libreoffice_engine_config.json

View File

@ -81,6 +81,9 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
@WebMvcTest(LibreOfficeControllerTest.class)
public class LibreOfficeControllerTest extends AbstractTransformerControllerTest
{
private static final String ENGINE_CONFIG_NAME = "libreoffice_engine_config.json";
@Mock
private ExecutionResult mockExecutionResult;
@ -137,6 +140,12 @@ public class LibreOfficeControllerTest extends AbstractTransformerControllerTest
}).when(javaExecutor).convert(any(), any());
}
@Override
public String getEngineConfigName()
{
return ENGINE_CONFIG_NAME;
}
@Override
protected void mockTransformCommand(String sourceExtension, String targetExtension,
String sourceMimetype, boolean readTargetFileBytes)

View File

@ -0,0 +1,235 @@
{
"transformers": [
{
"transformerName": "libreoffice",
"supportedSourceAndTargetList": [
{"sourceMediaType": "text/csv", "targetMediaType": "text/html" },
{"sourceMediaType": "text/csv", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "text/csv", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "text/csv", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "text/csv", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "text/csv", "maxSourceSizeBytes": 10485760, "priority": 55, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/msword", "targetMediaType": "text/html" },
{"sourceMediaType": "application/msword", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/msword", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/msword", "maxSourceSizeBytes": 10485760, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "maxSourceSizeBytes": 786432, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "maxSourceSizeBytes": 786432, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "maxSourceSizeBytes": 786432, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "maxSourceSizeBytes": 786432, "targetMediaType": "application/pdf" },
{"sourceMediaType": "text/html", "targetMediaType": "application/msword" },
{"sourceMediaType": "text/html", "priority": 55, "targetMediaType": "text/html" },
{"sourceMediaType": "text/html", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "text/html", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/vnd.oasis.opendocument.graphics", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.oasis.opendocument.graphics", "targetMediaType": "image/svg+xml" },
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.ms-powerpoint", "maxSourceSizeBytes": 6291456, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/rtf", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/rtf", "targetMediaType": "text/html" },
{"sourceMediaType": "application/rtf", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/rtf", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "targetMediaType": "text/csv" },
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "application/vnd.sun.xml.calc.template", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.sun.xml.impress.template", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/vnd.sun.xml.writer.template", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.sun.xml.calc", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.sun.xml.calc", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "application/vnd.sun.xml.calc", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "application/vnd.sun.xml.calc", "targetMediaType": "text/csv" },
{"sourceMediaType": "application/vnd.sun.xml.calc", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "application/vnd.sun.xml.calc", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "application/vnd.sun.xml.calc", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.sun.xml.impress", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.sun.xml.impress", "targetMediaType": "application/vnd.oasis.opendocument.presentation" },
{"sourceMediaType": "application/vnd.sun.xml.impress", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.sun.xml.impress", "targetMediaType": "application/vnd.ms-powerpoint" },
{"sourceMediaType": "application/vnd.sun.xml.impress", "targetMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide" },
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "application/pdf" },
{"sourceMediaType": "text/tab-separated-values", "priority": 55, "targetMediaType": "text/html" },
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "text/csv" },
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "application/pdf" },
{"sourceMediaType": "text/plain", "targetMediaType": "text/html" },
{"sourceMediaType": "text/plain", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "text/plain", "targetMediaType": "application/rtf" },
{"sourceMediaType": "text/plain", "targetMediaType": "application/msword" },
{"sourceMediaType": "text/plain", "maxSourceSizeBytes": 5242880, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.visio", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "image/svg+xml" },
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "application/vnd.oasis.opendocument.graphics" },
{"sourceMediaType": "application/vnd.visio2013", "maxSourceSizeBytes": 4194304, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.visio2013", "targetMediaType": "image/svg+xml" },
{"sourceMediaType": "application/vnd.visio2013", "targetMediaType": "application/vnd.oasis.opendocument.graphics" },
{"sourceMediaType": "application/wordperfect", "targetMediaType": "application/msword" },
{"sourceMediaType": "application/wordperfect", "targetMediaType": "text/html" },
{"sourceMediaType": "application/wordperfect", "targetMediaType": "application/vnd.oasis.opendocument.text" },
{"sourceMediaType": "application/wordperfect", "targetMediaType": "application/rtf" },
{"sourceMediaType": "application/wordperfect", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/csv" },
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "application/vnd.ms-excel", "maxSourceSizeBytes": 10485760, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/csv" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "maxSourceSizeBytes": 1572864, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/csv" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "maxSourceSizeBytes": 1572864, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/csv" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "maxSourceSizeBytes": 1572864, "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/html" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/csv" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/tab-separated-values" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "application/vnd.ms-excel" },
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "maxSourceSizeBytes": 1572864, "targetMediaType": "application/pdf" }
]
}
]
}

View File

@ -9,7 +9,7 @@ ENV JAVA_OPTS=""
ARG GROUPNAME=Alfresco
ARG GROUPID=1000
ARG MISCUSERNAME=transform-misc
ARG USERID=33004
ARG USERID=33006
COPY target/${env.project_artifactId}-${env.project_version}.jar /usr/bin

View File

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

View File

@ -1,2 +1,5 @@
queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.misc.acs}
transform:
config:
location: classpath:misc_engine_config.json

View File

@ -71,6 +71,8 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
private final String targetEncoding = "UTF-8";
private final String targetMimetype = MIMETYPE_TEXT_PLAIN;
private static final String ENGINE_CONFIG_NAME = "misc_engine_config.json";
@Before
public void before() throws Exception
{
@ -86,6 +88,12 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
expectedSourceFileBytes);
}
@Override
public String getEngineConfigName()
{
return ENGINE_CONFIG_NAME;
}
@Override
protected void mockTransformCommand(String sourceExtension, String targetExtension,
String sourceMimetype, boolean readTargetFileBytes)

View File

@ -0,0 +1,80 @@
{
"transformOptions": {
"textToPdfOptions": [
{"value": {"name": "pageLimit"}},
{"value": {"name": "sourceEncoding"}}
],
"stringOptions": [
{"value": {"name": "sourceEncoding"}},
{"value": {"name": "targetEncoding"}}
],
"htmlOptions": [
{"value": {"name": "sourceEncoding"}}
]
},
"transformers": [
{
"transformerName": "html",
"supportedSourceAndTargetList": [
{"sourceMediaType": "text/html", "targetMediaType": "text/plain"}
],
"transformOptions": [
"htmlOptions"
]
},
{
"transformerName": "string",
"supportedSourceAndTargetList": [
{"sourceMediaType": "text/plain", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/mediawiki", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/css", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/csv", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/xml", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/html", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/richtext", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/sgml", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-setext", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-jsp", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-markdown", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/calendar", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-javascript", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/dita+xml", "targetMediaType": "text/plain"}
],
"transformOptions": [
"stringOptions"
]
},
{
"transformerName": "appleIWorks",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "image/jpeg"},
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "image/jpeg"},
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "image/jpeg"}
],
"transformOptions": [
]
},
{
"transformerName": "textToPdf",
"supportedSourceAndTargetList": [
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "application/pdf"},
{"sourceMediaType": "text/csv", "targetMediaType": "application/pdf"},
{"sourceMediaType": "application/dita+xml", "targetMediaType": "application/pdf"},
{"sourceMediaType": "text/xml", "targetMediaType": "application/pdf"}
],
"transformOptions": [
"textToPdfOptions"
]
},
{
"transformerName": "rfc822",
"supportedSourceAndTargetList": [
{"sourceMediaType": "message/rfc822", "targetMediaType": "text/plain"}
],
"transformOptions": [
]
}
]
}

View File

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

View File

@ -0,0 +1,80 @@
{
"transformOptions": {
"textToPdfOptions": [
{"value": {"name": "pageLimit"}},
{"value": {"name": "sourceEncoding"}}
],
"stringOptions": [
{"value": {"name": "sourceEncoding"}},
{"value": {"name": "targetEncoding"}}
],
"htmlOptions": [
{"value": {"name": "sourceEncoding"}}
]
},
"transformers": [
{
"transformerName": "html",
"supportedSourceAndTargetList": [
{"sourceMediaType": "text/html", "targetMediaType": "text/plain"}
],
"transformOptions": [
"htmlOptions"
]
},
{
"transformerName": "string",
"supportedSourceAndTargetList": [
{"sourceMediaType": "text/plain", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/mediawiki", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/css", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/csv", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/xml", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/html", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/richtext", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/sgml", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-setext", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-jsp", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-markdown", "targetMediaType": "text/plain"},
{"sourceMediaType": "text/calendar", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-javascript", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/dita+xml", "targetMediaType": "text/plain"}
],
"transformOptions": [
"stringOptions"
]
},
{
"transformerName": "appleIWorks",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "image/jpeg"},
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "image/jpeg"},
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "image/jpeg"}
],
"transformOptions": [
]
},
{
"transformerName": "textToPdf",
"supportedSourceAndTargetList": [
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "application/pdf"},
{"sourceMediaType": "text/csv", "targetMediaType": "application/pdf"},
{"sourceMediaType": "application/dita+xml", "targetMediaType": "application/pdf"},
{"sourceMediaType": "text/xml", "targetMediaType": "application/pdf"}
],
"transformOptions": [
"textToPdfOptions"
]
},
{
"transformerName": "rfc822",
"supportedSourceAndTargetList": [
{"sourceMediaType": "message/rfc822", "targetMediaType": "text/plain"}
],
"transformOptions": [
]
}
]
}

View File

@ -114,7 +114,7 @@ public class AlfrescoPdfRendererController extends AbstractTransformerController
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
final String options = OptionsBuilder
final String options = PdfRendererOptionsBuilder
.builder()
.withPage(transformOptions.get("page"))
.withWidth(transformOptions.get("width"))
@ -147,7 +147,7 @@ public class AlfrescoPdfRendererController extends AbstractTransformerController
File targetFile = createTargetFile(request, targetFilename);
// Both files are deleted by TransformInterceptor.afterCompletion
final String options = OptionsBuilder
final String options = PdfRendererOptionsBuilder
.builder()
.withPage(page)
.withWidth(width)

View File

@ -1,2 +1,5 @@
queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.alfresco-pdf-renderer.acs}
transform:
config:
location: classpath:pdfrenderer_engine_config.json

View File

@ -86,6 +86,9 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
@WebMvcTest(AlfrescoPdfRendererController.class)
public class AlfrescoPdfRendererControllerTest extends AbstractTransformerControllerTest
{
private static final String ENGINE_CONFIG_NAME = "pdfrenderer_engine_config.json";
@Mock
private ExecutionResult mockExecutionResult;
@ -110,6 +113,12 @@ public class AlfrescoPdfRendererControllerTest extends AbstractTransformerContro
mockTransformCommand("pdf", "png", "application/pdf", true);
}
@Override
public String getEngineConfigName()
{
return ENGINE_CONFIG_NAME;
}
@Override
public void mockTransformCommand(String sourceExtension,
String targetExtension, String sourceMimetype,

View File

@ -36,7 +36,7 @@ import java.util.StringJoiner;
*
* @author Cezar Leahu
*/
final class OptionsBuilder
public final class PdfRendererOptionsBuilder
{
private Integer page;
private Integer width;
@ -44,58 +44,58 @@ final class OptionsBuilder
private Boolean allowPdfEnlargement;
private Boolean maintainPdfAspectRatio;
private OptionsBuilder() {}
private PdfRendererOptionsBuilder() {}
public OptionsBuilder withPage(final String page)
public PdfRendererOptionsBuilder withPage(final String page)
{
return withPage(stringToInteger(page));
}
public OptionsBuilder withPage(final Integer page)
public PdfRendererOptionsBuilder withPage(final Integer page)
{
this.page = page;
return this;
}
public OptionsBuilder withWidth(final String width)
public PdfRendererOptionsBuilder withWidth(final String width)
{
return withWidth(stringToInteger(width));
}
public OptionsBuilder withWidth(final Integer width)
public PdfRendererOptionsBuilder withWidth(final Integer width)
{
this.width = width;
return this;
}
public OptionsBuilder withHeight(final String height)
public PdfRendererOptionsBuilder withHeight(final String height)
{
return withHeight(stringToInteger(height));
}
public OptionsBuilder withHeight(final Integer height)
public PdfRendererOptionsBuilder withHeight(final Integer height)
{
this.height = height;
return this;
}
public OptionsBuilder withAllowPdfEnlargement(final String allowPdfEnlargement)
public PdfRendererOptionsBuilder withAllowPdfEnlargement(final String allowPdfEnlargement)
{
return withAllowPdfEnlargement(stringToBoolean(allowPdfEnlargement));
}
public OptionsBuilder withAllowPdfEnlargement(final Boolean allowPdfEnlargement)
public PdfRendererOptionsBuilder withAllowPdfEnlargement(final Boolean allowPdfEnlargement)
{
this.allowPdfEnlargement = allowPdfEnlargement;
return this;
}
public OptionsBuilder withMaintainPdfAspectRatio(final String maintainPdfAspectRatio)
public PdfRendererOptionsBuilder withMaintainPdfAspectRatio(final String maintainPdfAspectRatio)
{
return withMaintainPdfAspectRatio(stringToBoolean(maintainPdfAspectRatio));
}
public OptionsBuilder withMaintainPdfAspectRatio(final Boolean maintainPdfAspectRatio)
public PdfRendererOptionsBuilder withMaintainPdfAspectRatio(final Boolean maintainPdfAspectRatio)
{
this.maintainPdfAspectRatio = maintainPdfAspectRatio;
return this;
@ -127,8 +127,8 @@ final class OptionsBuilder
return args.toString();
}
public static OptionsBuilder builder()
public static PdfRendererOptionsBuilder builder()
{
return new OptionsBuilder();
return new PdfRendererOptionsBuilder();
}
}

View File

@ -0,0 +1,23 @@
{
"transformOptions": {
"pdfRendererOptions": [
{"value": {"name": "page"}},
{"value": {"name": "width"}},
{"value": {"name": "height"}},
{"value": {"name": "allowPdfEnlargement"}},
{"value": {"name": "maintainPdfAspectRatio"}}
]
},
"transformers": [
{
"transformerName": "pdfrenderer",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/pdf", "targetMediaType": "image/png" },
{"sourceMediaType": "application/illustrator", "targetMediaType": "image/png" }
],
"transformOptions": [
"pdfRendererOptions"
]
}
]
}

View File

@ -1,2 +1,5 @@
queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.tika.acs}
transform:
config:
location: classpath:tika_engine_config.json

View File

@ -116,6 +116,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
@WebMvcTest(TikaController.class)
public class TikaControllerTest extends AbstractTransformerControllerTest
{
private static final String ENGINE_CONFIG_NAME = "tika_engine_config.json";
private static final String EXPECTED_XHTML_CONTENT_CONTAINS = "<p>The quick brown fox jumps over the lazy dog</p>";
private static final String EXPECTED_TEXT_CONTENT_CONTAINS = "The quick brown fox jumps over the lazy dog";
private static final String EXPECTED_MSG_CONTENT_CONTAINS = "Recipients\n" +
@ -146,6 +147,12 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
targetExtension = "txt";
}
@Override
public String getEngineConfigName()
{
return ENGINE_CONFIG_NAME;
}
@Override
protected void mockTransformCommand(String sourceExtension,
String targetExtension, String sourceMimetype,

View File

@ -0,0 +1,508 @@
{
"transformOptions": {
"tikaOptions": [
{"value": {"name": "targetEncoding"}}
],
"archiveOptions": [
{"value": {"name": "includeContents"}},
{"value": {"name": "targetEncoding"}}
],
"pdfboxOptions": [
{"value": {"name": "notExtractBookmarksText"}},
{"value": {"name": "targetEncoding"}}
]
},
"transformers": [
{
"transformerName": "Archive",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/x-cpio", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-cpio", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-cpio", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-cpio", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/java-archive", "targetMediaType": "text/html"},
{"sourceMediaType": "application/java-archive", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/java-archive", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/java-archive", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-tar", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-tar", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-tar", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-tar", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/zip", "targetMediaType": "text/html"},
{"sourceMediaType": "application/zip", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/zip", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/zip", "targetMediaType": "text/xml"}
],
"transformOptions": [
"archiveOptions"
]
},
{
"transformerName": "OutlookMsg",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "PdfBox",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/pdf", "targetMediaType": "text/csv"},
{"sourceMediaType": "application/pdf", "targetMediaType": "text/html"},
{"sourceMediaType": "application/pdf", "maxSourceSizeBytes": 26214400, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/pdf", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/pdf", "targetMediaType": "text/xml"}
],
"transformOptions": [
"pdfboxOptions"
]
},
{
"transformerName": "Office",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "Poi",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/csv"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/csv"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 65, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "OOXML",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "TikaAuto",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document" , "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-gzip", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-gzip", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-gzip", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-gzip", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-hdf", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-hdf", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-hdf", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-hdf", "targetMediaType": "text/xml"},
{"sourceMediaType": "text/html", "targetMediaType": "text/html"},
{"sourceMediaType": "text/html", "priority": 60, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/html", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "text/html", "targetMediaType": "text/xml"},
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/html"},
{"sourceMediaType": "text/x-java-source", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-java-source", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-project", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-project", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-project", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-project", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.chart", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.chart", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.chart", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.chart", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.image", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.image", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.image", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.image", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/ogg", "targetMediaType": "text/html"},
{"sourceMediaType": "application/ogg", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/ogg", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/ogg", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/pdf", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/pdf", "maxSourceSizeBytes": 26214400, "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/pdf", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/pdf", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-rar-compressed", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-rar-compressed", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-rar-compressed", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-rar-compressed", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/rss+xml", "targetMediaType": "text/html"},
{"sourceMediaType": "application/rss+xml", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/rss+xml", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/rss+xml", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/rtf", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/rtf", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/rtf", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/rtf", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.sun.xml.writer", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "text/xml"},
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "text/xml", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "text/xml", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/xml", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "text/xml", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/xhtml+xml", "targetMediaType": "text/html"},
{"sourceMediaType": "application/xhtml+xml", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/xhtml+xml", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/xhtml+xml", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-compress", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "TextMining",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/msword", "priority": 65, "targetMediaType": "text/html"},
{"sourceMediaType": "application/msword", "priority": 65, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/msword", "priority": 65, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/msword", "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
}
]
}

View File

@ -0,0 +1,508 @@
{
"transformOptions": {
"tikaOptions": [
{"value": {"name": "targetEncoding"}}
],
"archiveOptions": [
{"value": {"name": "includeContents"}},
{"value": {"name": "targetEncoding"}}
],
"pdfboxOptions": [
{"value": {"name": "notExtractBookmarksText"}},
{"value": {"name": "targetEncoding"}}
]
},
"transformers": [
{
"transformerName": "Archive",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/x-cpio", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-cpio", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-cpio", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-cpio", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/java-archive", "targetMediaType": "text/html"},
{"sourceMediaType": "application/java-archive", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/java-archive", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/java-archive", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-tar", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-tar", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-tar", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-tar", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/zip", "targetMediaType": "text/html"},
{"sourceMediaType": "application/zip", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/zip", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/zip", "targetMediaType": "text/xml"}
],
"transformOptions": [
"archiveOptions"
]
},
{
"transformerName": "OutlookMsg",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "PdfBox",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/pdf", "targetMediaType": "text/csv"},
{"sourceMediaType": "application/pdf", "targetMediaType": "text/html"},
{"sourceMediaType": "application/pdf", "maxSourceSizeBytes": 26214400, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/pdf", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/pdf", "targetMediaType": "text/xml"}
],
"transformOptions": [
"pdfboxOptions"
]
},
{
"transformerName": "Office",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "Poi",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/csv"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/csv"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 65, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "OOXML",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 60, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "TikaAuto",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document" , "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-gzip", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-gzip", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-gzip", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-gzip", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-hdf", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-hdf", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-hdf", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-hdf", "targetMediaType": "text/xml"},
{"sourceMediaType": "text/html", "targetMediaType": "text/html"},
{"sourceMediaType": "text/html", "priority": 60, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/html", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "text/html", "targetMediaType": "text/xml"},
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/html"},
{"sourceMediaType": "text/x-java-source", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/x-java-source", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-project", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-project", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-project", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-project", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.chart", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.chart", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.chart", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.chart", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.image", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.image", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.image", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.image", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/ogg", "targetMediaType": "text/html"},
{"sourceMediaType": "application/ogg", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/ogg", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/ogg", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet-template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.oasis.opendocument.text-template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/pdf", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/pdf", "maxSourceSizeBytes": 26214400, "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/pdf", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/pdf", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-rar-compressed", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-rar-compressed", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-rar-compressed", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-rar-compressed", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/rss+xml", "targetMediaType": "text/html"},
{"sourceMediaType": "application/rss+xml", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/rss+xml", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/rss+xml", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/rtf", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/rtf", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/rtf", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/rtf", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.sun.xml.writer", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "text/xml"},
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "text/xml"},
{"sourceMediaType": "text/xml", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "text/xml", "priority": 55, "targetMediaType": "text/plain"},
{"sourceMediaType": "text/xml", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "text/xml", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.visio", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/xhtml+xml", "targetMediaType": "text/html"},
{"sourceMediaType": "application/xhtml+xml", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/xhtml+xml", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/xhtml+xml", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "text/html"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/xml"},
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/html"},
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/plain"},
{"sourceMediaType": "application/x-compress", "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
},
{
"transformerName": "TextMining",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/msword", "priority": 65, "targetMediaType": "text/html"},
{"sourceMediaType": "application/msword", "priority": 65, "targetMediaType": "text/plain"},
{"sourceMediaType": "application/msword", "priority": 65, "targetMediaType": "application/xhtml+xml"},
{"sourceMediaType": "application/msword", "targetMediaType": "text/xml"}
],
"transformOptions": [
"tikaOptions"
]
}
]
}

View File

@ -115,6 +115,7 @@ public abstract class AbstractTransformerController implements TransformControll
@GetMapping(value = "/transform/config")
public ResponseEntity<TransformConfig> info()
{
// TODO - This cast should not be here
logger.info("GET Transform Config.");
final TransformConfig transformConfig =
((TransformRegistryImpl) transformRegistry).getTransformConfig();

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,11 +54,22 @@ public class TransformRegistryImpl extends AbstractTransformRegistry
{
private static final Logger log = LoggerFactory.getLogger(TransformRegistryImpl.class);
private static final String ENGINE_CONFIG_JSON = "classpath:engine_config.json";
@Autowired
ResourceLoader resourceLoader;
@Value("${transform.config.location:classpath:engine_config.json}")
private String locationFromProperty;
@Value(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();
@ -72,17 +85,10 @@ public class TransformRegistryImpl extends AbstractTransformRegistry
catch (IOException e)
{
throw new TransformException(INTERNAL_SERVER_ERROR.value(),
"Could not read " + ENGINE_CONFIG_JSON, e);
"Could not read " + locationFromProperty, e);
}
}
@PostConstruct
public void afterPropertiesSet()
{
TransformConfig transformConfig = getTransformConfig();
registerAll(transformConfig, null, ENGINE_CONFIG_JSON);
}
@Override
public TransformCache getData()
{

View File

@ -0,0 +1,60 @@
/*
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 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";
}

View File

@ -52,4 +52,15 @@ public class Util
{
return param == null ? null : Boolean.parseBoolean(param);
}
/**
* Safely converts a {@link String} to a {@link Long}
*
* @param param String to be converted
* @return Null if param is null or converted value as {@link Boolean}
*/
public static Long stringToLong(final String param)
{
return param == null ? null : Long.parseLong(param);
}
}

View File

@ -340,15 +340,24 @@ public abstract class AbstractTransformerControllerTest
assertEquals(BAD_REQUEST.value(), transformReply.getStatus());
}
/**
*
* @return transformer specific engine config name
*/
public String getEngineConfigName()
{
return "engine_config.json";
}
@Test
public void testGetTransformConfigInfo() throws Exception
{
TransformConfig expectedTransformConfig = objectMapper
.readValue(new ClassPathResource("engine_config.json").getFile(),
.readValue(new ClassPathResource(getEngineConfigName()).getFile(),
TransformConfig.class);
ReflectionTestUtils.setField(transformRegistry, "engineConfig",
new ClassPathResource("engine_config.json"));
new ClassPathResource(getEngineConfigName()));
String response = mockMvc
.perform(MockMvcRequestBuilders.get("/transform/config"))
@ -357,7 +366,6 @@ public abstract class AbstractTransformerControllerTest
.andReturn().getResponse().getContentAsString();
TransformConfig transformConfig = objectMapper.readValue(response, TransformConfig.class);
assertEquals(expectedTransformConfig, transformConfig);
}

View File

@ -42,6 +42,8 @@
<module>alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot</module>
<module>alfresco-transform-misc/alfresco-transform-misc</module>
<module>alfresco-transform-misc/alfresco-transform-misc-boot</module>
<module>alfresco-transform-core-aio/alfresco-transform-core-aio</module>
<module>alfresco-transform-core-aio/alfresco-transform-core-aio-boot</module>
</modules>
<scm>