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:
@@ -27,6 +27,7 @@
|
||||
package org.alfresco.transform.misc.metadataExtractors;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
import org.alfresco.transform.base.metadataExtractors.AbstractMetadataExtractor;
|
||||
import org.alfresco.transform.common.TransformException;
|
||||
import org.slf4j.Logger;
|
||||
@@ -85,19 +86,6 @@ public class HtmlMetadataExtractor extends AbstractMetadataExtractor implements
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@Override public void transform(String sourceMimetype, String sourceEncoding, InputStream inputStream,
|
||||
String targetMimetype, String targetEncoding, OutputStream outputStream,
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
throw new TransformException(500, "TODO HtmlMetadataExtractor transform");
|
||||
}
|
||||
|
||||
public void extractMetadata(String sourceMimetype, String targetMimetype, Map<String, String> transformOptions,
|
||||
File sourceFile, File targetFile) throws Exception
|
||||
{
|
||||
extractMetadata(sourceMimetype, transformOptions, sourceFile, targetFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Serializable> extractMetadata(String sourceMimetype, Map<String, String> transformOptions,
|
||||
File sourceFile) throws Exception
|
||||
|
@@ -27,6 +27,7 @@
|
||||
package org.alfresco.transform.misc.metadataExtractors;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
import org.alfresco.transform.base.metadataExtractors.AbstractMetadataExtractor;
|
||||
import org.alfresco.transform.common.TransformException;
|
||||
import org.slf4j.Logger;
|
||||
@@ -87,19 +88,6 @@ public class RFC822MetadataExtractor extends AbstractMetadataExtractor implement
|
||||
super(EXTRACTOR, logger);
|
||||
}
|
||||
|
||||
@Override public void transform(String sourceMimetype, String sourceEncoding, InputStream inputStream,
|
||||
String targetMimetype, String targetEncoding, OutputStream outputStream,
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
throw new TransformException(500, "TODO RFC822MetadataExtractor transform");
|
||||
}
|
||||
|
||||
public void extractMetadata(String sourceMimetype, String targetMimetype, Map<String, String> transformOptions,
|
||||
File sourceFile, File targetFile) throws Exception
|
||||
{
|
||||
extractMetadata(sourceMimetype, transformOptions, sourceFile, targetFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Serializable> extractMetadata(String sourceMimetype, Map<String, String> transformOptions,
|
||||
File sourceFile) throws Exception
|
||||
|
@@ -27,8 +27,8 @@
|
||||
package org.alfresco.transform.misc.transformers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.common.TransformException;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
import org.alfresco.transform.base.util.CustomTransformerFileAdaptor;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
|
||||
import org.slf4j.Logger;
|
||||
@@ -64,7 +64,7 @@ import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||
* @since 4.0
|
||||
*/
|
||||
@Component
|
||||
public class AppleIWorksContentTransformer implements CustomTransformer
|
||||
public class AppleIWorksContentTransformer implements CustomTransformerFileAdaptor
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(
|
||||
AppleIWorksContentTransformer.class);
|
||||
@@ -84,15 +84,9 @@ public class AppleIWorksContentTransformer implements CustomTransformer
|
||||
return "appleIWorks";
|
||||
}
|
||||
|
||||
@Override public void transform(String sourceMimetype, String sourceEncoding, InputStream inputStream,
|
||||
String targetMimetype, String targetEncoding, OutputStream outputStream,
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
throw new TransformException(500, "TODO appleIWorks transform");
|
||||
}
|
||||
|
||||
public void transform(final String sourceMimetype, final String targetMimetype, final Map<String, String> parameters,
|
||||
final File sourceFile, final File targetFile)
|
||||
@Override
|
||||
public void transform(String sourceMimetype, String targetMimetype, Map<String, String> transformOptions,
|
||||
File sourceFile, File targetFile)
|
||||
{
|
||||
logger.debug("Performing IWorks to jpeg transform with sourceMimetype={} targetMimetype={}",
|
||||
sourceMimetype, targetMimetype);
|
||||
|
@@ -26,9 +26,9 @@
|
||||
*/
|
||||
package org.alfresco.transform.misc.transformers;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
import org.alfresco.transform.base.fs.FileManager;
|
||||
import org.alfresco.transform.common.TransformException;
|
||||
import org.alfresco.transform.base.util.CustomTransformerFileAdaptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -69,7 +69,7 @@ import static org.alfresco.transform.common.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
* </p>
|
||||
*/
|
||||
@Component
|
||||
public class EMLTransformer implements CustomTransformer
|
||||
public class EMLTransformer implements CustomTransformerFileAdaptor
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(EMLTransformer.class);
|
||||
|
||||
@@ -82,15 +82,9 @@ public class EMLTransformer implements CustomTransformer
|
||||
return "rfc822";
|
||||
}
|
||||
|
||||
@Override public void transform(String sourceMimetype, String sourceEncoding, InputStream inputStream,
|
||||
String targetMimetype, String targetEncoding, OutputStream outputStream,
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
throw new TransformException(500, "TODO rfc822 transform");
|
||||
}
|
||||
|
||||
public void transform(final String sourceMimetype, final String targetMimetype, final Map<String, String> parameters,
|
||||
final File sourceFile, final File targetFile) throws Exception
|
||||
@Override
|
||||
public void transform(String sourceMimetype, String targetMimetype, Map<String, String> transformOptions,
|
||||
File sourceFile, File targetFile) throws Exception
|
||||
{
|
||||
logger.debug("Performing RFC822 to text transform.");
|
||||
// Use try with resource
|
||||
|
@@ -26,8 +26,7 @@
|
||||
*/
|
||||
package org.alfresco.transform.misc.transformers;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.common.TransformException;
|
||||
import org.alfresco.transform.base.util.CustomTransformerFileAdaptor;
|
||||
import org.htmlparser.Parser;
|
||||
import org.htmlparser.beans.StringBean;
|
||||
import org.htmlparser.util.ParserException;
|
||||
@@ -38,8 +37,6 @@ import org.springframework.stereotype.Component;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.net.URLConnection;
|
||||
@@ -77,7 +74,7 @@ import static org.alfresco.transform.common.RequestParamMap.SOURCE_ENCODING;
|
||||
* @see <a href="http://sourceforge.net/tracker/?func=detail&aid=1644504&group_id=24399&atid=381401">HTML Parser</a>
|
||||
*/
|
||||
@Component
|
||||
public class HtmlParserContentTransformer implements CustomTransformer
|
||||
public class HtmlParserContentTransformer implements CustomTransformerFileAdaptor
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(
|
||||
HtmlParserContentTransformer.class);
|
||||
@@ -89,17 +86,11 @@ public class HtmlParserContentTransformer implements CustomTransformer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(String sourceMimetype, String sourceEncoding, InputStream inputStream,
|
||||
String targetMimetype, String targetEncoding, OutputStream outputStream,
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
throw new TransformException(500, "TODO html transform");
|
||||
}
|
||||
|
||||
public void transform(final String sourceMimetype, final String targetMimetype, final Map<String, String> parameters,
|
||||
public void transform(final String sourceMimetype, final String targetMimetype,
|
||||
final Map<String, String> transformOptions,
|
||||
final File sourceFile, final File targetFile) throws Exception
|
||||
{
|
||||
String sourceEncoding = parameters.get(SOURCE_ENCODING);
|
||||
String sourceEncoding = transformOptions.get(SOURCE_ENCODING);
|
||||
checkEncodingParameter(sourceEncoding, SOURCE_ENCODING);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
|
@@ -26,8 +26,8 @@
|
||||
*/
|
||||
package org.alfresco.transform.misc.transformers;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.common.TransformException;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
import org.alfresco.transform.base.util.CustomTransformerFileAdaptor;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||
@@ -58,7 +58,7 @@ import java.util.Map;
|
||||
* @author eknizat
|
||||
*/
|
||||
@Component
|
||||
public class OOXMLThumbnailContentTransformer implements CustomTransformer
|
||||
public class OOXMLThumbnailContentTransformer implements CustomTransformerFileAdaptor
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(
|
||||
OOXMLThumbnailContentTransformer.class);
|
||||
@@ -69,13 +69,6 @@ public class OOXMLThumbnailContentTransformer implements CustomTransformer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(String sourceMimetype, String sourceEncoding, InputStream inputStream,
|
||||
String targetMimetype, String targetEncoding, OutputStream outputStream,
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
throw new TransformException(500, "TODO ooXmlThumbnail transform");
|
||||
}
|
||||
|
||||
public void transform(final String sourceMimetype, final String targetMimetype, final Map<String, String> parameters,
|
||||
final File sourceFile, final File targetFile) throws Exception
|
||||
{
|
||||
|
@@ -26,8 +26,7 @@
|
||||
*/
|
||||
package org.alfresco.transform.misc.transformers;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.common.TransformException;
|
||||
import org.alfresco.transform.base.util.CustomTransformerFileAdaptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -37,9 +36,7 @@ import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
@@ -64,7 +61,7 @@ import static org.alfresco.transform.common.RequestParamMap.TARGET_ENCODING;
|
||||
* @author eknizat
|
||||
*/
|
||||
@Component
|
||||
public class StringExtractingContentTransformer implements CustomTransformer
|
||||
public class StringExtractingContentTransformer implements CustomTransformerFileAdaptor
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(StringExtractingContentTransformer.class);
|
||||
|
||||
@@ -82,18 +79,11 @@ public class StringExtractingContentTransformer implements CustomTransformer
|
||||
* be unformatted but valid.
|
||||
*/
|
||||
@Override
|
||||
public void transform(String sourceMimetype, String sourceEncoding, InputStream inputStream,
|
||||
String targetMimetype, String targetEncoding, OutputStream outputStream,
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
throw new TransformException(500, "TODO string transform");
|
||||
}
|
||||
|
||||
public void transform(final String sourceMimetype, final String targetMimetype, final Map<String, String> parameters,
|
||||
public void transform(final String sourceMimetype, final String targetMimetype, final Map<String, String> transformOptions,
|
||||
final File sourceFile, final File targetFile) throws Exception
|
||||
{
|
||||
String sourceEncoding = parameters.get(SOURCE_ENCODING);
|
||||
String targetEncoding = parameters.get(TARGET_ENCODING);
|
||||
String sourceEncoding = transformOptions.get(SOURCE_ENCODING);
|
||||
String targetEncoding = transformOptions.get(TARGET_ENCODING);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
|
@@ -26,8 +26,8 @@
|
||||
*/
|
||||
package org.alfresco.transform.misc.transformers;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.common.TransformException;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
import org.alfresco.transform.base.util.CustomTransformerFileAdaptor;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.pdmodel.PDPage;
|
||||
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
||||
@@ -66,7 +66,7 @@ import static org.alfresco.transform.common.RequestParamMap.SOURCE_ENCODING;
|
||||
* @author eknizat
|
||||
*/
|
||||
@Component
|
||||
public class TextToPdfContentTransformer implements CustomTransformer
|
||||
public class TextToPdfContentTransformer implements CustomTransformerFileAdaptor
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(TextToPdfContentTransformer.class);
|
||||
|
||||
@@ -113,17 +113,13 @@ public class TextToPdfContentTransformer implements CustomTransformer
|
||||
return "textToPdf";
|
||||
}
|
||||
|
||||
@Override public void transform(String sourceMimetype, String sourceEncoding, InputStream inputStream,
|
||||
String targetMimetype, String targetEncoding, OutputStream outputStream,
|
||||
Map<String, String> transformOptions) throws Exception
|
||||
{
|
||||
throw new TransformException(500, "TODO textToPdf transform");
|
||||
}
|
||||
public void transform(final String sourceMimetype, final String targetMimetype, final Map<String, String> parameters,
|
||||
@Override
|
||||
public void transform(final String sourceMimetype, final String targetMimetype, final Map<String,
|
||||
String> transformOptions,
|
||||
final File sourceFile, final File targetFile) throws Exception
|
||||
{
|
||||
String sourceEncoding = parameters.get(SOURCE_ENCODING);
|
||||
String stringPageLimit = parameters.get(PAGE_LIMIT);
|
||||
String sourceEncoding = transformOptions.get(SOURCE_ENCODING);
|
||||
String stringPageLimit = transformOptions.get(PAGE_LIMIT);
|
||||
int pageLimit = -1;
|
||||
if (stringPageLimit != null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user