Package org.corpus_tools.pepper.modules
Interface PepperManipulator
-
- All Superinterfaces:
PepperModule
- All Known Implementing Classes:
DoNothingManipulator,DOTManipulator,PepperManipulatorImpl,SaltValidator
public interface PepperManipulator extends PepperModule
A mapping task in the Pepper workflow is not a monolithic block. It consists of several smaller steps.
- Declare the fingerprint of the module. This is part of the constructor.
- Check readyness of the module.
- Map the document structure and create a mapper for each corpus and document.
- clean-up
Declare the fingerprint
Initialize the module and set the modules name and description. This is part of the constructor:public MyModule() { super("Name of the module"); setSupplierContact(URI.createURI("Contact address of the module's supplier")); setSupplierHomepage(URI.createURI("homepage of the module")); setDesc("A short description of what is the intention of this module, for instance which formats are importable. "); }Check readyness of the module
This method is invoked by the Pepper framework before the mapping process is started. This method must return true, otherwise, this Pepper module could not be used in a Pepper workflow. At this point problems which prevent the module from being used you can report all problems to the user, for instance a database connection could not be established.public boolean isReadyToStart() { return (true); }Map the document structure
In the method#createPepperMapper(SElementId)aPepperMapperobject needs to be initialized and returned. ThePepperMapperis the major part major part doing the mapping. It provides the methodsPepperMapper.mapSCorpus()to handle the mapping of a singleSCorpusobject andPepperMapper.mapSDocument()to handle a singleSDocumentobject. Both methods are invoked by the Pepper framework. The following snippet shows a dummy of that method:public PepperMapper createPepperMapper(SElementId sElementId) { PepperMapper mapper = new PepperMapperImpl() { @Override public DOCUMENT_STATUS mapSCorpus() { // handling the mapping of a single corpus // accessing the current file or folder getResourceURI(); // returning, that the corpus was mapped successfully return (DOCUMENT_STATUS.COMPLETED); } @Override public DOCUMENT_STATUS mapSDocument() { // handling the mapping of a single document // accessing the current file or folder getResourceURI(); // returning, that the document was mapped successfully return (DOCUMENT_STATUS.COMPLETED); } }; return (mapper); }clean-up
Sometimes it might be necessary to clean up after the module did the job. For instance when writing an im- or an exporter it might be necessary to close file streams, a db connection etc. Therefore, after the processing is done, the Pepper framework calls the method described in the following snippet:public void end() { super.end(); // do some clean up like closing of streams etc. }- Author:
- Florian Zipser
-
-
Field Summary
-
Fields inherited from interface org.corpus_tools.pepper.modules.PepperModule
ENDING_ALL_FILES, ENDING_FOLDER, ENDING_LEAF_FOLDER, ENDING_TAB, ENDING_TXT, ENDING_XML
-
-
Method Summary
-
Methods inherited from interface org.corpus_tools.pepper.modules.PepperModule
createPepperMapper, done, done, end, getComponentContext, getCorpusGraph, getDesc, getFingerprint, getModuleController, getModuleType, getName, getProgress, getProgress, getProperties, getResources, getSaltProject, getSelfTestDesc, getStartProblems, getSupplierContact, getSupplierHomepage, getSymbolicName, getTemproraries, getVersion, isMultithreaded, isReadyToStart, proposeImportOrder, setCorpusGraph, setDesc, setIsMultithreaded, setPepperModuleController, setPepperModuleController_basic, setProperties, setResources, setSaltProject, setSupplierContact, setSupplierHomepage, setSymbolicName, setTemproraries, setVersion, start, start
-
-