public class SampleProcessor extends java.lang.Object implements FileProcessor, FileParser
1. Configure in custom.prop
fileprocessor.repository.JCMSUpload.component.SampleParser.class: com.jalios.jcms.fileprocessor.test.SampleProcessor fileprocessor.repository.JCMSUpload.component.SampleParser.extensions: parseme processme processandparseme2. Upload test file with the following filename to trigger the corresponding behavior :
ignore.parsemeignore.processmeprocess.parsemeprocess.processmeexception.parsemeexception.processmeexception-long.parsemeexception-long.processmepartially-blacklist-exception.parsemepartially-blacklist-exception.processmeglobally-blacklist-exception.parsemeglobally-blacklist-exception.processmeunknown-exception.parsemeunknown-exception.processmeprocesserror-parsesuccess.processandparsemeprocesssuccess-parseerror.processandparsemeFileActionComponent.OperationCURRENT_FILE_DOCUMENT, CURRENT_OPERATION, FILE_SEPARATOR, PROCESSING_TYPE, REVISION| Constructor and Description |
|---|
SampleProcessor() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
extractText(java.io.File file,
java.util.Map<java.lang.String,java.lang.Object> ctxt)
Parsers have to implement at least this method which exctract the
text from the specified file and returns it.
|
java.lang.String |
getDescription()
More detailed description of the Parser.
|
java.lang.String |
getName()
Name of the Parser.
|
int |
getOrder()
Used to schedule the FileProcessors while treating a file.
|
boolean |
isAvailable()
A processor or parser may be unavailable (for instance because of a network connection down).
|
boolean |
process(java.io.File file,
java.util.Map<java.lang.String,java.lang.Object> ctxt)
Method invoked to process a file.
|
public java.lang.String getName()
FileActionComponentgetName in interface FileActionComponentpublic java.lang.String getDescription()
FileActionComponentgetDescription in interface FileActionComponentpublic boolean process(java.io.File file,
java.util.Map<java.lang.String,java.lang.Object> ctxt)
throws ProcessingException
FileProcessorprocess in interface FileProcessorfile - the file to processctxt - a Map to share informations between processings.ProcessingException - if the processing operation failed or if the file should be blacklisted (for this or all processors)public java.lang.String extractText(java.io.File file,
java.util.Map<java.lang.String,java.lang.Object> ctxt)
throws ProcessingException
FileParserextractText in interface FileParserfile - the file to parsectxt - a Map to share informations between processings.ProcessingException - if the text could not be extracted.public int getOrder()
FileActionComponentgetOrder in interface FileActionComponentpublic boolean isAvailable()
FileActionComponentisAvailable in interface FileActionComponentCopyright © 2001-2017 Jalios SA. All Rights Reserved.