mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-07-31 17:38:33 +00:00
Do the wiring
This commit is contained in:
@@ -50,6 +50,7 @@ import org.alfresco.transformer.probes.ProbeTestTransform;
|
||||
import org.alfresco.transformer.transformers.AllInOneTransformer;
|
||||
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;
|
||||
@@ -74,7 +75,8 @@ public class AIOController extends AbstractTransformerController
|
||||
TEST_DELAY
|
||||
};
|
||||
|
||||
private AllInOneTransformer transformer = new AllInOneTransformer();
|
||||
@Autowired
|
||||
private AllInOneTransformer transformer;
|
||||
|
||||
@Override
|
||||
public String getTransformerName()
|
||||
|
@@ -0,0 +1,47 @@
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import jdk.jfr.Name;
|
||||
import org.alfresco.transform.client.model.config.TransformConfig;
|
||||
import org.alfresco.transform.client.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transformer.transformers.AllInOneTransformer;
|
||||
import org.alfresco.transformer.transformers.Transformer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
@Configuration
|
||||
public class AIOCustomConfig
|
||||
{
|
||||
|
||||
@Bean("AllInOneTransformer")
|
||||
public Transformer aioTransformer()
|
||||
{
|
||||
return new AllInOneTransformer();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Override the TransformRegistryImpl used in {@link AbstractTransformerController}
|
||||
*/
|
||||
@Bean
|
||||
@Primary
|
||||
public TransformServiceRegistry transformRegistryOverride()
|
||||
{
|
||||
return new TransformRegistryImpl()
|
||||
{
|
||||
|
||||
@Autowired
|
||||
@Qualifier("AllInOneTransformer")
|
||||
Transformer transformer;
|
||||
|
||||
@Override
|
||||
TransformConfig getTransformConfig()
|
||||
{
|
||||
return transformer.getTransformConfig();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@@ -32,14 +32,20 @@ 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 {
|
||||
@@ -62,6 +68,6 @@ public class AIOControllerTest //extends AbstractTransformerControllerTest
|
||||
@Test
|
||||
public void emptyTest()
|
||||
{
|
||||
|
||||
aioController.info();
|
||||
}
|
||||
}
|
@@ -62,6 +62,9 @@ public class AllInOneTransformer implements Transformer
|
||||
{
|
||||
this.registerTransformer(new MiscAdapter());
|
||||
this.registerTransformer(new TikaAdapter());
|
||||
this.registerTransformer(new ImageMagickAdapter());
|
||||
this.registerTransformer(new LibreOfficeAdapter());
|
||||
this.registerTransformer(new PdfRendererAdapter());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@@ -37,7 +37,7 @@ import org.alfresco.transformer.PdfRendererOptionsBuilder;
|
||||
|
||||
public class PdfRendererAdapter extends AbstractTransformer
|
||||
{
|
||||
private static String CONFIG_PREFIX = "pdf-renderer";
|
||||
private static String CONFIG_PREFIX = "pdfrenderer";
|
||||
private PdfRendererCommandExecutor pdfExecutor;
|
||||
|
||||
//TODO move key strings to a central class
|
||||
|
Reference in New Issue
Block a user