Resolve some review comments

This commit is contained in:
Erik Knizat
2020-04-07 19:23:02 +01:00
parent efb9801535
commit 97542740ce
9 changed files with 58 additions and 98 deletions

View File

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