Pepper  3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
org.corpus_tools.pepper.modules.PepperManipulator Interface Reference

Inherits org.corpus_tools.pepper.modules.PepperModule.

Inherited by org.corpus_tools.pepper.impl.PepperManipulatorImpl, and org.corpus_tools.pepper.modules.coreModules.DoNothingManipulator.

Additional Inherited Members

- Public Member Functions inherited from org.corpus_tools.pepper.modules.PepperModule
PepperModuleDesc getFingerprint ()
 Returns a PepperModuleDesc object, which is a kind of a fingerprint of this PepperModule. More...
 
MODULE_TYPE getModuleType ()
 Returns the type of this module. More...
 
ComponentContext getComponentContext ()
 Returns the ComponentContext of the OSGi environment the bundle was started in. More...
 
String getName ()
 Returns the name of this module. More...
 
String getVersion ()
 Returns the version of this module. More...
 
void setVersion (String value)
 Sets the version of this module. More...
 
String getDesc ()
 Returns a short description of this module. More...
 
void setDesc (String desc)
 Sets a short description of this module. More...
 
URI getSupplierContact ()
 Returns a uri where to find more information about this module and where to find some contact information to contact the supplier. More...
 
void setSupplierContact (URI eMail)
 Sets a uri where to find more information about this module and where to find some contact information to contact the supplier. More...
 
URI getSupplierHomepage ()
 Sets the URI to the homepage describing the functionality of the module. More...
 
void setSupplierHomepage (URI hp)
 Returns the URI to the homepage describing the functionality of the module. More...
 
PepperModuleProperties getProperties ()
 Returns a PepperModuleProperties object containing properties to customize the behavior of this PepperModule. More...
 
void setProperties (PepperModuleProperties properties)
 Sets thePepperModuleProperties object containing properties to customize the behavior of this PepperModule. More...
 
ModuleController getModuleController ()
 Returns the container and controller object for the current module. More...
 
void setPepperModuleController (ModuleController value)
 Sets the container and controller object for the current module. More...
 
void setPepperModuleController_basic (ModuleController value)
 Sets the container and controller object for the current module. More...
 
SaltProject getSaltProject ()
 Returns the SaltProject object, which is filled, manipulated or exported by the current module. More...
 
void setSaltProject (SaltProject value)
 Sets the SaltProject object, which is filled, manipulated or exported by the current module. More...
 
SCorpusGraph getCorpusGraph ()
 Returns the SCorpusGraph object which is filled, manipulated or exported by the current module. More...
 
void setCorpusGraph (SCorpusGraph value)
 Sets the SCorpusGraph object which is filled, manipulated or exported by the current module. More...
 
URI getResources ()
 Returns the path of the folder which might contain resources for a Pepper module. More...
 
void setResources (URI value)
 Sets the resource folder used by getResources(). More...
 
URI getTemproraries ()
 TODO make docu.
 
void setTemproraries (URI value)
 TODO make docu.
 
String getSymbolicName ()
 Returns the symbolic name of this OSGi bundle. More...
 
void setSymbolicName (String value)
 Sets the symbolic name of this OSGi bundle. More...
 
Collection< String > getStartProblems ()
 If isReadyToStart() has returned false, this method returns a list of reasons why this module is not ready to start. More...
 
boolean isReadyToStart () throws PepperModuleNotReadyException
 This method is called by the pepper framework after initializing this object and directly before start processing. More...
 
void setIsMultithreaded (boolean isMultithreaded)
 Sets whether this PepperModule is able to run multithreaded. More...
 
boolean isMultithreaded ()
 Returns whether this PepperModule is able to run multithreaded. More...
 
void start () throws PepperModuleException
 Starts the conversion process. More...
 
void start (Identifier sElementId) throws PepperModuleException
 This method is called by the method start(). More...
 
PepperMapper createPepperMapper (Identifier sElementId)
 OVERRIDE THIS METHOD FOR CUSTOMIZED MAPPING. More...
 
List< Identifier > proposeImportOrder (SCorpusGraph sCorpusGraph)
 This method could be overridden, to make a proposal for the import order of SDocument objects. More...
 
Double getProgress (String globalId)
 This method is invoked by the Pepper framework, to get the current progress concerning the SDocument object corresponding to the given Identifier in percent. More...
 
Double getProgress ()
 This method is invoked by the Pepper framework, to get the current total progress of all SDocument objects being processed by this module. More...
 
void end () throws PepperModuleException
 This method is called by the pepper framework at the end of a conversion process. More...
 
void done (PepperMapperController controller)
 This method is called by a PepperMapperController object to notify the PepperModule object, that the mapping is done. More...
 
void done (Identifier identifier, DOCUMENT_STATUS result)
 This method is called by a PepperMapperController object to notify the PepperModule object, that the mapping for this object is done. More...
 
SelfTestDesc getSelfTestDesc ()
 This method is called by the Pepper framework to run an integration test for module. More...
 
- Static Public Attributes inherited from org.corpus_tools.pepper.modules.PepperModule
static final String ENDING_FOLDER = "FOLDER"
 A string specifying a value for a folder as ending. More...
 
static final String ENDING_LEAF_FOLDER = "LEAF_FOLDER"
 A string specifying a value for a leaf folder as ending. More...
 
static final String ENDING_XML = "xml"
 Ending for an xml file. More...
 
static final String ENDING_TXT = "txt"
 Ending for an txt file. More...
 
static final String ENDING_TAB = "tab"
 Ending for an tab file. More...
 
static final String ENDING_ALL_FILES = "ALL_FILES"
 All kinds of file endings.
 

Detailed Description

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

The following describes the single steps in short. To get a more detailed explanation, take a look to the documentations found at http://u.hu-berlin.de/ saltnpepper.

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) a PepperMapper object needs to be initialized and returned. The PepperMapper is the major part major part doing the mapping. It provides the methods PepperMapper#mapSCorpus() to handle the mapping of a single SCorpus object and PepperMapper#mapSDocument() to handle a single SDocument object. 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() {
                &#064;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);
                }
                &#064;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