mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-08-14 17:58:27 +00:00
Save point: [skip ci]
* cleaning up TransformController - more to do * wire up all transforms
This commit is contained in:
@@ -79,10 +79,15 @@ public class TransformerDebug
|
||||
}
|
||||
|
||||
public void pushTransform(String reference, String sourceMimetype, String targetMimetype, File sourceFile, String transformerName)
|
||||
{
|
||||
final long sourceSizeInBytes = sourceFile.length();
|
||||
pushTransform(reference, sourceMimetype, targetMimetype, sourceSizeInBytes, transformerName);
|
||||
}
|
||||
|
||||
public void pushTransform(String reference, String sourceMimetype, String targetMimetype, long sourceSizeInBytes, String transformerName)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
final long sourceSizeInBytes = sourceFile.length();
|
||||
String message = getPaddedReference(reference) +
|
||||
getMimetypeExt(sourceMimetype) +
|
||||
getTargetMimetypeExt(targetMimetype, sourceMimetype) + ' ' +
|
||||
|
@@ -74,19 +74,19 @@ public class TransformCache
|
||||
return transforms;
|
||||
}
|
||||
|
||||
public void cache(final String transformerName, final String sourceMimetype,
|
||||
public void cache(final String renditionName, final String sourceMimetype,
|
||||
final List<SupportedTransform> transformListBySize)
|
||||
{
|
||||
cachedSupportedTransformList
|
||||
.get(transformerName)
|
||||
.get(renditionName)
|
||||
.put(sourceMimetype, transformListBySize);
|
||||
}
|
||||
|
||||
public List<SupportedTransform> retrieveCached(final String transformerName,
|
||||
public List<SupportedTransform> retrieveCached(final String renditionName,
|
||||
final String sourceMimetype)
|
||||
{
|
||||
return cachedSupportedTransformList
|
||||
.computeIfAbsent(transformerName, k -> new ConcurrentHashMap<>())
|
||||
.computeIfAbsent(renditionName, k -> new ConcurrentHashMap<>())
|
||||
.get(sourceMimetype);
|
||||
}
|
||||
|
||||
|
@@ -75,20 +75,20 @@ class TransformRegistryHelper
|
||||
// been discarded.
|
||||
static List<SupportedTransform> retrieveTransformListBySize(final TransformCache data,
|
||||
final String sourceMimetype, final String targetMimetype,
|
||||
Map<String, String> actualOptions, String transformerName)
|
||||
Map<String, String> actualOptions, String renditionName)
|
||||
{
|
||||
if (actualOptions == null)
|
||||
{
|
||||
actualOptions = emptyMap();
|
||||
}
|
||||
if (transformerName != null && transformerName.trim().isEmpty())
|
||||
if (renditionName != null && renditionName.trim().isEmpty())
|
||||
{
|
||||
transformerName = null;
|
||||
renditionName = null;
|
||||
}
|
||||
|
||||
final List<SupportedTransform> cachedTransformList =
|
||||
transformerName == null ? null :
|
||||
data.retrieveCached(transformerName, sourceMimetype);
|
||||
renditionName == null ? null :
|
||||
data.retrieveCached(renditionName, sourceMimetype);
|
||||
if (cachedTransformList != null)
|
||||
{
|
||||
return cachedTransformList;
|
||||
@@ -99,9 +99,9 @@ class TransformRegistryHelper
|
||||
targetMimetype,
|
||||
filterTimeout(actualOptions));
|
||||
|
||||
if (transformerName != null)
|
||||
if (renditionName != null)
|
||||
{
|
||||
data.cache(transformerName, sourceMimetype, builtTransformList);
|
||||
data.cache(renditionName, sourceMimetype, builtTransformList);
|
||||
}
|
||||
|
||||
return builtTransformList;
|
||||
@@ -111,13 +111,12 @@ class TransformRegistryHelper
|
||||
final TransformCache data, final String sourceMimetype, final String targetMimetype,
|
||||
final Map<String, String> actualOptions)
|
||||
{
|
||||
|
||||
if(sourceMimetype == null)
|
||||
if (sourceMimetype == null)
|
||||
{
|
||||
throw new TransformException(400, "Null value provided for sourceMimetype, please provide a value");
|
||||
}
|
||||
|
||||
if(targetMimetype == null)
|
||||
if (targetMimetype == null)
|
||||
{
|
||||
throw new TransformException(400, "Null value provided for tragetMimetype, please provide a value");
|
||||
}
|
||||
|
Reference in New Issue
Block a user