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.parseme
ignore.processme
process.parseme
process.processme
exception.parseme
exception.processme
exception-long.parseme
exception-long.processme
partially-blacklist-exception.parseme
partially-blacklist-exception.processme
globally-blacklist-exception.parseme
globally-blacklist-exception.processme
unknown-exception.parseme
unknown-exception.processme
processerror-parsesuccess.processandparseme
processsuccess-parseerror.processandparseme
FileActionComponent.Operation
CURRENT_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()
FileActionComponent
getName
in interface FileActionComponent
public java.lang.String getDescription()
FileActionComponent
getDescription
in interface FileActionComponent
public boolean process(java.io.File file, java.util.Map<java.lang.String,java.lang.Object> ctxt) throws ProcessingException
FileProcessor
process
in interface FileProcessor
file
- 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
FileParser
extractText
in interface FileParser
file
- the file to parsectxt
- a Map to share informations between processings.ProcessingException
- if the text could not be extracted.public int getOrder()
FileActionComponent
getOrder
in interface FileActionComponent
public boolean isAvailable()
FileActionComponent
isAvailable
in interface FileActionComponent
Copyright © 2001-2017 Jalios SA. All Rights Reserved.