Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

86344: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud)
      86341: MNT-12491/ACE-2858: CLONE - 7z zip TIKA transformer is slow: Transformation of bin->txt to takes 2+ mins, continually retries and never succeeds
         - Added supported transformers.properties so we don't try to extract txt from binary (or unknown) files
         - fixed bug were none default mimetype for an extension was ignored


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@86347 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-10-03 05:58:55 +00:00
parent 1cc565d659
commit 172c9afcba
2 changed files with 17 additions and 8 deletions

View File

@@ -22,12 +22,14 @@ content.transformer.default.maxPages=-1
# ============================= # =============================
content.transformer.Archive.extensions.*.txt.priority=50 content.transformer.Archive.extensions.*.txt.priority=50
content.transformer.Archive.extensions.bin.txt.supported=false
content.transformer.BinaryPassThrough.priority=20 content.transformer.BinaryPassThrough.priority=20
# Text # Text
# ---- # ----
content.transformer.TikaAuto.priority=120 content.transformer.TikaAuto.priority=120
content.transformer.TikaAuto.extensions.bin.txt.supported=false
content.transformer.Office.priority=130 content.transformer.Office.priority=130

View File

@@ -20,6 +20,7 @@ package org.alfresco.repo.content.transform;
import java.util.Properties; import java.util.Properties;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory; import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory;
import org.alfresco.service.cmr.module.ModuleDetails; import org.alfresco.service.cmr.module.ModuleDetails;
import org.alfresco.service.cmr.module.ModuleService; import org.alfresco.service.cmr.module.ModuleService;
@@ -227,7 +228,7 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran
@Override @Override
public TransformerStatistics getStatistics(ContentTransformer transformer, String sourceMimetype, String targetMimetype, boolean createNew) public TransformerStatistics getStatistics(ContentTransformer transformer, String sourceMimetype, String targetMimetype, boolean createNew)
{ {
return statistics.getStatistics(transformer, sourceMimetype, targetMimetype, createNew); return statistics.getStatistics(transformer, stdMimetype(sourceMimetype), stdMimetype(targetMimetype), createNew);
} }
/** /**
@@ -237,7 +238,7 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran
public TransformationOptionLimits getLimits(ContentTransformer transformer, String sourceMimetype, public TransformationOptionLimits getLimits(ContentTransformer transformer, String sourceMimetype,
String targetMimetype, String use) String targetMimetype, String use)
{ {
return limits.getLimits(transformer, sourceMimetype, targetMimetype, use); return limits.getLimits(transformer, stdMimetype(sourceMimetype), stdMimetype(targetMimetype), use);
} }
/** /**
@@ -247,7 +248,7 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran
public boolean isSupportedTransformation(ContentTransformer transformer, String sourceMimetype, public boolean isSupportedTransformation(ContentTransformer transformer, String sourceMimetype,
String targetMimetype, TransformationOptions options) String targetMimetype, TransformationOptions options)
{ {
return supported.isSupportedTransformation(transformer, sourceMimetype, targetMimetype, options); return supported.isSupportedTransformation(transformer, stdMimetype(sourceMimetype), stdMimetype(targetMimetype), options);
} }
/** /**
@@ -258,7 +259,7 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran
{ {
try try
{ {
return priorities.getInt(transformer, sourceMimetype, targetMimetype); return priorities.getInt(transformer, stdMimetype(sourceMimetype), stdMimetype(targetMimetype));
} }
catch (NumberFormatException e1) catch (NumberFormatException e1)
{ {
@@ -281,7 +282,7 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran
{ {
try try
{ {
return thresholdCounts.getInt(transformer, sourceMimetype, targetMimetype); return thresholdCounts.getInt(transformer, stdMimetype(sourceMimetype), stdMimetype(targetMimetype));
} }
catch (NumberFormatException e1) catch (NumberFormatException e1)
{ {
@@ -303,7 +304,7 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran
{ {
try try
{ {
return errorTimes.getLong(transformer, sourceMimetype, targetMimetype); return errorTimes.getLong(transformer, stdMimetype(sourceMimetype), stdMimetype(targetMimetype));
} }
catch (NumberFormatException e1) catch (NumberFormatException e1)
{ {
@@ -326,7 +327,7 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran
{ {
try try
{ {
return initialAverageTimes.getLong(transformer, sourceMimetype, targetMimetype); return initialAverageTimes.getLong(transformer, stdMimetype(sourceMimetype), stdMimetype(targetMimetype));
} }
catch (NumberFormatException e1) catch (NumberFormatException e1)
{ {
@@ -349,7 +350,7 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran
{ {
try try
{ {
return initialCounts.getInt(transformer, sourceMimetype, targetMimetype); return initialCounts.getInt(transformer, stdMimetype(sourceMimetype), stdMimetype(targetMimetype));
} }
catch (NumberFormatException e1) catch (NumberFormatException e1)
{ {
@@ -363,4 +364,10 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran
} }
} }
} }
// Returns the main or standard mimetype. Needed were multiple mimetypes share the same extension or are unknown so binary.
private String stdMimetype(String mimetype)
{
return mimetypeService.getMimetype(mimetypeService.getExtension(mimetype));
}
} }